17 lines
515 B
TypeScript
17 lines
515 B
TypeScript
import {
|
|
shouldOpenInOnlyOffice,
|
|
shouldOpenInRichTextEditor,
|
|
shouldOpenInUltidrawEditor,
|
|
} from "@/lib/drive/drive-preview"
|
|
|
|
/** Best-effort guess from a public share URL path (before API metadata). */
|
|
export function sharePathLooksLikeEditorFile(path: string): boolean {
|
|
const name = path.replace(/^\/+|\/+$/g, "").split("/").pop() ?? ""
|
|
if (!name) return false
|
|
return (
|
|
shouldOpenInRichTextEditor({ name }) ||
|
|
shouldOpenInUltidrawEditor({ name }) ||
|
|
shouldOpenInOnlyOffice({ name })
|
|
)
|
|
}
|