Removed duplicate function

This commit is contained in:
2023-11-30 07:28:46 +01:00
parent 776dc69d87
commit f97b9ac62e
2 changed files with 4 additions and 15 deletions

View File

@@ -19,11 +19,6 @@ function sendValue() {
emit('update', data.value)
}
function sendNewValue(newValue : string) {
data.value = newValue
emit('update', data.value)
}
function updateData(newData: string) {
data.value = newData
inputFile.value.value = ''
@@ -46,7 +41,7 @@ function readFile(file : any) {
reader.onloadend = () => {
var result = reader.result?.toString()
if (typeof result == "string")
sendNewValue(result)
updateData(result)
}
reader.readAsText(file.target.files[0])
@@ -68,6 +63,6 @@ function readFile(file : any) {
<button class="tool-button" @click="clear">Clear</button>
</div>
</div>
<CodeEditor @update:updated-code="sendNewValue" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor>
<CodeEditor @update:updated-code="updateData" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor>
</div>
</template>

View File

@@ -33,12 +33,6 @@ function sendValue() {
emit('update', tabs.value);
}
function sendNewValue(newValue : string) {
data.value = newValue;
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;
@@ -62,7 +56,7 @@ function readFile(file : any) {
reader.onloadend = () => {
var result = reader.result!.toString();
console.log(result);
sendNewValue(result);
updateData(result);
}
reader.readAsText(file.target.files[0]);
@@ -144,6 +138,6 @@ function findIndexWithID(id : number) : number {
<button class="tool-button" @click="clear">Clear</button>
</div>
</div>
<CodeEditor @update:updated-code="sendNewValue" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor>
<CodeEditor @update:updated-code="updateData" v-model="data" :code="data" :config="{disabled:false, language:stylizedName}"></CodeEditor>
</div>
</template>