feat(core): add context menu for navigation and explorer (#13216)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced a customizable context menu component for desktop interfaces, enabling right-click menus in various UI elements. * Added context menu support to document list items and navigation tree nodes, allowing users to access additional operations via right-click. * **Improvements** * Enhanced submenu and menu item components to support both dropdown and context menu variants based on context. * Updated click handling in workbench links to prevent unintended actions on non-left mouse button clicks. * **Chores** * Added `@radix-ui/react-context-menu` as a dependency to relevant frontend packages. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -34,6 +34,7 @@
|
|||||||
"@emotion/styled": "^11.14.0",
|
"@emotion/styled": "^11.14.0",
|
||||||
"@radix-ui/react-avatar": "^1.1.2",
|
"@radix-ui/react-avatar": "^1.1.2",
|
||||||
"@radix-ui/react-collapsible": "^1.1.2",
|
"@radix-ui/react-collapsible": "^1.1.2",
|
||||||
|
"@radix-ui/react-context-menu": "^2.2.15",
|
||||||
"@radix-ui/react-dialog": "^1.1.3",
|
"@radix-ui/react-dialog": "^1.1.3",
|
||||||
"@radix-ui/react-dropdown-menu": "^2.1.3",
|
"@radix-ui/react-dropdown-menu": "^2.1.3",
|
||||||
"@radix-ui/react-popover": "^1.1.3",
|
"@radix-ui/react-popover": "^1.1.3",
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import * as RadixContextMenu from '@radix-ui/react-context-menu';
|
||||||
|
import clsx from 'clsx';
|
||||||
|
import type { RefAttributes } from 'react';
|
||||||
|
|
||||||
|
import * as styles from '../styles.css';
|
||||||
|
import { DesktopMenuContext } from './context';
|
||||||
|
import * as desktopStyles from './styles.css';
|
||||||
|
|
||||||
|
export type ContextMenuProps = RadixContextMenu.ContextMenuProps &
|
||||||
|
RadixContextMenu.ContextMenuTriggerProps &
|
||||||
|
RefAttributes<HTMLSpanElement> & {
|
||||||
|
items: React.ReactNode;
|
||||||
|
contentProps?: RadixContextMenu.ContextMenuContentProps;
|
||||||
|
};
|
||||||
|
|
||||||
|
const ContextMenuContextValue = {
|
||||||
|
type: 'context-menu',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
export const ContextMenu = ({
|
||||||
|
children,
|
||||||
|
onOpenChange,
|
||||||
|
dir,
|
||||||
|
modal,
|
||||||
|
items,
|
||||||
|
contentProps,
|
||||||
|
...props
|
||||||
|
}: ContextMenuProps) => {
|
||||||
|
return (
|
||||||
|
<DesktopMenuContext.Provider value={ContextMenuContextValue}>
|
||||||
|
<RadixContextMenu.Root
|
||||||
|
onOpenChange={onOpenChange}
|
||||||
|
dir={dir}
|
||||||
|
modal={modal}
|
||||||
|
>
|
||||||
|
<RadixContextMenu.Trigger {...props}>
|
||||||
|
{children}
|
||||||
|
</RadixContextMenu.Trigger>
|
||||||
|
<RadixContextMenu.Portal>
|
||||||
|
<RadixContextMenu.Content
|
||||||
|
className={clsx(
|
||||||
|
styles.menuContent,
|
||||||
|
desktopStyles.contentAnimation,
|
||||||
|
contentProps?.className
|
||||||
|
)}
|
||||||
|
style={{
|
||||||
|
zIndex: 'var(--affine-z-index-popover)',
|
||||||
|
...contentProps?.style,
|
||||||
|
}}
|
||||||
|
{...contentProps}
|
||||||
|
>
|
||||||
|
{items}
|
||||||
|
</RadixContextMenu.Content>
|
||||||
|
</RadixContextMenu.Portal>
|
||||||
|
</RadixContextMenu.Root>
|
||||||
|
</DesktopMenuContext.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { createContext } from 'react';
|
||||||
|
|
||||||
|
interface DesktopMenuContextValue {
|
||||||
|
type: 'dropdown-menu' | 'context-menu';
|
||||||
|
}
|
||||||
|
|
||||||
|
export const DesktopMenuContext = createContext<DesktopMenuContextValue>({
|
||||||
|
type: 'dropdown-menu',
|
||||||
|
});
|
||||||
@@ -1,13 +1,30 @@
|
|||||||
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
||||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||||
|
import { useContext } from 'react';
|
||||||
|
|
||||||
import type { MenuItemProps } from '../menu.types';
|
import type { MenuItemProps } from '../menu.types';
|
||||||
import { useMenuItem } from '../use-menu-item';
|
import { useMenuItem } from '../use-menu-item';
|
||||||
|
import { DesktopMenuContext } from './context';
|
||||||
|
|
||||||
export const DesktopMenuItem = (props: MenuItemProps) => {
|
export const DesktopMenuItem = (props: MenuItemProps) => {
|
||||||
|
const { type } = useContext(DesktopMenuContext);
|
||||||
const { className, children, otherProps } = useMenuItem(props);
|
const { className, children, otherProps } = useMenuItem(props);
|
||||||
return (
|
|
||||||
<DropdownMenu.Item className={className} {...otherProps}>
|
if (type === 'dropdown-menu') {
|
||||||
{children}
|
return (
|
||||||
</DropdownMenu.Item>
|
<DropdownMenu.Item className={className} {...otherProps}>
|
||||||
);
|
{children}
|
||||||
|
</DropdownMenu.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type === 'context-menu') {
|
||||||
|
return (
|
||||||
|
<ContextMenu.Item className={className} {...otherProps}>
|
||||||
|
{children}
|
||||||
|
</ContextMenu.Item>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,8 +4,13 @@ import React, { useCallback, useImperativeHandle, useState } from 'react';
|
|||||||
|
|
||||||
import type { MenuProps } from '../menu.types';
|
import type { MenuProps } from '../menu.types';
|
||||||
import * as styles from '../styles.css';
|
import * as styles from '../styles.css';
|
||||||
|
import { DesktopMenuContext } from './context';
|
||||||
import * as desktopStyles from './styles.css';
|
import * as desktopStyles from './styles.css';
|
||||||
|
|
||||||
|
const MenuContextValue = {
|
||||||
|
type: 'dropdown-menu',
|
||||||
|
} as const;
|
||||||
|
|
||||||
export const DesktopMenu = ({
|
export const DesktopMenu = ({
|
||||||
children,
|
children,
|
||||||
items,
|
items,
|
||||||
@@ -53,37 +58,39 @@ export const DesktopMenu = ({
|
|||||||
|
|
||||||
const ContentWrapper = noPortal ? React.Fragment : DropdownMenu.Portal;
|
const ContentWrapper = noPortal ? React.Fragment : DropdownMenu.Portal;
|
||||||
return (
|
return (
|
||||||
<DropdownMenu.Root
|
<DesktopMenuContext.Provider value={MenuContextValue}>
|
||||||
modal={modal ?? false}
|
<DropdownMenu.Root
|
||||||
open={finalOpen}
|
modal={modal ?? false}
|
||||||
onOpenChange={handleOpenChange}
|
open={finalOpen}
|
||||||
{...rootOptions}
|
onOpenChange={handleOpenChange}
|
||||||
>
|
{...rootOptions}
|
||||||
<DropdownMenu.Trigger
|
|
||||||
asChild
|
|
||||||
onClick={e => {
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
{children}
|
<DropdownMenu.Trigger
|
||||||
</DropdownMenu.Trigger>
|
asChild
|
||||||
|
onClick={e => {
|
||||||
<ContentWrapper {...portalOptions}>
|
e.stopPropagation();
|
||||||
<DropdownMenu.Content
|
e.preventDefault();
|
||||||
className={clsx(
|
}}
|
||||||
styles.menuContent,
|
|
||||||
desktopStyles.contentAnimation,
|
|
||||||
className
|
|
||||||
)}
|
|
||||||
sideOffset={4}
|
|
||||||
align="start"
|
|
||||||
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
|
||||||
{...otherContentOptions}
|
|
||||||
>
|
>
|
||||||
{items}
|
{children}
|
||||||
</DropdownMenu.Content>
|
</DropdownMenu.Trigger>
|
||||||
</ContentWrapper>
|
|
||||||
</DropdownMenu.Root>
|
<ContentWrapper {...portalOptions}>
|
||||||
|
<DropdownMenu.Content
|
||||||
|
className={clsx(
|
||||||
|
styles.menuContent,
|
||||||
|
desktopStyles.contentAnimation,
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
sideOffset={4}
|
||||||
|
align="start"
|
||||||
|
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
||||||
|
{...otherContentOptions}
|
||||||
|
>
|
||||||
|
{items}
|
||||||
|
</DropdownMenu.Content>
|
||||||
|
</ContentWrapper>
|
||||||
|
</DropdownMenu.Root>
|
||||||
|
</DesktopMenuContext.Provider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
import { ArrowRightSmallIcon } from '@blocksuite/icons/rc';
|
||||||
|
import * as ContextMenu from '@radix-ui/react-context-menu';
|
||||||
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { useMemo } from 'react';
|
import { useContext, useMemo } from 'react';
|
||||||
|
|
||||||
import type { MenuSubProps } from '../menu.types';
|
import type { MenuSubProps } from '../menu.types';
|
||||||
import * as styles from '../styles.css';
|
import * as styles from '../styles.css';
|
||||||
import { useMenuItem } from '../use-menu-item';
|
import { useMenuItem } from '../use-menu-item';
|
||||||
|
import { DesktopMenuContext } from './context';
|
||||||
|
|
||||||
export const DesktopMenuSub = ({
|
export const DesktopMenuSub = ({
|
||||||
children: propsChildren,
|
children: propsChildren,
|
||||||
@@ -19,12 +21,37 @@ export const DesktopMenuSub = ({
|
|||||||
...otherSubContentOptions
|
...otherSubContentOptions
|
||||||
} = {},
|
} = {},
|
||||||
}: MenuSubProps) => {
|
}: MenuSubProps) => {
|
||||||
|
const { type } = useContext(DesktopMenuContext);
|
||||||
const { className, children, otherProps } = useMenuItem({
|
const { className, children, otherProps } = useMenuItem({
|
||||||
children: propsChildren,
|
children: propsChildren,
|
||||||
suffixIcon: <ArrowRightSmallIcon />,
|
suffixIcon: <ArrowRightSmallIcon />,
|
||||||
...triggerOptions,
|
...triggerOptions,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const contentClassName = useMemo(
|
||||||
|
() => clsx(styles.menuContent, subContentClassName),
|
||||||
|
[subContentClassName]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (type === 'context-menu') {
|
||||||
|
return (
|
||||||
|
<ContextMenu.Sub defaultOpen={defaultOpen} {...otherSubOptions}>
|
||||||
|
<ContextMenu.SubTrigger className={className} {...otherProps}>
|
||||||
|
{children}
|
||||||
|
</ContextMenu.SubTrigger>
|
||||||
|
<ContextMenu.Portal {...portalOptions}>
|
||||||
|
<ContextMenu.SubContent
|
||||||
|
className={contentClassName}
|
||||||
|
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
||||||
|
{...otherSubContentOptions}
|
||||||
|
>
|
||||||
|
{items}
|
||||||
|
</ContextMenu.SubContent>
|
||||||
|
</ContextMenu.Portal>
|
||||||
|
</ContextMenu.Sub>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu.Sub defaultOpen={defaultOpen} {...otherSubOptions}>
|
<DropdownMenu.Sub defaultOpen={defaultOpen} {...otherSubOptions}>
|
||||||
<DropdownMenu.SubTrigger className={className} {...otherProps}>
|
<DropdownMenu.SubTrigger className={className} {...otherProps}>
|
||||||
@@ -32,10 +59,7 @@ export const DesktopMenuSub = ({
|
|||||||
</DropdownMenu.SubTrigger>
|
</DropdownMenu.SubTrigger>
|
||||||
<DropdownMenu.Portal {...portalOptions}>
|
<DropdownMenu.Portal {...portalOptions}>
|
||||||
<DropdownMenu.SubContent
|
<DropdownMenu.SubContent
|
||||||
className={useMemo(
|
className={contentClassName}
|
||||||
() => clsx(styles.menuContent, subContentClassName),
|
|
||||||
[subContentClassName]
|
|
||||||
)}
|
|
||||||
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
style={{ zIndex: 'var(--affine-z-index-popover)', ...contentStyle }}
|
||||||
{...otherSubContentOptions}
|
{...otherSubContentOptions}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export * from './menu.types';
|
export * from './menu.types';
|
||||||
|
import { ContextMenu } from './desktop/context-menu';
|
||||||
import { DesktopMenuItem } from './desktop/item';
|
import { DesktopMenuItem } from './desktop/item';
|
||||||
import { DesktopMenu } from './desktop/root';
|
import { DesktopMenu } from './desktop/root';
|
||||||
import { DesktopMenuSeparator } from './desktop/separator';
|
import { DesktopMenuSeparator } from './desktop/separator';
|
||||||
@@ -19,6 +20,7 @@ const MenuSub = BUILD_CONFIG.isMobileEdition ? MobileMenuSub : DesktopMenuSub;
|
|||||||
const Menu = BUILD_CONFIG.isMobileEdition ? MobileMenu : DesktopMenu;
|
const Menu = BUILD_CONFIG.isMobileEdition ? MobileMenu : DesktopMenu;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
ContextMenu,
|
||||||
DesktopMenu,
|
DesktopMenu,
|
||||||
DesktopMenuItem,
|
DesktopMenuItem,
|
||||||
DesktopMenuSeparator,
|
DesktopMenuSeparator,
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
"@marsidev/react-turnstile": "^1.1.0",
|
"@marsidev/react-turnstile": "^1.1.0",
|
||||||
"@preact/signals-core": "^1.8.0",
|
"@preact/signals-core": "^1.8.0",
|
||||||
"@radix-ui/react-collapsible": "^1.1.2",
|
"@radix-ui/react-collapsible": "^1.1.2",
|
||||||
|
"@radix-ui/react-context-menu": "^2.1.15",
|
||||||
"@radix-ui/react-dialog": "^1.1.3",
|
"@radix-ui/react-dialog": "^1.1.3",
|
||||||
"@radix-ui/react-popover": "^1.1.3",
|
"@radix-ui/react-popover": "^1.1.3",
|
||||||
"@radix-ui/react-scroll-area": "^1.2.2",
|
"@radix-ui/react-scroll-area": "^1.2.2",
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
ContextMenu,
|
||||||
DragHandle as DragHandleIcon,
|
DragHandle as DragHandleIcon,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
useDraggable,
|
useDraggable,
|
||||||
@@ -29,7 +30,7 @@ import { PagePreview } from '../../page-list/page-content-preview';
|
|||||||
import { DocExplorerContext } from '../context';
|
import { DocExplorerContext } from '../context';
|
||||||
import { quickActions } from '../quick-actions.constants';
|
import { quickActions } from '../quick-actions.constants';
|
||||||
import * as styles from './doc-list-item.css';
|
import * as styles from './doc-list-item.css';
|
||||||
import { MoreMenuButton } from './more-menu';
|
import { MoreMenuButton, MoreMenuContent } from './more-menu';
|
||||||
import { CardViewProperties, ListViewProperties } from './properties';
|
import { CardViewProperties, ListViewProperties } from './properties';
|
||||||
|
|
||||||
export type DocListItemView = 'list' | 'grid' | 'masonry';
|
export type DocListItemView = 'list' | 'grid' | 'masonry';
|
||||||
@@ -314,38 +315,46 @@ export const ListViewDoc = ({ docId }: DocListItemProps) => {
|
|||||||
const t = useI18n();
|
const t = useI18n();
|
||||||
const docsService = useService(DocsService);
|
const docsService = useService(DocsService);
|
||||||
const doc = useLiveData(docsService.list.doc$(docId));
|
const doc = useLiveData(docsService.list.doc$(docId));
|
||||||
|
const contextValue = useContext(DocExplorerContext);
|
||||||
|
const showMoreOperation = useLiveData(contextValue.showMoreOperation$);
|
||||||
|
|
||||||
if (!doc) {
|
if (!doc) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li className={styles.listViewRoot}>
|
<ContextMenu
|
||||||
<DragHandle id={docId} className={styles.listDragHandle} />
|
asChild
|
||||||
<Select id={docId} className={styles.listSelect} />
|
disabled={!showMoreOperation}
|
||||||
<DocIcon id={docId} className={styles.listIcon} />
|
items={<MoreMenuContent docId={docId} />}
|
||||||
<div className={styles.listBrief}>
|
>
|
||||||
<DocTitle
|
<li className={styles.listViewRoot}>
|
||||||
id={docId}
|
<DragHandle id={docId} className={styles.listDragHandle} />
|
||||||
className={styles.listTitle}
|
<Select id={docId} className={styles.listSelect} />
|
||||||
data-testid="doc-list-item-title"
|
<DocIcon id={docId} className={styles.listIcon} />
|
||||||
|
<div className={styles.listBrief}>
|
||||||
|
<DocTitle
|
||||||
|
id={docId}
|
||||||
|
className={styles.listTitle}
|
||||||
|
data-testid="doc-list-item-title"
|
||||||
|
/>
|
||||||
|
<DocPreview id={docId} className={styles.listPreview} />
|
||||||
|
</div>
|
||||||
|
<div className={styles.listSpace} />
|
||||||
|
<ListViewProperties docId={docId} />
|
||||||
|
{quickActions.map(action => {
|
||||||
|
return (
|
||||||
|
<Tooltip key={action.key} content={t.t(action.name)}>
|
||||||
|
<action.Component doc={doc} />
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
<MoreMenuButton
|
||||||
|
docId={docId}
|
||||||
|
contentOptions={listMoreMenuContentOptions}
|
||||||
/>
|
/>
|
||||||
<DocPreview id={docId} className={styles.listPreview} />
|
</li>
|
||||||
</div>
|
</ContextMenu>
|
||||||
<div className={styles.listSpace} />
|
|
||||||
<ListViewProperties docId={docId} />
|
|
||||||
{quickActions.map(action => {
|
|
||||||
return (
|
|
||||||
<Tooltip key={action.key} content={t.t(action.name)}>
|
|
||||||
<action.Component doc={doc} />
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
<MoreMenuButton
|
|
||||||
docId={docId}
|
|
||||||
contentOptions={listMoreMenuContentOptions}
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
ContextMenu,
|
||||||
DropIndicator,
|
DropIndicator,
|
||||||
type DropTargetDropEvent,
|
type DropTargetDropEvent,
|
||||||
type DropTargetOptions,
|
type DropTargetOptions,
|
||||||
@@ -466,47 +467,54 @@ export const NavigationPanelTreeNode = ({
|
|||||||
ref={rootRef}
|
ref={rootRef}
|
||||||
{...otherProps}
|
{...otherProps}
|
||||||
>
|
>
|
||||||
<div
|
<ContextMenu
|
||||||
className={clsx(styles.contentContainer, styles.draggedOverEffect)}
|
asChild
|
||||||
data-open={!collapsed}
|
items={menuOperations.map(({ view, index }) => (
|
||||||
data-self-dragged-over={isSelfDraggedOver}
|
<Fragment key={index}>{view}</Fragment>
|
||||||
ref={dropTargetRef}
|
))}
|
||||||
>
|
>
|
||||||
{to ? (
|
<div
|
||||||
<LinkComponent
|
className={clsx(styles.contentContainer, styles.draggedOverEffect)}
|
||||||
to={to}
|
data-open={!collapsed}
|
||||||
className={styles.linkItemRoot}
|
data-self-dragged-over={isSelfDraggedOver}
|
||||||
ref={dragRef}
|
ref={dropTargetRef}
|
||||||
draggable={false}
|
>
|
||||||
>
|
{to ? (
|
||||||
{content}
|
<LinkComponent
|
||||||
</LinkComponent>
|
to={to}
|
||||||
) : (
|
className={styles.linkItemRoot}
|
||||||
<div ref={dragRef}>{content}</div>
|
ref={dragRef}
|
||||||
)}
|
draggable={false}
|
||||||
<CustomDragPreview>
|
>
|
||||||
<div className={styles.draggingContainer}>{content}</div>
|
{content}
|
||||||
</CustomDragPreview>
|
</LinkComponent>
|
||||||
{treeInstruction &&
|
) : (
|
||||||
// Do not show drop indicator for self dragged over
|
<div ref={dragRef}>{content}</div>
|
||||||
!(treeInstruction.type !== 'reparent' && isSelfDraggedOver) &&
|
|
||||||
treeInstruction.type !== 'instruction-blocked' && (
|
|
||||||
<DropIndicator instruction={treeInstruction} />
|
|
||||||
)}
|
)}
|
||||||
{draggedOver &&
|
<CustomDragPreview>
|
||||||
dropEffect &&
|
<div className={styles.draggingContainer}>{content}</div>
|
||||||
draggedOverPosition &&
|
</CustomDragPreview>
|
||||||
!isSelfDraggedOver &&
|
{treeInstruction &&
|
||||||
draggedOverDraggable && (
|
// Do not show drop indicator for self dragged over
|
||||||
<DropEffect
|
!(treeInstruction.type !== 'reparent' && isSelfDraggedOver) &&
|
||||||
dropEffect={dropEffect({
|
treeInstruction.type !== 'instruction-blocked' && (
|
||||||
source: draggedOverDraggable,
|
<DropIndicator instruction={treeInstruction} />
|
||||||
treeInstruction: treeInstruction,
|
)}
|
||||||
})}
|
{draggedOver &&
|
||||||
position={draggedOverPosition}
|
dropEffect &&
|
||||||
/>
|
draggedOverPosition &&
|
||||||
)}
|
!isSelfDraggedOver &&
|
||||||
</div>
|
draggedOverDraggable && (
|
||||||
|
<DropEffect
|
||||||
|
dropEffect={dropEffect({
|
||||||
|
source: draggedOverDraggable,
|
||||||
|
treeInstruction: treeInstruction,
|
||||||
|
})}
|
||||||
|
position={draggedOverPosition}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</ContextMenu>
|
||||||
<Collapsible.Content style={{ display: dragging ? 'none' : undefined }}>
|
<Collapsible.Content style={{ display: dragging ? 'none' : undefined }}>
|
||||||
{/* For lastInGroup check, the placeholder must be placed above all children in the dom */}
|
{/* For lastInGroup check, the placeholder must be placed above all children in the dom */}
|
||||||
<div className={styles.collapseContentPlaceholder}>
|
<div className={styles.collapseContentPlaceholder}>
|
||||||
|
|||||||
@@ -70,6 +70,9 @@ export const WorkbenchLink = forwardRef<HTMLAnchorElement, WorkbenchLinkProps>(
|
|||||||
if (event.defaultPrevented) {
|
if (event.defaultPrevented) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.button !== 0 && event.button !== 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const at = inferOpenAt(event);
|
const at = inferOpenAt(event);
|
||||||
workbench.open(to, { at, replaceHistory, show: false });
|
workbench.open(to, { at, replaceHistory, show: false });
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|||||||
@@ -320,6 +320,7 @@ __metadata:
|
|||||||
"@emotion/styled": "npm:^11.14.0"
|
"@emotion/styled": "npm:^11.14.0"
|
||||||
"@radix-ui/react-avatar": "npm:^1.1.2"
|
"@radix-ui/react-avatar": "npm:^1.1.2"
|
||||||
"@radix-ui/react-collapsible": "npm:^1.1.2"
|
"@radix-ui/react-collapsible": "npm:^1.1.2"
|
||||||
|
"@radix-ui/react-context-menu": "npm:^2.2.15"
|
||||||
"@radix-ui/react-dialog": "npm:^1.1.3"
|
"@radix-ui/react-dialog": "npm:^1.1.3"
|
||||||
"@radix-ui/react-dropdown-menu": "npm:^2.1.3"
|
"@radix-ui/react-dropdown-menu": "npm:^2.1.3"
|
||||||
"@radix-ui/react-popover": "npm:^1.1.3"
|
"@radix-ui/react-popover": "npm:^1.1.3"
|
||||||
@@ -418,6 +419,7 @@ __metadata:
|
|||||||
"@marsidev/react-turnstile": "npm:^1.1.0"
|
"@marsidev/react-turnstile": "npm:^1.1.0"
|
||||||
"@preact/signals-core": "npm:^1.8.0"
|
"@preact/signals-core": "npm:^1.8.0"
|
||||||
"@radix-ui/react-collapsible": "npm:^1.1.2"
|
"@radix-ui/react-collapsible": "npm:^1.1.2"
|
||||||
|
"@radix-ui/react-context-menu": "npm:^2.1.15"
|
||||||
"@radix-ui/react-dialog": "npm:^1.1.3"
|
"@radix-ui/react-dialog": "npm:^1.1.3"
|
||||||
"@radix-ui/react-popover": "npm:^1.1.3"
|
"@radix-ui/react-popover": "npm:^1.1.3"
|
||||||
"@radix-ui/react-scroll-area": "npm:^1.2.2"
|
"@radix-ui/react-scroll-area": "npm:^1.2.2"
|
||||||
@@ -11238,7 +11240,7 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@radix-ui/react-context-menu@npm:^2.2.3":
|
"@radix-ui/react-context-menu@npm:^2.1.15, @radix-ui/react-context-menu@npm:^2.2.15, @radix-ui/react-context-menu@npm:^2.2.3":
|
||||||
version: 2.2.15
|
version: 2.2.15
|
||||||
resolution: "@radix-ui/react-context-menu@npm:2.2.15"
|
resolution: "@radix-ui/react-context-menu@npm:2.2.15"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user