Skip to content

Commit d94b3f0

Browse files
committed
Add MarkEdit.showSavePanel to save files
1 parent f2db20e commit d94b3f0

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ interface MarkEdit {
6464
showAlert(alert: Alert): Promise<number>;
6565
// Present a text box to receive user input.
6666
showTextBox(textBox?: TextBox): Promise<string | undefined>;
67+
// Present a save panel for saving the file.
68+
showSavePanel(options: SavePanelOptions): Promise<number>;
6769
}
6870
```
6971

markedit.d.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ export interface MarkEdit {
164164
* @returns The input string, or undefined if no value is provided.
165165
*/
166166
showTextBox(textBox?: TextBox): Promise<string | undefined>;
167+
168+
/**
169+
* Present a save panel for saving the file.
170+
* @param options The panel information, including the data and optionally a default file name.
171+
* @returns True if the file was successfully saved.
172+
*/
173+
showSavePanel(options: SavePanelOptions): Promise<boolean>;
167174
}
168175

169176
/**
@@ -358,3 +365,23 @@ export type TextBox = {
358365
placeholder?: string;
359366
defaultValue?: string;
360367
} | string;
368+
369+
/**
370+
* Represents options to show the save panel.
371+
*/
372+
export type SavePanelOptions = {
373+
/**
374+
* String representation of the file, if applicable.
375+
*/
376+
string?: string;
377+
378+
/**
379+
* Base64 representation of the file, if applicable.
380+
*/
381+
data?: string;
382+
383+
/**
384+
* Default file name.
385+
*/
386+
fileName?: string;
387+
};

0 commit comments

Comments
 (0)