Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(editor): re-init after yText change in inline editor (#9312)

Saul-Mirone37e44e034106
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<string | number | symbol, unknown>) {
+ 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);
}