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
0d0ace45
Commit
0d0ace45
authored
Mar 13, 2014
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get handling of static image links working again.
parent
9bc0638f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
8 deletions
+11
-8
common/lib/xmodule/xmodule/js/src/html/edit.coffee
+11
-8
No files found.
common/lib/xmodule/xmodule/js/src/html/edit.coffee
View file @
0d0ace45
...
...
@@ -45,8 +45,8 @@ class @HTMLEditingDescriptor
plugins
:
"textcolor, link, image"
,
# We may want to add "styleselect" when we collect all styles used throughout the LMS
# Can have a single toolbar by just specifying "toolbar". Splitting for now so all are visible.
toolbar1
:
"formatselect
fontselect bold italic underline forecolor
"
,
toolbar2
:
"
bullist numlist outdent indent | blockquote wrapAsCode | link unlink | image
"
,
toolbar1
:
"formatselect
| fontselect | bold italic underline forecolor | bullist numlist outdent indent
"
,
toolbar2
:
"
link unlink image | blockquote wrapAsCode
"
,
# TODO: i18n
block_formats
:
"Paragraph=p;Preformatted=pre;Heading 1=h1;Heading 2=h2;Heading 3=h3"
,
width
:
'100%'
,
...
...
@@ -79,15 +79,18 @@ class @HTMLEditingDescriptor
})
@
visualEditor
=
ed
ed
.
on
ExecCommand
.
add
(
@
onExecCommand
Handler
)
ed
.
on
(
'change'
,
@
change
Handler
)
# Intended to run after the "image" plugin is used so that static urls are set
# correctly in the Visual editor immediately after command use.
onExecCommandHandler
:
(
ed
,
cmd
,
ui
,
val
)
=>
if
cmd
==
'mceInsertContent'
and
val
.
match
(
/^<img/
)
content
=
rewriteStaticLinks
(
ed
.
getContent
(),
'/static/'
,
@
base_asset_url
)
ed
.
setContent
(
content
)
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).
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
)
onSwitchEditor
:
(
e
)
=>
e
.
preventDefault
();
...
...
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