Просмотр исходного кода

enhance: make it easier to drag files to the editor

Tienson Qin 4 лет назад
Родитель
Сommit
468adf6fca
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      src/main/frontend/handler/editor/lifecycle.cljs

+ 4 - 3
src/main/frontend/handler/editor/lifecycle.cljs

@@ -16,14 +16,15 @@
   [state]
   (let [[{:keys [format block-parent-id]} id] (:rum/args state)
         content (get-in @state/state [:editor/content id])
-        input (gdom/getElement id)]
+        input (gdom/getElement id)
+        element (gdom/getElement "main-content")]
     (when block-parent-id
       (state/set-editing-block-dom-id! block-parent-id))
     (editor-handler/restore-cursor-pos! id content)
 
-    (when input
+    (when (and input element)
       (dnd/subscribe!
-       input
+       element
        :upload-images
        {:drop (fn [e files]
                 (editor-handler/upload-asset id files format editor-handler/*asset-uploading? true))}))