fix: Can't change the case of a page name

Resolved #1555
pull/1570/head
Tienson Qin 2021-03-30 19:42:57 +08:00
parent 687283af12
commit e14a8d4a93
4 changed files with 38 additions and 41 deletions

View File

@ -39,8 +39,7 @@
"Your commit message:"]]] "Your commit message:"]]]
[:input#commit-message.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2 [:input#commit-message.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2
{:style {:color "#000"} {:auto-focus true
:auto-focus true
:default-value ""}] :default-value ""}]
[:div.mt-5.sm:mt-4.sm:flex.sm:flex-row-reverse [:div.mt-5.sm:mt-4.sm:flex.sm:flex-row-reverse

View File

@ -185,7 +185,6 @@
[:input.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2 [:input.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2
{:auto-focus true {:auto-focus true
:style {:color "#000"}
:on-change (fn [e] :on-change (fn [e]
(reset! input (util/evalue e)))}] (reset! input (util/evalue e)))}]

View File

@ -31,7 +31,6 @@
[:input.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2 [:input.form-input.block.w-full.sm:text-sm.sm:leading-5.my-2
{:auto-focus true {:auto-focus true
:style {:color "#000"}
:on-change (fn [e] :on-change (fn [e]
(reset! project (util/evalue e)))}] (reset! project (util/evalue e)))}]

View File

@ -341,11 +341,11 @@
(defn rename! (defn rename!
[old-name new-name] [old-name new-name]
(let [new-name (string/trim new-name)]
(when-not (string/blank? new-name)
(when (and old-name new-name (when (and old-name new-name
(not= (string/lower-case old-name) (string/lower-case new-name))) (not= (string/trim old-name) (string/trim new-name)))
(when-let [repo (state/get-current-repo)] (when-let [repo (state/get-current-repo)]
(if (db/entity [:page/name (string/lower-case new-name)])
(notification/show! "Page already exists!" :error)
(when-let [page (db/entity [:page/name (string/lower-case old-name)])] (when-let [page (db/entity [:page/name (string/lower-case old-name)])]
(let [old-original-name (:page/original-name page) (let [old-original-name (:page/original-name page)
file (:page/file page) file (:page/file page)
@ -384,7 +384,7 @@
(repo-handler/push-if-auto-enabled! repo) (repo-handler/push-if-auto-enabled! repo)
(ui-handler/re-render-root!)))))) (ui-handler/re-render-root!)))))))
(defn rename-when-alter-title-property! (defn rename-when-alter-title-property!
[page path format original-content content] [page path format original-content content]