I am a developer of a rich text editor engine.
I would like to know more about the advantages of EditContext API compared to contenteditable or hidden textarea.
I know that using contenteditable directly on the DOM to implement a rich text editor can lead to inconsistent data and unpredictable behavior.
So I now use a hidden textarea. I get user input by listening to beforeinput, compositionstart/compositionend and update my own text model and selection model, then render them. At the same time, by modifying the position of the textarea element, I make the IME window appear in the appropriate position.
Even when I use canvas to implement 3D art text input, I can also receive input text through a hidden textarea and then render it on the canvas.
So as of now, I'm not sure what significant benefits the EditContext API can bring me compared to hidden textarea?
I am a developer of a rich text editor engine.
I would like to know more about the advantages of EditContext API compared to
contenteditableorhidden textarea.I know that using contenteditable directly on the DOM to implement a rich text editor can lead to inconsistent data and unpredictable behavior.
So I now use a hidden textarea. I get user input by listening to
beforeinput,compositionstart/compositionendand update my own text model and selection model, then render them. At the same time, by modifying the position of thetextareaelement, I make the IME window appear in the appropriate position.Even when I use canvas to implement 3D art text input, I can also receive input text through a hidden textarea and then render it on the canvas.
So as of now, I'm not sure what significant benefits the EditContext API can bring me compared to hidden textarea?