Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
daea87eb
Commit
daea87eb
authored
Nov 09, 2012
by
Tom Giannattasio
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simple html editor added
parent
e446ed81
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
1 deletions
+48
-1
cms/static/coffee/src/views/unit.coffee
+4
-0
cms/static/js/html-editor.js
+27
-0
cms/static/sass/_unit.scss
+4
-0
cms/templates/unit.html
+13
-1
No files found.
cms/static/coffee/src/views/unit.coffee
View file @
daea87eb
...
@@ -94,6 +94,10 @@ class CMS.Views.UnitEdit extends Backbone.View
...
@@ -94,6 +94,10 @@ class CMS.Views.UnitEdit extends Backbone.View
@
$editor
=
$
(
$
(
'#problem-editor'
).
html
())
@
$editor
=
$
(
$
(
'#problem-editor'
).
html
())
$preview
=
$
(
$
(
'#problem-preview'
).
html
())
$preview
=
$
(
$
(
'#problem-preview'
).
html
())
initProblemEditors
(
@
$editor
,
$preview
)
initProblemEditors
(
@
$editor
,
$preview
)
when
'html'
@
$editor
=
$
(
$
(
'#html-editor'
).
html
())
$preview
=
$
(
'<div class="html-preview">'
)
initHTMLEditor
(
@
$editor
,
$preview
)
@
$editor
.
find
(
'.save-button, .cancel-button'
).
bind
(
'click'
,
=>
@
$editor
.
find
(
'.save-button, .cancel-button'
).
bind
(
'click'
,
=>
@
$componentItem
.
removeClass
(
'editing'
)
@
$componentItem
.
removeClass
(
'editing'
)
...
...
cms/static/js/html-editor.js
0 → 100644
View file @
daea87eb
var
$body
;
var
$htmlPreview
;
var
$htmlEditor
;
var
htmlEditor
;
function
initHTMLEditor
(
$editor
,
$prev
)
{
$htmlEditor
=
$editor
;
console
.
log
(
$editor
.
find
(
'.edit-box'
));
htmlEditor
=
CodeMirror
.
fromTextArea
(
$editor
.
find
(
'.edit-box'
)[
0
],
{
lineWrapping
:
true
,
mode
:
'xml'
,
lineNumbers
:
true
,
onChange
:
onHTMLEditorUpdate
});
currentEditor
=
htmlEditor
;
$
(
htmlEditor
.
getWrapperElement
()).
css
(
'background'
,
'#fff'
);
$
(
htmlEditor
.
getWrapperElement
()).
bind
(
'click'
,
setFocus
);
$htmlPreview
=
$prev
;
}
function
onHTMLEditorUpdate
(
e
)
{
$htmlPreview
.
html
(
htmlEditor
.
getValue
());
}
\ No newline at end of file
cms/static/sass/_unit.scss
View file @
daea87eb
...
@@ -374,6 +374,10 @@
...
@@ -374,6 +374,10 @@
}
}
}
}
.html-preview
{
padding
:
20px
30px
;
}
.component-editor
{
.component-editor
{
@include
edit-box
;
@include
edit-box
;
display
:
none
;
display
:
none
;
...
...
cms/templates/unit.html
View file @
daea87eb
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
</script>
</script>
<script
src=
"/static/js/speed-editor.js"
></script>
<script
src=
"/static/js/speed-editor.js"
></script>
<script
src=
"/static/js/html-editor.js"
></script>
<script
type=
"text/template"
id=
"simple-editor-cheatsheet"
>
<script
type=
"text/template"
id=
"simple-editor-cheatsheet"
>
<
article
class
=
"simple-editor-cheatsheet"
>
<
article
class
=
"simple-editor-cheatsheet"
>
...
@@ -143,6 +144,17 @@
...
@@ -143,6 +144,17 @@
<
/section
>
<
/section
>
</script>
</script>
<script
type=
"text/template"
id=
"html-editor"
>
<
div
class
=
"html-editor editor"
>
<
div
class
=
"row"
>
<
textarea
class
=
"edit-box"
><
/textarea
>
<
/div>
<
div
class
=
"row"
>
<
a
href
=
"#"
class
=
"save-button"
>
Save
<
/a><a href="#" class="cancel-button">Cancel</
a
>
<
/div
>
<
/div>
</script>
<script
type=
"text/template"
id=
"video-editor"
>
<script
type=
"text/template"
id=
"video-editor"
>
<
div
class
=
"video-editor editor"
>
<
div
class
=
"video-editor editor"
>
<
div
class
=
"row"
>
<
div
class
=
"row"
>
...
@@ -158,7 +170,7 @@
...
@@ -158,7 +170,7 @@
<
div
class
=
"row"
>
<
div
class
=
"row"
>
<
a
href
=
"#"
class
=
"save-button"
>
Save
<
/a><a href="#" class="cancel-button">Cancel</
a
>
<
a
href
=
"#"
class
=
"save-button"
>
Save
<
/a><a href="#" class="cancel-button">Cancel</
a
>
<
/div
>
<
/div
>
<
/div>
<
/div
>
</script>
</script>
<script
type=
"text/template"
id=
"video-preview"
>
<script
type=
"text/template"
id=
"video-preview"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment