[FIX] playground: keep ace editor alive between mounting/remounting

closes #136
This commit is contained in:
Géry Debongnie
2019-06-04 09:14:57 +02:00
committed by aab-odoo
parent f8e07f6d30
commit ff51443b8e
2 changed files with 12 additions and 21 deletions
+2 -6
View File
@@ -287,10 +287,11 @@ class TabbedEditor extends owl.Component {
this.sessions[tab].setUndoManager(new ace.UndoManager());
}
}
this.editor = null;
}
mounted() {
this.editor = ace.edit(this.refs.editor);
this.editor = this.editor || ace.edit(this.refs.editor);
this.editor.setValue(this.props[this.state.currentTab], -1);
this.editor.setFontSize("12px");
@@ -317,11 +318,6 @@ class TabbedEditor extends owl.Component {
this.editor.resize();
}
willUnmount() {
this.editor.destroy();
delete this.editor;
}
setTab(tab) {
if (this.state.currentTab !== tab) {
this.state.currentTab = tab;