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

This commit is contained in:
Henry Heino
2024-02-06 16:20:15 +00:00
committed by GitHub
parent e462881502
commit 8b9ce9ec72
2 changed files with 13 additions and 2 deletions
@@ -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);
@@ -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' : '',