Merge pull request #8583 from rhysd/missing-webContents-APIs

github-electron: Added findInPage(), stopFindInPage() and insertText() for WebContents
This commit is contained in:
Masahiro Wakame
2016-03-19 12:37:41 +09:00
2 changed files with 37 additions and 0 deletions
+28
View File
@@ -537,6 +537,14 @@ declare namespace Electron {
height?: number;
}
interface FindInPageOptions {
forward?: boolean;
findNext?: boolean;
matchCase?: boolean;
wordStart?: boolean;
medialCapitalAsWordStart?: boolean;
}
/**
* A WebContents is responsible for rendering and controlling a web page.
*/
@@ -677,6 +685,26 @@ declare namespace Electron {
* Executes Edit -> Replace Misspelling command in page.
*/
replaceMisspelling(text: string): void;
/**
* Inserts text to the focused element.
*/
insertText(text: string): void;
/**
* Starts a request to find all matches for the text in the web page and
* returns an Integer representing the request id used for the request.
* The result of the request can be obtained by subscribing to
* found-in-page event.
*/
findInPage(text: string, options?: FindInPageOptions): void;
/**
* Stops any findInPage request for the webContents with the provided
* action.
* @param action Specifies the action to take place when ending webContents.findInPage request.
* 'clearSelection' - Translate the selection into a normal selection.
* 'keepSelection' - Clear the selection.
* 'activateSelection' - Focus and click the selection node.
*/
stopFindInPage(action: 'clearSelection' | 'keepSelection' | 'activateSelection'): void;
/**
* Checks if any serviceworker is registered.
*/