Debug tree walker

This commit is contained in:
Peter Savchenko 2018-05-29 18:23:55 +03:00
commit beeecba089
No known key found for this signature in database
GPG key ID: 63E739583C761566
5 changed files with 17 additions and 12 deletions

View file

@ -258,6 +258,8 @@ export default class Dom {
let treeWalker = [],
leafs = [];
console.warn('check', node);
if (!node) {
return true;
@ -295,6 +297,8 @@ export default class Dom {
*/
if (node && !this.isNodeEmpty(node)) {
console.log('NOT EMPTY!!!!!!!!!', node);
return false;
}

View file

@ -8,7 +8,6 @@
*/
import Block from '../block';
import Selection from '../Selection';
/**
* @typedef {BlockManager} BlockManager
@ -541,7 +540,6 @@ class Blocks {
}
// this.blocks[index].html;
this.blocks[index].html.remove();
this.blocks.splice(index, 1);

View file

@ -224,7 +224,9 @@ export default class Caret extends Module {
if ($.isEmpty(firstNode)) {
let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),
nothingAtLeft = leftSiblings.every( node => node.textContent.length === 0 );
nothingAtLeft = leftSiblings.every( node => $.isEmpty(node) );
console.log('nothing at left?', nothingAtLeft);
if (nothingAtLeft && selection.anchorOffset === 0) {
@ -267,7 +269,7 @@ export default class Caret extends Module {
if ($.isEmpty(lastNode)) {
let leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),
nothingAtRight = leftSiblings.every( node => node.textContent.length === 0 );
nothingAtRight = leftSiblings.every( node => $.isEmpty(node) );
if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {