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
f71e3333
Commit
f71e3333
authored
Mar 17, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change how we detect that an image has been inserted.
parent
1e06fd33
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
+9
-12
common/lib/xmodule/xmodule/js/src/html/edit.coffee
+9
-12
No files found.
common/lib/xmodule/xmodule/js/src/html/edit.coffee
View file @
f71e3333
...
...
@@ -65,20 +65,14 @@ class @HTMLEditingDescriptor
@
visualEditor
=
ed
ed
.
on
(
'
change'
,
@
changeHandler
)
ed
.
on
(
'
SaveImage'
,
@
imageAdded
)
ed
.
on
(
'ShowCodeMirror'
,
@
showCodeEditor
)
ed
.
on
(
'SaveCodeMirror'
,
@
saveCodeEditor
)
# Intended to run after the "image" plugin is used so that static urls are set
# correctly in the Visual editor immediately after command use.
changeHandler
:
(
e
)
=>
# The fact that we have to listen to all change events and act on an event actually fired
# from undo (which is where the "level" comes from) is extremely ugly. However, plugins
# don't fire any events in TinyMCE version 4 that I can hook into (in particular, not ExecCommand).
debugger
if
e
.
level
and
e
.
level
.
content
and
e
.
level
.
content
.
match
(
/<img src="\/static\//
)
content
=
rewriteStaticLinks
(
e
.
target
.
getContent
(),
'/static/'
,
@
base_asset_url
)
e
.
target
.
setContent
(
content
)
imageAdded
:
(
e
)
=>
# Intended to run after the "image" plugin is used so that static urls are set
# correctly in the Visual editor immediately after command use.
@
rewriteLinksFromStatic
(
e
.
target
)
showCodeEditor
:
(
codeEditor
)
=>
# Called with the CodeMirror Editor is displayed to convert links to show satic prefix.
...
...
@@ -91,9 +85,12 @@ class @HTMLEditingDescriptor
codeEditor
.
setValue
(
content
)
initInstanceCallback
:
(
visualEditor
)
=>
visualEditor
.
setContent
(
rewriteStaticLinks
(
visualEditor
.
getContent
({
no_events
:
1
}),
'/static/'
,
@
base_asset_url
)
)
@
rewriteLinksFromStatic
(
visualEditor
)
@
focusVisualEditor
(
visualEditor
)
rewriteLinksFromStatic
:
(
visualEditor
)
=>
visualEditor
.
setContent
(
rewriteStaticLinks
(
visualEditor
.
getContent
({
no_events
:
1
}),
'/static/'
,
@
base_asset_url
))
focusVisualEditor
:
(
visualEditor
)
=>
visualEditor
.
focus
()
...
...
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