瀏覽代碼

fix: modal position, getting editor width from editor-wrapper

yshwaker 3 年之前
父節點
當前提交
22d41664a4
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      src/main/frontend/components/editor.cljs

+ 3 - 4
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"