ultisuite-client/lib/drive/use-drive-document-title.ts
R3D347HR4Y 82ca9a27db
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat(drive): refactor document and drawing editors with new metadata handling
- Replaced suite page metadata with drive-specific metadata for document and drawing editors.
- Introduced new `driveEditorPageMetadata` function to manage titles and favicons based on editor type.
- Updated layout components for document and drawing editors to utilize the new metadata structure.
- Enhanced document title handling in various editor components to reflect the current editing context.
- Added new SVG icons for UltiDocs, UltiSheets, UltiSlides, and UltiDraw to improve visual consistency across editors.
- Improved print styles and layout handling for better document rendering in print and PDF formats.
2026-06-15 15:51:09 +02:00

21 lines
563 B
TypeScript

"use client"
import { useEffect } from "react"
import {
applyDriveEditorFavicon,
driveEditorDocumentTitle,
type DriveEditorKind,
} from "@/lib/drive/drive-editor-metadata"
export function useDriveDocumentTitle(titleSegment: string, kind: DriveEditorKind) {
useEffect(() => {
const previousTitle = document.title
document.title = driveEditorDocumentTitle(titleSegment, kind)
const restoreFavicon = applyDriveEditorFavicon(kind)
return () => {
document.title = previousTitle
restoreFavicon()
}
}, [titleSegment, kind])
}