mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
feat: surface more webContents text selection commands (#37978)
* feat: surface more text selection commands * refactor: use options argument * docs: correct for review
This commit is contained in:
@@ -463,6 +463,10 @@ Executes editing command `cut` in page.
|
||||
|
||||
Executes editing command `copy` in page.
|
||||
|
||||
#### `<webview>.centerSelection()`
|
||||
|
||||
Centers the current text selection in page.
|
||||
|
||||
### `<webview>.paste()`
|
||||
|
||||
Executes editing command `paste` in page.
|
||||
@@ -483,6 +487,25 @@ Executes editing command `selectAll` in page.
|
||||
|
||||
Executes editing command `unselect` in page.
|
||||
|
||||
#### `<webview>.scrollToTop()`
|
||||
|
||||
Scrolls to the top of the current `<webview>`.
|
||||
|
||||
#### `<webview>.scrollToBottom()`
|
||||
|
||||
Scrolls to the bottom of the current `<webview>`.
|
||||
|
||||
#### `<webview>.adjustSelection(options)`
|
||||
|
||||
* `options` Object
|
||||
* `start` Number (optional) - Amount to shift the start index of the current selection.
|
||||
* `end` Number (optional) - Amount to shift the end index of the current selection.
|
||||
|
||||
Adjusts the current text selection starting and ending points in the focused frame by the given amounts. A negative amount moves the selection towards the beginning of the document, and a positive amount moves the selection towards the end of the document.
|
||||
|
||||
See [`webContents.adjustSelection`](web-contents.md#contentsadjustselectionoptions) for
|
||||
examples.
|
||||
|
||||
### `<webview>.replace(text)`
|
||||
|
||||
* `text` string
|
||||
|
||||
Reference in New Issue
Block a user