|
@@ -247,9 +247,9 @@ const app = Vue.createApp({
|
|
|
/**
|
|
|
* @returns {Object} a new module object from the moduleTemplate
|
|
|
*/
|
|
|
- newModule() {
|
|
|
- return { ...this.moduleTemplate }
|
|
|
- },
|
|
|
+ newModule() {
|
|
|
+ return JSON.parse(JSON.stringify(this.moduleTemplate));
|
|
|
+ },
|
|
|
/**
|
|
|
* spreads a source module into a new module from the moduleTemplate
|
|
|
* @param {Object} sourceModule the module to copy
|
|
@@ -258,12 +258,18 @@ const app = Vue.createApp({
|
|
|
*/
|
|
|
cloneModule(sourceModule,includeSubmodules) {
|
|
|
let output = {
|
|
|
- ...this.moduleTemplate,
|
|
|
- ...sourceModule,
|
|
|
+ ...this.moduleTemplate,
|
|
|
+ ...sourceModule,
|
|
|
//TODO: implement lineage pattern, same as the rule does
|
|
|
source: sourceModule, // keep track of where this module came from
|
|
|
};
|
|
|
if (!includeSubmodules) output.modules = [];
|
|
|
+ // clear configs
|
|
|
+ document.getElementById("newConfigKey").value =
|
|
|
+ "Configuration";
|
|
|
+ document.getElementById("newConfigValue").value =
|
|
|
+ "Value";
|
|
|
+ output.config = {};
|
|
|
// delete unnecessary properties
|
|
|
delete output.content;
|
|
|
delete output.readonly;
|
|
@@ -592,6 +598,10 @@ const app = Vue.createApp({
|
|
|
const k = document.getElementById("newConfigKey").value;
|
|
|
const v = document.getElementById("newConfigValue").value;
|
|
|
this.editor.module.config[k] = v;
|
|
|
+ document.getElementById("newConfigKey").value =
|
|
|
+ "Configuration";
|
|
|
+ document.getElementById("newConfigValue").value =
|
|
|
+ "Value";
|
|
|
},
|
|
|
|
|
|
/**
|
|
@@ -614,7 +624,7 @@ const app = Vue.createApp({
|
|
|
}
|
|
|
},
|
|
|
/**
|
|
|
- * Creates a new module, set's a default name, and adds it to the editor
|
|
|
+ * Creates a new module, sets a default name, and adds it to the editor
|
|
|
*/
|
|
|
newCustomModule() {
|
|
|
const module = this.newModule();
|