[xwiki-notifications] r8807 - xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/plugins
ludovic (SVN)
notifications at xwiki.org
Tue Apr 1 12:49:10 CEST 2008
Author: ludovic
Date: 2008-04-01 12:49:10 +0200 (Tue, 01 Apr 2008)
New Revision: 8807
Modified:
xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/plugins/core.js
Log:
XWIKI-2260 Wysiwyg editor needs to handle multiple carriage returns properly. IE was still a problem
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 2008-04-01 10:48:29 UTC (rev 8806)
+++ xwiki-platform/web/trunk/standard/src/main/webapp/wiki_editor/plugins/core.js 2008-04-01 10:49:10 UTC (rev 8807)
@@ -17,7 +17,7 @@
this.addInternalProcessor((/<p[^>]*> ?<\/p>/gi), "\\\\\r\n");
- this.addExternalProcessor((/\\\\(\r\n)+/gi), '<br />\r\n');
+ this.addExternalProcessor((/\\\\(\r?)(\n?)/gi), '<br />$1$2');
this.addExternalProcessor((/\\\\/gi), '<br />');
this.addExternalProcessor((/----(-*)/i), 'convertHRExternal');
@@ -203,10 +203,11 @@
var cols = trow.split("<\/td>");
for (var j=0; j<(cols.length-1); j++) {
var cell = this.trimRNString(cols[j].replace(/<td(.*?)>/g, ""));
- if ((cell.lastIndexOf("\\\\") > 1) && (cell.lastIndexOf("\\\\") == (cell.length-2))) {
- cell = cell.substring(0, cell.lastIndexOf("\\\\"));
+ cell = cell.replace(/\r/gi, "");
+ cell = cell.replace(/\n/gi, "");
+ if ((cell.lastIndexOf("\\\\") >= 0) && (cell.lastIndexOf("\\\\") == (cell.length-2))) {
+ cell += " ";
}
- cell = cell.replace(/[\r\n]{3,}/g, "\\\\");
if (cell == "") cell = " "
if (j == 0) {
str += "\r\n" + cell;
@@ -949,7 +950,7 @@
WikiEditor.prototype.PARAGRAPH_CLASS_NAME = "paragraph";
WikiEditor.prototype.convertParagraphExternal = function(regexp, result, content) {
- var lines = this._getLines(content);
+ var lines = this._getLines(content);
var str="";
var line = "";
var insideP = false;
@@ -963,9 +964,9 @@
for(var i=0; i < lines.length; i++) {
// Consume blank spaces
line = lines[i];
- var hh = this._hasHTML(line);
+ line = line.replace(/(\r$)|(\n$)|(\r\n$)/gi, "");
+ var hh = this._hasHTML(line);
var hbr = this._onlyHasBr(line);
- line = line.replace(/(\r$)|(\n$)|(\r\n$)/gi, "");
if(line != "" && (!hh || hbr)) {
if(!insideP) {
insideP=true;
@@ -1161,7 +1162,7 @@
do {
row += lines[i+k];
k++;
- } while ((lines[i + k] != null) && (lines[i+k-1].lastIndexOf("\\\\") == (lines[i+k-1].length - 2)))
+ } while ((lines[i + k] != null) && (lines[i+k-1].lastIndexOf("\\\\") == (lines[i+k-1].length - 2)) && (lines[i+k-1].lastIndexOf("\\\\")!=-1))
rows[rowindex] = row;
rowindex++;
i += (k - 1);
@@ -1177,8 +1178,7 @@
}
var cols = rows[i].split("|"); // get cols
for (var j=0; j < cols.length; j++) {
- if ( i== 0) str += "<td>";
- else str += "<td>";
+ str += "<td>";
var linescol = cols[j].split("\\\\");
if (linescol.length == 1) str += linescol[0];
else if (linescol.length > 1)
More information about the notifications
mailing list