mirror of
https://github.com/docmost/docmost.git
synced 2026-08-24 04:51:05 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75c2822fd7 | ||
|
|
89b7bb8778 |
@@ -64,7 +64,6 @@
|
||||
"react-router-dom": "7.18.2",
|
||||
"semver": "7.7.4",
|
||||
"socket.io-client": "4.8.3",
|
||||
"yet-another-react-lightbox": "^3.32.2",
|
||||
"zod": "4.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -294,9 +294,6 @@
|
||||
"Export space": "Export space",
|
||||
"Export {{type}}": "Export {{type}}",
|
||||
"File exceeds the {{limit}} attachment limit": "File exceeds the {{limit}} attachment limit",
|
||||
"Media": "Media",
|
||||
"Open image": "Open image",
|
||||
"Open video": "Open video",
|
||||
"Align left": "Align left",
|
||||
"Align right": "Align right",
|
||||
"Align center": "Align center",
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
Text,
|
||||
UnstyledButton,
|
||||
Button,
|
||||
MultiSelect,
|
||||
} from "@mantine/core";
|
||||
import { IconPlus, IconTrash } from "@tabler/icons-react";
|
||||
import {
|
||||
@@ -52,6 +53,9 @@ const NO_VALUE_OPERATORS: FilterOperator[] = ["isEmpty", "isNotEmpty"];
|
||||
// stored value so a stale shape isn't sent to the engine.
|
||||
function valueClass(op: FilterOperator, inputKind: string): string {
|
||||
if (NO_VALUE_OPERATORS.includes(op)) return "none";
|
||||
if (inputKind === "choices") {
|
||||
return op === "any" || op === "none" ? "choicesMulti" : "choicesSingle";
|
||||
}
|
||||
if (inputKind === "person") {
|
||||
return op === "any" || op === "none" ? "personMulti" : "personSingle";
|
||||
}
|
||||
@@ -70,6 +74,10 @@ function getOperatorsForType(type: string): FilterOperator[] {
|
||||
DEFAULT_FILTER_OPERATORS) as FilterOperator[];
|
||||
}
|
||||
|
||||
function isMultiChoice(op: FilterCondition["op"]): boolean {
|
||||
return op === "any" || op === "none";
|
||||
}
|
||||
|
||||
function FilterValueInput({
|
||||
condition,
|
||||
property,
|
||||
@@ -121,6 +129,32 @@ function FilterValueInput({
|
||||
const typeOptions = property.typeOptions as SelectTypeOptions | undefined;
|
||||
const choices = typeOptions?.choices ?? [];
|
||||
const choiceOptions = choices.map((c) => ({ value: c.id, label: c.name }));
|
||||
|
||||
if (isMultiChoice(condition.op)) {
|
||||
const { value } = condition;
|
||||
const selected = (
|
||||
Array.isArray(value) ? value : value ? [value] : []
|
||||
).filter((id) => choices.some((c) => c.id === id));
|
||||
|
||||
return (
|
||||
<MultiSelect
|
||||
size="xs"
|
||||
data={choiceOptions}
|
||||
comboboxProps={{ withinPortal: false }}
|
||||
value={selected}
|
||||
onChange={(values) => onChange(values)}
|
||||
w={160}
|
||||
styles={{
|
||||
pillsList: {
|
||||
maxHeight: 70,
|
||||
overflowY: "auto",
|
||||
},
|
||||
}}
|
||||
maxDropdownHeight={220}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Select
|
||||
size="xs"
|
||||
@@ -199,11 +233,18 @@ export function ViewFilterConfigPopover({
|
||||
label: p.name,
|
||||
}));
|
||||
|
||||
const [unSaved, setUnSaved] = useState(false)
|
||||
const [draft, setDraft] = useState<FilterCondition | null>(null);
|
||||
const [draftConditions, setDraftConditions] =
|
||||
useState<FilterCondition[]>(conditions);
|
||||
|
||||
useEffect(() => {
|
||||
if (!opened) setDraft(null);
|
||||
}, [opened]);
|
||||
if (opened) {
|
||||
setDraftConditions(conditions);
|
||||
setDraft(null);
|
||||
setUnSaved(false)
|
||||
}
|
||||
}, [opened, conditions]);
|
||||
|
||||
const handleStartDraft = useCallback(() => {
|
||||
const firstProperty = properties[0];
|
||||
@@ -216,14 +257,21 @@ export function ViewFilterConfigPopover({
|
||||
}, [properties]);
|
||||
|
||||
const handleSaveDraft = useCallback(() => {
|
||||
if (!draft) return;
|
||||
onChange([...conditions, draft]);
|
||||
const nextConditions = draft
|
||||
? [...draftConditions, draft]
|
||||
: draftConditions;
|
||||
|
||||
onChange(nextConditions);
|
||||
setDraft(null);
|
||||
}, [draft, conditions, onChange]);
|
||||
setUnSaved(false)
|
||||
|
||||
}, [draft, draftConditions, onChange]);
|
||||
|
||||
const handleCancelDraft = useCallback(() => {
|
||||
setDraftConditions(conditions)
|
||||
setDraft(null);
|
||||
}, []);
|
||||
setUnSaved(false)
|
||||
}, [conditions]);
|
||||
|
||||
const handleDraftPropertyChange = useCallback(
|
||||
(propertyId: string | null) => {
|
||||
@@ -272,17 +320,19 @@ export function ViewFilterConfigPopover({
|
||||
|
||||
const handleRemove = useCallback(
|
||||
(index: number) => {
|
||||
onChange(conditions.filter((_, i) => i !== index));
|
||||
setUnSaved(true);
|
||||
setDraftConditions((current) => current.filter((_, i) => i !== index));
|
||||
},
|
||||
[conditions, onChange],
|
||||
[],
|
||||
);
|
||||
|
||||
const handlePropertyChange = useCallback(
|
||||
(index: number, propertyId: string | null) => {
|
||||
if (!propertyId) return;
|
||||
const newProperty = properties.find((p) => p.id === propertyId);
|
||||
onChange(
|
||||
conditions.map((f, i) => {
|
||||
setUnSaved(true)
|
||||
setDraftConditions((current) =>
|
||||
current.map((f, i) => {
|
||||
if (i !== index) return f;
|
||||
if (newProperty) {
|
||||
const validOperators = getOperatorsForType(newProperty.type);
|
||||
@@ -302,15 +352,16 @@ export function ViewFilterConfigPopover({
|
||||
}),
|
||||
);
|
||||
},
|
||||
[conditions, properties, onChange],
|
||||
[properties],
|
||||
);
|
||||
|
||||
const handleOperatorChange = useCallback(
|
||||
(index: number, operator: string | null) => {
|
||||
if (!operator) return;
|
||||
const op = operator as FilterOperator;
|
||||
onChange(
|
||||
conditions.map((f, i) => {
|
||||
setUnSaved(true)
|
||||
setDraftConditions((current) =>
|
||||
current.map((f, i) => {
|
||||
if (i !== index) return f;
|
||||
const kind = inputKindForProperty(
|
||||
properties.find((p) => p.id === f.propertyId),
|
||||
@@ -320,16 +371,17 @@ export function ViewFilterConfigPopover({
|
||||
}),
|
||||
);
|
||||
},
|
||||
[conditions, properties, onChange],
|
||||
[properties],
|
||||
);
|
||||
|
||||
const handleValueChange = useCallback(
|
||||
(index: number, value: unknown) => {
|
||||
onChange(
|
||||
conditions.map((f, i) => (i === index ? { ...f, value } : f)),
|
||||
setUnSaved(true)
|
||||
setDraftConditions((current) =>
|
||||
current.map((f, i) => (i === index ? { ...f, value } : f)),
|
||||
);
|
||||
},
|
||||
[conditions, onChange],
|
||||
[],
|
||||
);
|
||||
|
||||
return (
|
||||
@@ -362,13 +414,13 @@ export function ViewFilterConfigPopover({
|
||||
{t("Filter by")}
|
||||
</Text>
|
||||
|
||||
{conditions.length === 0 && !draft && (
|
||||
{draftConditions.length === 0 && !draft && (
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("No filters applied")}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{conditions.map((condition, index) => {
|
||||
{draftConditions.map((condition, index) => {
|
||||
const needsValue = !NO_VALUE_OPERATORS.includes(condition.op);
|
||||
const property = properties.find(
|
||||
(p) => p.id === condition.propertyId,
|
||||
@@ -471,14 +523,6 @@ export function ViewFilterConfigPopover({
|
||||
/>
|
||||
)}
|
||||
</Group>
|
||||
<Group justify="flex-end" gap="xs">
|
||||
<Button variant="default" size="xs" onClick={handleCancelDraft}>
|
||||
{t("Cancel")}
|
||||
</Button>
|
||||
<Button size="xs" onClick={handleSaveDraft}>
|
||||
{t("Save")}
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
);
|
||||
})()}
|
||||
@@ -492,6 +536,20 @@ export function ViewFilterConfigPopover({
|
||||
{t("Add filter")}
|
||||
</UnstyledButton>
|
||||
)}
|
||||
<Group justify="flex-end" gap="xs">
|
||||
<Button
|
||||
variant="default"
|
||||
size="xs"
|
||||
onClick={handleCancelDraft}
|
||||
disabled={!draft && !unSaved}
|
||||
>
|
||||
{t("Cancel")}
|
||||
</Button>
|
||||
|
||||
<Button size="xs" onClick={handleSaveDraft} disabled={!draft && !unSaved}>
|
||||
{t("Save")}
|
||||
</Button>
|
||||
</Group>
|
||||
</Stack>
|
||||
</Popover.Dropdown>
|
||||
</Popover>
|
||||
|
||||
@@ -16,14 +16,6 @@ export const showAiMenuAtom = atom(false);
|
||||
|
||||
export const showLinkMenuAtom = atom(false);
|
||||
|
||||
export type LightboxRequest = {
|
||||
src: string;
|
||||
type: "image" | "video";
|
||||
} | null;
|
||||
|
||||
const initialLightboxRequest: LightboxRequest = null;
|
||||
export const lightboxRequestAtom = atom(initialLightboxRequest);
|
||||
|
||||
// Current page's edit mode — initialized from the user's saved preference on
|
||||
// first load, can be toggled locally without persisting to the server.
|
||||
export const currentPageEditModeAtom = atom<PageEditMode>(PageEditMode.Edit);
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
import type { Editor } from "@tiptap/react";
|
||||
import Lightbox, { type Slide } from "yet-another-react-lightbox";
|
||||
import { getFileUrl } from "@/lib/config.ts";
|
||||
import "yet-another-react-lightbox/styles.css";
|
||||
import "yet-another-react-lightbox/plugins/captions.css";
|
||||
import Captions from "yet-another-react-lightbox/plugins/captions";
|
||||
import Download from "yet-another-react-lightbox/plugins/download";
|
||||
import Fullscreen from "yet-another-react-lightbox/plugins/fullscreen";
|
||||
import Video from "yet-another-react-lightbox/plugins/video";
|
||||
import Zoom from "yet-another-react-lightbox/plugins/zoom";
|
||||
import { useMemo } from "react";
|
||||
import i18n from "@/i18n.ts";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
type LightboxViewProps = {
|
||||
editor: Editor;
|
||||
open: boolean;
|
||||
src: string;
|
||||
type: "image" | "video";
|
||||
onClose: () => void;
|
||||
};
|
||||
|
||||
function getVideoMimeType(src: string) {
|
||||
const extension = src.split(/[?#]/, 1)[0].split(".").pop()?.toLowerCase();
|
||||
|
||||
switch (extension) {
|
||||
case "webm":
|
||||
return "video/webm";
|
||||
case "ogv":
|
||||
return "video/ogg";
|
||||
case "mov":
|
||||
return "video/quicktime";
|
||||
case "m4v":
|
||||
return "video/x-m4v";
|
||||
default:
|
||||
return "video/mp4";
|
||||
}
|
||||
}
|
||||
|
||||
function getFilename(src: string) {
|
||||
const filename = src.split(/[?#]/, 1)[0].split("/").pop();
|
||||
if (!filename) return i18n.t("Media");
|
||||
|
||||
try {
|
||||
return decodeURIComponent(filename);
|
||||
} catch {
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
|
||||
function getMedia(rawSrc: string, type?: string, alt?: string): Slide {
|
||||
const src = getFileUrl(rawSrc);
|
||||
const filename = getFilename(rawSrc);
|
||||
const caption = alt || filename;
|
||||
|
||||
if (type === "video") {
|
||||
return {
|
||||
type: "video",
|
||||
sources: [{ src, type: getVideoMimeType(rawSrc) }],
|
||||
title: caption,
|
||||
download: { url: src, filename },
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
type: "image",
|
||||
src,
|
||||
alt: alt || undefined,
|
||||
title: caption,
|
||||
download: { url: src, filename },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function getPageMedia(editor: Editor): Slide[] {
|
||||
const media: Slide[] = [];
|
||||
|
||||
editor.state.doc.descendants((node) => {
|
||||
if (node.type.name !== "image" && node.type.name !== "video") return;
|
||||
|
||||
const rawSrc = typeof node.attrs.src === "string" ? node.attrs.src : "";
|
||||
if (!rawSrc) return;
|
||||
|
||||
media.push(getMedia(rawSrc, node.type.name, node.attrs.alt));
|
||||
});
|
||||
|
||||
return media;
|
||||
}
|
||||
|
||||
export default function LightboxView({
|
||||
editor,
|
||||
open,
|
||||
src,
|
||||
type,
|
||||
onClose,
|
||||
}: LightboxViewProps) {
|
||||
const { i18n: i18nInstance } = useTranslation();
|
||||
|
||||
const slides = useMemo(
|
||||
() => getPageMedia(editor),
|
||||
[editor, open, i18nInstance.language]
|
||||
);
|
||||
|
||||
const index = useMemo(() => {
|
||||
const idx = slides.findIndex((slide) =>
|
||||
type === "video"
|
||||
? "sources" in slide && slide.sources.some((s) => s.src === src)
|
||||
: "src" in slide && slide.src === src
|
||||
);
|
||||
return idx >= 0 ? idx : 0;
|
||||
}, [slides, src, type]);
|
||||
|
||||
return (
|
||||
<Lightbox
|
||||
open={open}
|
||||
close={onClose}
|
||||
index={index >= 0 ? index : 0}
|
||||
slides={slides}
|
||||
plugins={[Captions, Download, Fullscreen, Video, Zoom]}
|
||||
captions={{ descriptionTextAlign: "center" }}
|
||||
video={{ controls: true, playsInline: true }}
|
||||
zoom={{
|
||||
scrollToZoom: true,
|
||||
maxZoomPixelRatio: 4,
|
||||
maxZoom: 4,
|
||||
supports: ["video"],
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BubbleMenu as BaseBubbleMenu } from "@tiptap/react/menus";
|
||||
import { findParentNode, posToDOMRect, useEditorState } from "@tiptap/react";
|
||||
import React, { useCallback, useRef } from "react";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { Node as PMNode } from "@tiptap/pm/model";
|
||||
import { isEditorReady } from "@docmost/editor-ext";
|
||||
import {
|
||||
@@ -15,7 +14,6 @@ import {
|
||||
IconLayoutAlignLeft,
|
||||
IconLayoutAlignRight,
|
||||
IconDownload,
|
||||
IconMaximize,
|
||||
IconRefresh,
|
||||
IconTrash,
|
||||
} from "@tabler/icons-react";
|
||||
@@ -23,13 +21,11 @@ import { useTranslation } from "react-i18next";
|
||||
import { getFileUrl } from "@/lib/config.ts";
|
||||
import { uploadImageAction } from "@/features/editor/components/image/upload-image-action.tsx";
|
||||
import { useAltTextControl } from "@/features/editor/components/common/use-alt-text-control.tsx";
|
||||
import { lightboxRequestAtom } from "@/features/editor/atoms/editor-atoms";
|
||||
import classes from "../common/toolbar-menu.module.css";
|
||||
|
||||
export function ImageMenu({ editor }: EditorMenuProps) {
|
||||
const { t } = useTranslation();
|
||||
const fileInputRef = useRef<HTMLInputElement>(null);
|
||||
const setLightboxRequest = useSetAtom(lightboxRequestAtom);
|
||||
|
||||
const editorState = useEditorState({
|
||||
editor,
|
||||
@@ -169,25 +165,6 @@ export function ImageMenu({ editor }: EditorMenuProps) {
|
||||
altTextPanel
|
||||
) : (
|
||||
<div className={classes.toolbar}>
|
||||
<Tooltip position="top" label={t("Open image")} withinPortal={false}>
|
||||
<ActionIcon
|
||||
onClick={() =>
|
||||
editorState?.src &&
|
||||
setLightboxRequest({
|
||||
src: getFileUrl(editorState.src),
|
||||
type: "image",
|
||||
})
|
||||
}
|
||||
size="lg"
|
||||
aria-label={t("Open image")}
|
||||
variant="subtle"
|
||||
>
|
||||
<IconMaximize size={18} />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
|
||||
<div className={classes.divider} />
|
||||
|
||||
<Tooltip position="top" label={t("Align left")} withinPortal={false}>
|
||||
<ActionIcon
|
||||
onClick={alignImageLeft}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { BubbleMenu as BaseBubbleMenu } from "@tiptap/react/menus";
|
||||
import { findParentNode, posToDOMRect, useEditorState } from "@tiptap/react";
|
||||
import { useCallback } from "react";
|
||||
import { useSetAtom } from "jotai";
|
||||
import { Node as PMNode } from "@tiptap/pm/model";
|
||||
import { isEditorReady } from "@docmost/editor-ext";
|
||||
import {
|
||||
@@ -15,18 +14,15 @@ import {
|
||||
IconLayoutAlignLeft,
|
||||
IconLayoutAlignRight,
|
||||
IconDownload,
|
||||
IconMaximize,
|
||||
IconTrash,
|
||||
} from "@tabler/icons-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { getFileUrl } from "@/lib/config.ts";
|
||||
import { useAltTextControl } from "@/features/editor/components/common/use-alt-text-control.tsx";
|
||||
import { lightboxRequestAtom } from "@/features/editor/atoms/editor-atoms";
|
||||
import classes from "../common/toolbar-menu.module.css";
|
||||
|
||||
export function VideoMenu({ editor }: EditorMenuProps) {
|
||||
const { t } = useTranslation();
|
||||
const setLightboxRequest = useSetAtom(lightboxRequestAtom);
|
||||
|
||||
const editorState = useEditorState({
|
||||
editor,
|
||||
@@ -145,25 +141,6 @@ export function VideoMenu({ editor }: EditorMenuProps) {
|
||||
altTextPanel
|
||||
) : (
|
||||
<div className={classes.toolbar}>
|
||||
<Tooltip position="top" label={t("Open video")} withinPortal={false}>
|
||||
<ActionIcon
|
||||
onClick={() =>
|
||||
editorState?.src &&
|
||||
setLightboxRequest({
|
||||
src: getFileUrl(editorState.src),
|
||||
type: "video",
|
||||
})
|
||||
}
|
||||
size="lg"
|
||||
aria-label={t("Open video")}
|
||||
variant="subtle"
|
||||
>
|
||||
<IconMaximize size={18} />
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
|
||||
<div className={classes.divider} />
|
||||
|
||||
<Tooltip position="top" label={t("Align left")} withinPortal={false}>
|
||||
<ActionIcon
|
||||
onClick={alignLeft}
|
||||
|
||||
@@ -33,7 +33,6 @@ import { useAtom, useAtomValue } from "jotai";
|
||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||
import {
|
||||
currentPageEditModeAtom,
|
||||
lightboxRequestAtom,
|
||||
pageEditorAtom,
|
||||
yjsConnectionStatusAtom,
|
||||
yjsSyncedAtom,
|
||||
@@ -54,7 +53,6 @@ import CalloutMenu from "@/features/editor/components/callout/callout-menu.tsx";
|
||||
import VideoMenu from "@/features/editor/components/video/video-menu.tsx";
|
||||
import PdfMenu from "@/features/editor/components/pdf/pdf-menu.tsx";
|
||||
import SubpagesMenu from "@/features/editor/components/subpages/subpages-menu.tsx";
|
||||
import LightboxView from "@/features/editor/components/common/lightbox-view";
|
||||
import {
|
||||
handleFileDrop,
|
||||
handlePaste,
|
||||
@@ -186,7 +184,6 @@ function CollabPageEditor({
|
||||
const [, setActiveCommentId] = useAtom(activeCommentIdAtom);
|
||||
const [showCommentPopup, setShowCommentPopup] = useAtom(showCommentPopupAtom);
|
||||
const [showReadOnlyCommentPopup] = useAtom(showReadOnlyCommentPopupAtom);
|
||||
const [lightboxRequest, setLightboxRequest] = useAtom(lightboxRequestAtom);
|
||||
const [isLocalSynced, setIsLocalSynced] = useState(false);
|
||||
const [isRemoteSynced, setIsRemoteSynced] = useState(false);
|
||||
const [yjsConnectionStatus, setYjsConnectionStatus] = useAtom(
|
||||
@@ -462,15 +459,6 @@ function CollabPageEditor({
|
||||
{editor && !editorIsEditable && (editable || canComment) && (
|
||||
<ReadonlyBubbleMenu editor={editor} />
|
||||
)}
|
||||
{editor && (
|
||||
<LightboxView
|
||||
editor={editor}
|
||||
open={!!lightboxRequest}
|
||||
src={lightboxRequest?.src ?? ""}
|
||||
type={lightboxRequest?.type ?? "image"}
|
||||
onClose={() => setLightboxRequest(null)}
|
||||
/>
|
||||
)}
|
||||
{showCommentPopup && <CommentDialog editor={editor} pageId={pageId} />}
|
||||
{showReadOnlyCommentPopup && (
|
||||
<CommentDialog editor={editor} pageId={pageId} readOnly />
|
||||
|
||||
@@ -396,10 +396,7 @@ export class WorkspaceService {
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
updateWorkspaceDto.aiSearch &&
|
||||
this.environmentService.getAiVectorDriver() !== 'turbopuffer'
|
||||
) {
|
||||
if (updateWorkspaceDto.aiSearch) {
|
||||
const tableExists = await isPageEmbeddingsTableExists(this.db);
|
||||
if (!tableExists) {
|
||||
throw new BadRequestException(
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ThrottlerModule } from '@nestjs/throttler';
|
||||
import { ThrottlerStorageRedisService } from '@nest-lab/throttler-storage-redis';
|
||||
import { EnvironmentService } from '../environment/environment.service';
|
||||
import { EnvironmentModule } from '../environment/environment.module';
|
||||
import { createRetryStrategy, parseRedisUrl } from '../../common/helpers';
|
||||
import { parseRedisUrl } from '../../common/helpers';
|
||||
import { AUTH_THROTTLER, AI_CHAT_THROTTLER } from './throttler-names';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
@@ -27,8 +27,6 @@ import Redis from 'ioredis';
|
||||
password: redisConfig.password,
|
||||
db: redisConfig.db,
|
||||
family: redisConfig.family,
|
||||
tls: redisConfig.tls,
|
||||
retryStrategy: createRetryStrategy(),
|
||||
keyPrefix: 'throttle:',
|
||||
}),
|
||||
),
|
||||
|
||||
@@ -73,13 +73,9 @@ export const embedProviders: IEmbedProvider[] = [
|
||||
id: "vimeo",
|
||||
name: "Vimeo",
|
||||
regex:
|
||||
/^(https:)?\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)(?:\/([\da-zA-Z]+))?/,
|
||||
getEmbedUrl: (match, url: string) => {
|
||||
// preserve ?h= hash for unlisted videos
|
||||
const hash =
|
||||
match[5] ?? new URL(url, "https://vimeo.com").searchParams.get("h");
|
||||
const base = `https://player.vimeo.com/video/${match[4]}`;
|
||||
return hash ? `${base}?h=${hash}` : base;
|
||||
/^(https:)?\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/([^/]*)\/videos\/|album\/(\d+)\/video\/|video\/|)(\d+)/,
|
||||
getEmbedUrl: (match) => {
|
||||
return `https://player.vimeo.com/video/${match[4]}`;
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Generated
-27
@@ -397,9 +397,6 @@ importers:
|
||||
socket.io-client:
|
||||
specifier: 4.8.3
|
||||
version: 4.8.3(supports-color@10.2.2)
|
||||
yet-another-react-lightbox:
|
||||
specifier: ^3.32.2
|
||||
version: 3.32.2(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7)
|
||||
zod:
|
||||
specifier: 4.3.6
|
||||
version: 4.3.6
|
||||
@@ -4994,7 +4991,6 @@ packages:
|
||||
'@xmldom/xmldom@0.8.13':
|
||||
resolution: {integrity: sha512-KRYzxepc14G/CEpEGc3Yn+JKaAeT63smlDr+vjB8jRfgTBBI9wRj/nkQEO+ucV8p8I9bfKLWp37uHgFrbntPvw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
deprecated: this version has critical issues, please update to the latest version
|
||||
|
||||
'@xtuc/ieee754@1.2.0':
|
||||
resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==}
|
||||
@@ -6323,7 +6319,6 @@ packages:
|
||||
eslint@9.28.0:
|
||||
resolution: {integrity: sha512-ocgh41VhRlf9+fVpe7QKzwLj9c92fDiqOj8Y3Sd4/ZmVA4Btx4PlUYPq4pp9JDyupkf1upbEXecxL2mwNV7jPQ==}
|
||||
engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0}
|
||||
deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options.
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
jiti: '*'
|
||||
@@ -10038,20 +10033,6 @@ packages:
|
||||
resolution: {integrity: sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==}
|
||||
engines: {node: '>=12'}
|
||||
|
||||
yet-another-react-lightbox@3.32.2:
|
||||
resolution: {integrity: sha512-F4HtHQfUNpvkj+AmECgWM4XRdCqMY5gXpKgOUx39+T+FyxLe8II4SK/pwMyYj2X54KH9lFSQeHYY1/GfYf3SdA==}
|
||||
engines: {node: '>=14'}
|
||||
peerDependencies:
|
||||
'@types/react': ^16 || ^17 || ^18 || ^19
|
||||
'@types/react-dom': ^16 || ^17 || ^18 || ^19
|
||||
react: ^16.8.0 || ^17 || ^18 || ^19
|
||||
react-dom: ^16.8.0 || ^17 || ^18 || ^19
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
'@types/react-dom':
|
||||
optional: true
|
||||
|
||||
yjs@13.6.30:
|
||||
resolution: {integrity: sha512-vv/9h42eCMC81ZHDFswuu/MKzkl/vyq1BhaNGfHyOonwlG4CJbQF4oiBBJPvfdeCt/PlVDWh7Nov9D34YY09uQ==}
|
||||
engines: {node: '>=16.0.0', npm: '>=8.0.0'}
|
||||
@@ -20763,14 +20744,6 @@ snapshots:
|
||||
dependencies:
|
||||
pend: 1.2.0
|
||||
|
||||
yet-another-react-lightbox@3.32.2(@types/react-dom@19.2.3(@types/react@19.2.17))(@types/react@19.2.17)(react-dom@19.2.7(react@19.2.7))(react@19.2.7):
|
||||
dependencies:
|
||||
react: 19.2.7
|
||||
react-dom: 19.2.7(react@19.2.7)
|
||||
optionalDependencies:
|
||||
'@types/react': 19.2.17
|
||||
'@types/react-dom': 19.2.3(@types/react@19.2.17)
|
||||
|
||||
yjs@13.6.30:
|
||||
dependencies:
|
||||
lib0: 0.2.117
|
||||
|
||||
Reference in New Issue
Block a user