diff --git a/src/main/frontend/db/model.cljs b/src/main/frontend/db/model.cljs index ed5e044ded..390a86995a 100644 --- a/src/main/frontend/db/model.cljs +++ b/src/main/frontend/db/model.cljs @@ -269,8 +269,8 @@ (:file/content (d/entity (d/db conn) [:file/path path])))))) (defn get-block-by-uuid - [uuid] - (db-utils/entity [:block/uuid uuid])) + [id] + (db-utils/entity [:block/uuid (if (uuid? id) id (uuid id))])) (defn get-page-format [page-name] diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 3bf3e027d0..26c12d76da 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1419,10 +1419,14 @@ opts)))) (defn save-block! - [{:keys [format block id repo dummy?] :as state} value] - (when (or (:db/id (db/entity repo [:block/uuid (:block/uuid block)])) - dummy?) - (save-block-aux! block value format {}))) + ([repo uuid content] + (let [block (db-model/get-block-by-uuid uuid) + format (:block/format block)] + (save-block! {:block block :repo repo :format format} content))) + ([{:keys [format block repo dummy?] :as state} value] + (when (or (:db/id (db/entity repo [:block/uuid (:block/uuid block)])) + dummy?) + (save-block-aux! block value format {})))) (defn save-current-block-when-idle! ([]