enhance: wrap title rename condition with page-name-sanity

pull/3930/head
Junyi Du 2022-01-16 04:06:35 +08:00 committed by Tienson Qin
parent 3afde150ce
commit dbbf0c9dd0
2 changed files with 4 additions and 5 deletions

View File

@ -420,13 +420,13 @@
:data [block]}]
(db/refresh! repo opts)))
;; page title changed
;; sanitized page name changed
(when-let [title (get-in block [:block/properties :title])]
(when-let [old-title (:block/name (db/entity (:db/id (:block/page block))))]
(when-let [old-page-name (: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]))))))
(not= (util/page-name-sanity-lc title) old-page-name))
(state/pub-event! [:page/title-property-changed old-page-name title]))))))
(repo-handler/push-if-auto-enabled! repo)))

View File

@ -1171,7 +1171,6 @@
(subs s 0 (dec (count s)))
s))))
(defn normalize
[s]
(.normalize s "NFC"))