As far as I know, the EditContext.text is mainly designed for text editors that use the canvas element or choose the "hidden text area" solution. This may be a good fit for them, but that's not always the case.
There are text editors that rely on solutions like Virtual DOM or Custom Elements, and in that case, the text property is unused.
With the current implementation, the text property expands itself, assuming that we would use it. However, when we are not using it, we have to clear it to avoid using extra memory.
editContext.addEventListener("textupdate", () => {
// Clear the text to avoid unnecessary memory usage
editContext.updateText(0, editContext.text.length, "");
});
My suggestion is to change the behavior of the text somehow to not expand by default.
As far as I know, the
EditContext.textis mainly designed for text editors that use the canvas element or choose the "hidden text area" solution. This may be a good fit for them, but that's not always the case.There are text editors that rely on solutions like Virtual DOM or Custom Elements, and in that case, the text property is unused.
With the current implementation, the
textproperty expands itself, assuming that we would use it. However, when we are not using it, we have to clear it to avoid using extra memory.My suggestion is to change the behavior of the
textsomehow to not expand by default.