chore: remove deprecated inputFieldType (#41440)

chore: remove deprecated inputFieldType

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Milan Burda <milan.burda@gmail.com>
This commit is contained in:
trop[bot] 2024-02-28 14:52:01 +09:00 committed by GitHub
parent 47deb401b0
commit 174aedf54c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 57 deletions

View file

@ -778,9 +778,6 @@ Returns:
`input-text`, `input-time`, `input-url`, `input-week`, `output`, `reset-button`,
`select-list`, `select-list`, `select-multiple`, `select-one`, `submit-button`,
and `text-area`,
* `inputFieldType` string _Deprecated_ - If the context menu was invoked on an
input field, the type of that field. Possible values include `none`,
`plainText`, `password`, `other`.
* `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled.
* `menuSourceType` string - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.

View file

@ -1111,9 +1111,6 @@ Returns:
`input-text`, `input-time`, `input-url`, `input-week`, `output`, `reset-button`,
`select-list`, `select-list`, `select-multiple`, `select-one`, `submit-button`,
and `text-area`,
* `inputFieldType` string _Deprecated_ - If the context menu was invoked on an
input field, the type of that field. Possible values include `none`,
`plainText`, `password`, `other`.
* `spellcheckEnabled` boolean - If the context is editable, whether or not spellchecking is enabled.
* `menuSourceType` string - Input source that invoked the context menu.
Can be `none`, `mouse`, `keyboard`, `touch`, `touchMenu`, `longPress`, `longTap`, `touchHandle`, `stylus`, `adjustSelection`, or `adjustSelectionReset`.

View file

@ -38,6 +38,12 @@ The autoresizing behavior is now standardized across all platforms.
If your app uses `BrowserView.setAutoResize` to do anything more complex than making a BrowserView fill the entire window, it's likely you already had custom logic in place to handle this difference in behavior on macOS.
If so, that logic will no longer be needed in Electron 30 as autoresizing behavior is consistent.
### Removed: `params.inputFormType` property on `context-menu` on `WebContents`
The `inputFormType` property of the params object in the `context-menu`
event from `WebContents` has been removed. Use the new `formControlType`
property instead.
## Planned Breaking API Changes (29.0)
### Behavior Changed: `ipcRenderer` can no longer be sent over the `contextBridge`

View file

@ -23,51 +23,6 @@
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion.h"
namespace {
[[nodiscard]] constexpr std::string_view FormControlToInputFieldTypeString(
const std::optional<blink::mojom::FormControlType> form_control_type) {
if (!form_control_type)
return "none";
switch (*form_control_type) {
case blink::mojom::FormControlType::kInputPassword:
return "password";
case blink::mojom::FormControlType::kInputText:
return "plainText";
// other input types:
case blink::mojom::FormControlType::kInputButton:
case blink::mojom::FormControlType::kInputCheckbox:
case blink::mojom::FormControlType::kInputColor:
case blink::mojom::FormControlType::kInputDate:
case blink::mojom::FormControlType::kInputDatetimeLocal:
case blink::mojom::FormControlType::kInputEmail:
case blink::mojom::FormControlType::kInputFile:
case blink::mojom::FormControlType::kInputHidden:
case blink::mojom::FormControlType::kInputImage:
case blink::mojom::FormControlType::kInputMonth:
case blink::mojom::FormControlType::kInputNumber:
case blink::mojom::FormControlType::kInputRadio:
case blink::mojom::FormControlType::kInputRange:
case blink::mojom::FormControlType::kInputReset:
case blink::mojom::FormControlType::kInputSearch:
case blink::mojom::FormControlType::kInputSubmit:
case blink::mojom::FormControlType::kInputTelephone:
case blink::mojom::FormControlType::kInputTime:
case blink::mojom::FormControlType::kInputUrl:
case blink::mojom::FormControlType::kInputWeek:
return "other";
// not an input type
default:
return "none";
}
}
} // namespace
namespace gin {
static constexpr auto MenuSourceTypes =
@ -162,12 +117,6 @@ v8::Local<v8::Value> Converter<ContextMenuParamsWithRenderFrameHost>::ToV8(
dict.Set("frameCharset", params.frame_charset);
dict.Set("referrerPolicy", params.referrer_policy);
dict.Set("formControlType", params.form_control_type);
// NB: inputFieldType is deprecated because the upstream
// field was removed; we are emulating it now until removal
dict.Set("inputFieldType",
FormControlToInputFieldTypeString(params.form_control_type));
dict.Set("menuSourceType", params.source_type);
return gin::ConvertToV8(isolate, dict);

View file

@ -1319,6 +1319,11 @@ win4.webContents.on('scroll-touch-end', () => {});
// @ts-expect-error Removed API
win4.webContents.on('crashed', () => {});
win4.webContents.on('context-menu', (event, params) => {
// @ts-expect-error Removed API
console.log(params.inputFieldType);
});
// TouchBar
// https://github.com/electron/electron/blob/main/docs/api/touch-bar.md