Open ak5 opened 4 years ago
Try this. its working for me.
<Editor {html} on:change={(e)=>html = e.detail} height={"200px"} />
This still seems to be an issue for me.. neither of the above techniques trigger a change when editing HTML:
https://svelte.dev/repl/209dd0724c1d440bb5d9950985627f8a?version=3.55.1
It seems that we're missing an on:input
event on the <textarea/>
element within Editor.svelte
.
Modifying this line to:
<textarea
bind:this={$references.raw}
on:input={(event) => _onChange(event.target.value)}
class="cl-textarea"
style="max-height: {height}; min-height: {height}"
/>
And it behaves as I'd expect.
Thank you @acoyfellow your solution worked for my problem.
First off, thanks for this! Super useful!
I am using svelte also and found myself wanting do something like
<Editor bind:html height={"200"} />
, but had to do this:I'm probably missing something, but the simpler, more idiomatic version with
bind:html
did not work for me.Even then, the
$on('change')
doesn't seem to fire when editing raw htmlAm I doing it wrong? very likely xD