Skip to content

Commit

Permalink
fix: reset width on resize
Browse files Browse the repository at this point in the history
  • Loading branch information
sprocketc authored and andelf committed Oct 4, 2022
1 parent b270ed4 commit 35763e7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/frontend/extensions/excalidraw.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@
(rum/local false ::grid-mode?)
(rum/local nil ::elements)
(rum/local nil ::resize-observer)
(rum/local (random-uuid) ::uuid)
{:did-mount (fn [state]
(reset! (::resize-observer state) (js/ResizeObserver. (debounce #(reset! (::uuid state) (random-uuid)) 500)))
(reset! (::resize-observer state) (js/ResizeObserver. (debounce #(reset! (::draw-width state) 0) 300)))
(.observe @(::resize-observer state) (ui/main-node))
(update-draw-content-width state))
:did-update update-draw-content-width
Expand Down Expand Up @@ -95,8 +94,7 @@
(editor-handler/edit-block! block :max block-uuid))}
"Edit Block"]]
[:div.draw-wrap
{:key @(::uuid state)
:on-mouse-down (fn [e]
{:on-mouse-down (fn [e]
(util/stop e)
(state/set-block-component-editing-mode! true))
:on-blur #(state/set-block-component-editing-mode! false)
Expand Down

0 comments on commit 35763e7

Please sign in to comment.