1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +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
2 changed files with 13 additions and 2 deletions

View File

@ -54,6 +54,16 @@ describe('editorCommandDeclarations', () => {
}, },
true, 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) => { ])('should create the enabledCondition', (context: Record<string, any>, expected: boolean) => {
const condition = enabledCondition('textBold'); const condition = enabledCondition('textBold');
const wc = new WhenClause(condition); const wc = new WhenClause(condition);

View File

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