ultisuite-client/lib/drive/drive-menu-guard.ts
R3D347HR4Y 6ec95262af Add OnlyOffice integration and update project configurations
- Updated .env.example to include configuration for OnlyOffice Document Server.
- Modified the workspace configuration to remove the drive-suite path.
- Adjusted TypeScript environment imports for consistency.
- Enhanced Next.js configuration to disable canvas in Webpack.
- Updated package.json to include new dependencies for OnlyOffice and PDF.js.
- Added global styles for OnlyOffice theme integration in the CSS.
- Created new layout and page components for the Drive feature, including public sharing and editing functionalities.
- Updated metadata handling across various layouts to reflect the new app structure.
2026-06-07 15:49:21 +02:00

30 lines
1.2 KiB
TypeScript

import { useDriveUIStore } from "@/lib/stores/drive-ui-store"
/** Elements that must not bubble open/navigate on the file card underneath. */
export const DRIVE_MENU_INTERACTIVE_SELECTOR =
'[data-drive-menu-btn],[data-drive-menu-surface],[data-slot="dropdown-menu-content"],[data-slot="dropdown-menu-item"],[data-slot="context-menu-content"],[data-slot="context-menu-item"]'
export function isFromDriveMenu(target: EventTarget | null): boolean {
return target instanceof Element && target.closest(DRIVE_MENU_INTERACTIVE_SELECTOR) != null
}
export function isCardOpenSuppressed(): boolean {
return Date.now() < useDriveUIStore.getState().suppressCardOpenUntil
}
/** Block grid/list card open after menu use (Radix ghost click). */
export function guardDriveMenuPointer(ms = 700) {
useDriveUIStore.getState().blockCardOpen(ms)
}
/** Stop card/grid handlers only — safe on menu trigger button. */
export function stopDriveMenuBubble(e: { stopPropagation: () => void }) {
e.stopPropagation()
}
/** Menu item selection — also blocks ghost card open. */
export function stopDriveMenuEvent(e: { stopPropagation: () => void }) {
e.stopPropagation()
guardDriveMenuPointer()
}