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

@ -693,6 +693,8 @@ var Dom = function () {
var treeWalker = [],
leafs = [];
console.warn('check', node);
if (!node) {
return true;
@ -726,6 +728,8 @@ var Dom = function () {
*/
if (node && !this.isNodeEmpty(node)) {
console.log('NOT EMPTY!!!!!!!!!', node);
return false;
}
@ -1387,10 +1391,6 @@ var _block = __webpack_require__(8);
var _block2 = _interopRequireDefault(_block);
var _Selection = __webpack_require__(3);
var _Selection2 = _interopRequireDefault(_Selection);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@ -1981,7 +1981,6 @@ var Blocks = function () {
index = this.length - 1;
}
// this.blocks[index].html;
this.blocks[index].html.remove();
this.blocks.splice(index, 1);
}
@ -2681,9 +2680,11 @@ var Caret = function (_Module) {
var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'left'),
nothingAtLeft = leftSiblings.every(function (node) {
return node.textContent.length === 0;
return $.isEmpty(node);
});
console.log('nothing at left?', nothingAtLeft);
if (nothingAtLeft && selection.anchorOffset === 0) {
return true;
@ -2725,7 +2726,7 @@ var Caret = function (_Module) {
var leftSiblings = this.getHigherLevelSiblings(anchorNode, 'right'),
nothingAtRight = leftSiblings.every(function (node) {
return node.textContent.length === 0;
return $.isEmpty(node);
});
if (nothingAtRight && selection.anchorOffset === anchorNode.textContent.length) {

File diff suppressed because one or more lines are too long

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) {