r1678 - in xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2: . plugins

Phung Hai Nam namphunghai at users.forge.objectweb.org
Tue Dec 5 08:36:09 CET 2006


Author: namphunghai
Date: 2006-12-05 08:36:08 +0100 (Tue, 05 Dec 2006)
New Revision: 1678

Modified:
   xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js
   xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js
Log:
XWIKI-398: Allowing to change font size, type and color. convert internal and external of the style

Modified: xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js	2006-12-05 07:13:13 UTC (rev 1677)
+++ xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/plugins/core.js	2006-12-05 07:36:08 UTC (rev 1678)
@@ -952,29 +952,20 @@
 WikiEditor.prototype.convertFontInternal = function(regexp, result, content) {
     var type = result[1];
     var str = "";
-    switch (type) {
-        case "font" :
-            var attributes = this.readAttributes(result[2]);
-            break;
-        case "span" :
-            var attributes = this.readAttributes(result[2]);
-            str += "{style:type=span";
-            if (attributes["style"]) {
-                var atts = attributes["style"].split(";");
-                for (var i=0; i < atts.length ; i++) {
-                    var att = this.trimString(atts[i].substring(0, atts[i].indexOf(":")));
-                    var value = this.trimString(atts[i].substring(atts[i].indexOf(":") + 1 , atts[i].length));
-                    if (att == "font-size") att = "size";
-                    if (att == "font-family") att = "face";
-                    str += "|" + att + "=" + value;
-                }
+    if (type == "span" || type =="div") {
+        var attributes = this.readAttributes(result[2]);
+        str += "{style:type=" + type;
+        if (attributes["style"]) {
+            var atts = attributes["style"].split(";");
+            for (var i=0; i < atts.length ; i++) {
+                var att = this.trimString(atts[i].substring(0, atts[i].indexOf(":")));
+                var value = this.trimString(atts[i].substring(atts[i].indexOf(":") + 1 , atts[i].length));
+                str += "|" + att + "=" + value;
             }
-            str += "}";
-            str += result[3];
-            str += "{style}";   
-            break;
-        case "div" :
-            break;
+        }
+        str += "}";
+        str += result[3];
+        str += "{style}";
     }
     // alert("str = " + str);
     return content.replace(regexp, str);

Modified: xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js
===================================================================
--- xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js	2006-12-05 07:13:13 UTC (rev 1677)
+++ xwiki/trunk/web/standard/src/main/webapp/wiki_editor_2/wiki_editor.js	2006-12-05 07:36:08 UTC (rev 1678)
@@ -332,8 +332,6 @@
                 newNode.appendChild(childNodes[j].cloneNode(true));
                 parent.insertBefore(newNode, node);
             } else {
-                var childAtts = childNodes[j].style;
-                alert(childAtts)
                 newNode = childNodes[j].cloneNode(true);
                 parent.insertBefore(newNode, node);
                 newNode = node.cloneNode(false);





More information about the Xwiki-notifications mailing list