2 * @class Roo.htmleditor.FilterLongBr
3 * BR/BR/BR - keep a maximum of 2...
5 * Run a new Long BR Filter
6 * @param {Object} config Configuration options
9 Roo.htmleditor.FilterLongBr = function(cfg)
11 // no need to apply config.
15 Roo.extend(Roo.htmleditor.FilterLongBr, Roo.htmleditor.Filter,
22 replaceTag : function(node)
25 var ps = node.nextSibling;
26 while (ps && ps.nodeType == 3 && ps.nodeValue.trim().length < 1) {
30 if (!ps && [ 'TD', 'TH', 'LI', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ].indexOf(node.parentNode.tagName) > -1) {
31 node.parentNode.removeChild(node); // remove last BR inside one fo these tags
35 if (!ps || ps.nodeType != 1) {
39 if (!ps || ps.tagName != 'BR') {
48 if (!node.previousSibling) {
51 var ps = node.previousSibling;
53 while (ps && ps.nodeType == 3 && ps.nodeValue.trim().length < 1) {
54 ps = ps.previousSibling;
56 if (!ps || ps.nodeType != 1) {
59 // if header or BR before.. then it's a candidate for removal.. - as we only want '2' of these..
60 if (!ps || [ 'BR', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ].indexOf(ps.tagName) < 0) {
64 node.parentNode.removeChild(node); // remove me...
66 return false; // no need to do children