fix most issues on whiteboards

This commit is contained in:
Tienson Qin
2024-04-03 15:11:57 +08:00
parent 4a63f78aa8
commit 1f32893547
19 changed files with 158 additions and 187 deletions

View File

@@ -7,17 +7,15 @@
(defn get-current-page-name
"Fetch the current page's original name with same approach as get-current-page-id"
[]
(or (state/get-current-page)
(state/get-current-whiteboard)
(or (:block/original-name (db/get-page (state/get-current-page)))
(get-in (first (state/get-editor-args)) [:block :block/page :block/original-name])))
(defn get-current-page-id
"Fetches the current page id. Looks up page based on latest route and if
nothing is found, gets page of last edited block"
[]
(let [page-name (or (state/get-current-page) (state/get-current-whiteboard))]
(or (and page-name (db/get-page page-name))
(get-in (first (state/get-editor-args)) [:block :block/page :db/id]))))
(let [page-name (state/get-current-page)]
(:db/id (db/get-page page-name))))
(defn get-editing-page-id
"Fetch the editing page id. If there is an edit-input-id set, we are probably still