You've already forked joplin
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:
@@ -2,7 +2,9 @@ import CommandService from '../CommandService';
|
|||||||
import { stateUtils } from '../../reducer';
|
import { stateUtils } from '../../reducer';
|
||||||
import focusEditorIfEditorCommand from './focusEditorIfEditorCommand';
|
import focusEditorIfEditorCommand from './focusEditorIfEditorCommand';
|
||||||
import { WhenClauseContext } from './stateToWhenClauseContext';
|
import { WhenClauseContext } from './stateToWhenClauseContext';
|
||||||
|
import Logger from '@joplin/utils/Logger';
|
||||||
|
|
||||||
|
const logger = Logger.create('ToolbarButtonUtils');
|
||||||
|
|
||||||
export interface ToolbarButtonInfo {
|
export interface ToolbarButtonInfo {
|
||||||
type: 'button';
|
type: 'button';
|
||||||
@@ -94,7 +96,11 @@ export default class ToolbarButtonUtils {
|
|||||||
continue;
|
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('_'));
|
return stateUtils.selectArrayShallow({ array: output }, commandNames.join('_'));
|
||||||
|
|||||||
Reference in New Issue
Block a user