From 3a744c79ae95076e97962607ea019229a240172e Mon Sep 17 00:00:00 2001 From: Julien <32807437+julien-me@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:41:33 +0800 Subject: [PATCH 1/3] Desktop: Fixes #7920: List enabled plugins only in About Joplin and in alphabetical order (#7923) --- packages/app-desktop/gui/MenuBar.tsx | 1 - packages/lib/versionInfo.test.ts | 20 ++++++++++++++++++++ packages/lib/versionInfo.ts | 12 +++++++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/packages/app-desktop/gui/MenuBar.tsx b/packages/app-desktop/gui/MenuBar.tsx index efa70d082..22cf6dbab 100644 --- a/packages/app-desktop/gui/MenuBar.tsx +++ b/packages/app-desktop/gui/MenuBar.tsx @@ -489,7 +489,6 @@ function useMenu(props: Props) { function _showAbout() { const v = versionInfo(packageInfo, PluginService.instance().plugins); - const copyToClipboard = bridge().showMessageBox(v.message, { icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`, buttons: [_('Copy'), _('OK')], diff --git a/packages/lib/versionInfo.test.ts b/packages/lib/versionInfo.test.ts index 0897e3d22..5faa204d7 100644 --- a/packages/lib/versionInfo.test.ts +++ b/packages/lib/versionInfo.test.ts @@ -2,6 +2,8 @@ import versionInfo from './versionInfo'; import { reg } from './registry'; import { Plugins } from './services/plugins/PluginService'; import Plugin from './services/plugins/Plugin'; +import Setting from './models/Setting'; +import { PluginSettings } from './services/plugins/PluginService'; jest.mock('./registry'); @@ -64,6 +66,10 @@ describe('getPluginLists', () => { const plugins: Plugins = {}; plugins[plugin.manifest.id] = plugin; + const pluginSettings: PluginSettings = {}; + pluginSettings[plugin.id] = { enabled: true, deleted: false, hasBeenUpdated: false }; + Setting.setValue('plugins.states', pluginSettings); + const v = versionInfo(packageInfo, plugins); expect(v.body).toMatch(/\n\nPlugin1: 1/); expect(v.message).toMatch(/\n\nPlugin1: 1/); @@ -86,6 +92,13 @@ describe('getPluginLists', () => { ); plugins[plugin.manifest.id] = plugin; } + + const pluginSettings: PluginSettings = {}; + for (const key of Object.keys(plugins)) { + pluginSettings[key] = { enabled: true, deleted: false, hasBeenUpdated: false }; + } + Setting.setValue('plugins.states', pluginSettings); + const v = versionInfo(packageInfo, plugins); expect(v.body).toMatch(/\n\nPlugin1: 1\nPlugin2: 1\nPlugin3: 1/); @@ -110,6 +123,13 @@ describe('getPluginLists', () => { plugins[plugin.manifest.id] = plugin; } + + const pluginSettings: PluginSettings = {}; + for (const key of Object.keys(plugins)) { + pluginSettings[key] = { enabled: true, deleted: false, hasBeenUpdated: false }; + } + Setting.setValue('plugins.states', pluginSettings); + const v = versionInfo(packageInfo, plugins); const body = '\n'; diff --git a/packages/lib/versionInfo.ts b/packages/lib/versionInfo.ts index 867440fc4..7ee4b67f0 100644 --- a/packages/lib/versionInfo.ts +++ b/packages/lib/versionInfo.ts @@ -2,6 +2,7 @@ import { _ } from './locale'; import Setting from './models/Setting'; import { reg } from './registry'; import { Plugins } from './services/plugins/PluginService'; +import PluginService from './services/plugins/PluginService'; interface PluginList { completeList: string; @@ -10,12 +11,17 @@ interface PluginList { function getPluginLists(plugins: Plugins): PluginList { const pluginList = []; - if (Object.keys(plugins).length > 0) { - for (const pluginId in plugins) { - pluginList.push(`${plugins[pluginId].manifest.name}: ${plugins[pluginId].manifest.version}`); + const pluginSettings = PluginService.instance().unserializePluginSettings(Setting.value('plugins.states')); + const enabledPlugins = Object.fromEntries(Object.entries(plugins).filter((p) => pluginSettings[p[0]] && pluginSettings[p[0]].enabled === true)); + + if (Object.keys(enabledPlugins).length > 0) { + for (const pluginId in enabledPlugins) { + pluginList.push(`${enabledPlugins[pluginId].manifest.name}: ${enabledPlugins[pluginId].manifest.version}`); } } + pluginList.sort(); + let completeList = ''; let summary = ''; if (pluginList.length > 0) { From 5354ad3934a08a6bb8c187d45f90afe16d05e12c Mon Sep 17 00:00:00 2001 From: Julien <32807437+julien-me@users.noreply.github.com> Date: Fri, 17 Mar 2023 16:51:46 +0800 Subject: [PATCH 2/3] Desktop: Fixes text wrap on new buttons (#7938) --- packages/app-desktop/gui/NoteListControls/NoteListControls.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx b/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx index 4534ef584..f490af6ca 100644 --- a/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx +++ b/packages/app-desktop/gui/NoteListControls/NoteListControls.tsx @@ -51,6 +51,7 @@ const StyledButton = styled(Button)` height: 26px; min-height: 26px; max-width: none; + white-space: nowrap; .fa, .fas { font-size: 11px; From 09cbac30196bd845d4080baaedc35e0e05d12545 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Fri, 17 Mar 2023 08:55:09 +0000 Subject: [PATCH 3/3] Desktop release v2.10.11 --- packages/app-desktop/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/app-desktop/package.json b/packages/app-desktop/package.json index 048e739fa..70c1d2dd3 100644 --- a/packages/app-desktop/package.json +++ b/packages/app-desktop/package.json @@ -1,6 +1,6 @@ { "name": "@joplin/app-desktop", - "version": "2.10.10", + "version": "2.10.11", "description": "Joplin for Desktop", "main": "main.js", "private": true,