1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-11 18:24:43 +02:00

Desktop: Fixes #4505: Make plugin links clickable from search (#4548)

This commit is contained in:
Roman Musin 2021-03-10 19:12:43 +00:00 committed by GitHub
parent 286a31a7f7
commit 876fcfe008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import * as React from 'react';
import { useCallback } from 'react';
import { useCallback, useMemo } from 'react';
import { _ } from '@joplin/lib/locale';
import styled from 'styled-components';
import ToggleButton from '../../../lib/ToggleButton/ToggleButton';
@ -134,12 +134,15 @@ const StyledDescription = styled.div`
`;
export default function(props: Props) {
const item = props.item ? props.item : manifestToItem(props.manifest);
const item = useMemo(() => {
return props.item ? props.item : manifestToItem(props.manifest);
}, [props.item, props.manifest]);
const onNameClick = useCallback(() => {
if (!props.item.manifest.homepage_url) return;
bridge().openExternal(props.item.manifest.homepage_url);
}, [props.item]);
const manifest = item.manifest;
if (!manifest.homepage_url) return;
bridge().openExternal(manifest.homepage_url);
}, [item]);
// For plugins in dev mode things like enabling/disabling or
// uninstalling them doesn't make sense, as that should be done by