This commit is contained in:
2020-08-28 01:00:33 +00:00
parent 04d69d3f9d
commit 4354a7c3a8

View File

@@ -1,27 +1,33 @@
<template> <template>
<v-tabs color="primary"> <div v-resize="onResize">
<v-tab>Item One</v-tab> {{ tab }}
<v-tab>Item Two</v-tab> <v-tabs v-model="tab" color="primary" @change="resizeEditors">
<v-tab>CSS</v-tab> <v-tab>Properties</v-tab>
<v-tabs-items> <v-tab>Template</v-tab>
<v-tab-item> <v-tab>CSS</v-tab>
one <v-tabs-items v-model="tab">
</v-tab-item> <v-tab-item transition="none" reverse-transition="none" class="mt-5">
<v-tab-item> PRoperties tab
two </v-tab-item>
</v-tab-item> <v-tab-item transition="none" reverse-transition="none" class="mt-5">
<v-tab-item> <MonacoEditor
<MonacoEditor ref="scriptEditor"
class="editor" v-model="obj.template"
v-model="report.style" language="javascript"
language="css" :options="monacoOptions"
:options="monacoOptions" />
:style="editStyle()" </v-tab-item>
v-resize="onResize" <v-tab-item transition="none" reverse-transition="none" class="mt-5">
/> <MonacoEditor
</v-tab-item> ref="cssEditor"
</v-tabs-items> v-model="obj.style"
</v-tabs> language="css"
:options="monacoOptions"
/>
</v-tab-item>
</v-tabs-items>
</v-tabs>
</div>
<!-- <gz-report-viewer <!-- <gz-report-viewer
:reportId="$route.params.recordid" :reportId="$route.params.recordid"
@@ -73,9 +79,9 @@ export default {
replaceDialog: false, replaceDialog: false,
editingActiveTranslation: false, editingActiveTranslation: false,
duplicating: false, duplicating: false,
code: "const noop = () => {}",
monacoOptions: { automaticLayout: true }, monacoOptions: { automaticLayout: true },
editAreaHeight: 300, editAreaHeight: 300,
tab: 0,
obj: { obj: {
id: 0, id: 0,
concurrency: 0, concurrency: 0,
@@ -84,8 +90,29 @@ export default {
notes: null, notes: null,
roles: null, roles: null,
objectType: 0, objectType: 0,
template: "", template: `/* Xeslint-disable */
style: "", import "@fortawesome/fontawesome-free/css/all.css";
import "typeface-roboto/index.css";
import "github-markdown-css";
import Vue from "vue";
import Vuetify from "./plugins/vuetify";
import App from "./App.vue";
import router from "./router";
`,
style: ` @page {
margin: 1cm;
}
@page :first {
margin: 2cm;
}
.ay-red {
color:red;
}
.ay-blue {
color:blue;
}`,
jsPrerender: "", jsPrerender: "",
jsHelpers: "", jsHelpers: "",
renderType: 0 renderType: 0
@@ -101,17 +128,39 @@ export default {
serverError: {} serverError: {}
}, },
rights: window.$gz.role.defaultRightsObject(), rights: window.$gz.role.defaultRightsObject(),
ayaType: window.$gz.type.Translation ayaType: window.$gz.type.Report
}; };
}, },
methods: { methods: {
//alternate method, one editor with tabs example
//probably should do this way
//https://github.com/Microsoft/monaco-editor/issues/604
//https://github.com/Microsoft/monaco-editor/blob/bad3c34056624dca34ac8be5028ae3454172125c/website/playground/playground.js#L108
onResize() { onResize() {
// this.editAreaHeight = window.innerHeight / 2; // this.editAreaHeight = window.innerHeight / 2;
this.editAreaHeight = window.innerHeight * 0.89; this.editAreaHeight = window.innerHeight * 0.89;
this.resizeEditors();
//console.log(this.$refs.scriptEditor.$el.style);
}, },
editStyle() { resizeEditors() {
return "width: 100%;height: " + this.editAreaHeight + "px;"; let h = `${this.editAreaHeight}px`;
console.log("resizeEditors...");
let ed = this.$refs.scriptEditor;
if (ed != null) {
console.log("scriptEditor setting height", h);
ed.$el.style.height = h;
}
ed = this.$refs.cssEditor;
if (ed != null) {
console.log("cssEditor setting height", h);
ed.$el.style.height = h;
}
} }
// ,
// editStyle() {
// return "width: 100%;height: " + this.editAreaHeight + "px;";
// }
} }
}; };
</script> </script>