From 09a0bf0c0d58dadcfba890031cd0666ed4225601 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Tue, 6 Feb 2024 20:20:52 +0100 Subject: [PATCH] added attachment counter, cleanup --- gui/src/components/chat_new_message.vue | 46 ++++++++----------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/gui/src/components/chat_new_message.vue b/gui/src/components/chat_new_message.vue index def6ce1d..ea61e3d5 100644 --- a/gui/src/components/chat_new_message.vue +++ b/gui/src/components/chat_new_message.vue @@ -73,7 +73,9 @@ function handleFileSelection(event) { }; reader.readAsBinaryString(file); // Read the file content as binary string } -}function transmitNewMessage() { +} + +function transmitNewMessage() { // Check if a callsign is selected, default to the first one if not if (typeof(chat.selectedCallsign) === 'undefined') { chat.selectedCallsign = Object.keys(chat.callsign_list)[0]; @@ -113,33 +115,17 @@ function handleFileSelection(event) { } function resetFile(event){ - chat.inputFileName = '-' - chat.inputFileSize = '-' - chat.inputFileType = '-' + if (fileInput.value) { + fileInput.value = ''; // Attempt to clear by setting value to empty (may not work due to security restrictions in browsers) + } + + // Clear the selected files array to reset the state of attachments + selectedFiles.value = []; } -function readFile(event) { - const reader = new FileReader(); - reader.onload = () => { - console.log(reader.result); - chat.inputFileName = event.target.files[0].name - chat.inputFileSize = event.target.files[0].size - chat.inputFileType = event.target.files[0].type - - chat.inputFile = reader.result - calculateTimeNeeded() - -// String.fromCharCode.apply(null, Array.from(chatFile)) - - - }; - - reader.readAsArrayBuffer(event.target.files[0]); - -} @@ -241,12 +227,12 @@ const speedChartData = computed(() => ({ - - -