From 80144815a9d0c0efea8e8775181d8fdf446cedcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Fri, 10 May 2019 15:37:21 +0200 Subject: [PATCH] pass editor to sendable hook --- examples/Components/Routes/Collaboration/index.vue | 4 ++-- .../tiptap-extensions/src/extensions/Collaboration.js | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/examples/Components/Routes/Collaboration/index.vue b/examples/Components/Routes/Collaboration/index.vue index 5fcd7940..9081e9b9 100644 --- a/examples/Components/Routes/Collaboration/index.vue +++ b/examples/Components/Routes/Collaboration/index.vue @@ -69,8 +69,8 @@ export default { // debounce changes so we can save some bandwidth debounce: 250, // onSendable is called whenever there are changed we have to send to our server - onSendable: data => { - this.socket.emit('update', data) + onSendable: ({ sendable }) => { + this.socket.emit('update', sendable) }, }), ], diff --git a/packages/tiptap-extensions/src/extensions/Collaboration.js b/packages/tiptap-extensions/src/extensions/Collaboration.js index ab105209..785259bb 100644 --- a/packages/tiptap-extensions/src/extensions/Collaboration.js +++ b/packages/tiptap-extensions/src/extensions/Collaboration.js @@ -19,9 +19,12 @@ export default class Collaboration extends Extension { if (sendable) { this.options.onSendable({ - version: sendable.version, - steps: sendable.steps.map(step => step.toJSON()), - clientID: sendable.clientID, + editor: this.editor, + sendable: { + version: sendable.version, + steps: sendable.steps.map(step => step.toJSON()), + clientID: sendable.clientID, + }, }) } }, this.options.debounce)