mirror of https://github.com/sveltejs/svelte
parent
abcdc740b1
commit
820490fb4d
@ -0,0 +1,15 @@
|
||||
<script>
|
||||
let html = '<p>Write some text!</p>';
|
||||
</script>
|
||||
|
||||
<div contenteditable="true"></div>
|
||||
|
||||
<pre>{html}</pre>
|
||||
|
||||
<style>
|
||||
[contenteditable] {
|
||||
padding: 0.5em;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,18 @@
|
||||
<script>
|
||||
let html = '<p>Write some text!</p>';
|
||||
</script>
|
||||
|
||||
<div
|
||||
contenteditable="true"
|
||||
bind:innerHTML={html}
|
||||
></div>
|
||||
|
||||
<pre>{html}</pre>
|
||||
|
||||
<style>
|
||||
[contenteditable] {
|
||||
padding: 0.5em;
|
||||
border: 1px solid #eee;
|
||||
border-radius: 4px;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
title: Contenteditable bindings
|
||||
---
|
||||
|
||||
Elements with a `contenteditable="true"` attribute support `textContent` and `innerHTML` bindings:
|
||||
|
||||
```html
|
||||
<div
|
||||
contenteditable="true"
|
||||
bind:innerHTML={html}
|
||||
></div>
|
||||
```
|
Loading…
Reference in new issue