diff --git a/apps/client/package.json b/apps/client/package.json index cca0ef4be..d836d5db6 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -64,6 +64,7 @@ "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": { diff --git a/apps/client/public/locales/en-US/translation.json b/apps/client/public/locales/en-US/translation.json index 14bb06d85..098fb45dd 100644 --- a/apps/client/public/locales/en-US/translation.json +++ b/apps/client/public/locales/en-US/translation.json @@ -294,6 +294,7 @@ "Export space": "Export space", "Export {{type}}": "Export {{type}}", "File exceeds the {{limit}} attachment limit": "File exceeds the {{limit}} attachment limit", + "Media": "Media", "Align left": "Align left", "Align right": "Align right", "Align center": "Align center", diff --git a/apps/client/src/features/editor/atoms/editor-atoms.ts b/apps/client/src/features/editor/atoms/editor-atoms.ts index 74692d916..2de76fe70 100644 --- a/apps/client/src/features/editor/atoms/editor-atoms.ts +++ b/apps/client/src/features/editor/atoms/editor-atoms.ts @@ -16,6 +16,14 @@ 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.Edit); diff --git a/apps/client/src/features/editor/components/bubble-menu/bubble-menu.tsx b/apps/client/src/features/editor/components/bubble-menu/bubble-menu.tsx index a1283e34a..02108292e 100644 --- a/apps/client/src/features/editor/components/bubble-menu/bubble-menu.tsx +++ b/apps/client/src/features/editor/components/bubble-menu/bubble-menu.tsx @@ -23,11 +23,21 @@ import { } from "@/features/comment/atoms/comment-atom"; import { useAtom, useAtomValue } from "jotai"; import { v7 as uuid7 } from "uuid"; -import { isCellSelection, isEditorReady, isTextSelected } from "@docmost/editor-ext"; +import { + isCellSelection, + isEditorReady, + isTextSelected, +} from "@docmost/editor-ext"; import { LinkSelector } from "@/features/editor/components/bubble-menu/link-selector.tsx"; import { useTranslation } from "react-i18next"; -import { showAiMenuAtom, showLinkMenuAtom } from "@/features/editor/atoms/editor-atoms"; -import { userAtom, workspaceAtom } from "@/features/user/atoms/current-user-atom"; +import { + showAiMenuAtom, + showLinkMenuAtom, +} from "@/features/editor/atoms/editor-atoms"; +import { + userAtom, + workspaceAtom, +} from "@/features/user/atoms/current-user-atom"; export interface BubbleMenuItem { name: string; @@ -217,7 +227,12 @@ export const EditorBubbleMenu: FC = (props) => { {items.map((item, index) => ( - + = (props) => { aria-label={t(item.name)} className={clsx({ [classes.active]: item.isActive() })} style={{ border: "none" }} - onClick={() => isEditorReady(props.editor) && item.command()} + onClick={() => + isEditorReady(props.editor) && item.command() + } > @@ -256,7 +273,9 @@ export const EditorBubbleMenu: FC = (props) => { radius="6px" aria-label={t(commentItem.name)} style={{ border: "none" }} - onClick={() => isEditorReady(props.editor) && commentItem.command()} + onClick={() => + isEditorReady(props.editor) && commentItem.command() + } > diff --git a/apps/client/src/features/editor/components/bubble-menu/color-selector.tsx b/apps/client/src/features/editor/components/bubble-menu/color-selector.tsx index a228dc645..533bcda8a 100644 --- a/apps/client/src/features/editor/components/bubble-menu/color-selector.tsx +++ b/apps/client/src/features/editor/components/bubble-menu/color-selector.tsx @@ -129,8 +129,7 @@ function handleColorKeyNav( grid: "text" | "highlight", ) { const cols = COLOR_GRID_COLS; - const total = - grid === "text" ? TEXT_COLORS.length : HIGHLIGHT_COLORS.length; + const total = grid === "text" ? TEXT_COLORS.length : HIGHLIGHT_COLORS.length; const col = index % cols; if (e.key === "ArrowRight") { @@ -163,8 +162,7 @@ function handleColorKeyNav( if (prev >= 0) { focusSwatch(grid, prev); } else if (grid === "highlight") { - const lastRowStart = - Math.floor((TEXT_COLORS.length - 1) / cols) * cols; + const lastRowStart = Math.floor((TEXT_COLORS.length - 1) / cols) * cols; focusSwatch("text", Math.min(lastRowStart + col, TEXT_COLORS.length - 1)); } return; @@ -222,7 +220,7 @@ export const ColorSelector: FC = ({ withArrow > - + - + + ); diff --git a/apps/client/src/features/editor/components/bubble-menu/link-selector.tsx b/apps/client/src/features/editor/components/bubble-menu/link-selector.tsx index fdacf6a18..0b7992f18 100644 --- a/apps/client/src/features/editor/components/bubble-menu/link-selector.tsx +++ b/apps/client/src/features/editor/components/bubble-menu/link-selector.tsx @@ -10,7 +10,7 @@ export const LinkSelector: FC = () => { const setShowLinkMenu = useSetAtom(showLinkMenuAtom); return ( - + = ({ onChange={setIsOpen} > - +