1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-30 10:36:35 +02:00

Desktop: Fixes #9855: Allow using editor commands in the command palette (#9861)

This commit is contained in:
Henry Heino 2024-02-06 08:20:15 -08:00 committed by GitHub
parent e462881502
commit 8b9ce9ec72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 2 deletions

View File

@ -54,6 +54,16 @@ describe('editorCommandDeclarations', () => {
},
true,
],
[
// In the Markdown editor, and the command palette is visible
{
markdownEditorPaneVisible: true,
richTextEditorVisible: false,
gotoAnythingVisible: true,
modalDialogVisible: true,
},
true,
],
])('should create the enabledCondition', (context: Record<string, any>, expected: boolean) => {
const condition = enabledCondition('textBold');
const wc = new WhenClause(condition);

View File

@ -11,8 +11,9 @@ export const enabledCondition = (commandName: string) => {
const noteMustBeMarkdown = !workWithHtmlNotes.includes(commandName);
const output = [
'!modalDialogVisible',
'!gotoAnythingVisible',
// gotoAnythingVisible: Enable if the command palette (which is a modal dialog) is visible
'(!modalDialogVisible || gotoAnythingVisible)',
markdownEditorOnly ? 'markdownEditorPaneVisible' : '(markdownEditorPaneVisible || richTextEditorVisible)',
'oneNoteSelected',
noteMustBeMarkdown ? 'noteIsMarkdown' : '',