From 8fbec9ed87d402c2eb4caa2545733addaaf98cb7 Mon Sep 17 00:00:00 2001 From: Eragon Date: Tue, 16 May 2023 22:23:08 +0200 Subject: [PATCH] editor: Fix input being cleared on click in link modal --- app/static/scripts/editor.js | 9 ++------- app/templates/widgets/editor.html | 5 ----- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/app/static/scripts/editor.js b/app/static/scripts/editor.js index b0bd2e6..13d9aa0 100644 --- a/app/static/scripts/editor.js +++ b/app/static/scripts/editor.js @@ -161,11 +161,6 @@ function editor_display_link_modal(event) { else if (selection != "") { event.currentTarget.querySelector("#link-desc-input").value = selection; } - // Or nothing selected - else { - event.currentTarget.querySelector("#link-desc-input").value = ""; - event.currentTarget.querySelector("#link-link-input").value = ""; - } event.currentTarget.children[1].style = {'display': 'block'}; } @@ -354,8 +349,8 @@ if (document.cookie.split(";").some((item) => item.trim().startsWith("auto-previ } -previewTimeout = null; -ta = document.querySelector(".editor textarea"); +let previewTimeout = null; +let ta = document.querySelector(".editor textarea"); ta.addEventListener('keydown', function(e) { // Tab insert some spaces let keyCode = e.keyCode || e.which; diff --git a/app/templates/widgets/editor.html b/app/templates/widgets/editor.html index d04e085..bb75b2e 100644 --- a/app/templates/widgets/editor.html +++ b/app/templates/widgets/editor.html @@ -182,10 +182,5 @@ {% for error in field.errors %} {{ error }} {% endfor %} - - - {% endmacro %}