joplin icon indicating copy to clipboard operation
joplin copied to clipboard

Accelerator not being added for menu

Open will-0 opened this issue 1 year ago • 0 comments

Environment

Joplin version: 2.8.8 Platform: Windows OS specifics: Windows 11 Home, Version 21H2

Steps to reproduce

  1. Create new Joplin command with joplin.commands.register()
  2. Add menu item with joplin.views.menuItems.create([id], [commandName], [location], { accelerator: [shortcut] })

The last menu item created does not have the accelerator added to it, despite being present in the menu. Note: any menu item except the last one created will have the accelerator (see screenshots below).

Describe what you expected to happen

Accelerator to be added to all menu items created.

Screenshots

Example 1: 2 menu items

Source:

joplin.plugins.register({

	onStart: async function() {
		await joplin.commands.register({
			name: 'blankcommand1',
			label: 'Blank Command 1',
			execute: async () => {}
		});
		await joplin.commands.register({
			name: 'blankcommand2',
			label: 'Blank Command 2',
			execute: async () => {}
		});

		await joplin.views.menuItems.create('Blank1', 'blankcommand1', MenuItemLocation.Tools, { accelerator: 'Ctrl+Alt+T' });
		await joplin.views.menuItems.create('Blank2', 'blankcommand2', MenuItemLocation.Tools, { accelerator: 'Ctrl+Alt+L' });
	},
});

Menu item: image

Example 2: 3 menu items

Source:

joplin.plugins.register({

	onStart: async function() {
		await joplin.commands.register({
			name: 'blankcommand1',
			label: 'Blank Command 1',
			execute: async () => {}
		});
		await joplin.commands.register({
			name: 'blankcommand2',
			label: 'Blank Command 2',
			execute: async () => {}
		});
		await joplin.commands.register({
			name: 'blankcommand3',
			label: 'Blank Command 3',
			execute: async () => {}
		});

		await joplin.views.menuItems.create('Blank1', 'blankcommand1', MenuItemLocation.Tools, { accelerator: 'Ctrl+Alt+A' });
		await joplin.views.menuItems.create('Blank2', 'blankcommand2', MenuItemLocation.Tools, { accelerator: 'Ctrl+Alt+B' });
		await joplin.views.menuItems.create('Blank3', 'blankcommand3', MenuItemLocation.Tools, { accelerator: 'Ctrl+Alt+C' });

	},
});

Menu item: image

will-0 avatar Jul 28 '22 03:07 will-0

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? If you require support or are requesting an enhancement or feature then please create a topic on the Joplin forum. This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

github-actions[bot] avatar Aug 27 '22 16:08 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Sep 04 '22 16:09 github-actions[bot]