Skip to content

Commit 080e8fb

Browse files
committed
Add MarkEdit.openFile for opening files
1 parent 9cba195 commit 080e8fb

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Add `markedit-api` to your (TypeScript) project's devDependencies:
1919
```json
2020
{
2121
"devDependencies": {
22-
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.20.0"
22+
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.21.0"
2323
}
2424
}
2525
```
@@ -52,6 +52,8 @@ interface MarkEdit {
5252
lezer: { common, highlight, markdown, lr };
5353
// Get notified when the editor is initialized.
5454
onEditorReady(listener: (editorView: EditorView) => void): void;
55+
// Open a file in the file system.
56+
openFile(path: string): Promise<boolean>;
5557
// Create a file in the file system.
5658
createFile(options: CreateFileOptions): Promise<boolean>;
5759
// Delete a file from the file system.

index.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ export interface MarkEdit {
131131
*/
132132
onEditorReady(listener: (editorView: EditorView) => void): void;
133133

134+
/**
135+
* Open a file in the file system.
136+
* @param path The file path. It must be one that the app can access. See the [wiki](https://github.com/MarkEdit-app/MarkEdit/wiki/Customization#grant-folder-access) for more details.
137+
* @returns True if the file was successfully opened.
138+
*/
139+
openFile(path: string): Promise<boolean>;
140+
134141
/**
135142
* Create a file in the file system.
136143
* @param options The options, including path and content.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "markedit-api",
3-
"version": "0.20.0",
3+
"version": "0.21.0",
44
"description": "Type definitions for the latest MakrEdit API.",
55
"main": "./index.cjs",
66
"module": "./index.js",

0 commit comments

Comments
 (0)