[FIX] rte crashes when inserting new lines

We deal with text nodes in this case

bzr revid: fme@openerp.com-20131203161630-f34r1nrqcb4m6jge
This commit is contained in:
Fabien Meghazi 2013-12-03 17:16:30 +01:00
parent abf5c88510
commit 49f357da54
1 changed files with 10 additions and 8 deletions

View File

@ -1428,14 +1428,16 @@
var output = [];
for(var i=0; i<nodes.length; ++i) {
var node = nodes[i];
if (node.nodeName === 'BR' && node.getAttribute('type') === '_moz') {
// <br type="_moz"> appears when focusing RTE in FF, ignore
continue;
}
if (node.className.indexOf('image-edit-button') !== -1) {
// [Edit] button added and removed on image hover, don't count
// as making parent node dirty
continue;
if (node.nodeType === document.ELEMENT_NODE) {
if (node.nodeName === 'BR' && node.getAttribute('type') === '_moz') {
// <br type="_moz"> appears when focusing RTE in FF, ignore
continue;
}
if (node.className.indexOf('image-edit-button') !== -1) {
// [Edit] button added and removed on image hover, don't count
// as making parent node dirty
continue;
}
}
output.push(node);