From aecf2284e95ad057b57a0f55cb0b4a4f7f092979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 23 Oct 2018 20:49:30 +0200 Subject: [PATCH] move some functions --- packages/tiptap/src/utils/Editor.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/tiptap/src/utils/Editor.js b/packages/tiptap/src/utils/Editor.js index ecff1a1a..c80e899d 100644 --- a/packages/tiptap/src/utils/Editor.js +++ b/packages/tiptap/src/utils/Editor.js @@ -21,7 +21,11 @@ import builtInNodes from '../Nodes' export default class Editor { constructor(options = {}) { + this.setOptions(options) + this.init() + } + setOptions(options) { const defaultOptions = { editable: true, content: '', @@ -30,13 +34,15 @@ export default class Editor { }, } - this.element = document.createElement('div') - this.bus = new Vue() - this.options = { ...defaultOptions, ...options, } + } + + init() { + this.bus = new Vue() + this.element = document.createElement('div') this.extensions = this.createExtensions() this.nodes = this.createNodes() this.marks = this.createMarks() @@ -51,7 +57,7 @@ export default class Editor { this.updateMenuActions() this.emit('init') - } + } createExtensions() { return new ExtensionManager([