|
@@ -1561,6 +1561,13 @@
|
|
|
:edit-block? false
|
|
|
:properties properties}
|
|
|
edit-block (state/get-edit-block)
|
|
|
+ _ (when (util/electron?)
|
|
|
+ (if-let [from (not-empty (.-path file))]
|
|
|
+ (-> (js/window.apis.copyFileToAssets dir file-rpath from)
|
|
|
+ (p/catch #(js/console.error "Debug: Copy Asset Error#" %)))
|
|
|
+ (-> (p/let [buffer (.arrayBuffer file)]
|
|
|
+ (fs/write-file! repo dir file-rpath buffer {:skip-compare? false}))
|
|
|
+ (p/catch #(js/console.error "Debug: Writing Asset #" %)))))
|
|
|
insert-opts' (if (and (:block/uuid edit-block)
|
|
|
(string/blank? (:block/title edit-block)))
|
|
|
(assoc insert-opts
|
|
@@ -1571,14 +1578,7 @@
|
|
|
result (api-insert-new-block! file-name-without-ext insert-opts')
|
|
|
new-entity (db/entity [:block/uuid (:block/uuid result)])]
|
|
|
(if (util/electron?)
|
|
|
- (if-let [from (not-empty (.-path file))]
|
|
|
- (-> (js/window.apis.copyFileToAssets dir file-rpath from)
|
|
|
- (p/then (fn [_dest] new-entity))
|
|
|
- (p/catch #(js/console.error "Debug: Copy Asset Error#" %)))
|
|
|
- (-> (p/let [buffer (.arrayBuffer file)]
|
|
|
- (fs/write-file! repo dir file-rpath buffer {:skip-compare? false}))
|
|
|
- (p/then (fn [_] new-entity))
|
|
|
- (p/catch #(js/console.error "Debug: Writing Asset #" %))))
|
|
|
+ new-entity
|
|
|
(->
|
|
|
(p/do! (js/console.debug "Debug: Writing Asset #" dir file-rpath)
|
|
|
(cond
|