mirror of
https://github.com/logseq/logseq.git
synced 2026-04-25 22:54:48 +00:00
Fix edit global config.edn
This also effects editing any file that's not in the current repo
This commit is contained in:
committed by
Gabriel Horner
parent
021a017555
commit
047f8a8fef
@@ -19,7 +19,8 @@
|
||||
[goog.object :as gobj]
|
||||
[reitit.frontend.easy :as rfe]
|
||||
[rum.core :as rum]
|
||||
[promesa.core :as p]))
|
||||
[promesa.core :as p]
|
||||
["path" :as path]))
|
||||
|
||||
(defn- get-path
|
||||
[state]
|
||||
@@ -73,11 +74,12 @@
|
||||
(rum/defcs file-inner < rum/reactive
|
||||
{:will-mount (fn [state]
|
||||
(let [*content (atom nil)
|
||||
[path format] (:rum/args state)]
|
||||
[path format] (:rum/args state)
|
||||
repo-dir (config/get-repo-dir (state/get-current-repo))
|
||||
dir (if (string/includes? path repo-dir) repo-dir (path/dirname path))]
|
||||
(when (and format (contains? (gp-config/text-formats) format))
|
||||
(p/let [content (fs/read-file
|
||||
(config/get-repo-dir (state/get-current-repo)) path)]
|
||||
(reset! *content content)))
|
||||
(p/let [content (fs/read-file dir path)]
|
||||
(reset! *content content)))
|
||||
(assoc state ::file-content *content)))
|
||||
:did-mount (fn [state]
|
||||
(state/set-file-component! (:rum/react-component state))
|
||||
|
||||
Reference in New Issue
Block a user