|
|
@@ -7,6 +7,7 @@
|
|
|
[frontend.handler.editor :as editor]
|
|
|
[frontend.handler.extract :as extract]
|
|
|
[frontend.handler.file :as file-handler]
|
|
|
+ [frontend.handler.page :as page-handler]
|
|
|
[lambdaisland.glogi :as log]
|
|
|
[electron.ipc :as ipc]
|
|
|
[promesa.core :as p]
|
|
|
@@ -30,7 +31,7 @@
|
|
|
(let [repo (config/get-local-repo dir)
|
|
|
{:keys [mtime]} stat
|
|
|
db-content (or (db/get-file repo path) "")]
|
|
|
- (when (and content
|
|
|
+ (when (and (or content (= type "unlink"))
|
|
|
(not (encrypt/content-encrypted? content))
|
|
|
(not (:encryption/graph-parsing? @state/state)))
|
|
|
(cond
|
|
|
@@ -64,6 +65,12 @@
|
|
|
(set-missing-block-ids! content)
|
|
|
(db/set-file-last-modified-at! repo path mtime)))
|
|
|
|
|
|
+ (and (= "unlink" type)
|
|
|
+ (db/file-exists? repo path))
|
|
|
+ (when-let [page-name (db/get-file-page path)]
|
|
|
+ (println "Delete page: " page-name ", file path: " path ".")
|
|
|
+ (page-handler/delete! page-name #()))
|
|
|
+
|
|
|
(contains? #{"add" "change" "unlink"} type)
|
|
|
nil
|
|
|
|