mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
added attachment counter, cleanup
This commit is contained in:
parent
1f38267626
commit
09a0bf0c0d
|
@ -73,7 +73,9 @@ function handleFileSelection(event) {
|
||||||
};
|
};
|
||||||
reader.readAsBinaryString(file); // Read the file content as binary string
|
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
|
// Check if a callsign is selected, default to the first one if not
|
||||||
if (typeof(chat.selectedCallsign) === 'undefined') {
|
if (typeof(chat.selectedCallsign) === 'undefined') {
|
||||||
chat.selectedCallsign = Object.keys(chat.callsign_list)[0];
|
chat.selectedCallsign = Object.keys(chat.callsign_list)[0];
|
||||||
|
@ -113,33 +115,17 @@ function handleFileSelection(event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetFile(event){
|
function resetFile(event){
|
||||||
chat.inputFileName = '-'
|
if (fileInput.value) {
|
||||||
chat.inputFileSize = '-'
|
fileInput.value = ''; // Attempt to clear by setting value to empty (may not work due to security restrictions in browsers)
|
||||||
chat.inputFileType = '-'
|
}
|
||||||
|
|
||||||
|
// 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]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,10 +229,10 @@ const speedChartData = computed(() => ({
|
||||||
|
|
||||||
<button type="button" class="btn btn-outline-secondary border-0 rounded-pill me-1" data-bs-toggle="modal" data-bs-target="#fileSelectionModal">
|
<button type="button" class="btn btn-outline-secondary border-0 rounded-pill me-1" data-bs-toggle="modal" data-bs-target="#fileSelectionModal">
|
||||||
<i class="bi bi-paperclip" style="font-size: 1.2rem"></i>
|
<i class="bi bi-paperclip" style="font-size: 1.2rem"></i>
|
||||||
|
<!-- Badge showing the number of attached files -->
|
||||||
|
<span class="badge bg-warning">{{ selectedFiles.length }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
class="form-control border rounded-pill"
|
class="form-control border rounded-pill"
|
||||||
rows="1"
|
rows="1"
|
||||||
|
@ -303,11 +289,6 @@ const speedChartData = computed(() => ({
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<div class="input-group-text mb-3">
|
|
||||||
<input class="" type="file" ref="doc" @change="readFile" />
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<div class="container w-100 mb-3">
|
<div class="container w-100 mb-3">
|
||||||
<!-- Button that user will click to open file dialog -->
|
<!-- Button that user will click to open file dialog -->
|
||||||
|
@ -352,8 +333,9 @@ const speedChartData = computed(() => ({
|
||||||
<button type="button" class="btn btn-secondary disabled">{{chat.inputFileSize}} {{totalSizeFormatted}}</button>
|
<button type="button" class="btn btn-secondary disabled">{{chat.inputFileSize}} {{totalSizeFormatted}}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--
|
||||||
<Line :data="speedChartData" />
|
<Line :data="speedChartData" />
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @click="resetFile">Reset</button>
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" @click="resetFile">Reset</button>
|
||||||
|
|
Loading…
Reference in a new issue