mirror of
https://gitlab.rlp.net/proj-wise2526-video2document/video2document.git
synced 2026-06-15 18:01:52 +02:00
Removed the "confirm alert" in the delete costume document function. It made the textarea unklickable
This commit is contained in:
+20
-31
@@ -133,22 +133,7 @@ Listeners for Step 3
|
||||
|
||||
*/
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
var menu = document.getElementById('customDocumentTypes');
|
||||
var l = document.getElementById('customDocumentTypes').options.length - 1;
|
||||
for (i = l; i >= 0; i--) {
|
||||
menu.remove(i);
|
||||
}
|
||||
files.forEach(file => {
|
||||
const option = document.createElement('option');
|
||||
option.value = file;
|
||||
option.textContent = file
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
menu.appendChild(option);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//Checkboxlistener so that only one can be selected at a time
|
||||
docFormat.addEventListener("change", (e) => {
|
||||
@@ -331,6 +316,7 @@ generateBtn.addEventListener("click", () => {
|
||||
|
||||
// dokumente löschen
|
||||
deleteBtn.addEventListener("click", () => {
|
||||
try {
|
||||
const name = docName.value.trim();
|
||||
|
||||
if (!name) {
|
||||
@@ -340,51 +326,54 @@ deleteBtn.addEventListener("click", () => {
|
||||
}, 3000);
|
||||
return;
|
||||
}
|
||||
|
||||
const confirmDelete = confirm(
|
||||
`Möchtest du das Dokument "${name}" wirklich löschen?`
|
||||
);
|
||||
|
||||
if (!confirmDelete) return;
|
||||
|
||||
var success = true;
|
||||
window.api.deleteTxtFile(name).then((success) => {
|
||||
if (success) {
|
||||
result.textContent = "Dokument erfolgreich gelöscht!";
|
||||
reloadDocuments();
|
||||
existingDocs.value = "newDoc";
|
||||
existingDocs.dispatchEvent(new Event("change"));
|
||||
} else {
|
||||
result.textContent = "Dokument konnte nicht gelöscht werden.";
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
result.textContent = "";
|
||||
}, 3000);
|
||||
});
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//function to load existingDoc options to the drop down list
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
try {
|
||||
reloadDocuments();
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
|
||||
//content anzeigen
|
||||
existingDocs.addEventListener("change", async () => {
|
||||
try {
|
||||
const existingDocsed = existingDocs.value;
|
||||
const exampleText = "";
|
||||
if (existingDocsed === "newDoc") {
|
||||
docNameWrapper.classList.remove("hidden");
|
||||
docName.value = "";
|
||||
prompt.value = exampleText;
|
||||
document.getElementById("prompt").value = exampleText;
|
||||
document.getElementById("prompt").textContent = exampleText;
|
||||
return;
|
||||
}
|
||||
docNameWrapper.classList.add("hidden");
|
||||
document.getElementById("prompt").textContent = "";
|
||||
document.getElementById("prompt").value = "";
|
||||
|
||||
const content = await window.api.readTxtFile(existingDocsed);
|
||||
prompt.value = content;
|
||||
document.getElementById("prompt").value = content;
|
||||
document.getElementById("prompt").textContent = content;
|
||||
docName.value = existingDocsed.replace(".txt", "");
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
+13
-10
@@ -482,10 +482,6 @@ function fileDownload() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Functions for the custom document section
|
||||
@@ -494,6 +490,7 @@ Functions for the custom document section
|
||||
|
||||
//reload drop down
|
||||
function reloadDocuments() {
|
||||
try{
|
||||
[...existingDocs.querySelectorAll('option:not([value="newDoc"])')]
|
||||
.forEach(o => o.remove());
|
||||
[...customDocumentTypes.querySelectorAll('option:not([value="newDoc"])')]
|
||||
@@ -501,23 +498,29 @@ function reloadDocuments() {
|
||||
|
||||
window.api.getTxtFiles().then(files => {
|
||||
files.forEach(file => {
|
||||
const option = document.createElement('option');
|
||||
var option = document.createElement('option');
|
||||
option.value = file;
|
||||
option.textContent = file
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
.replace(/\b\w/g, c => c.toUpperCase()); // ersten Buchstaben groß
|
||||
existingDocs.appendChild(option);
|
||||
const option2 = document.createElement('option');
|
||||
option.value = file;
|
||||
option.textContent = file
|
||||
var option2 = document.createElement('option');
|
||||
option2.value = file;
|
||||
option2.name = file;
|
||||
option2.textContent = file
|
||||
.replace('.txt', '') // Endung entfernen
|
||||
.replace(/_/g, ' ') // Leerzeichen ersetzen
|
||||
.replace(/\b\w/g, c => c.toUpperCase()) // ersten Buchstaben groß
|
||||
.replace(/\b\w/g, c => c.toUpperCase()); // ersten Buchstaben groß
|
||||
customDocumentTypes.appendChild(option2);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch(error){
|
||||
console.log(error)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sendSpeakerPackages() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user