Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Duplicate
-
Affects Version/s: 1.8
-
Fix Version/s: None
-
Component/s: HTML Editor
-
Labels:None
-
Environment:Lee-nooks
-
Affected Branches:MOODLE_18_STABLE
Description
Switching to and from HTML Source mode changed the line breaks and whitespace in my <pre> sections into single spaces.
Issue Links
| This issue duplicates: | ||||
| MDL-2738 | HTML Editor eating non-breaking spaces |
|
|
|
This issue may be same as following discussion, I think.
http://moodle.org/mod/forum/discuss.php?d=66794
It may be HTMLArea 3.0(beta)'s bug.
The following patch will be fix.
$ diff -u moodle-1.8.3+/lib/editor/htmlarea/htmlarea.php moodle/lib/editor/htmlarea/htmlarea.php
— moodle-1.8.3+/lib/editor/htmlarea/htmlarea.php 2007-09-22 11:42:33.000000000 +0900
+++ moodle/lib/editor/htmlarea/htmlarea.php 2007-12-27 13:36:49.000000000 +0900
@@ -2602,6 +2602,11 @@
// This partially undoes the damage done by moz, which translates ' 's into spaces in the data element
if ( !root.previousSibling && !root.nextSibling && root.data.match(/^\s*$/i) && root.data.length > 1 ) html = ' ';
else html = HTMLArea.htmlEncode(root.data);
+ // Do not call HTMLArea.indent() for stripped <pre> or <script>
+ var parentnode = root.parentNode.tagName.toLowerCase();
+ if ( parentnode == "pre" || parentnode == "script" ) { + return html; + }
break;
case 8: // Node.COMMENT_NODE
html = "<!-
" + root.data + "->";" + root.data + "->";