From 988a00e2665822d71a2932715c0e8e986aa91798 Mon Sep 17 00:00:00 2001 From: charlie Date: Wed, 15 Mar 2023 11:59:51 +0800 Subject: [PATCH] fix(ui): incorrect position of absolute modal on some mobile platforms --- src/main/frontend/components/editor.cljs | 8 +++----- src/main/frontend/components/editor.css | 6 ++++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index deafb296c..8c80fe97a 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -392,11 +392,9 @@ :z-index 11} (when set-default-width? {:width max-width}) - (when-let [^js/HTMLElement editor - (js/document.querySelector ".editor-wrapper")] - (if (<= (.-clientWidth editor) (+ left (if set-default-width? max-width 500))) - {:right 0} - {:left (if (or (nil? y-diff) (and y-diff (= y-diff 0))) left 0)})))] + (if (<= vw-max-width (+ left (if set-default-width? max-width 500))) + {:right 0} + {:left (if (or (nil? y-diff) (and y-diff (= y-diff 0))) left 0)}))] [:div.absolute.rounded-md.shadow-lg.absolute-modal {:ref *el :data-modal-name modal-name diff --git a/src/main/frontend/components/editor.css b/src/main/frontend/components/editor.css index 1223c6ca1..e6083c819 100644 --- a/src/main/frontend/components/editor.css +++ b/src/main/frontend/components/editor.css @@ -42,8 +42,10 @@ } &[data-modal-name="commands"] { - width: 380px !important; - max-width: 90vw !important; + @screen sm { + width: 380px !important; + max-width: 90vw !important; + } } }