add watchDoc prop to editor

This commit is contained in:
Philipp Kühn 2018-10-10 18:21:33 +02:00
parent a648d858b1
commit 9d94d49112
2 changed files with 8 additions and 1 deletions

View File

@ -58,6 +58,7 @@ export default {
| --- | :---: | :---: | --- |
| `editable` | `Boolean` | `true` | When set to `false` the editor is read-only. |
| `doc` | `Object` | `null` | The editor state object used by Prosemirror. You can also pass HTML to the `content` slot. When used both, the `content` slot will be ignored. |
| `watchDoc` | `Boolean` | `true` | If set to `true` the content gets updated whenever `doc` changes. |
| `extensions` | `Array` | `[]` | A list of extensions used, by the editor. This can be `Nodes`, `Marks` or `Plugins`. |
| `@init` | `Object` | `undefined` | This will return an Object with the current `state` and `view` of Prosemirror on init. |
| `@update` | `Object` | `undefined` | This will return an Object with the current `state` of Prosemirror, a `getJSON()` and `getHTML()` function on every change. |

View File

@ -32,6 +32,10 @@ export default {
type: Boolean,
default: true,
},
watchDoc: {
type: Boolean,
default: true,
},
},
data() {
@ -61,7 +65,9 @@ export default {
doc: {
deep: true,
handler() {
if (this.watchDoc) {
this.setContent(this.doc, true)
}
},
},