mirror of https://github.com/logseq/logseq
Merge branch 'andelf-enhance/allow-edit-markup-files'
commit
138335987b
|
@ -105,14 +105,6 @@
|
||||||
(and format (contains? (config/img-formats) format))
|
(and format (contains? (config/img-formats) format))
|
||||||
[:img {:src path}]
|
[:img {:src path}]
|
||||||
|
|
||||||
(and format (contains? config/markup-formats format))
|
|
||||||
(when-let [file-content (db/get-file path)]
|
|
||||||
(let [content (string/trim file-content)]
|
|
||||||
(content/content path {:config {:file? true
|
|
||||||
:file-path path}
|
|
||||||
:content content
|
|
||||||
:format format})))
|
|
||||||
|
|
||||||
(and format (contains? (config/text-formats) format))
|
(and format (contains? (config/text-formats) format))
|
||||||
(when-let [file-content (db/get-file path)]
|
(when-let [file-content (db/get-file path)]
|
||||||
(let [content (string/trim file-content)
|
(let [content (string/trim file-content)
|
||||||
|
|
|
@ -183,8 +183,7 @@
|
||||||
(file-handler/alter-file (state/get-current-repo)
|
(file-handler/alter-file (state/get-current-repo)
|
||||||
path
|
path
|
||||||
(str (string/trim value) "\n")
|
(str (string/trim value) "\n")
|
||||||
{:re-render-root? true})
|
{:re-render-root? true})))
|
||||||
(notification/show! "Saved file!" :success)))
|
|
||||||
|
|
||||||
:else
|
:else
|
||||||
nil))))
|
nil))))
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
(p/resolved (= (string/trim disk-content) (string/trim db-content))))))
|
(p/resolved (= (string/trim disk-content) (string/trim db-content))))))
|
||||||
|
|
||||||
(defn- write-file-impl!
|
(defn- write-file-impl!
|
||||||
[this repo dir path content {:keys [ok-handler error-handler skip-compare?] :as opts} stat]
|
[this repo dir path content {:keys [ok-handler error-handler old-content skip-compare?] :as opts} stat]
|
||||||
(if skip-compare?
|
(if skip-compare?
|
||||||
(p/catch
|
(p/catch
|
||||||
(p/let [result (ipc/ipc "writeFile" repo path content)]
|
(p/let [result (ipc/ipc "writeFile" repo path content)]
|
||||||
|
@ -55,7 +55,7 @@
|
||||||
ext (string/lower-case (util/get-file-ext path))
|
ext (string/lower-case (util/get-file-ext path))
|
||||||
file-page (db/get-file-page-id path)
|
file-page (db/get-file-page-id path)
|
||||||
page-empty? (and file-page (db/page-empty? repo file-page))
|
page-empty? (and file-page (db/page-empty? repo file-page))
|
||||||
db-content (or (db/get-file repo path) "")
|
db-content (or old-content (db/get-file repo path) "")
|
||||||
contents-matched? (contents-matched? disk-content db-content)
|
contents-matched? (contents-matched? disk-content db-content)
|
||||||
pending-writes (state/get-write-chan-length)]
|
pending-writes (state/get-write-chan-length)]
|
||||||
(cond
|
(cond
|
||||||
|
|
Loading…
Reference in New Issue