From cf4efcbac788eb07a62f284ff24519d8308112b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 23 Jul 2019 19:50:02 +0200 Subject: [PATCH] codestyle --- .../tiptap-extensions/src/extensions/TrailingNode.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/tiptap-extensions/src/extensions/TrailingNode.js b/packages/tiptap-extensions/src/extensions/TrailingNode.js index 1beb40f21..b5c0f5a89 100644 --- a/packages/tiptap-extensions/src/extensions/TrailingNode.js +++ b/packages/tiptap-extensions/src/extensions/TrailingNode.js @@ -29,15 +29,16 @@ export default class TrailingNode extends Extension { view: () => ({ update: view => { const { state } = view - const { doc } = state const insertNodeAtEnd = plugin.getState(state) if (!insertNodeAtEnd) { return } - const type = state.schema.nodes[this.options.node] - view.dispatch(view.state.tr.insert(doc.content.size, type.create())) + const { doc, schema, tr } = state + const type = schema.nodes[this.options.node] + const transaction = tr.insert(doc.content.size, type.create()) + view.dispatch(transaction) }, }), state: { @@ -45,9 +46,9 @@ export default class TrailingNode extends Extension { const lastNode = state.tr.doc.lastChild return !nodeEqualsType({ node: lastNode, types: disabledNodes }) }, - apply: (tr, oldState) => { + apply: (tr, value) => { if (!tr.docChanged) { - return oldState + return value } const lastNode = tr.doc.lastChild