diff --git a/packages/core/src/block/base/content.ts b/packages/core/src/block/base/content.ts index 79600ed..be5aebb 100644 --- a/packages/core/src/block/base/content.ts +++ b/packages/core/src/block/base/content.ts @@ -211,16 +211,16 @@ class Content extends TreeNode { const { anchor, focus, - anchorBlock, - focusBlock, + // anchorBlock, + // focusBlock, isCollapsed, isSelectionInSameBlock, // This is always be true. direction, type, } = selection; - if (anchorBlock !== this || focusBlock !== this) - return null; + // if (anchorBlock !== this || focusBlock !== this) + // return null; return { start: { offset: Math.min(anchor.offset, focus.offset) }, diff --git a/packages/core/src/block/base/format.ts b/packages/core/src/block/base/format.ts index faff4f9..aa79a20 100644 --- a/packages/core/src/block/base/format.ts +++ b/packages/core/src/block/base/format.ts @@ -337,8 +337,23 @@ class Format extends Content { override blurHandler() { super.blurHandler(); const needRender = this.checkNeedRender(); + const _cursor = this.getCursor(); + let cursor = null; + if (_cursor) { + const { start, end } = _cursor; + cursor = { + path: this.path, + block: this, + anchor: { + offset: start.offset, + }, + focus: { + offset: end.offset, + }, + }; + } if (needRender) - this.update(); + cursor ? this.update(cursor) : this.update(); } /** diff --git a/packages/core/src/inlineRenderer/index.ts b/packages/core/src/inlineRenderer/index.ts index c97fc6b..1559469 100644 --- a/packages/core/src/inlineRenderer/index.ts +++ b/packages/core/src/inlineRenderer/index.ts @@ -47,7 +47,9 @@ class InlineRenderer { block, cursor && cursor.block === block ? cursor : {}, ); - domNode!.innerHTML = html; + if (domNode!.innerHTML !== html) { + domNode!.innerHTML = html; + } } collectReferenceDefinitions() {