Replies: 2 comments 4 replies
-
How do you override insertText? You can prevent it by not calling |
Beta Was this translation helpful? Give feedback.
-
So I tried (using CodeSandbox, here is the link Test Paragraph) to reproduce my piece of code and here everything works as expected. My project, on the other hand, still doesn't work I tried debugging both versions (CodeSandbox and my version) and there is a difference (which is Slate-related to be honest): the CodeSandbox version "handles" the beforeinput event (uses preventDefault and executes other code), whereas my version (which runs on a recent browser) lets the beforeinput event execute by default and consequently the text is inserted before the insertText call I don't know if this is actually the problem, but if I try to force the handling of 'beforeinput' in the via version, the behaviour is as expected |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am implementing my custom paragraph plugin which limits editing functions under certain circumstances. So far, I have managed to correctly handle the deletion of text, the insertion of breaks, etc, all by overriding the functions insertBreak, deleteBackward, deleteForward, etc.
Now I would like to limit the insertion of text, but even if I override insertText this is executed after the text has already been inserted. At the moment I have solved it by intercepting the keyDown event but I wanted to know if there was a way to do it differently
Thanks
Beta Was this translation helpful? Give feedback.
All reactions