ultisuite-client/lib/api/preview-blob-url.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

31 lines
832 B
TypeScript

export type PreviewBlobThumb = {
url: string
display: "image" | "video"
}
export function isPreviewThumbQueryKey(key: readonly unknown[]): boolean {
return key.includes("preview-thumb") || key.includes("attachment-thumb")
}
export function revokePreviewBlobUrl(url: string | undefined): void {
if (url?.startsWith("blob:")) {
URL.revokeObjectURL(url)
}
}
export function revokePreviewBlobData(data: unknown): void {
const thumb = data as PreviewBlobThumb | undefined
revokePreviewBlobUrl(thumb?.url)
}
/** Revoke a cached blob URL before replacing it with a fresh one. */
export function commitPreviewBlobUrl(
previous: PreviewBlobThumb | undefined,
next: PreviewBlobThumb
): PreviewBlobThumb {
if (previous?.url && previous.url !== next.url) {
revokePreviewBlobUrl(previous.url)
}
return next
}