cmdk initial implementation

This commit is contained in:
Ben Yorke
2023-08-02 23:07:05 +03:00
parent 6f984d45ef
commit 8bff0f2139
14 changed files with 777 additions and 119 deletions

View File

@@ -193,8 +193,16 @@
(state/set-edit-content! edit-id new-value)
(cursor/move-cursor-to input (+ cur-pos forward-pos))))))
(-> (random-uuid) str)
(defn open-block-in-sidebar!
[block-id]
; (assert (uuid? block-id) "frontend.handler.editor/open-block-in-sidebar! expects block-id to be of type uuid")
(js/console.log "db-entity/block" block-id)
(js/console.log "db-entity/entity" (db/entity [:block/uuid block-id]))
; (js/console.log "db-entity/types" (str block-id) (uuid block-id))
; (js/console.log "db-entity/string" (db/entity [:block/uuid (str block-id)]))
; (js/console.log "db-entity/uuid" (db/entity [:block/uuid (uuid block-id)]))
(when block-id
(when-let [block (db/entity [:block/uuid block-id])]
(let [page? (nil? (:block/page block))]
@@ -831,9 +839,9 @@
concat-prev-block? (boolean (and prev-block new-content))
transact-opts (cond->
{:outliner-op :delete-blocks}
concat-prev-block?
(assoc :concat-data
{:last-edit-block (:block/uuid block)}))]
concat-prev-block?
(assoc :concat-data
{:last-edit-block (:block/uuid block)}))]
(outliner-tx/transact! transact-opts
(if concat-prev-block?
(let [prev-block' (if (seq (:block/_refs block-e))
@@ -1267,7 +1275,7 @@
(defn save-block!
([repo block-or-uuid content]
(save-block! repo block-or-uuid content {}))
(save-block! repo block-or-uuid content {}))
([repo block-or-uuid content {:keys [properties] :as opts}]
(let [block (if (or (uuid? block-or-uuid)
(string? block-or-uuid))