mirror of https://github.com/logseq/logseq
fix: don't alert file already exists when creating new page
parent
bca87b2b81
commit
b6a9afc303
|
@ -682,11 +682,12 @@
|
||||||
dir (util/get-repo-dir repo)]
|
dir (util/get-repo-dir repo)]
|
||||||
(p/let [exists? (fs/file-exists? dir file-path)]
|
(p/let [exists? (fs/file-exists? dir file-path)]
|
||||||
(if exists?
|
(if exists?
|
||||||
(notification/show!
|
(do (notification/show!
|
||||||
[:p.content
|
[:p.content
|
||||||
(util/format "File %s already exists!"
|
(util/format "File %s already exists!"
|
||||||
file-path)]
|
file-path)]
|
||||||
:error)
|
:error)
|
||||||
|
(state/set-editor-op! nil))
|
||||||
;; create the file
|
;; create the file
|
||||||
(let [content (util/default-content-with-title format (or
|
(let [content (util/default-content-with-title format (or
|
||||||
(:page/original-name page)
|
(:page/original-name page)
|
||||||
|
@ -703,8 +704,9 @@
|
||||||
;; Continue to edit the last block
|
;; Continue to edit the last block
|
||||||
(let [blocks (db/get-page-blocks repo (:page/name page))
|
(let [blocks (db/get-page-blocks repo (:page/name page))
|
||||||
last-block (last blocks)]
|
last-block (last blocks)]
|
||||||
(edit-last-block-for-new-page! last-block 0))))))
|
(edit-last-block-for-new-page! last-block 0))
|
||||||
(state/set-editor-op! nil))
|
|
||||||
|
(state/set-editor-op! nil))))))
|
||||||
|
|
||||||
file
|
file
|
||||||
(let [file-path (:file/path file)
|
(let [file-path (:file/path file)
|
||||||
|
|
Loading…
Reference in New Issue