quill
quill copied to clipboard
Typing with Chinese IME Causes Text Overlapping with the Placeholder
Presumably a similar or the same issue as #4021 #4105
Steps for Reproduction
- Visit https://quilljs.com/playground/snow
- Switch to macOS's native Chinese IME
- Start typing in this box
Expected behavior: Placeholder dismisses as I type
Actual behavior:
Placeholder doesn't dismiss
Platforms: Chrome 123.0.6312.87, macOS 14.2.1 Include browser, operating system and respective versions
Version:
v2.0.0
Run Quill.version
to find out
You can use quillRef. root. dataset. placeholder='Placeholder text'
to solve this problem
A quick solution is to listen to compositionstart
and clear the placeholder in the handler. Also restore the placeholder in compositionend
.
@dccxi You can use quill-react-commercial. Feature: When using IME and other input methods (such as Pinyin), placeholders can disappear in a timely manner.
//解决新版quill系统键盘输入时,placeholder不消失的bug quill.root.addEventListener('input',()=>{ if (quill.root.innerText !== '\n' && quill.root.classList.contains('ql-blank')) { quill.root.classList.toggle('ql-blank', false); } });
quill.root.addEventListener('input', () => { if (quill.root.classList.contains('ql-blank')) { if (quill.root.innerText !== '\n' && quill.root.innerText !== '') { quill.root.classList.toggle('ql-blank', false); } } });