-
Question from Gitter, answered here where we want future discussions. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I wanted to use Svelte. I thought it would be perfect. However, I couldn't get around certain problems in a cross-browser compatible way that didn't hurt text composition and auto-complete with mobile devices. The Details An empty paragraph needs to have a I tried several workarounds. Using the Using a I love Svelte and really wanted to make Typewriter a fully Svelte-rendered library. Most people don't need to worry about rendering too much and want Svelte mostly for their UI, so I resolved to stick with the VDOM approach for the text content and Svelte as the recommended UI (though you could use anything). All this being said, the rendering is actually implemented as a module, so if we figure out a nice way to allow Svelte to do that, we can create a Svelte renderer module to replace the existing one and still remain backwards compatible for others. |
Beta Was this translation helpful? Give feedback.
I wanted to use Svelte. I thought it would be perfect. However, I couldn't get around certain problems in a cross-browser compatible way that didn't hurt text composition and auto-complete with mobile devices.
The Details
An empty paragraph needs to have a
<br>
tag in it to keep it from collapsing to 0px-height. Typewriter needs to add this<br>
in, and can do so with Svelte. However, in contenteditable, if you place the cursor in the paragraph and type a letter, the<br>
is removed from the DOM and a text node is created. Listening to a mutation observer or input event you can read the change from the DOM and update the data model of the editor, then Svelte will update the paragraph to m…