feat: right-click to open menu for document/collection links

This commit is contained in:
2024-05-30 00:36:25 +08:00
parent 43cf33fc0a
commit eaea7b043e
6 changed files with 56 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ type Props = {
/** Pass true if the document is currently being displayed */
showDisplayOptions?: boolean;
modal?: boolean;
visible?: boolean;
showToggleEmbeds?: boolean;
showPin?: boolean;
label?: (props: MenuButtonHTMLProps) => React.ReactNode;
@@ -74,6 +75,7 @@ function DocumentMenu({
document,
className,
modal = true,
visible,
showToggleEmbeds,
showDisplayOptions,
label,
@@ -106,6 +108,12 @@ function DocumentMenu({
})
);
React.useEffect(() => {
if (visible !== undefined && menu.visible !== visible) {
menu.setVisible(visible);
}
}, [visible]);
const handleOpen = React.useCallback(async () => {
if (!data && !loading) {
await request();