mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
feat: add support for associating a Menu with a WebFrameMain (#45138)
* feat: add support for associating a Menu with a WebFrameMain
This allows certain OS level features to activate such as Writing Tools, Autofill.. and Services.
There appears to be a bug in macOS where the responder chain isn't traversed if the menu is not popped up using an event, as such we spoof a fake mouse event at the write coordinates in the right window and use that to open the menu.
* build: fix build on non-mac
* build: oops missed a header
* fix: safely handle optional T* by checking nullptr too
* build: fix gn check and build errors
* docs: suggested changes
* feat: default `frame` to `window.webContents.mainFrame` when possible
* fix: avoid deref nullptr view
* Revert "feat: default `frame` to `window.webContents.mainFrame` when possible"
This reverts commit 2e88836819.
* fix: lint
* Remove redundant scoped objects
This code, including the comments, matches almost exactly the behavior of this argument to the function.
* Add ScopedPumpMessagesInPrivateModes patch
* More null pointer safety
---------
Co-authored-by: clavin <clavin@electronjs.org>
This commit is contained in:
@@ -73,6 +73,8 @@ The `menu` object has the following instance methods:
|
||||
|
||||
* `options` Object (optional)
|
||||
* `window` [BaseWindow](base-window.md) (optional) - Default is the focused window.
|
||||
* `frame` [WebFrameMain](web-frame-main.md) (optional) - Provide the relevant frame
|
||||
if you want certain OS-level features such as Writing Tools on macOS to function correctly. Typically, this should be `params.frame` from the [`context-menu` event](web-contents.md#event-context-menu) on a WebContents.
|
||||
* `x` number (optional) - Default is the current mouse cursor position.
|
||||
Must be declared if `y` is declared.
|
||||
* `y` number (optional) - Default is the current mouse cursor position.
|
||||
|
||||
Reference in New Issue
Block a user