1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-29 22:48:10 +02:00

Mobile: Plugins: Improve handling of invalid toolbar button enabled conditions (#13076)

This commit is contained in:
Henry Heino
2025-09-01 04:50:59 -07:00
committed by GitHub
parent b9c5b8f187
commit faa44468f3

View File

@@ -2,7 +2,9 @@ import CommandService from '../CommandService';
import { stateUtils } from '../../reducer';
import focusEditorIfEditorCommand from './focusEditorIfEditorCommand';
import { WhenClauseContext } from './stateToWhenClauseContext';
import Logger from '@joplin/utils/Logger';
const logger = Logger.create('ToolbarButtonUtils');
export interface ToolbarButtonInfo {
type: 'button';
@@ -94,7 +96,11 @@ export default class ToolbarButtonUtils {
continue;
}
output.push(this.commandToToolbarButton(commandName, whenClauseContext));
try {
output.push(this.commandToToolbarButton(commandName, whenClauseContext));
} catch (error) {
logger.error('Unable to add toolbar button for command', commandName, '. Error: ', error);
}
}
return stateUtils.selectArrayShallow({ array: output }, commandNames.join('_'));