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
c87eb08b
Commit
c87eb08b
authored
Dec 12, 2012
by
Christina Roberts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fix for Lighthouse #22.
html names are automatically converted to the symbols they describe.
parent
c3d7c466
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
5 deletions
+34
-5
cms/templates/widgets/html-edit.html
+1
-1
common/lib/xmodule/jasmine_test_runner.html.erb
+1
-0
common/lib/xmodule/xmodule/js/fixtures/html-edit-formattingbug.html
+9
-0
common/lib/xmodule/xmodule/js/spec/html/edit_spec.coffee
+18
-0
common/lib/xmodule/xmodule/js/src/html/edit.coffee
+5
-4
No files found.
cms/templates/widgets/html-edit.html
View file @
c87eb08b
<
%
include
file=
"metadata-edit.html"
/>
<section
class=
"html-edit"
>
<
textarea
name=
""
class=
"edit-box"
rows=
"8"
cols=
"40"
>
${data}
</textarea
>
<
div
name=
""
class=
"edit-box"
>
${data}
</div
>
</section>
common/lib/xmodule/jasmine_test_runner.html.erb
View file @
c87eb08b
...
...
@@ -12,6 +12,7 @@
<script
type=
"text/javascript"
src=
"
<%=
common_coffee_root
%>
/logger.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
common_js_root
%>
/vendor/jquery.min.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
common_js_root
%>
/vendor/jasmine-jquery.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
common_js_root
%>
/vendor/CodeMirror/codemirror.js"
></script>
<script
type=
"text/javascript"
src=
"
<%=
common_js_root
%>
/vendor/mathjax-MathJax-c9db6ac/MathJax.js"
></script>
<script
type=
"text/javascript"
>
...
...
common/lib/xmodule/xmodule/js/fixtures/html-edit-formattingbug.html
0 → 100644
View file @
c87eb08b
<section
class=
"html-edit"
>
<div
name=
""
class=
"edit-box"
rows=
"8"
cols=
"40"
>
<
problem>
<
p>
<
/p>
<
multiplechoiceresponse>
<pre>
<
problem>
<
p>
<
/p>
</pre>
<div><foo>
bar
</foo></div></div>
</section>
\ No newline at end of file
common/lib/xmodule/xmodule/js/spec/html/edit_spec.coffee
0 → 100644
View file @
c87eb08b
describe
'HTMLEditingDescriptor'
,
->
describe
'Read data from server, create Editor, and get data back out'
,
->
it
'Does not munge <'
,
->
# This is a test for Lighthouse #22,
# "html names are automatically converted to the symbols they describe"
# A better test would be a Selenium test to avoid duplicating the
# mako template structure in html-edit-formattingbug.html.
# However, we currently have no working Selenium tests.
loadFixtures
'html-edit-formattingbug.html'
@
descriptor
=
new
HTMLEditingDescriptor
(
$
(
'.html-edit'
))
data
=
@
descriptor
.
save
().
data
expect
(
data
).
toEqual
(
"""<problem>
<p></p>
<multiplechoiceresponse>
<pre><problem>
<p></p></pre>
<div><foo>bar</foo></div>"""
)
\ No newline at end of file
common/lib/xmodule/xmodule/js/src/html/edit.coffee
View file @
c87eb08b
class
@
HTMLEditingDescriptor
constructor
:
(
@
element
)
->
@
edit_box
=
CodeMirror
.
fromTextArea
(
$
(
".edit-box"
,
@
element
)[
0
],
{
text
=
$
(
".edit-box"
,
@
element
)[
0
];
replace_func
=
(
elt
)
->
text
.
parentNode
.
replaceChild
(
elt
,
text
)
@
edit_box
=
CodeMirror
(
replace_func
,
{
value
:
text
.
innerHTML
mode
:
"text/html"
lineNumbers
:
true
lineWrapping
:
true
})
lineWrapping
:
true
})
save
:
->
data
:
@
edit_box
.
getValue
()
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