quill icon indicating copy to clipboard operation
quill copied to clipboard

If you type in Korean, the change event will be executed one letter later

Open happytalkKJ opened this issue 1 year ago • 1 comments

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

  1. input 'ㄱ' (You can type in other Korean)
  2. Check the console log.
  3. Unfocus the quill or On the keyboard, press a non-text direction key or alt key, etc.
  4. 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

happytalkKJ avatar Aug 05 '24 03:08 happytalkKJ

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

MagisterUnivers avatar Aug 09 '24 10:08 MagisterUnivers