Introducing two types of lists: bullet & enum
[fnpeditor.git] / modules / documentCanvas / transformations.js
index d245818..4824849 100644 (file)
@@ -37,6 +37,20 @@ define(['libs/jquery-1.9.1.min'], function($) {
             transform(toBlock, 'div');\r
             transform(toInline, 'span');\r
 \r
+            toret.find(":not(iframe)").addBack().contents().filter(function() {\r
+                return this.nodeType == 3} ).each(function() {\r
+                    var n = $(this); \r
+                    var hasText = /\S/g.test(n.text());\r
+                    if(!hasText) {\r
+                        n.remove();\r
+                        return;\r
+                    }\r
+                    var startSpace = /\s/g.test(n.text().substr(0,1));\r
+                    var endSpace = /\s/g.test(n.text().substr(-1)) && n.text().length > 1;\r
+                    var trimmed = $.trim(n.text());\r
+                    n.get(0).data = (startSpace ? ' ' : '') + trimmed + (endSpace ? ' ' : '');\r
+            });\r
+            \r
             return toret.children();\r
         },\r
         getMetaData: function(xml) {\r