diff --git a/assets/typescript/Forum/Posting.ts b/assets/typescript/Forum/Posting.ts index f55b989b..ac46bb27 100644 --- a/assets/typescript/Forum/Posting.ts +++ b/assets/typescript/Forum/Posting.ts @@ -1,5 +1,7 @@ /// +let forumPostingCloseOK: boolean = false; + function forumPostingInit(): void { const postingForm: HTMLDivElement = document.querySelector('.js-forum-posting'); @@ -18,7 +20,7 @@ function forumPostingInit(): void markupButtons = document.querySelectorAll('.forum__post__action--tag'); window.addEventListener("beforeunload", (e) => { - if (postingText.value.length > 0) { + if (!forumPostingCloseOK && postingText.value.length > 0) { const message: string = 'Are you sure you want to close the tab?'; e.returnValue = message; return message; diff --git a/assets/typescript/misuzu.ts b/assets/typescript/misuzu.ts index 25b04d9a..403f538e 100644 --- a/assets/typescript/misuzu.ts +++ b/assets/typescript/misuzu.ts @@ -98,6 +98,9 @@ window.addEventListener('load', () => { ctrlSubmit[i].addEventListener('keydown', ev => { if (ev.code === 'Enter' /* i hate this fucking language so much */ && ev.ctrlKey && !ev.altKey && !ev.shiftKey && !ev.metaKey) { + // for a hackjob + forumPostingCloseOK = true; + ctrlSubmit[i].form.submit(); ev.preventDefault(); } diff --git a/templates/forum/posting.twig b/templates/forum/posting.twig index b0dafe9a..f225a8e8 100644 --- a/templates/forum/posting.twig +++ b/templates/forum/posting.twig @@ -163,7 +163,7 @@
- +