X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Ftiny_mce%2Fplugins%2Fvisualchars%2Feditor_plugin_src.js;h=df985905b6a1b26eb775f38783b24926be73b3d9;hb=b05f4eef4014db3885787ef15107cba93c932ac9;hp=02ec4e6982bb99339a659e64fa6db671430defa7;hpb=7ce246db4a173b9c738e8e160f8d0030d4e82d78;p=citadel.git diff --git a/webcit/tiny_mce/plugins/visualchars/editor_plugin_src.js b/webcit/tiny_mce/plugins/visualchars/editor_plugin_src.js index 02ec4e698..df985905b 100644 --- a/webcit/tiny_mce/plugins/visualchars/editor_plugin_src.js +++ b/webcit/tiny_mce/plugins/visualchars/editor_plugin_src.js @@ -1,8 +1,11 @@ /** - * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $ + * editor_plugin_src.js * - * @author Moxiecode - * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. + * Copyright 2009, Moxiecode Systems AB + * Released under LGPL License. + * + * License: http://tinymce.moxiecode.com/license + * Contributing: http://tinymce.moxiecode.com/contributing */ (function() { @@ -19,9 +22,9 @@ ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'}); ed.onBeforeGetContent.add(function(ed, o) { - if (t.state) { + if (t.state && o.format != 'raw' && !o.draft) { t.state = true; - t._toggleVisualChars(); + t._toggleVisualChars(false); } }); }, @@ -38,12 +41,15 @@ // Private methods - _toggleVisualChars : function() { - var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo; + _toggleVisualChars : function(bookmark) { + var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo, div, bm; t.state = !t.state; ed.controlManager.setActive('visualchars', t.state); + if (bookmark) + bm = s.getBookmark(); + if (t.state) { nl = []; tinymce.walk(b, function(n) { @@ -51,20 +57,24 @@ nl.push(n); }, 'childNodes'); - for (i=0; i$1'); - nv = nv.replace(/\u00a0/g, '\u00b7'); - ed.dom.setOuterHTML(nl[i], nv, d); + nv = nv.replace(/(\u00a0)/g, '$1'); + + div = ed.dom.create('div', null, nv); + while (node = div.lastChild) + ed.dom.insertAfter(node, nl[i]); + + ed.dom.remove(nl[i]); } } else { - nl = tinymce.grep(ed.dom.select('span', b), function(n) { - return ed.dom.hasClass(n, 'mceVisualNbsp'); - }); + nl = ed.dom.select('span.mceItemNbsp', b); - for (i=0; i= 0; i--) + ed.dom.remove(nl[i], 1); } + + s.moveToBookmark(bm); } });