Skip to content

Commit

Permalink
chore: cleanup whitespace in docs (electron#26356)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsanders11 authored Nov 5, 2020
1 parent 3814a56 commit 43dbd1b
Show file tree
Hide file tree
Showing 45 changed files with 129 additions and 72 deletions.
9 changes: 6 additions & 3 deletions docs/api/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -859,9 +859,10 @@ This method returns the application name of the default handler for the protocol
minimum (e.g. `https://`).

Returns `Promise<Object>` - Resolve with an object containing the following:
* `icon` NativeImage - the display icon of the app handling the protocol.
* `path` String - installation path of the app handling the protocol.
* `name` String - display name of the app handling the protocol.

* `icon` NativeImage - the display icon of the app handling the protocol.
* `path` String - installation path of the app handling the protocol.
* `name` String - display name of the app handling the protocol.

This method returns a promise that contains the application name, icon and path of the default handler for the protocol
(aka URI scheme) of a URL.
Expand Down Expand Up @@ -1091,6 +1092,7 @@ Changes the [Application User Model ID][app-user-model-id] to `id`.
Sets the activation policy for a given app.

Activation policy types:

* 'regular' - The application is an ordinary app that appears in the Dock and may have a user interface.
* 'accessory' - The application doesn’t appear in the Dock and doesn’t have a menu bar, but it may be activated programmatically or by clicking on one of its windows.
* 'prohibited' - The application doesn’t appear in the Dock and may not create windows or be activated.
Expand Down Expand Up @@ -1142,6 +1144,7 @@ For `infoType` equal to `complete`:

For `infoType` equal to `basic`:
Promise is fulfilled with `Object` containing fewer attributes than when requested with `complete`. Here's an example of basic response:

```js
{
auxAttributes:
Expand Down
5 changes: 3 additions & 2 deletions docs/api/browser-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ window.onbeforeunload = (e) => {
e.returnValue = false // equivalent to `return false` but not recommended
}
```

_**Note**: There is a subtle difference between the behaviors of `window.onbeforeunload = handler` and `window.addEventListener('beforeunload', handler)`. It is recommended to always set the `event.returnValue` explicitly, instead of only returning a value, as the former works more consistently within Electron._

#### Event: 'closed'
Expand Down Expand Up @@ -859,7 +860,7 @@ A `Boolean` property that determines whether the menu bar should be visible.

**Note:** If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single `Alt` key.

#### `win.kiosk`
#### `win.kiosk`

A `Boolean` property that determines whether the window is in kiosk mode.

Expand Down Expand Up @@ -1049,7 +1050,7 @@ Returns `Boolean` - Whether the window is in normal state (not maximized, not mi

* `aspectRatio` Float - The aspect ratio to maintain for some portion of the
content view.
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
* `extraSize` [Size](structures/size.md) (optional) _macOS_ - The extra size not to be included while
maintaining the aspect ratio.

This will make a window maintain an aspect ratio. The extra size allows a
Expand Down
2 changes: 1 addition & 1 deletion docs/api/client-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ request.on('login', (authInfo, callback) => {
callback('username', 'password')
})
```

Providing empty credentials will cancel the request and report an authentication
error on the response object:

Expand Down Expand Up @@ -139,7 +140,6 @@ Emitted as the last event in the HTTP request-response transaction. The `close`
event indicates that no more events will be emitted on either the `request` or
`response` objects.


#### Event: 'redirect'

Returns:
Expand Down
2 changes: 2 additions & 0 deletions docs/api/command-line-switches.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Forces the maximum disk space to be used by the disk cache, in bytes.
### --enable-api-filtering-logging

Enables caller stack logging for the following APIs (filtering events):

- `desktopCapturer.getSources()` / `desktop-capturer-get-sources`
- `remote.require()` / `remote-require`
- `remote.getGlobal()` / `remote-get-builtin`
Expand Down Expand Up @@ -227,6 +228,7 @@ See the [Debugging the Main Process][debugging-main-process] guide for more deta
Aliased to `--debug[=[host:]port`.

### --inspect-publish-uid=stderr,http

Specify ways of the inspector web socket url exposure.

By default inspector websocket url is available in stderr and under /json/list endpoint on http://host:port/json/list.
Expand Down
1 change: 0 additions & 1 deletion docs/api/context-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,4 @@ has been included below for completeness:
| [Cloneable Types](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm) | Simple ||| See the linked document on cloneable types |
| `Symbol` | N/A ||| Symbols cannot be copied across contexts so they are dropped |


If the type you care about is not in the above table, it is probably not supported.
12 changes: 7 additions & 5 deletions docs/api/dialog.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,10 @@ The `filters` specifies an array of file types that can be displayed, see
* `securityScopedBookmarks` Boolean (optional) _macOS_ _mas_ - Create a [security scoped bookmark](https://developer.apple.com/library/content/documentation/Security/Conceptual/AppSandboxDesignGuide/AppSandboxInDepth/AppSandboxInDepth.html#//apple_ref/doc/uid/TP40011183-CH3-SW16) when packaged for the Mac App Store. If this option is enabled and the file doesn't already exist a blank file will be created at the chosen path.

Returns `Promise<Object>` - Resolve with an object containing the following:
* `canceled` Boolean - whether or not the dialog was canceled.
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
* `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).)

* `canceled` Boolean - whether or not the dialog was canceled.
* `filePath` String (optional) - If the dialog is canceled, this will be `undefined`.
* `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).)

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

Expand Down Expand Up @@ -302,8 +303,9 @@ If `browserWindow` is not shown dialog will not be attached to it. In such case
via `Alt-W` on Windows and Linux.

Returns `Promise<Object>` - resolves with a promise containing the following properties:
* `response` Number - The index of the clicked button.
* `checkboxChecked` Boolean - The checked state of the checkbox if

* `response` Number - The index of the clicked button.
* `checkboxChecked` Boolean - The checked state of the checkbox if
`checkboxLabel` was set. Otherwise `false`.

Shows a message box.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/environment-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ Don't use the global menu bar on Linux.
Set the trash implementation on Linux. Default is `gio`.

Options:

* `gvfs-trash`
* `trash-cli`
* `kioclient5`
Expand All @@ -115,7 +116,6 @@ Options:
The following environment variables are intended primarily for development and
debugging purposes.


### `ELECTRON_ENABLE_LOGGING`

Prints Chrome's internal logging to the console.
Expand Down
1 change: 0 additions & 1 deletion docs/api/frameless-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ options on the [`BrowserWindow`](browser-window.md) class.
To create a frameless window, you need to set `frame` to `false` in
[BrowserWindow](browser-window.md)'s `options`:


```javascript
const { BrowserWindow } = require('electron')
const win = new BrowserWindow({ width: 800, height: 600, frame: false })
Expand Down
2 changes: 2 additions & 0 deletions docs/api/ipc-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ The main process should listen for `channel` with
[`ipcMain.handle()`](ipc-main.md#ipcmainhandlechannel-listener).

For example:

```javascript
// Renderer process
ipcRenderer.invoke('some-name', someArgument).then((result) => {
Expand Down Expand Up @@ -149,6 +150,7 @@ The transferred `MessagePort` objects will be available in the main process as
property of the emitted event.

For example:

```js
// Renderer process
const { port1, port2 } = new MessageChannel()
Expand Down
1 change: 1 addition & 0 deletions docs/api/menu-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ A `String` indicating the item's visible label.

A `Function` that is fired when the MenuItem receives a click event.
It can be called with `menuItem.click(event, focusedWindow, focusedWebContents)`.

* `event` [KeyboardEvent](structures/keyboard-event.md)
* `focusedWindow` [BrowserWindow](browser-window.md)
* `focusedWebContents` [WebContents](web-contents.md)
Expand Down
1 change: 1 addition & 0 deletions docs/api/message-channel-main.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ channel messaging.
Process: [Main](../glossary.md#main-process)

Example:

```js
// Main process
const { port1, port2 } = new MessageChannelMain()
Expand Down
3 changes: 3 additions & 0 deletions docs/api/native-theme.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ Setting this property to `system` will remove the override and
everything will be reset to the OS default. By default `themeSource` is `system`.

Settings this property to `dark` will have the following effects:

* `nativeTheme.shouldUseDarkColors` will be `true` when accessed
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the dark UI.
* Any UI the OS renders on macOS including menus, window frames, etc. will use the dark UI.
* The [`prefers-color-scheme`](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) CSS query will match `dark` mode.
* The `updated` event will be emitted

Settings this property to `light` will have the following effects:

* `nativeTheme.shouldUseDarkColors` will be `false` when accessed
* Any UI Electron renders on Linux and Windows including context menus, devtools, etc. will use the light UI.
* Any UI the OS renders on macOS including menus, window frames, etc. will use the light UI.
Expand All @@ -49,6 +51,7 @@ Settings this property to `light` will have the following effects:

The usage of this property should align with a classic "dark mode" state machine in your application
where the user has three options.

* `Follow OS` --> `themeSource = 'system'`
* `Dark Mode` --> `themeSource = 'dark'`
* `Light Mode` --> `themeSource = 'light'`
Expand Down
2 changes: 2 additions & 0 deletions docs/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ It adds the following events, properties, and methods:
## Sandbox

In sandboxed renderers the `process` object contains only a subset of the APIs:

- `crash()`
- `hang()`
- `getCreationTime()`
Expand Down Expand Up @@ -104,6 +105,7 @@ A `Boolean` that controls whether or not deprecations printed to `stderr` includ
This property is instead of the `--trace-deprecation` command line flag.

### `process.traceProcessWarnings`

A `Boolean` that controls whether or not process warnings printed to `stderr` include
their stack trace. Setting this to `true` will print stack traces for process warnings
(including deprecations). This property is instead of the `--trace-warnings` command
Expand Down
2 changes: 1 addition & 1 deletion docs/api/remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ win.loadURL('https://github.com')
you can use [webContents.executeJavaScript](web-contents.md#contentsexecutejavascriptcode-usergesture).

**Note:** The remote module can be disabled for security reasons in the following contexts:

- [`BrowserWindow`](browser-window.md) - by setting the `enableRemoteModule` option to `false`.
- [`<webview>`](webview-tag.md) - by setting the `enableremotemodule` attribute to `false`.

Expand Down Expand Up @@ -207,7 +208,6 @@ module.exports = 'bar'
const foo = require('electron').remote.require('./foo') // bar
```


### `remote.process` _Readonly_

A `NodeJS.Process` object. The `process` object in the main process. This is the same as
Expand Down
7 changes: 4 additions & 3 deletions docs/api/session.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ Returns:

Emitted after an extension is loaded. This occurs whenever an extension is
added to the "enabled" set of extensions. This includes:

- Extensions being loaded from `Session.loadExtension`.
- Extensions being reloaded:
* from a crash.
* if the extension requested it ([`chrome.runtime.reload()`](https://developer.chrome.com/extensions/runtime#method-reload)).
* from a crash.
* if the extension requested it ([`chrome.runtime.reload()`](https://developer.chrome.com/extensions/runtime#method-reload)).

#### Event: 'extension-unloaded'

Expand Down Expand Up @@ -354,7 +355,7 @@ The `proxyBypassRules` is a comma separated list of rules described below:
"foobar.com", "*foobar.com", "*.foobar.com", "*foobar.com:99",
"https://x.*.y.com:99"

* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`
* `"." HOSTNAME_SUFFIX_PATTERN [ ":" PORT ]`

Match a particular domain suffix.

Expand Down
1 change: 0 additions & 1 deletion docs/api/structures/new-window-web-contents-event.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# NewWindowWebContentsEvent Object extends `Event`

* `newGuest` BrowserWindow (optional)

2 changes: 1 addition & 1 deletion docs/api/tray.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ app.whenReady().then(() => {
appIcon.setContextMenu(contextMenu)
})
```

* On Windows it is recommended to use `ICO` icons to get best visual effects.

If you want to keep exact same behaviors on all platforms, you should not
rely on the `click` event and always attach a context menu to the tray icon.


### `new Tray(image, [guid])`

* `image` ([NativeImage](native-image.md) | String)
Expand Down
2 changes: 2 additions & 0 deletions docs/api/web-contents.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ Emitted when the window leaves a full-screen state triggered by HTML API.
#### Event: 'zoom-changed'

Returns:

* `event` Event
* `zoomDirection` String - Can be `in` or `out`.

Expand Down Expand Up @@ -1690,6 +1691,7 @@ process by accessing the `ports` property of the emitted event. When they
arrive in the renderer, they will be native DOM `MessagePort` objects.

For example:

```js
// Main process
const { port1, port2 } = new MessageChannelMain()
Expand Down
1 change: 1 addition & 0 deletions docs/api/web-frame.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ reject and the `result` would be `undefined`. This is because Chromium does not
dispatch errors of isolated worlds to foreign worlds.

### `webFrame.setIsolatedWorldInfo(worldId, info)`

* `worldId` Integer - The ID of the world to run the javascript in, `0` is the default world, `999` is the world used by Electrons `contextIsolation` feature. Chrome extensions reserve the range of IDs in `[1 << 20, 1 << 29)`. You can provide any integer here.
* `info` Object
* `securityOrigin` String (optional) - Security origin for the isolated world.
Expand Down
1 change: 1 addition & 0 deletions docs/api/window-open.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ The `features` string follows the format of standard browser, but each feature
has to be a field of `BrowserWindow`'s options. These are the features you can set via `features` string: `zoomFactor`, `nodeIntegration`, `preload`, `javascript`, `contextIsolation`, `webviewTag`.

For example:

```js
window.open('https://github.com', '_blank', 'nodeIntegration=no')
```
Expand Down
8 changes: 8 additions & 0 deletions docs/breaking-changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ messages, but also brings some breaking changes in behavior.
- Sending Functions, Promises, WeakMaps, WeakSets, or objects containing any
such values, over IPC will now throw an exception, instead of silently
converting the functions to `undefined`.

```js
// Previously:
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
Expand All @@ -310,6 +311,7 @@ ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
// => throws Error("() => {} could not be cloned.")
```

- `NaN`, `Infinity` and `-Infinity` will now be correctly serialized, instead
of being converted to `null`.
- Objects containing cyclic references will now be correctly serialized,
Expand All @@ -327,6 +329,7 @@ ipcRenderer.send('channel', { value: 3, someFunction: () => {} })
- Node.js `Buffer` objects will be transferred as `Uint8Array`s. You can
convert a `Uint8Array` back to a Node.js `Buffer` by wrapping the underlying
`ArrayBuffer`:

```js
Buffer.from(value.buffer, value.byteOffset, value.byteLength)
```
Expand Down Expand Up @@ -462,6 +465,7 @@ the folder, similarly to Chrome, Firefox, and Edge
([link to MDN docs](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/webkitdirectory)).

As an illustration, take a folder with this structure:

```console
folder
├── file1
Expand All @@ -470,11 +474,13 @@ folder
```

In Electron <=6, this would return a `FileList` with a `File` object for:

```console
path/to/folder
```

In Electron 7, this now returns a `FileList` with a `File` object for:

```console
/path/to/folder/file3
/path/to/folder/file2
Expand Down Expand Up @@ -629,7 +635,9 @@ webFrame.setIsolatedWorldInfo(
```

### API Changed: `webFrame.setSpellCheckProvider` now takes an asynchronous callback

The `spellCheck` callback is now asynchronous, and `autoCorrectWord` parameter has been removed.

```js
// Deprecated
webFrame.setSpellCheckProvider('en-US', true, {
Expand Down
Loading

0 comments on commit 43dbd1b

Please sign in to comment.