Skip to content

Commit 54a5e68

Browse files
committed
Add MarkEdit.userSettings to read settings.json
1 parent d94b3f0 commit 54a5e68

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ The `MarkEdit` object provides these interfaces:
3434

3535
```ts
3636
interface MarkEdit {
37+
// Configuration of the current editor.
38+
editorConfig: Record<string, unknown>;
39+
// User-defined settings loaded from the settings.json file.
40+
userSettings: JSONObject;
3741
// CodeMirror EditorView instance of the current editor.
3842
editorView: EditorView;
3943
// Convenient text editing interfaces.

markedit.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ export interface MarkEdit {
3131
*/
3232
editorConfig: Record<string, unknown>;
3333

34+
/**
35+
* User-defined settings loaded from the [settings.json](https://github.com/MarkEdit-app/MarkEdit/wiki/Customization#advanced-settings) file.
36+
*
37+
* For example, user-defined scripts can use this to provide additional configurations.
38+
*/
39+
userSettings: JSONObject;
40+
3441
/**
3542
* CodeMirror EditorView instance of the current editor.
3643
*/
@@ -385,3 +392,21 @@ export type SavePanelOptions = {
385392
*/
386393
fileName?: string;
387394
};
395+
396+
/**
397+
* Typed JSON value.
398+
*/
399+
type JSONValue =
400+
| string
401+
| number
402+
| boolean
403+
| null
404+
| JSONObject
405+
| JSONValue[];
406+
407+
/**
408+
* Typed JSON Object.
409+
*/
410+
type JSONObject = {
411+
[key: string]: JSONValue;
412+
};

0 commit comments

Comments
 (0)