Browse Source

Disable RTE properly

pull/3411/head
Artur Arseniev 5 years ago
parent
commit
de287c5066
  1. 14
      src/rich_text_editor/index.js

14
src/rich_text_editor/index.js

@ -33,7 +33,8 @@ import defaults from './config/config';
export default () => { export default () => {
let config = {}; let config = {};
let toolbar, actions, lastEl, lastElPos, globalRte; let toolbar, actions, lastEl, lastElPos, globalRte;
const eventsUp =
'change:canvasOffset canvasScroll frame:scroll component:update';
const hideToolbar = () => { const hideToolbar = () => {
const style = toolbar.style; const style = toolbar.style;
const size = '-1000px'; const size = '-1000px';
@ -301,10 +302,8 @@ export default () => {
if (em) { if (em) {
setTimeout(this.updatePosition.bind(this), 0); setTimeout(this.updatePosition.bind(this), 0);
const event = em.off(eventsUp, this.updatePosition, this);
'change:canvasOffset canvasScroll frame:scroll component:update'; em.on(eventsUp, this.updatePosition, this);
em.off(event, this.updatePosition, this);
em.on(event, this.updatePosition, this);
em.trigger('rte:enable', view, rte); em.trigger('rte:enable', view, rte);
} }
@ -329,7 +328,10 @@ export default () => {
} }
hideToolbar(); hideToolbar();
em && em.trigger('rte:disable', view, rte); if (em) {
em.off(eventsUp, this.updatePosition, this);
em.trigger('rte:disable', view, rte);
}
} }
}; };
}; };

Loading…
Cancel
Save