|
@@ -1079,17 +1079,17 @@
|
|
(defn ^:export append_block_in_page
|
|
(defn ^:export append_block_in_page
|
|
[uuid-or-page-name content ^js opts]
|
|
[uuid-or-page-name content ^js opts]
|
|
(let [current-page? (or (and (nil? content) (nil? opts))
|
|
(let [current-page? (or (and (nil? content) (nil? opts))
|
|
- (and (nil? opts) (some->> content (instance? js/Object))))
|
|
|
|
|
|
+ (and (nil? opts) (some->> content (instance? js/Object))))
|
|
opts (if current-page? content opts)
|
|
opts (if current-page? content opts)
|
|
content (if current-page? uuid-or-page-name content)
|
|
content (if current-page? uuid-or-page-name content)
|
|
uuid-or-page-name (if current-page? (state/get-current-page)
|
|
uuid-or-page-name (if current-page? (state/get-current-page)
|
|
- uuid-or-page-name)]
|
|
|
|
|
|
+ uuid-or-page-name)]
|
|
(p/let [_ (<ensure-page-loaded uuid-or-page-name)
|
|
(p/let [_ (<ensure-page-loaded uuid-or-page-name)
|
|
page? (not (util/uuid-string? uuid-or-page-name))
|
|
page? (not (util/uuid-string? uuid-or-page-name))
|
|
page-not-exist? (and page? (nil? (db-model/get-page uuid-or-page-name)))
|
|
page-not-exist? (and page? (nil? (db-model/get-page uuid-or-page-name)))
|
|
_ (and page-not-exist? (page-handler/<create! uuid-or-page-name
|
|
_ (and page-not-exist? (page-handler/<create! uuid-or-page-name
|
|
- {:redirect? false
|
|
|
|
- :format (state/get-preferred-format)}))]
|
|
|
|
|
|
+ {:redirect? false
|
|
|
|
+ :format (state/get-preferred-format)}))]
|
|
(when-let [block (db-model/get-page uuid-or-page-name)]
|
|
(when-let [block (db-model/get-page uuid-or-page-name)]
|
|
(let [target (str (:block/uuid block))]
|
|
(let [target (str (:block/uuid block))]
|
|
(insert_block target content opts))))))
|
|
(insert_block target content opts))))))
|