Added new endpoint handling
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user