- 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.
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
export type DriveMarqueeRect = {
|
|
left: number
|
|
top: number
|
|
width: number
|
|
height: number
|
|
}
|
|
|
|
export function rectsIntersect(
|
|
a: { left: number; top: number; right: number; bottom: number },
|
|
b: DOMRect
|
|
) {
|
|
return !(a.right < b.left || a.left > b.right || a.bottom < b.top || a.top > b.bottom)
|
|
}
|
|
|
|
export function pathsInMarqueeRect(
|
|
cardRefs: Map<string, HTMLDivElement>,
|
|
rect: DriveMarqueeRect
|
|
): string[] {
|
|
const sel = {
|
|
left: rect.left,
|
|
top: rect.top,
|
|
right: rect.left + rect.width,
|
|
bottom: rect.top + rect.height,
|
|
}
|
|
const paths: string[] = []
|
|
cardRefs.forEach((el, path) => {
|
|
if (rectsIntersect(sel, el.getBoundingClientRect())) {
|
|
paths.push(path)
|
|
}
|
|
})
|
|
return paths
|
|
}
|
|
|
|
export function shouldIgnoreDriveMarqueeStart(target: HTMLElement): boolean {
|
|
if (target.closest("[data-drive-card]")) return true
|
|
if (target.closest("[data-drive-menu-btn]")) return true
|
|
if (
|
|
target.closest(
|
|
'button, a, input, textarea, select, [role="menuitem"], [role="menuitemradio"], [data-drive-menu-surface], [contenteditable="true"]'
|
|
)
|
|
) {
|
|
return true
|
|
}
|
|
return false
|
|
}
|