diff --git a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts index 6cd97c6fed..79f14f2456 100644 --- a/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts +++ b/packages/app-desktop/gui/NoteEditor/NoteBody/TinyMCE/utils/joplinCommandToTinyMceCommands.ts @@ -22,4 +22,8 @@ export const joplinCommandToTinyMceCommands: JoplinCommandToTinyMceCommands = { 'search': { name: 'SearchReplace' }, 'attachFile': { name: 'joplinAttach' }, 'insertDateTime': true, + 'textCopy': true, + 'textCut': true, + 'textPaste': true, + 'textSelectAll': true, }; diff --git a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts index 3a99d2b4ef..4833d12ece 100644 --- a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts +++ b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.test.ts @@ -17,19 +17,19 @@ describe('editorCommandDeclarations', () => { test.each([ [ {}, - true, + { textBold: true }, ], [ { markdownEditorPaneVisible: false, }, - false, + { textBold: false }, ], [ { noteIsReadOnly: true, }, - false, + { textBold: false }, ], [ // In the Markdown editor, but only the viewer is visible @@ -37,7 +37,7 @@ describe('editorCommandDeclarations', () => { markdownEditorPaneVisible: false, richTextEditorVisible: false, }, - false, + { textBold: false }, ], [ // In the Markdown editor, and the viewer is visible @@ -45,7 +45,7 @@ describe('editorCommandDeclarations', () => { markdownEditorPaneVisible: true, richTextEditorVisible: false, }, - true, + { textBold: true }, ], [ // In the RT editor @@ -53,7 +53,7 @@ describe('editorCommandDeclarations', () => { markdownEditorPaneVisible: false, richTextEditorVisible: true, }, - true, + { textBold: true }, ], [ // In the Markdown editor, and the command palette is visible @@ -63,14 +63,57 @@ describe('editorCommandDeclarations', () => { gotoAnythingVisible: true, modalDialogVisible: true, }, - true, + { textBold: true }, ], - // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied - ])('should create the enabledCondition', (context: Record, expected: boolean) => { - const condition = enabledCondition('textBold'); - const wc = new WhenClause(condition); - const actual = wc.evaluate({ ...baseContext, ...context }); - expect(actual).toBe(expected); + [ + // In the Markdown editor, and the command palette is visible + { + markdownEditorPaneVisible: true, + richTextEditorVisible: false, + gotoAnythingVisible: true, + modalDialogVisible: true, + }, + { textBold: true }, + ], + [ + // Rich Text Editor, HTML note + { + markdownEditorPaneVisible: false, + richTextEditorVisible: true, + noteIsMarkdown: false, + }, + { + textCopy: true, + textPaste: true, + textSelectAll: true, + }, + ], + [ + // Rich Text Editor, read-only note + { + markdownEditorPaneVisible: false, + richTextEditorVisible: true, + noteIsReadOnly: true, + }, + { + textBold: false, + textPaste: false, + + // TODO: textCopy should be enabled in read-only notes: + // textCopy: false, + }, + ], + ])('should correctly determine whether command is enabled (case %#)', (context, expectedStates) => { + const actualStates = []; + for (const commandName of Object.keys(expectedStates)) { + const condition = enabledCondition(commandName); + const wc = new WhenClause(condition); + const actual = wc.evaluate({ ...baseContext, ...context }); + actualStates.push([commandName, actual]); + } + + const expectedStatesArray = Object.entries(expectedStates); + expect(actualStates).toEqual(expectedStatesArray); }); }); diff --git a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts index ea3540fc46..d7da054a12 100644 --- a/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts +++ b/packages/app-desktop/gui/NoteEditor/editorCommandDeclarations.ts @@ -4,6 +4,10 @@ import { joplinCommandToTinyMceCommands } from './NoteBody/TinyMCE/utils/joplinC const workWithHtmlNotes = [ 'attachFile', + 'textCopy', + 'textCut', + 'textPaste', + 'textSelectAll', ]; export const enabledCondition = (commandName: string) => { diff --git a/packages/app-desktop/services/autoUpdater/AutoUpdaterService.ts b/packages/app-desktop/services/autoUpdater/AutoUpdaterService.ts index 86faae4283..1cc2aef92e 100644 --- a/packages/app-desktop/services/autoUpdater/AutoUpdaterService.ts +++ b/packages/app-desktop/services/autoUpdater/AutoUpdaterService.ts @@ -140,7 +140,10 @@ export default class AutoUpdaterService implements AutoUpdaterServiceInterface { // electron's autoUpdater appends automatically the platform's yml file to the link so we should remove it assetUrl = assetUrl.substring(0, assetUrl.lastIndexOf('/')); autoUpdater.setFeedURL({ provider: 'generic', url: assetUrl }); - await autoUpdater.checkForUpdates(); + const result = await autoUpdater.checkForUpdates(); + + // Wait for the installation to finish. By default, .checkForUpdates runs in the background + await result.downloadPromise; } catch (error) { this.logger_.error(`Update download url failed: ${error.message}`); this.isUpdateInProgress = false;