1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Desktop: Added button to browse plugins

This commit is contained in:
Laurent Cozic 2021-01-21 22:57:09 +00:00
parent 63493214a0
commit 43a8f4a46e
2 changed files with 18 additions and 10 deletions

View File

@ -100,11 +100,11 @@ const StyledName = styled.div`
color: ${props => props.theme.color};
font-size: ${props => props.theme.fontSize}px;
font-weight: bold;
padding-right: 5px;
flex: 1;
`;
const StyledVersion = styled.span`
margin-left: 5px;
const StyledVersion = styled.span`
color: ${props => props.theme.colorFaded};
font-size: ${props => props.theme.fontSize * 0.9}px;
`;
@ -190,7 +190,7 @@ export default function(props: Props) {
return (
<CellRoot>
<CellTop>
<StyledName mb={'5px'}>{item.name} {item.deleted ? '(Deleted)' : ''} <StyledVersion>v{item.version}</StyledVersion></StyledName>
<StyledName mb={'5px'}><span style={{ marginRight: 5 }}>{item.name} {item.deleted ? '(Deleted)' : ''}</span><StyledVersion>v{item.version}</StyledVersion></StyledName>
{renderToggleButton()}
</CellTop>
<CellContent>

View File

@ -172,6 +172,10 @@ export default function(props: Props) {
props.onChange({ value: pluginService.serializePluginSettings(newSettings) });
}, [pluginSettings, props.onChange]);
const onBrowsePlugins = useCallback(() => {
bridge().openExternal('https://github.com/joplin/plugins/blob/master/README.md#plugins');
}, []);
const onPluginSettingsChange = useCallback((event: OnPluginSettingChangeEvent) => {
props.onChange({ value: pluginService.serializePluginSettings(event.value) });
}, []);
@ -179,16 +183,20 @@ export default function(props: Props) {
const onUpdate = useOnInstallHandler(setUpdatingPluginIds, pluginSettings, repoApi, onPluginSettingsChange, true);
const onToolsClick = useCallback(async () => {
const template = [];
template.push({
label: _('Install from file'),
click: onInstall,
});
const template = [
{
label: _('Browse all plugins'),
click: onBrowsePlugins,
},
{
label: _('Install from file'),
click: onInstall,
},
];
const menu = bridge().Menu.buildFromTemplate(template);
menu.popup(bridge().window());
}, [onInstall]);
}, [onInstall, onBrowsePlugins]);
const onSearchQueryChange = useCallback((event: OnChangeEvent) => {
setSearchQuery(event.value);