[IMP] editor: set tab size dynamically

closes #46
This commit is contained in:
Géry Debongnie
2019-04-17 12:48:54 +02:00
parent 8156a9ef6f
commit cac301f0f7
+4
View File
@@ -47,6 +47,8 @@ class TabbedEditor extends Component {
this.editor.setFontSize("13px");
this.editor.setTheme("ace/theme/monokai");
this.editor.session.setMode(MODES[this.state.currentTab]);
const tabSize = this.state.currentTab === "xml" ? 2 : 4;
this.editor.session.setOption("tabSize", tabSize);
this.editor.on("blur", () => {
const editorValue = this.editor.getValue();
const propsValue = this.props[this.state.currentTab];
@@ -76,6 +78,8 @@ class TabbedEditor extends Component {
const mode = MODES[tab];
this.editor.session.setMode(mode);
const tabSize = tab === "xml" ? 2 : 4;
this.editor.session.setOption("tabSize", tabSize);
this.state.currentTab = tab;
}