From 37e44e034106ee4f1306116d59b65f0c373dd053 Mon Sep 17 00:00:00 2001 From: Saul-Mirone Date: Thu, 26 Dec 2024 03:51:07 +0000 Subject: [PATCH] fix(editor): re-init after yText change in inline editor (#9312) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: [BS-2143](https://linear.app/affine-design/issue/BS-2143/block通过drag-handle拖动位置后,无法输入) --- blocksuite/affine/components/src/rich-text/rich-text.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blocksuite/affine/components/src/rich-text/rich-text.ts b/blocksuite/affine/components/src/rich-text/rich-text.ts index bed5e2c136..de58c9e1f9 100644 --- a/blocksuite/affine/components/src/rich-text/rich-text.ts +++ b/blocksuite/affine/components/src/rich-text/rich-text.ts @@ -360,6 +360,12 @@ export class RichText extends WithDisposable(ShadowlessElement) { } override updated(changedProperties: Map) { + const inlineEditor = this.inlineEditor; + if (inlineEditor && this._yText && this._yText !== inlineEditor.yText) { + this._unmount(); + this._init(); + return; + } if (this._inlineEditor && changedProperties.has('readonly')) { this._inlineEditor.setReadonly(this.readonly); }