This commit is contained in:
2020-08-31 18:53:39 +00:00
parent 1a8bd23d5e
commit f5c27a47e9

View File

@@ -104,24 +104,6 @@ export default {
}
},
mounted() {
/*
data.js.model = monaco.editor.createModel('console.log("hi")', 'javascript');
data.css.model = monaco.editor.createModel('css', 'css');
data.html.model = monaco.editor.createModel('html', 'html');
editor = monaco.editor.create(editorContainer, {
model: data.js.model,
minimap: {
enabled: false
}
});
*/
// let monacoOptions = {
// value: 'console.log("Hello, world");',
// theme: "vs",
// language: "javascript"
// };
let vm = this;
//Created editor models for each type of report element that can be edited
@@ -153,18 +135,10 @@ export default {
data() {
return {
search: "",
find: "",
replace: "",
replaceDialog: false,
editingActiveTranslation: false,
duplicating: false,
monacoOptions: { automaticLayout: true },
editor: null,
editAreaHeight: 300,
activeTab: "properties",
lastTab: "properties",
lastEditTab: "template",
showEditor: true,
editData: {
template: {
@@ -227,13 +201,6 @@ export default {
//
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);
//todo: use function below for inspiration to save editor state and contents as necessary and switch views
//Note that properties tab doesn't mean need to dump editor as user could be switching back and forth
//so really the lasttab needs to be the last edited tab because we don't need to save when going to properties from script and back again
let currentState = vm.editor.saveViewState();
let currentModel = vm.editor.getModel();
@@ -288,34 +255,6 @@ export default {
break;
}
vm.lastTab = vm.activeTab;
/*
function changeTab(selectedTabNode, desiredModelId) {
for (var i = 0; i < tabArea.childNodes.length; i++) {
var child = tabArea.childNodes[i];
if (/tab/.test(child.className)) {
child.className = 'tab';
}
}
selectedTabNode.className = 'tab active';
var currentState = editor.saveViewState();
var currentModel = editor.getModel();
if (currentModel === data.js.model) {
data.js.state = currentState;
} else if (currentModel === data.css.model) {
data.css.state = currentState;
} else if (currentModel === data.html.model) {
data.html.state = currentState;
}
editor.setModel(data[desiredModelId].model);
editor.restoreViewState(data[desiredModelId].state);
editor.focus();
}
*/
},
onResize() {
//resize related links:
@@ -396,6 +335,12 @@ export default {
}
},
async submit() {
//######################
//need to set vm.obj first with model get value of text of each type being edited
//as only properties will be set already on obj, the rest is still as it was upon initial fetch
//unless I code it to always save to obj on each change of view or something but not necessary really
//USE MODEL.getValue() to get the text value of the model being edited
//Models sb already set in vm if they were set or edited previously
let vm = this;
if (vm.canSave == false) {
return;
@@ -424,7 +369,7 @@ export default {
//NOTE: will not cause a page re-render, almost nothing does unless forced with a KEY property or using router.GO()
this.$router.push({
name: "widget-edit",
name: "ay-report-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
@@ -515,7 +460,7 @@ export default {
} else {
//Navigate to new record
this.$router.push({
name: "widget-edit",
name: "ay-report-edit",
params: {
recordid: res.data.id,
obj: res.data // Pass data object to new form
@@ -552,7 +497,7 @@ async function clickHandler(menuItem) {
break;
case "new":
m.vm.$router.push({
name: "widget-edit",
name: "ay-report-edit",
params: { recordid: 0, new: true }
});
break;