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
dcad5640
Commit
dcad5640
authored
Jan 11, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pretty much works.
parent
cbf5174b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
125 additions
and
23 deletions
+125
-23
cms/static/css/tiny-mce.css
+51
-0
cms/templates/widgets/html-edit.html
+8
-10
common/lib/xmodule/xmodule/css/html/edit.scss
+3
-0
common/lib/xmodule/xmodule/js/src/html/edit.coffee
+55
-13
common/lib/xmodule/xmodule/templates/html/empty.yaml
+8
-0
No files found.
cms/static/css/tiny-mce.css
0 → 100644
View file @
dcad5640
body
{
background-color
:
#fff
;
font-family
:
'Open Sans'
,
Verdana
,
Arial
,
Helvetica
,
sans-serif
;
font-size
:
16px
;
line-height
:
1.6
;
color
:
#3c3c3c
;
scrollbar-3dlight-color
:
#F0F0EE
;
scrollbar-arrow-color
:
#676662
;
scrollbar-base-color
:
#F0F0EE
;
scrollbar-darkshadow-color
:
#DDDDDD
;
scrollbar-face-color
:
#E0E0DD
;
scrollbar-highlight-color
:
#F0F0EE
;
scrollbar-shadow-color
:
#F0F0EE
;
scrollbar-track-color
:
#F5F5F5
;
}
a
{
color
:
#1d9dd9
;
text-decoration
:
none
;
}
p
{
font-size
:
16px
;
line-height
:
1.6
;
}
h2
{
color
:
#646464
;
font-size
:
19px
;
font-weight
:
300
;
letter-spacing
:
1px
;
margin-bottom
:
15px
;
text-transform
:
uppercase
;
}
h3
{
font-size
:
19px
;
font-weight
:
400
;
}
code
{
margin
:
0
2px
;
padding
:
0px
5px
;
border-radius
:
3px
;
border
:
1px
solid
#eaeaea
;
white-space
:
nowrap
;
font-family
:
Monaco
,
monospace
;
font-size
:
14px
;
background-color
:
#f8f8f8
;
}
\ No newline at end of file
cms/templates/widgets/html-edit.html
View file @
dcad5640
<
%
include
file=
"metadata-edit.html"
/>
<section
class=
"html-edit"
>
<div
class=
"html-editor editor"
>
<div
class=
"row"
>
<div
class=
"editor-bar"
>
<ul
class=
"editor-tabs"
>
<li><a
href=
"#"
class=
"visual-tab tab current"
data-tab=
"visual"
>
Visual
</a></li>
<li><a
href=
"#"
class=
"html-tab tab"
data-tab=
"html"
>
Advanced
</a></li>
</ul>
</div>
<textarea
class=
"tiny-mce"
>
${data}
</textarea>
<div
name=
""
class=
"edit-box"
>
${data}
</div>
<div
class=
"row"
>
<div
class=
"editor-bar"
>
<ul
class=
"editor-tabs"
>
<li><a
href=
"#"
class=
"visual-tab tab current"
data-tab=
"visual"
>
Visual
</a></li>
<li><a
href=
"#"
class=
"html-tab tab"
data-tab=
"advanced"
>
Advanced
</a></li>
</ul>
</div>
<textarea
class=
"tiny-mce"
>
${data}
</textarea>
<div
name=
""
class=
"edit-box"
>
${data}
</div>
</div>
</section>
common/lib/xmodule/xmodule/css/html/edit.scss
View file @
dcad5640
// TODO: this code is a subset of what is in problem editor's CSS. Should share.
.editor-bar
{
position
:
relative
;
@include
linear-gradient
(
top
,
#d4dee8
,
#c9d5e2
);
...
...
@@ -6,6 +7,8 @@
border-radius
:
3px
3px
0
0
;
border-bottom-color
:
#a5aaaf
;
@include
clearfix
;
// TODO: I added this -- Brian to fix roperly
height
:
34px
;
a
{
display
:
block
;
...
...
common/lib/xmodule/xmodule/js/src/html/edit.coffee
View file @
dcad5640
...
...
@@ -10,27 +10,69 @@ class @HTMLEditingDescriptor
lineWrapping
:
true
})
$
(
@
advanced_editor
.
getWrapperElement
()).
hide
()
@
tiny_mce
=
$
(
".tiny-mce"
,
@
element
).
tinymce
({
@
tiny_mce
_textarea
=
$
(
".tiny-mce"
,
@
element
).
tinymce
({
script_url
:
'/static/js/vendor/tiny_mce/tiny_mce.js'
,
theme
:
"advanced"
,
#skin: 'studio',
# we may want to add "styleselect" when we collect all styles used throughout the lms
theme_advanced_buttons1
:
"formatselect,bold,italic,underline,studio.asset,bullist,numlist,outdent,indent,blockquote,link,unlink"
,
schema
:
"html5"
,
# TODO: we should share this CSS with studio (and LMS)
content_css
:
"/static/css/tiny-mce.css"
,
# We may want to add "styleselect" when we collect all styles used throughout the LMS
theme_advanced_buttons1
:
"formatselect,bold,italic,underline,bullist,numlist,outdent,indent,blockquote,link,unlink"
,
theme_advanced_toolbar_location
:
"top"
,
theme_advanced_toolbar_align
:
"left"
,
theme_advanced_statusbar_location
:
"none"
,
theme_advanced_resizing
:
true
,
theme_advanced_blockformats
:
"p,code,h2,h3,blockquote"
,
width
:
'100%'
,
height
:
'400px'
height
:
'400px'
,
})
# @tiny_mce.focus()
# /tinyMCE.activeEditor.setContent(text, {format : 'raw'});
# @tiny = tinyMCE.get($('.tiny-mce', this.element).attr('id'))
# @tiny.setContent(@edit_box.getValue(), {format : 'raw'});
# @tiny_mce.html(@edit_box.getValue())
@
visual_editor
=
tinyMCE
.
get
(
$
(
'.tiny-mce'
,
this
.
element
).
attr
(
'id'
))
@
showingVisualEditor
=
true
@
element
.
on
(
'click'
,
'.editor-tabs .tab'
,
@
onSwitchEditor
)
onSwitchEditor
:
(
e
)
=>
e
.
preventDefault
();
if
not
$
(
e
.
currentTarget
).
hasClass
(
'current'
)
$
(
'.editor-tabs .current'
).
removeClass
(
'current'
)
$
(
e
.
currentTarget
).
addClass
(
'current'
)
tinyMCE
=
@
getVisualEditor
()
if
$
(
e
.
currentTarget
).
attr
(
'data-tab'
)
is
'visual'
$
(
@
advanced_editor
.
getWrapperElement
()).
hide
()
tinyMCE
.
show
()
tinyMCE
.
setContent
(
@
advanced_editor
.
getValue
())
# In order for tinyMCE.isDirty() to return true ONLY if edits have been made after setting the text,
# both the startContent must be sync'ed up and the dirty flag set to false.
tinyMCE
.
startContent
=
tinyMCE
.
getContent
({
format
:
"raw"
,
no_events
:
1
});
tinyMCE
.
isNotDirty
=
true
@
showingVisualEditor
=
true
else
tinyMCE
.
hide
()
@
tiny_mce_textarea
.
hide
()
$
(
@
advanced_editor
.
getWrapperElement
()).
show
()
if
tinyMCE
.
isDirty
()
console
.
log
(
'was dirty! setting text'
)
@
advanced_editor
.
setValue
(
tinyMCE
.
getContent
({
no_events
:
1
}))
@
advanced_editor
.
setCursor
(
0
)
@
advanced_editor
.
refresh
()
@
advanced_editor
.
focus
()
@
showingVisualEditor
=
false
getVisualEditor
:
->
###
Returns the instance of TinyMCE.
This is different from the textarea that exists in the HTML template (@tiny_mce_textarea.
###
return
tinyMCE
.
get
(
$
(
'.tiny-mce'
,
this
.
element
).
attr
(
'id'
))
save
:
->
data
:
@
advanced_editor
.
getValue
()
@
element
.
off
(
'click'
,
'.editor-tabs .tab'
,
@
onSwitchEditor
)
text
=
@
advanced_editor
.
getValue
()
tinyMCE
=
@
getVisualEditor
()
if
@
showingVisualEditor
and
tinyMCE
.
isDirty
()
console
.
log
(
'persist from visual editor'
)
text
=
tinyMCE
.
getContent
({
no_events
:
1
})
else
console
.
log
(
'persist from HTML editor'
)
data
:
text
common/lib/xmodule/xmodule/templates/html/empty.yaml
0 → 100644
View file @
dcad5640
---
metadata
:
display_name
:
Empty
data
:
|
c
hildren: []
\ No newline at end of file
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