From 58815637d3c5a32cf8d2869c916bcd4415186808 Mon Sep 17 00:00:00 2001 From: yshwaker Date: Sat, 30 Apr 2022 16:52:57 +0800 Subject: [PATCH] fix: modal position, getting editor width from editor-wrapper --- src/main/frontend/components/editor.cljs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index 5c29fc178a0..be96d174724 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -408,9 +408,9 @@ :z-index 11} (when set-default-width? {:width max-width}) - (let [^js/HTMLElement textarea - (js/document.querySelector "textarea.ls-textarea")] - (if (<= (.-clientWidth textarea) (+ left (if set-default-width? max-width 500))) + (let [^js/HTMLElement editor + (js/document.querySelector ".editor-wrapper")] + (if (<= (.-clientWidth editor) (+ left (if set-default-width? max-width 500))) {:right 0} {:left (if (and y-diff (= y-diff 0)) left 0)})))} cp])) @@ -477,7 +477,6 @@ (let [content (if content (str content) "")] ;; as the function is binding to the editor content, optimization is welcome (str - "ls-textarea " (if (or (> (.-length content) 1000) (string/includes? content "\n")) "multiline-block"