This commit is contained in:
2020-09-04 18:33:25 +00:00
parent d9366c2628
commit e72bd207a0

View File

@@ -6,7 +6,7 @@
<v-col cols="12" class="d-sm-none accent--text"> <v-col cols="12" class="d-sm-none accent--text">
<h4>{{ $ay.t("ReportEditorMobileWarning") }}</h4> <h4>{{ $ay.t("ReportEditorMobileWarning") }}</h4>
</v-col> </v-col>
<v-col cols="12" sm="6" class="py-2"> <v-col cols="12" class="py-2">
<v-btn-toggle <v-btn-toggle
v-model="activeTab" v-model="activeTab"
tile tile
@@ -458,66 +458,61 @@ Handlebars.registerHelper('loud', function (aString) {
vm.editData.rawData.state = currentState; vm.editData.rawData.state = currentState;
break; break;
} }
vm.lastTab = vm.activeTab;
//set new view stuff //set new view stuff
switch (vm.activeTab) { switch (vm.activeTab) {
case "properties": case "properties":
vm.view = "properties"; vm.view = "properties";
return;
break; break;
case "template": case "template":
editor.setModel(vm.editData.template.model); editor.setModel(vm.editData.template.model);
editor.restoreViewState(vm.editData.template.state); editor.restoreViewState(vm.editData.template.state);
editor.updateOptions({ readOnly: false }); editor.updateOptions({ readOnly: false });
vm.view = "edit"; vm.view = "edit";
vm.$nextTick(() => {
editor.layout();
editor.focus();
});
break; break;
case "style": case "style":
editor.setModel(vm.editData.style.model); editor.setModel(vm.editData.style.model);
editor.restoreViewState(vm.editData.style.state); editor.restoreViewState(vm.editData.style.state);
editor.updateOptions({ readOnly: false }); editor.updateOptions({ readOnly: false });
vm.view = "edit"; vm.view = "edit";
editor.layout();
editor.focus();
break; break;
case "jsPrerender": case "jsPrerender":
editor.setModel(vm.editData.jsPrerender.model); editor.setModel(vm.editData.jsPrerender.model);
editor.restoreViewState(vm.editData.jsPrerender.state); editor.restoreViewState(vm.editData.jsPrerender.state);
editor.updateOptions({ readOnly: false }); editor.updateOptions({ readOnly: false });
vm.view = "edit"; vm.view = "edit";
editor.layout();
editor.focus();
break; break;
case "jsHelpers": case "jsHelpers":
editor.setModel(vm.editData.jsHelpers.model); editor.setModel(vm.editData.jsHelpers.model);
editor.restoreViewState(vm.editData.jsHelpers.state); editor.restoreViewState(vm.editData.jsHelpers.state);
editor.updateOptions({ readOnly: false }); editor.updateOptions({ readOnly: false });
vm.view = "edit"; vm.view = "edit";
editor.layout();
editor.focus();
break; break;
case "rawData": case "rawData":
editor.setModel(vm.editData.rawData.model); editor.setModel(vm.editData.rawData.model);
editor.restoreViewState(vm.editData.rawData.state); editor.restoreViewState(vm.editData.rawData.state);
editor.updateOptions({ readOnly: true }); editor.updateOptions({ readOnly: true });
vm.view = "edit"; vm.view = "edit";
editor.layout();
editor.focus();
break; break;
} }
vm.lastTab = vm.activeTab; vm.$nextTick(() => {
editor.layout();
editor.focus();
});
// vm.lastTab = vm.activeTab;
}, },
onResize() { onResize() {
//resize related links: this.$nextTick(() => {
//https://github.com/Microsoft/monaco-editor/issues/28 //resize related links:
let el = document.getElementById("editContainer"); //https://github.com/Microsoft/monaco-editor/issues/28
el.style = `width:100%;height:${window.innerHeight * 0.77}px`; let el = document.getElementById("editContainer");
if (editor != null) { el.style = `width:100%;height:${window.innerHeight * 0.77}px`;
editor.layout(); if (editor != null) {
} editor.layout();
}
});
}, },
canSave: function() { canSave: function() {
return this.formState.valid && this.formState.dirty; return this.formState.valid && this.formState.dirty;