Hi Ludovic,
It seems you've encoded characters in this commit too and not just
XWIKI-1198.
This requires a JIRA issue in XWiki Platform.
Also, what about Word/Excel and HTML copy paste in general?
Thanks
-Vincent
On Aug 14, 2007, at 12:59 AM, Ludovic Dubost wrote:
Author: ludovic
Date: 2007-08-14 00:57:13 +0200 (Tue, 14 Aug 2007)
New Revision: 4231
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/tiny_mce/
tiny_mce.js
xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/
plugins/core.js
Log:
CURRIKI-718 and XWIKI-1198 Empty lines/spaces are compacted/remove
in some cases. Handling of 2 empty lines are now transformed to <br />
Modified: xwiki-platform/web/trunk/standard/src/main/webapp/
tiny_mce/tiny_mce.js
===================================================================
--- xwiki-platform/web/trunk/standard/src/main/webapp/tiny_mce/
tiny_mce.js 2007-08-13 22:42:46 UTC (rev 4230)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/tiny_mce/
tiny_mce.js 2007-08-13 22:57:13 UTC (rev 4231)
@@ -2241,7 +2241,6 @@
s = s.replace(/\'/g, '''); // ' is not working in MSIE
s = s.replace(/</g, '<');
s = s.replace(/>/g, '>');
-
return s;
},
@@ -3019,7 +3018,8 @@
value = tinyMCE.storeAwayURLs(value);
value = tinyMCE._customCleanup(this, "insert_to_editor", value);
tinyMCE._setHTML(doc, value);
- tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc,
tinyMCE.settings, doc.body));
+ // tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this,
doc, tinyMCE.settings, doc.body));
+ tinyMCE.setInnerHTML(doc.body, value);
tinyMCE.convertAllRelativeURLs(doc.body);
// Cleanup any mess left from storyAwayURLs
Modified: xwiki-platform/web/trunk/standard/src/main/webapp/
wiki_editor/plugins/core.js
===================================================================
--- xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/
plugins/core.js 2007-08-13 22:42:46 UTC (rev 4230)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/
plugins/core.js 2007-08-13 22:57:13 UTC (rev 4231)
@@ -15,7 +15,7 @@
this.addExternalProcessor((/^\s*(1(\.1)*)\s+([^\r\n]*)$/im),
'convertHeadingExternal');
this.addInternalProcessor((/<h[1-7]\s*(([^>]*)class=\"heading([^>]
*))>([\s\S]+?)<\/h[1-7]>/i), 'convertHeadingInternal');
- this.addInternalProcessor((/<p[^>]*> <\/p>/gi),
"");
+ this.addInternalProcessor((/<p[^>]*> ?<\/p>/gi),
"\\\\\r
\n");
this.addExternalProcessor((/\\\\([\r\n]+)/gi), '<br />');
@@ -62,8 +62,8 @@
this.addExternalProcessorBefore('convertParagraphExternal', (/
##([^\r\n]*)$|(#\*([\s\S]+?)\*#)/im),
'convertVelocityCommentExternal');
this.addInternalProcessorBefore('convertStyleInternal', (/<div
\s*([^>]*)class=\"vcomment\"\s*([^>]*)>([\s\S]+?)(\r?\n?)<\/div>/
i), 'convertVelocityCommentInternal');
- this.addExternalProcessorBefore('convertTableExternal', (/\
{style:\s*(.*?)\}([\s\S]+?)\{style\}/i), 'convertStyleExternal');
- this.addInternalProcessorBefore('convertTableInternal', (/<
(font|span|div)\s*(.*?)>([\s\S]+?)<\/(font|span|div)>/i),
'convertStyleInternal');
+ this.addExternalProcessorBefore('convertParagraphExternal', (/
\r?\n?\{style:\s*(.*?)\}\r?\n?([\s\S]+?)\r?\n?\{style\}/i),
'convertStyleExternal');
+ this.addInternalProcessorBefore('convertTableInternal', (/<
(font|span|div)\s*(.*?)>\r?\n?([\s\S]+?)\r?\n?\<\/(font|span|div)>/
i), 'convertStyleInternal');
//this.addInternalProcessor((/ (?!\|)/gi), "");
this.setHtmlTagRemover('removeHtmlTags_Groovy');
@@ -344,7 +344,8 @@
WikiEditor.prototype.__removeBlankParagraphs = function(node) {
if(node.nodeName.toLowerCase() == "p" && this.trimString
(node.innerHTML) == "") {
- node.parentNode.removeChild(node);
+ node.parentNode.innerHTML += "<br />";
+ node.parentNode.removeChild(node);
return;
}
for(var i=0; node.childNodes[i]; i++) {
@@ -371,6 +372,37 @@
}
}
+WikiEditor.prototype._encodeNode = function(node) {
+ function encode(s) {
+ s = "" + s;
+ // Encoding wiki syntax
+ s = s.replace(/\*/g, '*');
+ s = s.replace(/\~/g, '~');
+ s = s.replace(/\[/g, '[');
+ s = s.replace(/\]/g, ']');
+ s = s.replace(/\_/g, '_');
+ s = s.replace(/\{/g, '#123;');
+ s = s.replace(/\}/g, '}');
+ // Encoding HTML
+ // s = s.replace(/\'/g, '''); // ' is not working
in MSIE
+ // s = s.replace(/</g, '<');
+ // s = s.replace(/>/g, '>');
+ // Encoding more wiki syntax
+ // s = s.replace(/\-/g, '-');
+ // s = s.replace(/\1/g, '1');
+ return s;
+ }
+
+ function encodeNode(node) {
+ for(var i=0; node.childNodes[i];i++) {
+ encodeNode(node.childNodes[i]);
+ }
+ node.nodeValue = encode(node.nodeValue);
+ }
+
+ encodeNode(node);
+}
+
WikiEditor.prototype.handleSupAndSubButons = function(editor_id,
node, undo_index, undo_levels, visual_aid, any_selection) {
tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal');
tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal');
@@ -1429,7 +1461,7 @@
if (this.core.isMSIE) {
str += "\r\n";
} else if (result[1] == null || result[1] == "" ||
this.trimString(result[1].toString()) == "/") {
- str += "\n";
+ str += "\r\n";
}
return content.replace(regexp, str);
}
\ No newline at end of file
--
You receive this message as a subscriber of the xwiki-
commits(a)objectweb.org mailing list.
To unsubscribe: mailto:xwiki-commits-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/
wws