From 9049447cc9ee93c4e835451612f55235b8d2d403 Mon Sep 17 00:00:00 2001 From: wuyiping0628 <1106773985@qq.com> Date: Fri, 13 Mar 2026 01:55:53 -0700 Subject: [PATCH] feat: the problem of starting to input the placeholder without disappearing in the context of Chinese input method --- .../fluent-editor/src/modules/custom-clipboard.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/packages/fluent-editor/src/modules/custom-clipboard.ts b/packages/fluent-editor/src/modules/custom-clipboard.ts index 8bf9fda6..78df0015 100644 --- a/packages/fluent-editor/src/modules/custom-clipboard.ts +++ b/packages/fluent-editor/src/modules/custom-clipboard.ts @@ -22,6 +22,19 @@ const Delta = Quill.import('delta') export class CustomClipboard extends Clipboard { declare quill: FluentEditor + constructor(public quill: FluentEditor) { + super(quill) + // 解决 quill 组件在中文输入法的情景下开始输入placeholder不消失的问题 + this.quill.root.addEventListener('input', () => { + if (this.quill.root.innerText !== '\\n' && this.quill.root.classList.contains('ql-blank')) { + this.quill.root.classList.toggle('ql-blank', false) + } + else { + this.quill.options.placeholder = this.quill.getLangText('editor-placeholder') + } + }) + } + prepareMatching(container: HTMLElement, nodeMatches) { const elementMatchers = [] const textMatchers = []