new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Electron · API · all subjects

web-contents/editing

15 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

contents.copy() - execute copy command

Executes the editing command 'copy' in the web page.

contents.centerSelection() - center text selection

Centers the current text selection in the web page.

contents.copyImageAt(x, y) - copy image to clipboard

Copies the image at the given position to the clipboard. Parameters: x (Integer), y (Integer).

contents.copyVideoFrameAt(x, y) - copy video frame

When executed on a video media element, copies the frame at the specified coordinates to the clipboard. Parameters: x (Integer), y (Integer).

contents.saveVideoFrameAs(x, y) - save video frame

When executed on a video media element, shows a save dialog and saves the frame at the specified coordinates to disk. Parameters: x (Integer), y (Integer).

contents.paste() - execute paste command

Executes the editing command 'paste' in the web page.

contents.pasteAndMatchStyle() - paste with style matching

Executes the editing command 'pasteAndMatchStyle' in the web page.

contents.delete() - execute delete command

Executes the editing command 'delete' in the web page.

contents.selectAll() - execute selectAll command

Executes the editing command 'selectAll' in the web page.

contents.unselect() - execute unselect command

Executes the editing command 'unselect' in the web page.

contents.adjustSelection(options) - adjust text 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. Parameters: options (Object) with start (Number, optional) - amount to shift the start index of the current selection, and end (Number, optional) - amount to shift the end index of the current selection.

adjustSelection() example

const win = new BrowserWindow() // Adjusts the beginning of the selection 1 letter forward, // and the end of the selection 5 letters forward. win.webContents.adjustSelection({ start: 1, end: 5 }) // Adjusts the beginning of the selection 2 letters forward, // and the end of the selection 3 letters backward. win.webContents.adjustSelection({ start: 2, end: -3 })

contents.replace(text) - execute replace command

Executes the editing command 'replace' in the web page. Parameters: text (string).

contents.replaceMisspelling(text) - replace misspelling

Executes the editing command 'replaceMisspelling' in the web page. Parameters: text (string).

contents.insertText(text) - insert text

Inserts text to the focused element. Returns Promise<void>. Parameters: text (string).

Give your agent this brain