Merge pull request #671 from KKishikawa/save-menu-are-not-working

fix(web): file menu save and save as not working
This commit is contained in:
Infinity 2023-12-05 15:38:06 +01:00 committed by GitHub
commit 843675a056
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
import _ from 'lodash';
import { getContext, setContext } from 'svelte';
import invalidateCommands from '../commands/invalidateCommands';
import { runGroupCommand } from '../commands/runCommand';
import { currentDropDownMenu, visibleCommandPalette } from '../stores';
import getAsArray from './getAsArray';
@ -98,8 +99,12 @@ function mapItem(item, commands) {
text: item.text || command.menuName || command.toolbarName || command.name,
keyText: command.keyText || command.keyTextFromGroup,
onClick: () => {
if (command.getSubCommands) visibleCommandPalette.set(command);
else if (command.onClick) command.onClick();
if (command.isGroupCommand) {
runGroupCommand(command.group);
} else {
if (command.getSubCommands) visibleCommandPalette.set(command);
else if (command.onClick) command.onClick();
}
},
disabled: !command.enabled,
hideDisabled: item.hideDisabled,