From 57644c4378293c9e67092606d121be521936c1f2 Mon Sep 17 00:00:00 2001 From: Eragon Date: Tue, 6 Jun 2023 20:57:05 +0200 Subject: [PATCH] editor: fix modal not closing when openning an other one --- app/static/css/editor.css | 10 ++++++++-- app/static/less/editor.less | 11 +++++++++-- app/static/scripts/editor.js | 7 ++++--- app/templates/widgets/editor.html | 5 +++-- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/static/css/editor.css b/app/static/css/editor.css index aa9e410..efb5ab9 100644 --- a/app/static/css/editor.css +++ b/app/static/css/editor.css @@ -51,14 +51,14 @@ position: absolute; left: 0px; width: auto; - min-width: 30vw; + min-width: min-content; text-align: left; right: inherit; background: var(--background-hover); border: var(--border); color: var(--text); padding: .2rem; - top: 3.2rem; + top: 2.3rem; z-index: 100; list-style-position: initial; list-style-type: none; @@ -67,10 +67,16 @@ margin: 0.8rem; margin-top: 0.4rem; margin-bottom: 1rem; + min-width: 30vw; } .editor .modal > div label { margin-top: 0.4rem; } +.editor .modal a.editor-emoji-close-btn { + display: inline-block; + margin: 0.3rem; + margin-top: 0.5rem; +} @media screen and (max-width:849px) { .editor .modal { width: 80vw; diff --git a/app/static/less/editor.less b/app/static/less/editor.less index 46d0a3b..3f3a5c4 100644 --- a/app/static/less/editor.less +++ b/app/static/less/editor.less @@ -63,7 +63,7 @@ position: absolute; left: 0px; width: auto; - min-width: 30vw; + min-width: min-content; text-align: left; right: inherit; @@ -79,7 +79,7 @@ border: var(--border); color: var(--text); padding: .2rem; - top: 3.2rem; + top: 2.3rem; z-index: 100; list-style-position: initial; list-style-type: none; @@ -88,11 +88,18 @@ margin: 0.8rem; margin-top: 0.4rem; margin-bottom: 1rem; + min-width: 30vw; label { margin-top: 0.4rem; } } + + a.editor-emoji-close-btn { + display: inline-block; + margin: 0.3rem; + margin-top: 0.5rem; + } } } diff --git a/app/static/scripts/editor.js b/app/static/scripts/editor.js index 930b223..436543c 100644 --- a/app/static/scripts/editor.js +++ b/app/static/scripts/editor.js @@ -114,7 +114,7 @@ function editor_clear_modals(event, close = true) document.getElementById('media-alt-input').value = ''; document.getElementById('media-link-input').value = ''; document.getElementById('link-desc-input').value = ''; - document.getElementById('link-desc-input').value = ''; + document.getElementById('link-link-input').value = ''; const media_type = document.getElementsByName("media-type"); for(i = 0; i < media_type.length; i++) { media_type[i].checked = false; @@ -162,7 +162,7 @@ function editor_display_link_modal(event) { event.currentTarget.querySelector("#link-desc-input").value = selection; } - event.currentTarget.children[1].style = {'display': 'block'}; + editor_display_child_modal(event); } function editor_insert_link(event, link_id, text_id, media = false) @@ -284,7 +284,8 @@ function editor_separator(event) { editor_insert_around(event, "", "\n---\n"); } -function editor_display_emoji_modal(event) { +function editor_display_child_modal(event) { + editor_clear_modals(event); event.currentTarget.children[1].style = {'display': 'block'}; } diff --git a/app/templates/widgets/editor.html b/app/templates/widgets/editor.html index 2d30dc7..3f51e33 100644 --- a/app/templates/widgets/editor.html +++ b/app/templates/widgets/editor.html @@ -92,13 +92,14 @@ - @@ -120,7 +121,7 @@ -