mirror of https://github.com/logseq/logseq
fix: redirect to the new page when page property title changed
parent
c87258c4e9
commit
55074dec1c
|
@ -348,7 +348,15 @@
|
|||
(when refresh?
|
||||
(let [opts {:key :block/change
|
||||
:data [block]}]
|
||||
(db/refresh! repo opts)))))
|
||||
(db/refresh! repo opts)))
|
||||
|
||||
;; page title changed
|
||||
(when-let [title (get-in block [:block/properties :title])]
|
||||
(when-let [old-title (:block/name (db/entity (:db/id (:block/page block))))]
|
||||
(when (and (:block/pre-block? block)
|
||||
(not (string/blank? title))
|
||||
(not= (string/lower-case title) old-title))
|
||||
(state/pub-event! [:page/title-property-changed old-title title]))))))
|
||||
|
||||
(repo-handler/push-if-auto-enabled! repo)))
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
[frontend.handler.notification :as notification]
|
||||
[frontend.handler.common :as common-handler]
|
||||
[frontend.handler.editor :as editor-handler]
|
||||
[frontend.handler.page :as page-handler]
|
||||
[frontend.components.encryption :as encryption]
|
||||
[frontend.fs.nfs :as nfs]
|
||||
[frontend.db.conn :as conn]
|
||||
|
@ -133,6 +134,9 @@
|
|||
(defmethod handle :modal/show-cards [_]
|
||||
(state/set-modal! srs/global-cards))
|
||||
|
||||
(defmethod handle :page/title-property-changed [[_ old-title new-title]]
|
||||
(page-handler/rename! old-title new-title))
|
||||
|
||||
(defmethod handle :after-db-restore [[_ repos]]
|
||||
(mapv (fn [{url :url} repo]
|
||||
;; compare :ast/version
|
||||
|
|
Loading…
Reference in New Issue