Skip to content

Commit

Permalink
fix: fix issue with composing input
Browse files Browse the repository at this point in the history
  • Loading branch information
neuqzxy committed Dec 17, 2024
1 parent 6d1485d commit 51db3ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion packages/vrender-core/src/graphic/richtext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ export class RichText extends Graphic<IRichTextGraphicAttribute> 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)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 51db3ae

Please sign in to comment.