From a9251be2f09fb5f18a85d201c67668c70980efe3 Mon Sep 17 00:00:00 2001 From: thomascube Date: Wed, 20 Apr 2011 19:11:10 +0000 Subject: Update to TinyMCE 3.4.2 to fix errors in IE9 --- .../plugins/visualchars/editor_plugin_src.js | 33 +++++++++++++--------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js') diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js index 0a5275fe2..df985905b 100644 --- a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js @@ -22,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); } }); }, @@ -41,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) { @@ -54,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); } }); -- cgit v1.2.3