From 60ccc9686a39ff67d3cf361c4e6848d79877b18b Mon Sep 17 00:00:00 2001 From: r Date: Sat, 9 Sep 2023 08:12:56 +0000 Subject: fluoride: Allow submitting the form with Ctrl+Enter --- static/fluoride.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'static') diff --git a/static/fluoride.js b/static/fluoride.js index e6a63ef..abeed21 100644 --- a/static/fluoride.js +++ b/static/fluoride.js @@ -285,6 +285,12 @@ function onPaste(e) { fp.files = dt.files; } +function onKeydown(e) { + if (e.key == 'Enter' && e.ctrlKey) { + document.querySelector(".post-form").submit(); + } +} + document.addEventListener("DOMContentLoaded", function() { checkCSRFToken(); checkAntiDopamineMode(); @@ -325,8 +331,10 @@ document.addEventListener("DOMContentLoaded", function() { } var pf = document.querySelector(".post-form") - if (pf) + if (pf) { pf.addEventListener("paste", onPaste); + pf.addEventListener("keydown", onKeydown); + } }); // @license-end -- cgit v1.2.3