From 4c3b2dd4d2d4b9d4d9219cb193c7057f31b22675 Mon Sep 17 00:00:00 2001 From: Aevann Date: Sun, 6 Aug 2023 06:26:16 +0300 Subject: [PATCH] improve post title flow --- files/assets/js/edit_post.js | 4 ++++ files/assets/js/submit.js | 4 ++++ files/templates/submit.html | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/files/assets/js/edit_post.js b/files/assets/js/edit_post.js index 58bcea941..941a2d9b5 100644 --- a/files/assets/js/edit_post.js +++ b/files/assets/js/edit_post.js @@ -15,3 +15,7 @@ function togglePostEdit(id){ close_inline_speed_emoji_modal(); }; + +document.getElementById('post-edit-title').addEventListener('keydown', (e) => { + if(e.key === "Enter") e.preventDefault(); +}) diff --git a/files/assets/js/submit.js b/files/assets/js/submit.js index f113a4abb..e678ac5f1 100644 --- a/files/assets/js/submit.js +++ b/files/assets/js/submit.js @@ -155,6 +155,10 @@ document.addEventListener('keydown', (e) => { submitButton.click(); }); +document.getElementById('post-title').addEventListener('keydown', (e) => { + if(e.key === "Enter") e.preventDefault(); +}) + checkRepost(); function submit(form) { diff --git a/files/templates/submit.html b/files/templates/submit.html index b5e9f2c61..9c3b52b1a 100644 --- a/files/templates/submit.html +++ b/files/templates/submit.html @@ -30,7 +30,7 @@ - +