Added new endpoint handling

This commit is contained in:
2023-11-29 14:48:07 +01:00
parent ca9b07fabc
commit fd5996c572
4 changed files with 79 additions and 19 deletions

View File

@@ -2,12 +2,12 @@
import TabComponent from './TabComponent.vue'
import InsertTemplateComponent from '@components/common/InsertTemplateComponent.vue'
import XMLButtonFormatterComponent from '@components/formatter/XMLButtonFormatterComponent.vue'
import { type TabData } from '../common/TabData'
import { ref } from 'vue'
import CodeEditor from '../CodeEditorComponent.vue'
const newTabId = ref(0);
const activeTabId = ref(0);
const prevActiveTabId = ref(-1);
const tabs = ref(new Array<TabData>);
tabs.value.push({
@@ -22,28 +22,26 @@ const inputFile = ref()
const props = defineProps(
{
stylizedName: {type: String, required: true},
data: {type: String},
data: {type: Array<TabData>},
}
)
const emit = defineEmits(['update'])
interface TabData {
id: number;
name: string;
data: string;
}
function sendValue() {
emit('update', data.value);
emit('update', tabs.value);
}
function sendNewValue(newValue : string) {
data.value = newValue;
emit('update', data.value);
tabs.value.at(findIndexWithID(activeTabId.value))!.data = newValue;
emit('update', tabs.value);
}
function updateData(newData: string) {
data.value = newData;
tabs.value.at(findIndexWithID(activeTabId.value))!.data = newData;
inputFile.value.value = '';
sendValue();
}
@@ -81,7 +79,6 @@ function changeActiveTab(id : number) {
let newIndex = findIndexWithID(id);
tabs.value.at(index)!.data = data.value;
prevActiveTabId.value = activeTabId.value;
activeTabId.value = id;
data.value = tabs.value.at(newIndex)!.data;