From a331d97fb32b5aeaa7ee6ad15f7813e8e10609c7 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Wed, 11 Oct 2017 02:06:10 +0200 Subject: [PATCH] Refactor few ComponentTextView methods --- src/dom_components/view/ComponentTextView.js | 5 ++--- src/rich_text_editor/{view => model}/RichTextEditor.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) rename src/rich_text_editor/{view => model}/RichTextEditor.js (99%) diff --git a/src/dom_components/view/ComponentTextView.js b/src/dom_components/view/ComponentTextView.js index 0caab1952..ba3ec68aa 100644 --- a/src/dom_components/view/ComponentTextView.js +++ b/src/dom_components/view/ComponentTextView.js @@ -16,7 +16,6 @@ module.exports = ComponentView.extend({ this.listenTo(model, 'focus active', this.enableEditing); this.listenTo(model, 'change:content', this.updateContent); this.rte = em && em.get('RichTextEditor'); - this.activeRte = null; }, /** @@ -30,7 +29,7 @@ module.exports = ComponentView.extend({ if (rte && editable) { try { - this.activeRte = rte.attach(this, this.activeRte); + this.activeRte = rte.enable(this, this.activeRte); rte.focus(this, this.activeRte); } catch (err) { console.error(err); @@ -52,7 +51,7 @@ module.exports = ComponentView.extend({ if (rte && editable) { try { - rte.detach(this, this.activeRte); + rte.disable(this, this.activeRte); } catch (err) { console.error(err); } diff --git a/src/rich_text_editor/view/RichTextEditor.js b/src/rich_text_editor/model/RichTextEditor.js similarity index 99% rename from src/rich_text_editor/view/RichTextEditor.js rename to src/rich_text_editor/model/RichTextEditor.js index e73728955..f42d2a03b 100644 --- a/src/rich_text_editor/view/RichTextEditor.js +++ b/src/rich_text_editor/model/RichTextEditor.js @@ -37,7 +37,7 @@ const actions = { export default class RichTextEditor { constructor(settings = {}) { - const el = settings.element; + const el = settings.el; if (el[RTE_KEY]) { return el[RTE_KEY];