chore: Deprecate options in webcontents.findInPage (#15735)

* chore: Deprecate options in webcontents.findInPage
This commit is contained in:
Nitish Sakhawalkar
2018-11-16 14:26:02 -08:00
committed by GitHub
parent 43be9e9ed3
commit 797338095c
4 changed files with 15 additions and 3 deletions

View File

@@ -2090,7 +2090,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
.SetMethod("unselect", &WebContents::Unselect)
.SetMethod("replace", &WebContents::Replace)
.SetMethod("replaceMisspelling", &WebContents::ReplaceMisspelling)
.SetMethod("findInPage", &WebContents::FindInPage)
.SetMethod("_findInPage", &WebContents::FindInPage)
.SetMethod("stopFindInPage", &WebContents::StopFindInPage)
.SetMethod("focus", &WebContents::Focus)
.SetMethod("isFocused", &WebContents::IsFocused)

View File

@@ -22,6 +22,10 @@ The following `webPreferences` option default values are deprecated in favor of
Child windows opened with the `nativeWindowOpen` option will always have Node.js integration disabled.
## `webContents.findInPage(text[, options])`
`wordStart` and `medialCapitalAsWordStart` options are removed.
# Planned Breaking API Changes (4.0)
The following list includes the breaking API changes planned for Electron 4.0.

View File

@@ -1016,9 +1016,9 @@ Inserts `text` to the focused element.
defaults to `false`.
* `matchCase` Boolean (optional) - Whether search should be case-sensitive,
defaults to `false`.
* `wordStart` Boolean (optional) - Whether to look only at the start of words.
* `wordStart` Boolean (optional) (Deprecated) - Whether to look only at the start of words.
defaults to `false`.
* `medialCapitalAsWordStart` Boolean (optional) - When combined with `wordStart`,
* `medialCapitalAsWordStart` Boolean (optional) (Deprecated) - When combined with `wordStart`,
accepts a match in the middle of a word if the match begins with an
uppercase letter followed by a lowercase or non-letter.
Accepts several other intra-word matches, defaults to `false`.

View File

@@ -288,6 +288,14 @@ WebContents.prototype.getZoomFactor = function (callback) {
})
}
WebContents.prototype.findInPage = function (text, options = {}) {
// TODO (nitsakh): Remove in 5.0
if (options.wordStart != null || options.medialCapitalAtWordStart != null) {
deprecate.log('wordStart and medialCapitalAtWordStart options are deprecated')
}
return this._findInPage(text, options)
}
// Add JavaScript wrappers for WebContents class.
WebContents.prototype._init = function () {
// The navigation controller.