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