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
84a70279
Commit
84a70279
authored
Feb 28, 2014
by
zubiar-arbi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
properly set tinymce editor startContent
STUD-1336
parent
b4478081
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
9 deletions
+3
-9
common/lib/xmodule/xmodule/js/spec/html/edit_spec.coffee
+2
-6
common/lib/xmodule/xmodule/js/src/html/edit.coffee
+1
-3
No files found.
common/lib/xmodule/xmodule/js/spec/html/edit_spec.coffee
View file @
84a70279
...
...
@@ -89,17 +89,15 @@ describe 'HTMLEditingDescriptor', ->
@
descriptor
.
showingVisualEditor
=
false
visualEditorStub
=
isNotDirty
:
false
content
:
'not set'
startContent
:
'not set'
,
focus
:
()
->
true
isDirty
:
()
->
not
@
isNotDirty
isDirty
:
()
->
false
setContent
:
(
x
)
->
@
content
=
x
getContent
:
->
@
content
@
descriptor
.
showVisualEditor
(
visualEditorStub
)
expect
(
@
descriptor
.
showingVisualEditor
).
toEqual
(
true
)
expect
(
visualEditorStub
.
isDirty
()).
toEqual
(
false
)
expect
(
visualEditorStub
.
getContent
()).
toEqual
(
'Advanced Editor Text'
)
expect
(
visualEditorStub
.
startContent
).
toEqual
(
'Advanced Editor Text'
)
it
'When switching to visual editor links are rewritten to c4x format'
,
->
...
...
@@ -109,16 +107,14 @@ describe 'HTMLEditingDescriptor', ->
@
descriptor
.
showingVisualEditor
=
false
visualEditorStub
=
isNotDirty
:
false
content
:
'not set'
startContent
:
'not set'
,
focus
:
()
->
true
isDirty
:
()
->
not
@
isNotDirty
isDirty
:
()
->
false
setContent
:
(
x
)
->
@
content
=
x
getContent
:
->
@
content
@
descriptor
.
showVisualEditor
(
visualEditorStub
)
expect
(
@
descriptor
.
showingVisualEditor
).
toEqual
(
true
)
expect
(
visualEditorStub
.
isDirty
()).
toEqual
(
false
)
expect
(
visualEditorStub
.
getContent
()).
toEqual
(
'Advanced Editor Text with link /c4x/foo/bar/asset/dummy.jpg'
)
expect
(
visualEditorStub
.
startContent
).
toEqual
(
'Advanced Editor Text with link /c4x/foo/bar/asset/dummy.jpg'
)
common/lib/xmodule/xmodule/js/src/html/edit.coffee
View file @
84a70279
...
...
@@ -123,7 +123,7 @@ class @HTMLEditingDescriptor
# both the startContent must be sync'ed up and the dirty flag set to false.
content
=
rewriteStaticLinks
(
@
advanced_editor
.
getValue
(),
'/static/'
,
@
base_asset_url
)
visualEditor
.
setContent
(
content
)
visualEditor
.
startContent
=
content
visualEditor
.
startContent
=
visualEditor
.
getContent
({
format
:
'raw'
})
@
focusVisualEditor
(
visualEditor
)
@
showingVisualEditor
=
true
...
...
@@ -133,8 +133,6 @@ class @HTMLEditingDescriptor
focusVisualEditor
:
(
visualEditor
)
=>
visualEditor
.
focus
()
# Need to mark editor as not dirty both when it is initially created and when we switch back to it.
visualEditor
.
isNotDirty
=
true
if
not
@
$mceToolbar
?
@
$mceToolbar
=
$
(
@
element
).
find
(
'table.mceToolbar'
)
...
...
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