Browse Source

Refactor few ComponentTextView methods

pull/415/head
Artur Arseniev 8 years ago
parent
commit
a331d97fb3
  1. 5
      src/dom_components/view/ComponentTextView.js
  2. 2
      src/rich_text_editor/model/RichTextEditor.js

5
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);
}

2
src/rich_text_editor/view/RichTextEditor.js → 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];
Loading…
Cancel
Save