Explorar o código

enhance: reload custom.css when changed

Andelf %!s(int64=4) %!d(string=hai) anos
pai
achega
b1eb9117be
Modificáronse 1 ficheiros con 7 adicións e 0 borrados
  1. 7 0
      src/main/frontend/fs/watcher_handler.cljs

+ 7 - 0
src/main/frontend/fs/watcher_handler.cljs

@@ -8,6 +8,7 @@
             [frontend.handler.extract :as extract]
             [frontend.handler.file :as file-handler]
             [frontend.handler.page :as page-handler]
+            [frontend.handler.ui :as ui-handler]
             [lambdaisland.glogi :as log]
             [electron.ipc :as ipc]
             [promesa.core :as p]
@@ -73,6 +74,12 @@
             (println "Delete page: " page-name ", file path: " path ".")
             (page-handler/delete! page-name #() :delete-file? false))
 
+          (and (contains? #{"add" "change" "unlink"} type)
+               (string/ends-with? path "logseq/custom.css"))
+          (do
+            (println "reloading custom.css")
+            (ui-handler/add-style-if-exists!))
+
           (contains? #{"add" "change" "unlink"} type)
           nil