Skip to content

Commit

Permalink
Expose onEditorReady function
Browse files Browse the repository at this point in the history
  • Loading branch information
cyanzhong committed Sep 15, 2024
1 parent b806c00 commit e39ff4d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Add `markedit-api` to your (TypeScript) project's devDependencies:
```json
{
"devDependencies": {
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.3.0"
"markedit-api": "https://github.com/MarkEdit-app/MarkEdit-api#v0.4.0"
}
}
```
Expand All @@ -40,6 +40,8 @@ interface MarkEdit {
codemirror: { view, state, language, commands, search };
// Lezer modules used by MarkEdit.
lezer: { common, highlight, markdown, lr };
// Get notified when the editor is initialized.
onEditorReady: (listener: (editorView: EditorView) => void) => void;
// Add an extension to MarkEdit.
addExtension: (extension: Extension) => void;
// Add a Markdown config to MarkEdit.
Expand Down
2 changes: 1 addition & 1 deletion main.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const MarkEdit = {};
export const MarkEdit = { /* stub */ };
8 changes: 7 additions & 1 deletion markedit.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ export interface MarkEdit {
* The `@lezer/lr` module.
*/
lr: typeof lezerLr;
},
};

/**
* Get notified when the editor is initialized.
* @param listener The callback function with the initialized editor instance.
*/
onEditorReady: (listener: (editorView: EditorView) => void) => void;

/**
* Add an extension to MarkEdit.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "markedit-api",
"version": "0.3.0",
"version": "0.4.0",
"description": "Type definitions for the latest MakrEdit API.",
"main": "main.ts",
"types": "markedit.d.ts",
Expand Down

0 comments on commit e39ff4d

Please sign in to comment.