浏览代码

fix: reset width on resize

Konstantinos Kaloutas 3 年之前
父节点
当前提交
35763e75ce
共有 1 个文件被更改,包括 2 次插入4 次删除
  1. 2 4
      src/main/frontend/extensions/excalidraw.cljs

+ 2 - 4
src/main/frontend/extensions/excalidraw.cljs

@@ -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
@@ -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)