From: Alan Date: Thu, 17 Mar 2022 08:53:48 +0000 (+0800) Subject: Roo/htmleditor/FilterWord.js X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=63bae0ef50c67f5c17ea95ae59157c400d44bb5e Roo/htmleditor/FilterWord.js --- diff --git a/Roo/htmleditor/FilterWord.js b/Roo/htmleditor/FilterWord.js index 7e6e19faf9..da1c6f15b6 100644 --- a/Roo/htmleditor/FilterWord.js +++ b/Roo/htmleditor/FilterWord.js @@ -12,7 +12,7 @@ Roo.htmleditor.FilterWord = function(cfg) { // no need to apply config. - this.replaceBullets(cfg.node) + this.replaceDocBullets(cfg.node); this.walk(cfg.node); @@ -118,5 +118,62 @@ Roo.extend(Roo.htmleditor.FilterWord, Roo.htmleditor.Filter, + }, + + styleToObject: function(node) + { + var styles = node.getAttribute("style").split(";"); + var ret = {}; + Roo.each(styles, function(s) { + if (!s.match(/:/)) { + return; + } + var kv = s.split(":"); + + // what ever is left... we allow. + ret[kv[0]] = kv[1]; + }); + return ret; + } + + + replaceDocBullets : function(doc) + { + var listpara = doc.getElementsByClassName('MsoListParagraph'); + while(listpara.length) { + this.replaceDocBullet(listpara.item(0)); + //code + } + }, + + replaceDocBullet : function(p) + { + // gather all the siblings. + var ns = p, + parent = p.parentNode, + items = []; + while (ns) { + if (!ns.className.match(/MsoListParagraph/)) { + break; + } + items.push(ns); + ns = ns.nextSibling; + + } + var ul = parent.ownerDocument.createElement('ul'); // what about number lists... + + items.forEach(function(n) { + parent.removeChild(n); + var spans = n.getElementsByTagName('span'); + n.removeChild(spans.item(0)); // remove the fake bullet. + + }); + + + + } + + + }); \ No newline at end of file