From 51db3aed131ea2e86dd5a96e937adadfae34e1fb Mon Sep 17 00:00:00 2001 From: zhouxinyu Date: Tue, 17 Dec 2024 15:24:15 +0800 Subject: [PATCH] fix: fix issue with composing input --- packages/vrender-core/src/graphic/richtext.ts | 5 ++++- .../vrender-core/src/plugins/builtin-plugin/edit-module.ts | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/vrender-core/src/graphic/richtext.ts b/packages/vrender-core/src/graphic/richtext.ts index b4b5c0526..21b68213c 100644 --- a/packages/vrender-core/src/graphic/richtext.ts +++ b/packages/vrender-core/src/graphic/richtext.ts @@ -196,9 +196,12 @@ export class RichText extends Graphic implements IRic line.paragraphs.every(item => !(item.text && isString(item.text) && RichText.splitText(item.text).length > 1)) ); } + // isComposing的不算 const tc = cache as IRichTextGraphicAttribute['textConfig']; return tc.every( - item => !((item as any).text && isString((item as any).text) && RichText.splitText((item as any).text).length > 1) + item => + (item as any).isComposing || + !((item as any).text && isString((item as any).text) && RichText.splitText((item as any).text).length > 1) ); } diff --git a/packages/vrender-core/src/plugins/builtin-plugin/edit-module.ts b/packages/vrender-core/src/plugins/builtin-plugin/edit-module.ts index f2fb7ab9d..8ff772330 100644 --- a/packages/vrender-core/src/plugins/builtin-plugin/edit-module.ts +++ b/packages/vrender-core/src/plugins/builtin-plugin/edit-module.ts @@ -142,7 +142,7 @@ export class EditModule { const text = (lastConfig as any).text; const textList: string[] = text ? Array.from(text.toString()) : []; for (let i = 0; i < textList.length; i++) { - textConfig.splice(i + configIdx, 0, { ...lastConfig, text: textList[i] }); + textConfig.splice(i + configIdx, 0, { ...lastConfig, isComposing: false, text: textList[i] } as any); } this.currRt.setAttributes({ textConfig }); this.onChangeCbList.forEach(cb => { @@ -231,6 +231,7 @@ export class EditModule { textConfig.splice(startIdx, 0, currConfig); } (currConfig as any).text = str; + currConfig.isComposing = this.isComposing; if (!textConfig.length) { textConfig.push(currConfig); }