Browse Source

Remove focus from the RTE module

pull/415/head
Artur Arseniev 9 years ago
parent
commit
7394bb42b8
  1. 1
      src/dom_components/view/ComponentTextView.js
  2. 31
      src/rich_text_editor/index.js

1
src/dom_components/view/ComponentTextView.js

@ -29,7 +29,6 @@ module.exports = ComponentView.extend({
if (rte && editable) {
try {
this.activeRte = rte.enable(this, this.activeRte);
rte.focus(this, this.activeRte);
} catch (err) {
console.error(err);
}

31
src/rich_text_editor/index.js

@ -157,7 +157,7 @@ module.exports = () => {
/**
* Enable rich text editor on the element
* @param {View} view
* @param {View} view Component view
* @param {Object} rte The instance of already defined RTE
* @private
* */
@ -166,17 +166,17 @@ module.exports = () => {
const em = config.em;
const el = view.getChildrenContainer();
const customRte = this.customRte;
const actionbarContainer = toolbar;
rte = customRte ? customRte.enable(el, rte) : new RichTextEditor({el});
toolbar.style.display = '';
rte = customRte ? customRte.enable(el, rte) :
new RichTextEditor({el, actionbarContainer});
if (em) {
setTimeout(this.udpatePosition.bind(this), 0);
em.off('change:canvasOffset', this.udpatePosition, this);
em.on('change:canvasOffset', this.udpatePosition, this);
// Update position on scrolling
em.off('canvasScroll', this.udpatePosition, this);
em.on('canvasScroll', this.udpatePosition, this);
const event = 'change:canvasOffset canvasScroll';
em.off(event, this.udpatePosition, this);
em.on(event, this.udpatePosition, this);
}
return rte;
@ -201,23 +201,6 @@ module.exports = () => {
toolbar.style.display = 'none';
},
/**
* Unbind rich text editor from the element
* @param {View} view
* @param {Object} rte The instance of already defined RTE
* @private
* */
focus(view, rte) {
var customRte = this.customRte;
var el = view.getChildrenContainer();
if (customRte) {
if(customRte.focus)
customRte.focus(el, rte);
} else {
this.attach(view);
}
},
/**
* Return the toolbar element
* @return {HTMLElement}

Loading…
Cancel
Save