mise a jour pour mtweb.0.9.0
[mw_pages] / app / out / default / tiny_mce / plugins / visualchars / editor_plugin_src.js
diff --git a/app/out/default/tiny_mce/plugins/visualchars/editor_plugin_src.js b/app/out/default/tiny_mce/plugins/visualchars/editor_plugin_src.js
new file mode 100644 (file)
index 0000000..35856e2
--- /dev/null
@@ -0,0 +1,83 @@
+/**\r
+ * editor_plugin_src.js\r
+ *\r
+ * Copyright 2009, Moxiecode Systems AB\r
+ * Released under LGPL License.\r
+ *\r
+ * License: http://tinymce.moxiecode.com/license\r
+ * Contributing: http://tinymce.moxiecode.com/contributing\r
+ */\r
+\r
+(function() {\r
+       tinymce.create('tinymce.plugins.VisualChars', {\r
+               init : function(ed, url) {\r
+                       var t = this;\r
+\r
+                       t.editor = ed;\r
+\r
+                       // Register commands\r
+                       ed.addCommand('mceVisualChars', t._toggleVisualChars, t);\r
+\r
+                       // Register buttons\r
+                       ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'});\r
+\r
+                       ed.onBeforeGetContent.add(function(ed, o) {\r
+                               if (t.state && o.format != 'raw' && !o.draft) {\r
+                                       t.state = true;\r
+                                       t._toggleVisualChars(false);\r
+                               }\r
+                       });\r
+               },\r
+\r
+               getInfo : function() {\r
+                       return {\r
+                               longname : 'Visual characters',\r
+                               author : 'Moxiecode Systems AB',\r
+                               authorurl : 'http://tinymce.moxiecode.com',\r
+                               infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',\r
+                               version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+                       };\r
+               },\r
+\r
+               // Private methods\r
+\r
+               _toggleVisualChars : function(bookmark) {\r
+                       var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo, div, bm;\r
+\r
+                       t.state = !t.state;\r
+                       ed.controlManager.setActive('visualchars', t.state);\r
+\r
+                       if (bookmark)\r
+                               bm = s.getBookmark();\r
+\r
+                       if (t.state) {\r
+                               nl = [];\r
+                               tinymce.walk(b, function(n) {\r
+                                       if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1)\r
+                                               nl.push(n);\r
+                               }, 'childNodes');\r
+\r
+                               for (i = 0; i < nl.length; i++) {\r
+                                       nv = nl[i].nodeValue;\r
+                                       nv = nv.replace(/(\u00a0)/g, '<span _mce_bogus="1" class="mceItemHidden mceItemNbsp">$1</span>');\r
+\r
+                                       div = ed.dom.create('div', null, nv);\r
+                                       while (node = div.lastChild)\r
+                                               ed.dom.insertAfter(node, nl[i]);\r
+\r
+                                       ed.dom.remove(nl[i]);\r
+                               }\r
+                       } else {\r
+                               nl = ed.dom.select('span.mceItemNbsp', b);\r
+\r
+                               for (i = nl.length - 1; i >= 0; i--)\r
+                                       ed.dom.remove(nl[i], 1);\r
+                       }\r
+\r
+                       s.moveToBookmark(bm);\r
+               }\r
+       });\r
+\r
+       // Register plugin\r
+       tinymce.PluginManager.add('visualchars', tinymce.plugins.VisualChars);\r
+})();
\ No newline at end of file