You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using IME to type with placeholder text present, the placeholder text movies with the IME input instead of begin removed. Once IME completes, behavior varies by browser:
Chrome:
Raises the following error:
Cannot resolve a Slate point from DOM point: [object Text],5
If the error is caught, the composition text is inserted correctly.
Safari
Composition text is inserted correctly, but cursor is placed at the beginning of the input.
Firefox
Composition text is inserted twice. Adding additional text / modifying the slate state in any way will raise an error:
Cannot resolve a DOM point from Slate point: {"path":[0,0],"offset":11}
constonComposition=(e: React.CompositionEvent<HTMLDivElement>)=>{if(e.type==="compositionstart"){setComposition(true);if(value[0].children.length===1&&value[0].children[0].text==="")){setIsPlaceholderRemove(true);editor.insertText(" ");// important, this will be added at the head of the composition text and change the visibility of placeholder}}elseif(e.type==="compositionend"){setComposition(false);if(isPlaceholderRemove){editor.deleteBackward("character");// remove the space " " we just addedsetIsPlaceholderRemove(false);}}};
🐞 Bug
What's the current behavior?
When using IME to type with placeholder text present, the placeholder text movies with the IME input instead of begin removed. Once IME completes, behavior varies by browser:
Chrome:
Raises the following error:
If the error is caught, the composition text is inserted correctly.
Safari
Composition text is inserted correctly, but cursor is placed at the beginning of the input.
Firefox
Composition text is inserted twice. Adding additional text / modifying the slate state in any way will raise an error:
See: #3824
Slate: v0.58.1
Browser: Chrome / Safari / Firefox / Edge
OS: Mac / Windows / Linux / iOS / Android
What's the expected behavior?
Duplicate of #3369
The text was updated successfully, but these errors were encountered: