ianstormtaylor / slate

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

Chinese IME sogou,cause crash by editing text before a inline-element #5066

Open OldDream opened 2 years ago

OldDream commented 2 years ago

Description Chinese IME sogou,cause crash by editing text before a inline-element. select -> input by sogou IME -> crash

Recording rec

Sandbox

This bug can be reproduce with official online demo. https://www.slatejs.org/examples/mentions

Steps To reproduce the behavior:

  1. select all characters befor @R2-D2
  2. start input with sogou IME
  3. then the bug show up.
  4. See error in console: Uncaught Error: Cannot resolve a Slate point from DOM point: [object Text],2 at Object.toSlatePoint ([example]-5e4f16b701ecada0.js:1:99830) at Object.toSlateRange ([example]-5e4f16b701ecada0.js:1:100498) at HTMLDocument.<anonymous> ([example]-5e4f16b701ecada0.js:1:117948) at g (674-c731382ea76bd727.js:1:1377655) at b (674-c731382ea76bd727.js:1:1377711) at HTMLDocument.z (674-c731382ea76bd727.js:1:1378030) at g (674-c731382ea76bd727.js:1:1377655) at S (674-c731382ea76bd727.js:1:1377930) at w (674-c731382ea76bd727.js:1:1377820)

Context The official demo can work smooth with Microsoft's chinese IME, so I'm not sure if this is a bug. But sogou IME is widely used in china. So it would be very helpful if we can fix this.

washanhanzi commented 1 week ago

5762