enhance(libs): add get_file_content function for retrieving file content

This commit is contained in:
charlie
2026-01-06 12:42:29 +08:00
parent 74bfe36d8f
commit 23c6f81010
3 changed files with 7 additions and 0 deletions

View File

@@ -924,6 +924,7 @@ export interface IDBProxy {
* @param content
*/
setFileContent: (path: string, content: string) => Promise<void>
getFileContent: (path: string) => Promise<string | null>
}
/**

View File

@@ -89,6 +89,7 @@
(def ^:export datascript_query api-db/datascript_query)
(def ^:export custom_query api-db/custom_query)
(def ^:export set_file_content api-db/set_file_content)
(def ^:export get_file_content api-db/get_file_content)
;; editor
(def ^:export prepend_block_in_page api-editor/prepend_block_in_page)

View File

@@ -3,6 +3,7 @@
(:require [cljs-bean.core :as bean]
[cljs.reader]
[frontend.db :as db]
[frontend.db.model :as db-model]
[frontend.db.async :as db-async]
[frontend.db.query-custom :as query-custom]
[frontend.db.query-dsl :as query-dsl]
@@ -67,3 +68,7 @@
(db/transact! [{:file/path path
:file/content content}])
true))))
(defn get_file_content
[path]
(db-model/get-file path))