ianstormtaylor / slate

A completely customizable framework for building rich text editors. (Currently in beta.)
http://slatejs.org
MIT License
29.87k stars 3.24k forks source link

can't input Chinese characters IOS, but can input English characters. #5703

Open TianYu0605 opened 2 months ago

TianYu0605 commented 2 months ago

Description I used Safari on my iPhone to open the example(https://www.slatejs.org/examples/richtext) provided by Slate, and found that I could not input Chinese. The following is the error I got when I opened it with the iOS simulator. At the same time, I found that if I used English as the first word and Chinese as the subsequent words, it could be input normally.

Recording When the editor value is empty, entering Chinese will result in an error and cannot be deleted. https://github.com/user-attachments/assets/61c6f15c-db26-46cd-a2b4-065771552009 Enter some English first, then enter Chinese, and you can enter and delete normally. The following is the error information: image

Expectation I hope that when the editor is empty, I can input Chinese normally and the console will not report an error.

Environment

TianYu0605 commented 2 months ago

Enter some English first, then enter Chinese, and you can enter and delete normally. https://github.com/user-attachments/assets/96e7f308-f152-44cc-bc93-450d3d13f183

daddybh commented 2 months ago

I looks like safari will break slate's dom structure at beforeinput event inputType = deleteCompositionText.

there is a workaround to trick safari which mentioned at https://github.com/ProseMirror/prosemirror/issues/934

It works for me, you can give it a shot.

daddybh commented 2 months ago

And this bug was brought in at this PR https://github.com/ianstormtaylor/slate/pull/5654.