Skip to content

Commit 4cf67fe

Browse files
trop[bot]codebytere
authored andcommitted
docs: added info on bookmark return values for securityScopedBookmarks (electron#21873)
1 parent 2c29a4e commit 4cf67fe

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/api/dialog.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Returns `Promise<Object>` - Resolve with an object containing the following:
118118

119119
* `canceled` Boolean - whether or not the dialog was canceled.
120120
* `filePaths` String[] - An array of file paths chosen by the user. If the dialog is cancelled this will be an empty array.
121-
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated.
121+
* `bookmarks` String[] (optional) _macOS_ _mas_ - An array matching the `filePaths` array of base64 encoded strings which contains security scoped bookmark data. `securityScopedBookmarks` must be enabled for this to be populated. (For return values, see [table here](#bookmarks-array).)
122122

123123
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
124124

@@ -200,7 +200,7 @@ The `filters` specifies an array of file types that can be displayed, see
200200
Returns `Promise<Object>` - Resolve with an object containing the following:
201201
* `canceled` Boolean - whether or not the dialog was canceled.
202202
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
203-
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present.
203+
* `bookmark` String (optional) _macOS_ _mas_ - Base64 encoded string which contains the security scoped bookmark data for the saved file. `securityScopedBookmarks` must be enabled for this to be present. (For return values, see [table here](#bookmarks-array).)
204204

205205
The `browserWindow` argument allows the dialog to attach itself to a parent window, making it modal.
206206

@@ -335,6 +335,17 @@ On Windows the options are more limited, due to the Win32 APIs used:
335335
* The `browserWindow` argument is ignored since it is not possible to make
336336
this confirmation dialog modal.
337337

338+
## Bookmarks array
339+
340+
`showOpenDialog`, `showOpenDialogSync`, `showSaveDialog`, and `showSaveDialogSync` will return a `bookmarks` array.
341+
342+
| Build Type | securityScopedBookmarks boolean | Return Type | Return Value |
343+
|------------|---------------------------------|:-----------:|--------------------------------|
344+
| macOS mas | True | Success | `['LONGBOOKMARKSTRING']` |
345+
| macOS mas | True | Error | `['']` (array of empty string) |
346+
| macOS mas | False | NA | `[]` (empty array) |
347+
| non mas | any | NA | `[]` (empty array) |
348+
338349
## Sheets
339350

340351
On macOS, dialogs are presented as sheets attached to a window if you provide

0 commit comments

Comments
 (0)