Browse Source

fix: the popup position is sometimes wrong

Peng Xiao 3 years ago
parent
commit
3a362c2ecd
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/main/frontend/components/editor.cljs

+ 2 - 1
src/main/frontend/components/editor.cljs

@@ -408,7 +408,7 @@
               (when set-default-width?
               (when set-default-width?
                 {:width max-width})
                 {:width max-width})
               (let [^js/HTMLElement textarea
               (let [^js/HTMLElement textarea
-                    (js/document.querySelector "textarea")]
+                    (js/document.querySelector "textarea.ls-textarea")]
                 (if (<= (.-clientWidth textarea) (+ left (if set-default-width? max-width 500)))
                 (if (<= (.-clientWidth textarea) (+ left (if set-default-width? max-width 500)))
                   {:right 0}
                   {:right 0}
                   {:left (if (and y-diff (= y-diff 0)) left 0)})))}
                   {:left (if (and y-diff (= y-diff 0)) left 0)})))}
@@ -476,6 +476,7 @@
   (let [content (if content (str content) "")]
   (let [content (if content (str content) "")]
     ;; as the function is binding to the editor content, optimization is welcome
     ;; as the function is binding to the editor content, optimization is welcome
     (str
     (str
+     "ls-textarea "
      (if (or (> (.-length content) 1000)
      (if (or (> (.-length content) 1000)
              (string/includes? content "\n"))
              (string/includes? content "\n"))
        "multiline-block"
        "multiline-block"