2 * @class Roo.htmleditor.FilterParagraph
3 * paragraphs cause a nightmare for shared content - this filter is designed to be called ? at various points when editing
4 * like on 'push' to remove the <p> tags and replace them with line breaks.
6 * Run a new Paragraph Filter
7 * @param {Object} config Configuration options
10 Roo.htmleditor.FilterParagraph = function(cfg)
12 // no need to apply config.
16 Roo.extend(Roo.htmleditor.FilterParagraph, Roo.htmleditor.Filter,
23 replaceTag : function(node)
26 if (node.childNodes.length == 1 &&
27 node.childNodes[0].nodeType == 3 &&
28 node.childNodes[0].textContent.trim().length < 1
30 // remove and replace with '<BR>';
31 node.parentNode.replaceChild(node.ownerDocument.createElement('BR'),node);
32 return false; // no need to walk..
34 var ar = Array.from(node.childNodes);
35 for (var i = 0; i < ar.length; i++) {
36 node.removeChild(ar[i]);
37 // what if we need to walk these???
38 node.parentNode.insertBefore(ar[i], node);
40 // now what about this?
44 node.parentNode.insertBefore(node.ownerDocument.createElement('BR'), node);
45 node.parentNode.insertBefore(node.ownerDocument.createElement('BR'), node);
46 node.parentNode.removeChild(node);