|
|
@@ -20,6 +20,8 @@
|
|
|
[frontend.modules.outliner.tree :as outliner-tree]
|
|
|
[frontend.commands :as commands]
|
|
|
[frontend.date :as date]
|
|
|
+ [frontend.db-schema :as db-schema]
|
|
|
+ [frontend.db.model :as model]
|
|
|
[clojure.walk :as walk]
|
|
|
[frontend.git :as git]
|
|
|
[frontend.fs :as fs]
|
|
|
@@ -205,7 +207,16 @@
|
|
|
(p/catch (fn [err]
|
|
|
(js/console.error "error: " err))))))
|
|
|
|
|
|
- (db/transact! [[:db.fn/retractEntity [:block/name page-name]]])
|
|
|
+
|
|
|
+ ;; if other page alias this pagename,
|
|
|
+ ;; then just remove some attrs of this entity instead of retractEntity
|
|
|
+ (if (model/get-alias-source-page (state/get-current-repo) page-name)
|
|
|
+ (when-let [id (:db/id (db/entity [:block/name page-name]))]
|
|
|
+ (let [txs (mapv (fn [attribute]
|
|
|
+ [:db/retract id attribute])
|
|
|
+ db-schema/retract-page-attributes)]
|
|
|
+ (db/transact! txs)))
|
|
|
+ (db/transact! [[:db.fn/retractEntity [:block/name page-name]]]))
|
|
|
|
|
|
(ok-handler))))))
|
|
|
|