Resetování tagů při přidávání další korektury (potenciálně vypnutelné)

This commit is contained in:
Jonas Havelka 2025-02-26 14:40:47 +01:00
parent b72f3f3395
commit c004e4f6d2

View file

@ -30,6 +30,8 @@
close_button.addEventListener("click", _ => { this.close(); }); close_button.addEventListener("click", _ => { this.close(); });
this.submit_button.addEventListener("click", _ => { this.submit(); }); this.submit_button.addEventListener("click", _ => { this.submit(); });
for (const tag of this.tagy.getElementsByTagName("button")) tag.addEventListener("click", event => { this.toggle_tag(event); }); for (const tag of this.tagy.getElementsByTagName("button")) tag.addEventListener("click", event => { this.toggle_tag(event); });
this.reset_tags_every_open = true;
} }
toggle_tag(event) { toggle_tag(event) {
@ -37,6 +39,8 @@
button.dataset.selected = String(button.dataset.selected === "false"); button.dataset.selected = String(button.dataset.selected === "false");
} }
reset_tags() { for (const tag of this.tagy.getElementsByTagName("button")) tag.dataset.selected = "false"; }
// schová commform // schová commform
close() { this.div.style.display = 'none'; } close() { this.div.style.display = 'none'; }
@ -68,6 +72,7 @@
// show form // show form
if (oprava_id === -1 && komentar_id === -1) this.tagy.style.display = 'unset'; else this.tagy.style.display = 'none'; if (oprava_id === -1 && komentar_id === -1) this.tagy.style.display = 'unset'; else this.tagy.style.display = 'none';
if (this.reset_tags_every_open) this.reset_tags();
this._show(img_id, x, y); this._show(img_id, x, y);
} }