diff --git a/frontend/apps/desktop/src/editor/blocknote/core/extensions/LinkMenu/defaultLinkMenuItems.tsx b/frontend/apps/desktop/src/editor/blocknote/core/extensions/LinkMenu/defaultLinkMenuItems.tsx index d1f73f01..0cbc80a4 100644 --- a/frontend/apps/desktop/src/editor/blocknote/core/extensions/LinkMenu/defaultLinkMenuItems.tsx +++ b/frontend/apps/desktop/src/editor/blocknote/core/extensions/LinkMenu/defaultLinkMenuItems.tsx @@ -8,7 +8,14 @@ import { isPublicGatewayLink, normalizeHmId, } from '@shm/shared' -import {Link, Spinner, TwitterXIcon} from '@shm/ui' +import { + File as FileIcon, + ImageIcon, + Link, + Spinner, + TwitterXIcon, + VideoIcon, +} from '@shm/ui' import {CircleDot, PanelBottom, Quote} from '@tamagui/lucide-icons' import {Fragment, Node} from '@tiptap/pm/model' import {BlockNoteEditor} from '../../BlockNoteEditor' @@ -210,21 +217,33 @@ export function getLinkMenuItems({ ] } } else if (media) { + let mediaIcon + switch (media) { + case 'twitter': + mediaIcon = + break + case 'video': + mediaIcon = + break + case 'image': + mediaIcon = + break + default: + mediaIcon = + break + } const mediaItem = { name: media === 'twitter' ? 'X Post embed' : media.charAt(0).toUpperCase() + media.slice(1), disabled: false, - icon: - media === 'twitter' ? ( - - ) : undefined, + icon: mediaIcon, execute: (editor: BlockNoteEditor, link: string) => { const {state, schema} = editor._tiptapEditor const {selection} = state if (!selection.empty) return - let embedUrl = '' + let embedUrl = link ? link : sourceUrl ? sourceUrl : '' if (media === 'video') { let videoUrl = link ? link : sourceUrl ? sourceUrl : '' if (videoUrl.includes('youtu.be') || videoUrl.includes('youtube')) { diff --git a/frontend/packages/ui/src/icons.tsx b/frontend/packages/ui/src/icons.tsx index 9f506ae2..f9c13a61 100644 --- a/frontend/packages/ui/src/icons.tsx +++ b/frontend/packages/ui/src/icons.tsx @@ -11,9 +11,9 @@ export { Book, Camera, ChevronDown, - ChevronUp, ChevronsDownUp, ChevronsUpDown, + ChevronUp, Clock, X as Close, XSquare as CloseAll, @@ -77,6 +77,7 @@ export { Unlink, List as UnorderedList, User, + Video as VideoIcon, XCircle, } from "@tamagui/lucide-icons";