|
@@ -106,20 +106,11 @@
|
|
|
(let [page (string/trim (if (string? chosen) chosen (:value chosen)))
|
|
|
id (:block/uuid (db/entity [:block/name (util/page-name-sanity-lc page)]))
|
|
|
class? (= (:block/name property) "tags")]
|
|
|
- (cond
|
|
|
- (nil? id)
|
|
|
+ (when (nil? id)
|
|
|
(page-handler/create! page {:redirect? false
|
|
|
:create-first-block? false
|
|
|
:tags classes
|
|
|
- :class? class?})
|
|
|
- ;; user typed a new option to get here so update the existing page
|
|
|
- ;; to make their option valid
|
|
|
- (seq classes)
|
|
|
- (db/transact! repo
|
|
|
- [{:block/uuid id
|
|
|
- :block/tags (map (fn [class]
|
|
|
- {:db/id (:db/id (db/entity repo [:block/uuid class]))}) classes)}]
|
|
|
- {:outliner-op :save-block}))
|
|
|
+ :class? class?}))
|
|
|
(let [id' (or id (:block/uuid (db/entity [:block/name (util/page-name-sanity-lc page)])))]
|
|
|
(add-property! block (:block/original-name property) id'))
|
|
|
(when-let [f (:on-chosen opts)] (f))))
|