This commit is contained in:
2020-08-28 17:46:58 +00:00
parent 4354a7c3a8
commit e9d8b0cc15

View File

@@ -1,32 +1,48 @@
<template> <template>
<div v-resize="onResize"> <div v-resize="onResize">
{{ tab }} <v-row>
<v-tabs v-model="tab" color="primary" @change="resizeEditors"> <v-col cols="12" sm="6" class="py-2">
<v-tab>Properties</v-tab> <v-btn-toggle
<v-tab>Template</v-tab> v-model="activeTab"
<v-tab>CSS</v-tab> tile
<v-tabs-items v-model="tab"> color="deep-purple accent-3"
<v-tab-item transition="none" reverse-transition="none" class="mt-5"> group
PRoperties tab @change="onViewChange"
</v-tab-item> mandatory
<v-tab-item transition="none" reverse-transition="none" class="mt-5"> >
<MonacoEditor <v-btn value="properties">
ref="scriptEditor" Properties
v-model="obj.template" </v-btn>
language="javascript"
:options="monacoOptions" <v-btn value="template">
/> Template
</v-tab-item> </v-btn>
<v-tab-item transition="none" reverse-transition="none" class="mt-5">
<MonacoEditor <v-btn value="style">
ref="cssEditor" Style
v-model="obj.style" </v-btn>
language="css"
:options="monacoOptions" <v-btn value="jsprerender">
/> JSPrerender
</v-tab-item> </v-btn>
</v-tabs-items>
</v-tabs> <v-btn value="jshelpers">
JSHelpers
</v-btn>
</v-btn-toggle>
</v-col>
<v-col cols="12" v-show="activeTab != 'properties'">
<MonacoEditor
ref="editor"
v-model="obj.template"
language="javascript"
:options="monacoOptions"
/>
</v-col>
<v-col cols="12" v-show="activeTab == 'properties'">
<h5>Properties</h5>
</v-col>
</v-row>
</div> </div>
<!-- <gz-report-viewer <!-- <gz-report-viewer
@@ -71,6 +87,7 @@ export default {
helpUrl: "form-ay-report-edit" helpUrl: "form-ay-report-edit"
}); });
}, },
created() {},
data() { data() {
return { return {
search: "", search: "",
@@ -81,7 +98,8 @@ export default {
duplicating: false, duplicating: false,
monacoOptions: { automaticLayout: true }, monacoOptions: { automaticLayout: true },
editAreaHeight: 300, editAreaHeight: 300,
tab: 0, activeTab: "properties",
lastTab: "properties",
obj: { obj: {
id: 0, id: 0,
concurrency: 0, concurrency: 0,
@@ -136,6 +154,41 @@ import router from "./router";
//probably should do this way //probably should do this way
//https://github.com/Microsoft/monaco-editor/issues/604 //https://github.com/Microsoft/monaco-editor/issues/604
//https://github.com/Microsoft/monaco-editor/blob/bad3c34056624dca34ac8be5028ae3454172125c/website/playground/playground.js#L108 //https://github.com/Microsoft/monaco-editor/blob/bad3c34056624dca34ac8be5028ae3454172125c/website/playground/playground.js#L108
onViewChange() {
let vm = this;
let editor = vm.$refs.editor ? vm.$refs.editor.getEditor() : null;
console.log(`Switching from ${vm.lastTab} to ${vm.activeTab}`);
console.log("editor", editor);
//save last view stuff
switch (vm.lastTab) {
case "properties":
break;
case "template":
break;
case "style":
break;
case "jsprerender":
break;
case "jshelpers":
break;
}
//set new view stuff
switch (vm.activeTab) {
case "properties":
break;
case "template":
break;
case "style":
break;
case "jsprerender":
break;
case "jshelpers":
break;
}
vm.lastTab = vm.activeTab;
},
onResize() { onResize() {
// this.editAreaHeight = window.innerHeight / 2; // this.editAreaHeight = window.innerHeight / 2;
this.editAreaHeight = window.innerHeight * 0.89; this.editAreaHeight = window.innerHeight * 0.89;
@@ -144,18 +197,18 @@ import router from "./router";
}, },
resizeEditors() { resizeEditors() {
let h = `${this.editAreaHeight}px`; let h = `${this.editAreaHeight}px`;
console.log("resizeEditors..."); // console.log("resizeEditor...");
let ed = this.$refs.scriptEditor; let ed = this.$refs.editor;
if (ed != null) { if (ed != null) {
console.log("scriptEditor setting height", h); // console.log("editor setting height", h);
ed.$el.style.height = h; ed.$el.style.height = h;
} }
ed = this.$refs.cssEditor; // ed = this.$refs.cssEditor;
if (ed != null) { // if (ed != null) {
console.log("cssEditor setting height", h); // console.log("cssEditor setting height", h);
ed.$el.style.height = h; // ed.$el.style.height = h;
} // }
} }
// , // ,
// editStyle() { // editStyle() {