From 6047263ee18f350e6269edfe92f719bff56e9d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=A8=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D0=B3=D0=B0=D1=87=D0=B8=D0=BA?= Date: Mon, 3 Sep 2018 14:26:46 +0300 Subject: [PATCH] add init event --- README.md | 1 + packages/tiptap/src/components/editor.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index fa93596d..ee50840b 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,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. | | `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. | ## Scoped Slots diff --git a/packages/tiptap/src/components/editor.js b/packages/tiptap/src/components/editor.js index 7ffd9f82..461aa0ba 100644 --- a/packages/tiptap/src/components/editor.js +++ b/packages/tiptap/src/components/editor.js @@ -100,6 +100,10 @@ export default { this.view = this.createView() this.commands = this.createCommands() this.updateMenuActions() + this.$emit('init', { + view: this.view, + state: this.state, + }) }, createSchema() {