Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

zcbenz
Copy link
Contributor

@zcbenz zcbenz commented Sep 25, 2020

Description of Change

Close #6330.

This PR adds a new MenuItem role shareMenu, that would turn a submenu into macOS share menu. There is also a new MenuItem.sharingItem property added, to specify which items to share.

Screen Shot 2020-09-25 at 16 27 53

const menu = Menu.buildFromTemplate([
  { role: 'windowMenu' },
  {
    role: 'shareMenu',
    sharingItem: {
      urls: [ 'https://github.com/electron/electron/issues/6330' ]
    }
  },
])
menu.popup(win)

There is also a new ShareMenu class added, which can create a top share menu directly. This is because MenuItem roles can only be applied on submenus, while it is very common to show a top share menu directly:

Screen Shot 2020-09-25 at 16 44 03

const menu2 = new ShareMenu({
  filePaths: [ __filename ]
})
menu2.popup(win)

Future extension

There could be a few possible feature requests about the share menu, like whether to show the "more" menu item, whether to hide certain items, callbacks to get notifications. Most of them can be achieved by adding new fields to the SharingItem structure.

Checklist

Release Notes

Notes: Add support for showing macOS share menu.

@zcbenz zcbenz requested a review from a team September 25, 2020 07:46
@electron-cation electron-cation bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Sep 25, 2020
@jkleinsc
Copy link
Member

jkleinsc commented Oct 5, 2020

The API WG reviewed this PR at our Oct 5, 2020 meeting. After reviewing, the suggestion was made to instead create a ShareMenu class.

@zcbenz
Copy link
Contributor Author

zcbenz commented Oct 12, 2020

I have changed the API's interface according to last wg-api meeting's advice, would love to get some reviews.

@jkleinsc
Copy link
Member

The API WG approved this at our Oct 19 2020 meeting.

@codebytere
Copy link
Member

session.serviceWorkers getFromVersionID() should report the correct script url and scope

is a known flake.

@codebytere codebytere merged commit 6b6ffbd into master Oct 20, 2020
@release-clerk
Copy link

release-clerk bot commented Oct 20, 2020

Release Notes Persisted

Add support for showing macOS share menu.

@zcbenz zcbenz deleted the share-menu branch February 15, 2021 06:29
andersk added a commit to andersk/electron that referenced this pull request Jul 20, 2021
`shareMenu` (electron#25629) and `toggleSpellChecker` (electron#26276) were missing.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
trop bot pushed a commit that referenced this pull request Jul 28, 2021
`shareMenu` (#25629) and `toggleSpellChecker` (#26276) were missing.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
trop bot pushed a commit that referenced this pull request Jul 28, 2021
`shareMenu` (#25629) and `toggleSpellChecker` (#26276) were missing.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add API to trigger share menu on macOS

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.