Skip to content

Commit e39ff4d

Browse files
committed
Expose onEditorReady function
1 parent b806c00 commit e39ff4d

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Add `markedit-api` to your (TypeScript) project's devDependencies:
1717
```json
1818
{
1919
"devDependencies": {
20-
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.3.0"
20+
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.4.0"
2121
}
2222
}
2323
```
@@ -40,6 +40,8 @@ interface MarkEdit {
4040
codemirror: { view, state, language, commands, search };
4141
// Lezer modules used by MarkEdit.
4242
lezer: { common, highlight, markdown, lr };
43+
// Get notified when the editor is initialized.
44+
onEditorReady: (listener: (editorView: EditorView) => void) => void;
4345
// Add an extension to MarkEdit.
4446
addExtension: (extension: Extension) => void;
4547
// Add a Markdown config to MarkEdit.

main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const MarkEdit = {};
1+
export const MarkEdit = { /* stub */ };

markedit.d.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ export interface MarkEdit {
7979
* The `@lezer/lr` module.
8080
*/
8181
lr: typeof lezerLr;
82-
},
82+
};
83+
84+
/**
85+
* Get notified when the editor is initialized.
86+
* @param listener The callback function with the initialized editor instance.
87+
*/
88+
onEditorReady: (listener: (editorView: EditorView) => void) => void;
8389

8490
/**
8591
* Add an extension to MarkEdit.

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.3.0",
3+
"version": "0.4.0",
44
"description": "Type definitions for the latest MakrEdit API.",
55
"main": "main.ts",
66
"types": "markedit.d.ts",

0 commit comments

Comments
 (0)