quill
quill copied to clipboard
If you type in Korean, the change event will be executed one letter later
useEffect(() => {
if (!ref.current || quillRef.current) return;
quillRef.current = new Quill(ref.current, {
theme: 'snow',
modules: {
toolbar: {
container: `#toolbar_${id}`,
handlers: {
emoji: function () {
setIsEmojiOpen(true);
},
},
},
},
...quillOptions,
});
quillRef.current.on('text-change', () => {
if (!quillRef.current) return;
const innerHTML= quillRef.current.root.innerHTML;
console.log(innerHTML);
console.log('length: ', quillRef.current.getLength() - 1);
});
}, [ref, id, onChange, quillOptions]);
Steps for Reproduction
- input 'ㄱ' (You can type in other Korean)
- Check the console log.
- Unfocus the quill or On the keyboard, press a non-text direction key or alt key, etc.
- Check the console log.
Expected behavior:
step2 console
<p>ㄱ</p> and length: 0
step4 console
<p>ㄱ</p> and length: 0
Actual behavior:
step2
The text-change event is not running
step4 console
<p>ㄱ</p> and length: 0
Platforms: Chrome: 127.0.6533.89 operating system: windows 11(23H2)
Version: quill: ^2.0.2
Run Quill.version to find out
Same here.
I am writing in English, and if you write "just a text" into the editor, in result it will be: "just a tex" :D