Skip to content

Commit

Permalink
fix: modal position, getting editor width from editor-wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
yshwaker committed May 12, 2022
1 parent 8af6a3d commit 5881563
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/frontend/components/editor.cljs
Expand Up @@ -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]))
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 5881563

Please sign in to comment.