1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Plugins: Add command to hide the plugin panel viewer (#12018)

This commit is contained in:
Henry Heino
2025-03-28 05:40:36 -07:00
committed by GitHub
parent 98fe57e87a
commit 1fed875140
5 changed files with 23 additions and 7 deletions

View File

@ -583,6 +583,7 @@ packages/app-desktop/utils/restartInSafeModeFromMain.test.js
packages/app-desktop/utils/restartInSafeModeFromMain.js packages/app-desktop/utils/restartInSafeModeFromMain.js
packages/app-desktop/utils/window/types.js packages/app-desktop/utils/window/types.js
packages/app-mobile/PluginAssetsLoader.js packages/app-mobile/PluginAssetsLoader.js
packages/app-mobile/commands/dismissPluginPanels.js
packages/app-mobile/commands/index.js packages/app-mobile/commands/index.js
packages/app-mobile/commands/newNote.test.js packages/app-mobile/commands/newNote.test.js
packages/app-mobile/commands/newNote.js packages/app-mobile/commands/newNote.js

1
.gitignore vendored
View File

@ -558,6 +558,7 @@ packages/app-desktop/utils/restartInSafeModeFromMain.test.js
packages/app-desktop/utils/restartInSafeModeFromMain.js packages/app-desktop/utils/restartInSafeModeFromMain.js
packages/app-desktop/utils/window/types.js packages/app-desktop/utils/window/types.js
packages/app-mobile/PluginAssetsLoader.js packages/app-mobile/PluginAssetsLoader.js
packages/app-mobile/commands/dismissPluginPanels.js
packages/app-mobile/commands/index.js packages/app-mobile/commands/index.js
packages/app-mobile/commands/newNote.test.js packages/app-mobile/commands/newNote.test.js
packages/app-mobile/commands/newNote.js packages/app-mobile/commands/newNote.js

View File

@ -0,0 +1,16 @@
import { CommandRuntime, CommandDeclaration, CommandContext } from '@joplin/lib/services/CommandService';
export const declaration: CommandDeclaration = {
name: 'dismissPluginPanels',
};
export const runtime = (): CommandRuntime => {
return {
execute: async (context: CommandContext) => {
context.dispatch({
type: 'SET_PLUGIN_PANELS_DIALOG_VISIBLE',
visible: false,
});
},
};
};

View File

@ -1,10 +1,12 @@
// AUTO-GENERATED using `gulp buildScriptIndexes` // AUTO-GENERATED using `gulp buildScriptIndexes`
import * as dismissPluginPanels from './dismissPluginPanels';
import * as newNote from './newNote'; import * as newNote from './newNote';
import * as openItem from './openItem'; import * as openItem from './openItem';
import * as openNote from './openNote'; import * as openNote from './openNote';
import * as scrollToHash from './scrollToHash'; import * as scrollToHash from './scrollToHash';
const index: any[] = [ const index: any[] = [
dismissPluginPanels,
newNote, newNote,
openItem, openItem,
openNote, openNote,

View File

@ -12,8 +12,8 @@ import PluginUserWebView from './PluginUserWebView';
import { View, StyleSheet, AccessibilityInfo } from 'react-native'; import { View, StyleSheet, AccessibilityInfo } from 'react-native';
import { _ } from '@joplin/lib/locale'; import { _ } from '@joplin/lib/locale';
import Setting from '@joplin/lib/models/Setting'; import Setting from '@joplin/lib/models/Setting';
import { Dispatch } from 'redux';
import DismissibleDialog, { DialogSize } from '../../../components/DismissibleDialog'; import DismissibleDialog, { DialogSize } from '../../../components/DismissibleDialog';
import CommandService from '@joplin/lib/services/CommandService';
interface Props { interface Props {
themeId: number; themeId: number;
@ -21,7 +21,6 @@ interface Props {
pluginHtmlContents: PluginHtmlContents; pluginHtmlContents: PluginHtmlContents;
pluginStates: PluginStates; pluginStates: PluginStates;
visible: boolean; visible: boolean;
dispatch: Dispatch;
} }
@ -157,11 +156,8 @@ const PluginPanelViewer: React.FC<Props> = props => {
}; };
const onClose = useCallback(() => { const onClose = useCallback(() => {
props.dispatch({ void CommandService.instance().execute('dismissPluginPanels');
type: 'SET_PLUGIN_PANELS_DIALOG_VISIBLE', }, []);
visible: false,
});
}, [props.dispatch]);
return ( return (
<Portal> <Portal>