Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(web): add GIF search with /gif slash command (#8188)

Jacob Beckerman79cd6819e097
diff --git a/apps/web/src/features/channel/Input/ChannelInput.tsx b/apps/web/src/features/channel/Input/ChannelInput.tsx
index 04b2ba5efc..6dc414977b 100644
--- a/apps/web/src/features/channel/Input/ChannelInput.tsx
+++ b/apps/web/src/features/channel/Input/ChannelInput.tsx
@@ -34,6 +34,7 @@ import {
import type { EntityData } from '@entity';
import AtIcon from '@phosphor/at.svg';
import ChartBarIcon from '@phosphor/chart-bar-horizontal.svg';
+import GifIcon from '@phosphor/gif.svg';
import PaperclipIcon from '@phosphor/paperclip.svg';
import PhoneIcon from '@phosphor/phone.svg';
import type { MessageParent } from '@service-storage/messages';
@@ -422,6 +423,23 @@ export function ChannelInput(props: ChannelInputProps) {
},
];
};
+ // The picker opens at the caret, so the editor takes focus first.
+ const gif = (): ComposerAddMenuGroup['items'] => {
+ const action = slashAction('gif');
+ if (!action) return [];
+ return [
+ {
+ id: 'gif',
+ label: 'GIF',
+ icon: <GifIcon class="size-3.5" />,
+ onSelect: () =>
+ runInEditor((editor) => action.action(editor, actionContext), {
+ focus: true,
+ }),
+ focusesEditor: true,
+ },
+ ];
+ };
const macro = macroUser();
const startCall = props.onStartCall;
const callInProgress = !!props.callInProgress;
@@ -442,6 +460,7 @@ export function ChannelInput(props: ChannelInputProps) {
icon: <PaperclipIcon class="size-3.5" />,
onSelect: () => collapsedInput.attach(),
},
+ ...gif(),
],
},
{
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
index 07de3eac32..68e733a44c 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/builder/MarkdownShell.tsx
@@ -24,6 +24,7 @@ import { NodeAccessoryRenderer } from '../component/core/NodeAccessoryRenderer';
import { ActionMenu } from '../component/menu/ActionsMenu';
import { EmojiMenu } from '../component/menu/EmojiMenu';
import { FloatingFormatMenu } from '../component/menu/FloatingFormatMenu';
+import { FloatingGifMenu } from '../component/menu/FloatingGifMenu';
import { FloatingLinkMenu } from '../component/menu/FloatingLinkMenu';
import { MentionsMenu } from '../component/menu/MentionsMenu';
import { SkillsMenu } from '../component/menu/SkillsMenu';
@@ -367,11 +368,12 @@ export const MarkdownShell: Component<MarkdownShellProps> = (props) => {
)}
</Show>
- {/* Floating Link & Selection Format Menus */}
+ {/* Floating Link, Format, and GIF Menus */}
<Show
when={
builderConfig.links?.floatingMenu ||
- builderConfig.floatingFormatMenu
+ builderConfig.floatingFormatMenu ||
+ state.actionsMenuOps
}
>
<FloatingMenuGroup>
@@ -390,6 +392,12 @@ export const MarkdownShell: Component<MarkdownShellProps> = (props) => {
}
/>
</Show>
+ <Show when={state.actionsMenuOps}>
+ <FloatingGifMenu
+ canEdit={() => !props.disabled}
+ portalScope={props.portalScope}
+ />
+ </Show>
</FloatingMenuGroup>
</Show>
</div>
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx
new file mode 100644
index 0000000000..3f4840754e
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/component/menu/FloatingGifMenu.tsx
@@ -0,0 +1,246 @@
+import { type PortalScope, ScopedPortal } from '@core/component/ScopedPortal';
+import clickOutside from '@core/directive/clickOutside';
+import { useCanEdit } from '@core/signal/permissions';
+import MagnifyingGlassIcon from '@phosphor/magnifying-glass.svg';
+import { createCallback } from '@solid-primitives/rootless';
+import { debounce } from '@solid-primitives/scheduled';
+import { cn, InputGroup, Surface } from '@ui';
+import { $getSelection, $setSelection, type BaseSelection } from 'lexical';
+import {
+ type Accessor,
+ createEffect,
+ createResource,
+ createSignal,
+ For,
+ Match,
+ Show,
+ Switch,
+ untrack,
+ useContext,
+} from 'solid-js';
+import {
+ createMenuOpenSignal,
+ MenuPriority,
+} from '../../context/FloatingMenuContext';
+import { LexicalWrapperContext } from '../../context/LexicalWrapperContext';
+import { floatWithSelection } from '../../directive/floatWithSelection';
+import {
+ $insertGifNode,
+ type Gif,
+ gifPickerPlugin,
+ searchGifs,
+} from '../../plugins/gif';
+import PoweredByKlipy from '../../plugins/gif/powered-by-klipy.svg';
+import { useMenuKeyboardNavigation } from './useMenuKeyboardNavigation';
+
+false && floatWithSelection;
+false && clickOutside;
+
+const COLUMNS = 2;
+const RESULT_LIMIT = 30;
+
+/**
+ * GIF search, opened via TRY_INSERT_GIF_COMMAND (`/gif` or a composer's +).
+ * The search field takes focus; arrows move through the grid, Enter inserts,
+ * Escape closes. Portalled like the slash menu so the editor shell's click
+ * and keydown handlers don't swallow the picker's events.
+ */
+export function FloatingGifMenu(
+ props: { canEdit?: Accessor<boolean>; portalScope?: PortalScope } = {}
+) {
+ const canEdit = props.canEdit ?? useCanEdit();
+ const lexicalWrapper = useContext(LexicalWrapperContext);
+ const plugins = () => lexicalWrapper?.plugins;
+ const editor = () => lexicalWrapper?.editor;
+
+ const [menuOpen, setMenuOpen] = createMenuOpenSignal(
+ 'gif-picker-menu',
+ MenuPriority.Low,
+ false
+ );
+
+ const [searchTerm, setSearchTerm] = createSignal('');
+ const [debouncedSearchTerm, setDebouncedSearchTerm] = createSignal('');
+ const [selectedIndex, setSelectedIndex] = createSignal(0);
+ // The search field takes focus, so the editor's caret is kept to insert at.
+ let insertAt: BaseSelection | null = null;
+ let inputRef: HTMLInputElement | undefined;
+
+ const debouncedSetSearch = debounce(setDebouncedSearchTerm, 300);
+ const updateSearch = (term: string) => {
+ setSearchTerm(term);
+ setSelectedIndex(0);
+ debouncedSetSearch(term);
+ };
+
+ const [gifs, { refetch }] = createResource(
+ () => (menuOpen() ? debouncedSearchTerm() : false),
+ (query) => searchGifs(query, RESULT_LIMIT)
+ );
+ const gifList = () => (gifs.state === 'ready' ? gifs() : []);
+
+ const resetMenu = () => {
+ setMenuOpen(false);
+ debouncedSetSearch.clear();
+ setSearchTerm('');
+ setDebouncedSearchTerm('');
+ setSelectedIndex(0);
+ insertAt = null;
+ };
+
+ const closeToEditor = () => {
+ resetMenu();
+ editor()?.focus();
+ };
+
+ const handleOpenPicker = createCallback(() => {
+ if (menuOpen()) {
+ resetMenu();
+ return;
+ }
+ insertAt = $getSelection()?.clone() ?? null;
+ // Defer past the keystroke that ran the command, as FloatingTableMenu does.
+ setTimeout(() => {
+ setMenuOpen(true);
+ inputRef?.focus();
+ }, 0);
+ });
+
+ const insertGif = (gif: Gif) => {
+ const selection = insertAt;
+ editor()?.update(() => {
+ if (selection) $setSelection(selection.clone());
+ $insertGifNode(gif);
+ });
+ closeToEditor();
+ };
+
+ createEffect(() => {
+ const currentPlugins = plugins();
+ if (!currentPlugins) return;
+
+ currentPlugins.useReactive(canEdit, () => {
+ if (!canEdit()) return;
+ return gifPickerPlugin({ onOpenPicker: handleOpenPicker });
+ });
+ });
+
+ const moveSelection = (delta: number) => {
+ const lastIndex = gifList().length - 1;
+ if (lastIndex < 0) return;
+ setSelectedIndex((index) =>
+ Math.min(lastIndex, Math.max(0, index + delta))
+ );
+ };
+
+ useMenuKeyboardNavigation({
+ isActive: menuOpen,
+ onUp: () => moveSelection(-COLUMNS),
+ onDown: () => moveSelection(COLUMNS),
+ onLeft: () => moveSelection(-1),
+ onRight: () => moveSelection(1),
+ onSelect: () => {
+ const gif = gifList()[selectedIndex()];
+ if (gif) insertGif(gif);
+ },
+ onClose: closeToEditor,
+ });
+
+ return (
+ <Show when={menuOpen()}>
+ <ScopedPortal scope={props.portalScope}>
+ <div
+ class="w-80 cursor-default select-none z-modal-content menu-open-animation"
+ use:floatWithSelection={{
+ selection: untrack(() => window.getSelection()),
+ reactiveOnContainer: editor()?.getRootElement(),
+ }}
+ use:clickOutside={resetMenu}
+ on:touchstart={(event) => event.stopPropagation()}
+ // Keep focus in the search field while picking a GIF.
+ on:mousedown={(event) => {
+ if (event.target !== inputRef) event.preventDefault();
+ }}
+ >
+ <Surface
+ depth={2}
+ class="flex flex-col gap-1.5 p-1.5 glass bg-menu-glass rounded-xl"
+ >
+ <InputGroup size="sm">
+ <InputGroup.Input
+ ref={inputRef}
+ type="search"
+ value={searchTerm()}
+ onInput={(event) => updateSearch(event.currentTarget.value)}
+ placeholder="Search KLIPY"
+ aria-label="Search GIFs"
+ />
+ <InputGroup.Addon align="inline-start">
+ <MagnifyingGlassIcon aria-hidden="true" />
+ </InputGroup.Addon>
+ </InputGroup>
+
+ <div class="h-70 overflow-y-auto overscroll-contain scrollbar-hidden">
+ <Switch>
+ <Match when={gifs.error}>
+ <div class="flex h-full flex-col items-center justify-center gap-1 text-sm text-ink-muted">
+ Couldn't load GIFs
+ <button
+ type="button"
+ class="text-xs text-accent"
+ onClick={() => refetch()}
+ >
+ Try again
+ </button>
+ </div>
+ </Match>
+ <Match when={gifs.loading && gifList().length === 0}>
+ <div class="flex h-full items-center justify-center text-sm text-ink-muted">
+ Loading…
+ </div>
+ </Match>
+ <Match when={gifList().length === 0}>
+ <div class="flex h-full items-center justify-center text-sm text-ink-muted">
+ No GIFs found
+ </div>
+ </Match>
+ <Match when={true}>
+ <div class="grid grid-cols-2 auto-rows-24 gap-1.5 p-0.5">
+ <For each={gifList()}>
+ {(gif, index) => (
+ <button
+ type="button"
+ aria-label={gif.title}
+ onClick={() => insertGif(gif)}
+ onPointerEnter={() => setSelectedIndex(index())}
+ class={cn(
+ 'size-full overflow-hidden rounded-lg bg-ink/5 outline-none',
+ selectedIndex() === index() && 'ring-2 ring-accent'
+ )}
+ >
+ <img
+ src={gif.previewUrl}
+ alt=""
+ loading="lazy"
+ class="size-full object-cover"
+ />
+ </button>
+ )}
+ </For>
+ </div>
+ </Match>
+ </Switch>
+ </div>
+
+ <div class="flex justify-end px-1">
+ <PoweredByKlipy
+ class="h-2.5 w-auto text-ink-extra-muted"
+ aria-label="Powered by KLIPY"
+ />
+ </div>
+ </Surface>
+ </div>
+ </ScopedPortal>
+ </Show>
+ );
+}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/editing/MarkdownEditingOverlays.tsx b/apps/web/src/lib/core/component/LexicalMarkdown/editing/MarkdownEditingOverlays.tsx
index fa3e38d17f..72bd1dfb29 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/editing/MarkdownEditingOverlays.tsx
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/editing/MarkdownEditingOverlays.tsx
@@ -6,6 +6,7 @@ import { NodeAccessoryRenderer } from '../component/core/NodeAccessoryRenderer';
import { ActionMenu } from '../component/menu/ActionsMenu';
import { EmojiMenu } from '../component/menu/EmojiMenu';
import { FloatingEquationMenu } from '../component/menu/FloatingEquationMenu';
+import { FloatingGifMenu } from '../component/menu/FloatingGifMenu';
import { FloatingLinkMenu } from '../component/menu/FloatingLinkMenu';
import { FloatingTableMenu } from '../component/menu/FloatingTableMenu';
import { MentionsMenu } from '../component/menu/MentionsMenu/MentionsMenu';
@@ -98,6 +99,7 @@ export function MarkdownEditingOverlays(props: {
<FloatingLinkMenu autoLinkMatchMode="common-tlds" />
<FloatingEquationMenu canEdit={props.canEdit} />
<FloatingTableMenu canEdit={props.canEdit} />
+ <FloatingGifMenu canEdit={props.canEdit} />
{props.floatingMenus}
</FloatingMenuGroup>
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/actions/actions.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/actions/actions.ts
index 8c15c8f94c..355af6914e 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/actions/actions.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/actions/actions.ts
@@ -28,6 +28,7 @@ import CodeBlock from '@phosphor/code-block.svg';
import FileText from '@phosphor/file-text.svg';
import VideoIcon from '@phosphor/file-video.svg';
import MathIcon from '@phosphor/function.svg';
+import GifIcon from '@phosphor/gif.svg';
import TableIcon from '@phosphor/grid-four.svg';
import ImageIcon from '@phosphor/image.svg';
import LightningIcon from '@phosphor/lightning.svg';
@@ -49,6 +50,7 @@ import {
INSERT_AWAIT_NODE_COMMAND,
REPLACE_AWAIT_NODE_COMMAND,
} from '../await';
+import { TRY_INSERT_GIF_COMMAND } from '../gif';
import { TRY_INSERT_EQUATION_COMMAND } from '../katex';
import { TRY_INSERT_LINK_COMMAND } from '../links';
import { TRY_INSERT_MEDIA_UPLOAD_COMMAND } from '../media';
@@ -270,6 +272,19 @@ export const ACTIONS: Action[] = [
},
dependencies: [ImageNode, VideoNode],
},
+ {
+ id: 'gif',
+ name: 'GIF',
+ keywords: ['gif', 'giphy', 'tenor', 'animated', 'meme', 'reaction'],
+ category: ActionCategory.MEDIA,
+ icon: GifIcon,
+ action: (editor: LexicalEditor) => {
+ queueMicrotask(() => {
+ editor.dispatchCommand(TRY_INSERT_GIF_COMMAND, undefined);
+ });
+ },
+ dependencies: [ImageNode],
+ },
{
id: 'video',
name: 'Video',
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/gifPlugin.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/gifPlugin.ts
new file mode 100644
index 0000000000..045c52957a
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/gifPlugin.ts
@@ -0,0 +1,59 @@
+import { $createImageNode, ImageNode } from '@macro-inc/lexical-core';
+import {
+ $getSelection,
+ COMMAND_PRIORITY_NORMAL,
+ createCommand,
+ type LexicalCommand,
+ type LexicalEditor,
+} from 'lexical';
+import { $insertNodesAndSplitList } from '../../utils';
+import type { Gif } from './klipy';
+
+const MAX_GIF_WIDTH = 400;
+
+export const TRY_INSERT_GIF_COMMAND: LexicalCommand<void> = createCommand(
+ 'TRY_INSERT_GIF_COMMAND'
+);
+
+type GifPickerPluginProps = {
+ onOpenPicker: () => void;
+};
+
+function registerGifPickerPlugin(
+ editor: LexicalEditor,
+ props: GifPickerPluginProps
+) {
+ return editor.registerCommand(
+ TRY_INSERT_GIF_COMMAND,
+ () => {
+ const selection = $getSelection();
+ if (!selection) {
+ return false;
+ }
+ props.onOpenPicker();
+ return true;
+ },
+ COMMAND_PRIORITY_NORMAL
+ );
+}
+
+export function gifPickerPlugin(props: GifPickerPluginProps) {
+ return (editor: LexicalEditor) => registerGifPickerPlugin(editor, props);
+}
+
+export function $insertGifNode(gif: Gif) {
+ const width = Math.min(gif.width, MAX_GIF_WIDTH);
+ const imageNode = $createImageNode({
+ srcType: 'url',
+ url: gif.url,
+ alt: gif.title,
+ width: gif.width,
+ height: gif.height,
+ constrainedWidth: width,
+ constrainedHeight: Math.round((width / gif.width) * gif.height),
+ });
+
+ $insertNodesAndSplitList([imageNode]);
+}
+
+export { ImageNode as GifDependency };
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/index.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/index.ts
new file mode 100644
index 0000000000..d7d33937eb
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/index.ts
@@ -0,0 +1,7 @@
+export {
+ $insertGifNode,
+ GifDependency,
+ gifPickerPlugin,
+ TRY_INSERT_GIF_COMMAND,
+} from './gifPlugin';
+export { fetchTrendingGifs, type Gif, searchGifs } from './klipy';
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/klipy.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/klipy.ts
new file mode 100644
index 0000000000..2c0c0c9dbf
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/klipy.ts
@@ -0,0 +1,81 @@
+import { z } from 'zod';
+
+// Klipy keys are meant to ship in the client: its terms require requests to
+// come from the user's browser, not a proxy.
+const KLIPY_API_KEY =
+ 'FKijCGbLIyeSWaLowRX53mFAkpjDPZ3S8ncEw1AENQdL4tj0CQFpu37JmJaMluHG';
+// Klipy serves Tenor's v2 API shape.
+const KLIPY_BASE_URL = 'https://api.klipy.com/v2';
+const MEDIA_FILTER = 'gif,tinygif,nanogif,mediumgif';
+const CONTENT_FILTER = 'medium';
+
+export interface Gif {
+ id: string;
+ title: string;
+ previewUrl: string;
+ url: string;
+ width: number;
+ height: number;
+}
+
+const mediaFormatSchema = z.object({
+ url: z.string(),
+ dims: z.tuple([z.number(), z.number()]),
+});
+
+const resultSchema = z.object({
+ id: z.string(),
+ title: z.string(),
+ media_formats: z.object({
+ gif: mediaFormatSchema.optional(),
+ mediumgif: mediaFormatSchema.optional(),
+ tinygif: mediaFormatSchema.optional(),
+ nanogif: mediaFormatSchema.optional(),
+ }),
+});
+
+const responseSchema = z.object({ results: z.array(resultSchema) });
+
+function toGif(result: z.infer<typeof resultSchema>): Gif | null {
+ // mediumgif is a fraction of the full gif's size at message width.
+ const gif = result.media_formats.mediumgif ?? result.media_formats.gif;
+ const preview = result.media_formats.tinygif ?? result.media_formats.nanogif;
+ if (!gif || !preview) return null;
+
+ return {
+ id: result.id,
+ title: result.title,
+ previewUrl: preview.url,
+ url: gif.url,
+ width: gif.dims[0],
+ height: gif.dims[1],
+ };
+}
+
+async function fetchGifs(
+ endpoint: 'search' | 'featured',
+ params: Record<string, string>
+): Promise<Gif[]> {
+ const query = new URLSearchParams({
+ key: KLIPY_API_KEY,
+ media_filter: MEDIA_FILTER,
+ contentfilter: CONTENT_FILTER,
+ ...params,
+ });
+ const response = await fetch(`${KLIPY_BASE_URL}/${endpoint}?${query}`);
+ if (!response.ok) {
+ throw new Error(`Klipy API error: ${response.status}`);
+ }
+
+ const data = responseSchema.parse(await response.json());
+ return data.results.map(toGif).filter((gif) => gif !== null);
+}
+
+export function searchGifs(query: string, limit = 20): Promise<Gif[]> {
+ if (!query.trim()) return fetchTrendingGifs(limit);
+ return fetchGifs('search', { q: query, limit: String(limit) });
+}
+
+export function fetchTrendingGifs(limit = 20): Promise<Gif[]> {
+ return fetchGifs('featured', { limit: String(limit) });
+}
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/powered-by-klipy.svg b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/powered-by-klipy.svg
new file mode 100644
index 0000000000..d91ec1e98c
--- /dev/null
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/gif/powered-by-klipy.svg
@@ -0,0 +1,30 @@
+<svg viewBox="0 0 2335.63 396.67" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
+ <g>
+ <g>
+ <g>
+ <path d="M82.4,203.22c7.32,7.05,10.99,16.84,10.99,29.38,0,8.32-1.69,15.48-5.08,21.47-3.39,5.99-8.1,10.54-14.15,13.65-6.05,3.11-13.01,4.66-20.89,4.66h-28.63v44.78H0v-124.51h53.27c12.09,0,21.81,3.52,29.13,10.57ZM50.27,250.58c5.21,0,9.51-1.58,12.9-4.74,3.38-3.16,5.08-7.57,5.08-13.23s-1.69-10.24-5.08-13.4c-3.39-3.16-7.69-4.74-12.9-4.74h-25.63v36.12h25.63Z"/>
+ <path d="M207.16,198.81c9.71,5.22,17.34,12.65,22.89,22.31,5.55,9.65,8.32,20.92,8.32,33.79s-2.78,24.14-8.32,33.79c-5.55,9.65-13.18,17.09-22.89,22.31-9.71,5.22-20.72,7.82-33.04,7.82s-23.55-2.61-33.38-7.82c-9.82-5.21-17.51-12.65-23.05-22.31-5.55-9.65-8.32-20.92-8.32-33.79s2.77-24.14,8.32-33.79c5.55-9.65,13.23-17.09,23.05-22.31,9.82-5.21,20.95-7.82,33.38-7.82s23.33,2.61,33.04,7.82ZM139.66,277.38c3.33,6.33,7.96,11.18,13.9,14.56,5.94,3.39,12.79,5.08,20.56,5.08s14.45-1.69,20.39-5.08c5.94-3.38,10.54-8.24,13.82-14.56,3.27-6.33,4.91-13.82,4.91-22.47s-1.64-16.15-4.91-22.47c-3.27-6.33-7.88-11.18-13.82-14.56-5.94-3.38-12.73-5.08-20.39-5.08s-14.62,1.69-20.56,5.08c-5.94,3.39-10.57,8.24-13.9,14.56-3.33,6.33-4.99,13.82-4.99,22.47s1.66,16.15,4.99,22.47Z"/>
+ <path d="M339.91,235.93l-27.13,81.23h-20.81l-43.45-124.51h27.13l26.97,83.56,27.13-83.56h20.31l27.13,83.56,27.13-83.56h26.97l-43.45,124.51h-20.81l-27.13-81.23Z"/>
+ <path d="M474.24,242.59h47.61v21.47h-47.61v31.13h54.93v21.97h-79.57v-124.51h79.4v21.81h-54.77v28.13Z"/>
+ <path d="M552.98,192.65h52.6c11.99,0,21.64,3.5,28.96,10.49s10.99,16.7,10.99,29.13c0,8.55-1.78,15.84-5.33,21.89-3.55,6.05-8.55,10.57-14.98,13.57l26.97,49.44h-27.97l-24.64-45.28h-21.97v45.28h-24.64v-124.51ZM602.58,250.08c5.33,0,9.65-1.55,12.98-4.66,3.33-3.11,4.99-7.49,4.99-13.15s-1.66-10.04-4.99-13.15c-3.33-3.11-7.66-4.66-12.98-4.66h-24.97v35.62h24.97Z"/>
+ <path d="M698.3,242.59h47.61v21.47h-47.61v31.13h54.93v21.97h-79.57v-124.51h79.4v21.81h-54.77v28.13Z"/>
+ <path d="M859.6,200.14c9.32,4.99,16.65,12.18,21.97,21.56,5.33,9.38,7.99,20.45,7.99,33.21s-2.66,23.83-7.99,33.21c-5.33,9.38-12.68,16.56-22.06,21.56-9.38,4.99-19.95,7.49-31.71,7.49h-50.77v-124.51h50.94c11.76,0,22.31,2.5,31.63,7.49ZM827.97,295.85c11.43,0,20.47-3.5,27.13-10.49,6.66-6.99,9.99-17.15,9.99-30.46s-3.3-23.47-9.9-30.46c-6.6-6.99-15.62-10.49-27.05-10.49h-26.47v81.9h26.3Z"/>
+ <path d="M1031.3,201.39c7.05,5.83,10.57,14.4,10.57,25.72,0,5.66-1.06,10.52-3.16,14.57-2.11,4.05-4.88,7.41-8.32,10.07,4.66,2.11,8.57,5.69,11.74,10.74,3.16,5.05,4.74,11.24,4.74,18.56,0,11.65-3.64,20.59-10.9,26.8-7.27,6.22-16.95,9.32-29.05,9.32h-55.26v-124.51h51.44c11.76,0,21.17,2.91,28.21,8.74ZM1001.92,242.92c4.55,0,8.13-1.14,10.74-3.41,2.61-2.27,3.91-5.8,3.91-10.57s-1.44-8.38-4.33-10.82c-2.89-2.44-6.88-3.66-11.99-3.66h-23.97v28.46h25.63ZM1003.92,295.19c5.44,0,9.76-1.27,12.98-3.83,3.22-2.55,4.83-6.43,4.83-11.65s-1.58-9.26-4.74-11.82c-3.16-2.55-7.35-3.83-12.57-3.83h-28.13v31.13h27.63Z"/>
+ <path d="M1104.29,317.16v-48.27l-47.27-76.24h28.63l30.96,51.77,30.8-51.77h28.63l-47.11,76.24v48.27h-24.64Z"/>
+ </g>
+ <g>
+ <rect x="1742.19" y="111.85" width="85.35" height="284.82" rx="4.27" ry="4.27"/>
+ <path d="M1603.91,309.45V124.2c0-6.82-5.53-12.36-12.36-12.36h-60.64c-6.82,0-12.36,5.53-12.36,12.36v260.11c0,6.82,5.53,12.36,12.36,12.36h180.82c6.82,0,12.36-5.53,12.36-12.36v-50.15c0-6.82-5.53-12.36-12.36-12.36h-95.46c-6.82,0-12.36-5.53-12.36-12.36Z"/>
+ <path d="M1964.12,111.82c-3.2,0-9.84.03-10.02.03h-29.97s-66.71,0-66.71,0c-6.82,0-12.36,5.53-12.36,12.36v260.11c0,6.82,5.53,12.36,12.36,12.36h60.64c6.82,0,12.36-5.53,12.36-12.36v-71.89c0-2.18,2.09-3.79,4.18-3.17,30.52,8.94,70.45,9.83,104.71-24.43,72.96-72.96,3.73-173.01-75.18-173.01ZM1985.45,236.59c-32.47,22.93-68.34-12.95-45.41-45.41.75-1.06,1.69-2,2.75-2.75,32.47-22.93,68.34,12.94,45.41,45.41-.75,1.06-1.69,2-2.75,2.75Z"/>
+ <path d="M2332.11,156.92l-41.66-41.66c-4.69-4.69-12.29-4.69-16.97,0l-66.55,66.55c-1.84,1.84-4.83,1.84-6.67,0l-66.55-66.55c-4.69-4.69-12.29-4.69-16.97,0l-41.66,41.66c-4.69,4.69-4.69,12.29,0,16.97l85.61,85.61c.93.93,1.45,2.19,1.45,3.5v121.66c0,6.63,5.37,12,12,12h58.91c6.63,0,12-5.37,12-12v-121.66c0-1.31.52-2.57,1.45-3.5l85.61-85.61c4.69-4.69,4.69-12.29,0-16.97Z"/>
+ <g>
+ <g>
+ <path d="M1496.99,385.59l-83.53-128.94c-1.49-2.3-1.53-5.25-.08-7.63l78.43-129.01c2.91-4.83-.54-11-6.17-11l-49.54,11.23c-39.39,8.89-51.04,31.84-74.64,64.6-4.64,6.44-7.63,10.81-7.63,10.81-3.6,6.59-13.56,4.02-13.56-3.41v-106.37c-30.04,0-45.75,10.96-57.97,21.04-37.59,31.04-45.83,69.51-45.83,118.4v164.15c0,3.98,3.22,7.2,7.2,7.2h89.43c3.95,0,7.17-3.22,7.17-7.2v-81.84c0-7.32,9.62-9.96,13.37-3.72l30.5,89.28c1.3,2.18,3.68,3.49,6.17,3.49h100.62c5.75.04,9.2-6.28,6.05-11.07ZM1319.78,123.51c-5.4,0-9.81-4.41-9.81-9.81s4.41-9.77,9.81-9.77,9.77,4.37,9.77,9.77-4.37,9.81-9.77,9.81Z"/>
+ <path d="M1223.83,180.64c.8,2.11,7.78-109.85,117.36-110.93,0,0-88.93-104.18-121.85-57.82,0,0-16.32,25.6,15.17,33.45,0,0-50.73,13.26-49.7,48.59.34,11.04,11.53,18.16,21.65,13.76,5.86-2.57,13.33-7.59,22.72-16.48.04-.04-22.19,44.6-5.36,89.43Z"/>
+ </g>
+ <path d="M1352.46,90.36v27.17c0,1.95,2.15,3.1,3.76,2.03l25.94-17.24-26.13-14.06c-1.61-.88-3.56.27-3.56,2.11Z"/>
+ </g>
+ </g>
+ </g>
+ </g>
+</svg>
diff --git a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/index.ts b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/index.ts
index f20aa32f80..c325bd2eee 100644
--- a/apps/web/src/lib/core/component/LexicalMarkdown/plugins/index.ts
+++ b/apps/web/src/lib/core/component/LexicalMarkdown/plugins/index.ts
@@ -17,6 +17,7 @@ export * from './emojis';
export * from './file-paste';
export * from './find-and-replace';
export * from './generate';
+export * from './gif';
export * from './horizontal-rules';
export * from './insert-text';
export * from './ios-cursor-scroll';
diff --git a/packages/lexical-core/node-list.ts b/packages/lexical-core/node-list.ts
index 465c034f06..df27a8a02b 100644
--- a/packages/lexical-core/node-list.ts
+++ b/packages/lexical-core/node-list.ts
@@ -156,7 +156,9 @@ export const RegisteredNodesByType: { [K in EditorType]: ValidNode[] } = {
'plain-text': [ParagraphNode, TextNode],
markdown: [...SupportedNodeTypes],
'markdown-sync': [...SupportedNodeTypes],
- chat: exclude([ImageNode, VideoNode]),
+ // Chat carries URL images (GIFs); uploaded media still goes as attachments,
+ // and the Image/Video slash actions need VideoNode, so they stay hidden.
+ chat: exclude([VideoNode]),
// Calendar descriptions are provider-supplied HTML from anyone who can write
// the event, so the editor must not carry a node that renders raw markup.
calendar: exclude([HtmlRenderNode, ImageNode, VideoNode]),