mirror of
https://github.com/codex-team/editor.js
synced 2026-03-17 16:10:07 +01:00
Debug tree walker
This commit is contained in:
parent
24a7b9cf0f
commit
beeecba089
5 changed files with 17 additions and 12 deletions
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue