From 9d94d491121e1eabab953d9423a2b9a8f44e2d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 10 Oct 2018 18:21:33 +0200 Subject: [PATCH] add watchDoc prop to editor --- README.md | 1 + packages/tiptap/src/components/editor.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ad9915b..d5f7b25b 100644 --- a/README.md +++ b/README.md @@ -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. | diff --git a/packages/tiptap/src/components/editor.js b/packages/tiptap/src/components/editor.js index da268c4c..c8062ff9 100644 --- a/packages/tiptap/src/components/editor.js +++ b/packages/tiptap/src/components/editor.js @@ -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() { - this.setContent(this.doc, true) + if (this.watchDoc) { + this.setContent(this.doc, true) + } }, },