r1344 - in xwiki/trunk/src/main/web/wiki_editor: . plugins

Phung Hai Nam namphunghai at users.forge.objectweb.org
Thu Sep 28 04:34:18 CEST 2006


Author: namphunghai
Date: 2006-09-28 04:34:17 +0200 (Thu, 28 Sep 2006)
New Revision: 1344

Modified:
   xwiki/trunk/src/main/web/wiki_editor/plugins/core.js
   xwiki/trunk/src/main/web/wiki_editor/wiki_editor.js
Log:
Fixed the bug "Page failing to switch from WYSIWYG to Wiki for some test case"

Modified: xwiki/trunk/src/main/web/wiki_editor/plugins/core.js
===================================================================
--- xwiki/trunk/src/main/web/wiki_editor/plugins/core.js	2006-09-27 09:00:04 UTC (rev 1343)
+++ xwiki/trunk/src/main/web/wiki_editor/plugins/core.js	2006-09-28 02:34:17 UTC (rev 1344)
@@ -120,6 +120,8 @@
     str = str.replace(/<p class="paragraph">([\s\S]+?)<\/p>/g,'$1');
     str = str.replace(/<span class="wikiexternallink">([\s\S]+?)<\/span>/gi,'$1');
     str = str.replace(/<span class="wikilink">([\s\S]+?)<\/span>/gi,'$1');
+    str = str.replace(/<\/?p[^>]*>/gi, "");
+    str = str.replace(/<br \/>/g, '\r\n')
     return str;
 }
 
@@ -805,7 +807,7 @@
 }
 
 WikiEditor.prototype.convertListInternal = function(regexp, result, content) {
-	var bounds = this.replaceMatchingTag(content, result[1], null);
+    var bounds = this.replaceMatchingTag(content, result[1], null);
 	var str = "";
 	if(bounds && bounds["start"] > -1) {
 		str = this._convertListInternal(content.substring(bounds["start"], bounds["end"]));

Modified: xwiki/trunk/src/main/web/wiki_editor/wiki_editor.js
===================================================================
--- xwiki/trunk/src/main/web/wiki_editor/wiki_editor.js	2006-09-27 09:00:04 UTC (rev 1343)
+++ xwiki/trunk/src/main/web/wiki_editor/wiki_editor.js	2006-09-28 02:34:17 UTC (rev 1344)
@@ -414,11 +414,12 @@
     var result = str.match(attrib_regexp);
     var attributes = new Array();
 	var n=0;
-    for(var i=0; i < result.length; i++) {
-        var attrib = attrib_local_regexp.exec(result[i]);
-        n++;
-        attributes[attrib[1]] = attrib[2];
-    }
+    if (result != null)
+        for(var i=0; i < result.length; i++) {
+            var attrib = attrib_local_regexp.exec(result[i]);
+            n++;
+            attributes[attrib[1]] = attrib[2];
+        }
 
     return (n>0)?attributes:null;
 }





More information about the Xwiki-notifications mailing list