You've already forked joplin
							
							
				mirror of
				https://github.com/laurent22/joplin.git
				synced 2025-10-31 00:07:48 +02:00 
			
		
		
		
	Merge branch 'release-2.10' into dev
This commit is contained in:
		| @@ -21,7 +21,7 @@ import checkForUpdates from '../checkForUpdates'; | ||||
| const { connect } = require('react-redux'); | ||||
| import { reg } from '@joplin/lib/registry'; | ||||
| import { ProfileConfig } from '@joplin/lib/services/profileConfig/types'; | ||||
| import PluginService from '@joplin/lib/services/plugins/PluginService'; | ||||
| import PluginService, { PluginSettings } from '@joplin/lib/services/plugins/PluginService'; | ||||
| const packageInfo = require('../packageInfo.js'); | ||||
| const { clipboard } = require('electron'); | ||||
| const Menu = bridge().Menu; | ||||
| @@ -128,6 +128,7 @@ interface Props { | ||||
| 	customCss: string; | ||||
| 	locale: string; | ||||
| 	profileConfig: ProfileConfig; | ||||
| 	pluginSettings: PluginSettings; | ||||
| } | ||||
|  | ||||
| const commandNames: string[] = menuCommandNames(); | ||||
| @@ -487,7 +488,7 @@ function useMenu(props: Props) { | ||||
| 			} | ||||
|  | ||||
| 			function _showAbout() { | ||||
| 				const v = versionInfo(packageInfo, PluginService.instance().plugins); | ||||
| 				const v = versionInfo(packageInfo, PluginService.instance().enabledPlugins(props.pluginSettings)); | ||||
|  | ||||
| 				const copyToClipboard = bridge().showMessageBox(v.message, { | ||||
| 					icon: `${bridge().electronApp().buildDir()}/icons/128x128.png`, | ||||
| @@ -930,6 +931,7 @@ function useMenu(props: Props) { | ||||
| 		props['spellChecker.languages'], | ||||
| 		// eslint-disable-next-line @seiyab/react-hooks/exhaustive-deps -- Old code before rule was applied | ||||
| 		props['spellChecker.enabled'], | ||||
| 		props.pluginSettings, | ||||
| 		props.customCss, | ||||
| 		props.locale, | ||||
| 		props.profileConfig, | ||||
| @@ -985,6 +987,7 @@ const mapStateToProps = (state: AppState) => { | ||||
| 		['folders.sortOrder.field']: state.settings['folders.sortOrder.field'], | ||||
| 		['notes.sortOrder.reverse']: state.settings['notes.sortOrder.reverse'], | ||||
| 		['folders.sortOrder.reverse']: state.settings['folders.sortOrder.reverse'], | ||||
| 		pluginSettings: state.settings['plugins.states'], | ||||
| 		showNoteCounts: state.settings.showNoteCounts, | ||||
| 		uncompletedTodosOnTop: state.settings.uncompletedTodosOnTop, | ||||
| 		showCompletedTodos: state.settings.showCompletedTodos, | ||||
|   | ||||
| @@ -100,6 +100,11 @@ export default class PluginService extends BaseService { | ||||
| 		return this.plugins_; | ||||
| 	} | ||||
|  | ||||
| 	public enabledPlugins(pluginSettings: PluginSettings): Plugins { | ||||
| 		const enabledPlugins = Object.fromEntries(Object.entries(this.plugins_).filter((p) => this.pluginEnabled(pluginSettings, p[0]))); | ||||
| 		return enabledPlugins; | ||||
| 	} | ||||
|  | ||||
| 	public get pluginIds(): string[] { | ||||
| 		return Object.keys(this.plugins_); | ||||
| 	} | ||||
|   | ||||
| @@ -2,8 +2,6 @@ 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'); | ||||
|  | ||||
| @@ -66,10 +64,6 @@ 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/); | ||||
| @@ -93,12 +87,6 @@ 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/); | ||||
| @@ -124,12 +112,6 @@ 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'; | ||||
|   | ||||
| @@ -2,7 +2,6 @@ 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; | ||||
| @@ -11,16 +10,13 @@ interface PluginList { | ||||
|  | ||||
| function getPluginLists(plugins: Plugins): PluginList { | ||||
| 	const pluginList = []; | ||||
| 	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}`); | ||||
| 	if (Object.keys(plugins).length > 0) { | ||||
| 		for (const pluginId in plugins) { | ||||
| 			pluginList.push(`${plugins[pluginId].manifest.name}: ${plugins[pluginId].manifest.version}`); | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	pluginList.sort(); | ||||
| 	pluginList.sort(Intl.Collator().compare); | ||||
|  | ||||
| 	let completeList = ''; | ||||
| 	let summary = ''; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user