Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

feat(slash-menu): add an emoji picker entry (#2991)

Abraham417ff03d3f58
diff --git a/.changeset/slash-menu-emoji.md b/.changeset/slash-menu-emoji.md
new file mode 100644
index 000000000..14727dc40
--- /dev/null
+++ b/.changeset/slash-menu-emoji.md
@@ -0,0 +1,5 @@
+---
+"@inkeep/open-knowledge": minor
+---
+
+The slash menu now has an Emoji entry — type `/emoji` (or just `/:`) and an emoji picker opens right at your cursor, with search. Picking one inserts it as plain text, so it round-trips through markdown untouched.
diff --git a/packages/app/src/components/EditorPane.tsx b/packages/app/src/components/EditorPane.tsx
index d70f3e2fd..c50508ed3 100644
--- a/packages/app/src/components/EditorPane.tsx
+++ b/packages/app/src/components/EditorPane.tsx
@@ -1,5 +1,6 @@
import type { TerminalCli } from '@inkeep/open-knowledge-core';
import { lazy, Suspense, useEffect, useEffectEvent, useRef, useState } from 'react';
+import { EmojiInsertPopover } from '@/editor/components/EmojiInsertPopover';
import { TagDialog } from '@/editor/components/TagDialog';
import { useDocumentContext } from '@/editor/DocumentContext';
import { RAW_MDX_NAV_EVENT, type RawMdxNavDetail } from '@/editor/extensions/raw-mdx-nav-event';
@@ -553,6 +554,7 @@ export function EditorPane({ onOpenSearch }: EditorPaneProps = {}) {
onResolved={() => setAutoSyncOnboardingDismissed(true)}
/>
<TagDialog />
+ <EmojiInsertPopover />
{/*
Agent Activity Panel now lives inside DocPanel as the `'agent'` mode
content.
diff --git a/packages/app/src/components/PageHeaderWidgets.tsx b/packages/app/src/components/PageHeaderWidgets.tsx
index 2819a4c49..cce9973aa 100644
--- a/packages/app/src/components/PageHeaderWidgets.tsx
+++ b/packages/app/src/components/PageHeaderWidgets.tsx
@@ -26,10 +26,10 @@
// biome-ignore-all lint/plugin/no-raw-html-interactive-element: matches the existing PropertyWidgets.tsx posture — raw `<input>` is the typed-input affordance shared across every frontmatter widget; migrating to shadcn `<Input>` is the file-wide pre-rule backlog described in PropertyWidgets.tsx's top-of-file ignore comment.
import { ALLOWED_IMAGE_MIME_TYPES } from '@inkeep/open-knowledge-core';
-import { Trans, useLingui } from '@lingui/react/macro';
-import { EmojiPicker, type EmojiPickerListComponents } from 'frimousse';
+import { useLingui } from '@lingui/react/macro';
import { ImagePlus, Smile, Upload, X } from 'lucide-react';
import { useEffect, useRef, useState } from 'react';
+import { FrimousseEmojiPicker } from '@/components/emoji-picker';
import type { CommonWidgetProps } from '@/components/PropertyWidgets';
import { resolvePageCover, resolvePageIcon } from '@/components/page-header-utils';
import { Button } from '@/components/ui/button';
@@ -121,7 +121,7 @@ export function PageIconWidget({ keyName, value, onCommit }: CommonWidgetProps<s
<PageIconPreviewContent resolved={resolved} />
</button>
</PopoverTrigger>
- <PopoverContent className="w-auto p-0" align="end">
+ <PopoverContent className="w-auto p-0" align="end" aria-label={t`Emoji picker`}>
<FrimousseEmojiPicker
onSelect={(emoji) => {
setDraft(emoji);
@@ -367,68 +367,3 @@ function PageCoverPreviewContent({ resolved }: { resolved: ReturnType<typeof res
}
return <ImagePlus className="size-4" aria-hidden />;
}
-
-/**
- * Themed component overrides for `EmojiPicker.List` — extracted to a
- * module-level constant so React Compiler can hoist the object literal
- * once (the picker re-renders on every keystroke; an inline object
- * would create a new identity each pass and force the virtualised
- * list to remount its rows).
- */
-const EMOJI_LIST_COMPONENTS: EmojiPickerListComponents = {
- CategoryHeader: ({ category, ...props }) => (
- <div
- {...props}
- className="bg-popover px-3 pt-3 pb-1.5 font-medium text-muted-foreground text-xs"
- >
- {category.label}
- </div>
- ),
- Row: ({ children, ...props }) => (
- <div {...props} className="scroll-my-1.5 px-1.5">
- {children}
- </div>
- ),
- Emoji: ({ emoji, ...props }) => (
- <button
- type="button"
- {...props}
- className="flex size-8 items-center justify-center rounded-md text-lg data-[active]:bg-accent"
- >
- {emoji.emoji}
- </button>
- ),
-};
-
-/**
- * Frimousse-backed emoji picker, themed to match OK's shadcn surface
- * (popover bg, accent on hover, ring on focus). Keeps the picker
- * compact (320px) and constrained vertically so it fits inside the
- * popover without scrolling the page. The `onSelect` callback fires
- * with the rendered emoji string (multi-codepoint sequences already
- * joined by `frimousse`).
- */
-function FrimousseEmojiPicker({ onSelect }: { onSelect: (emoji: string) => void }) {
- const { t } = useLingui();
- return (
- <EmojiPicker.Root
- className="isolate flex h-[326px] w-[320px] flex-col bg-popover text-popover-foreground"
- onEmojiSelect={({ emoji }) => onSelect(emoji)}
- >
- <EmojiPicker.Search
- className="z-10 mx-2 mt-2 rounded-md border bg-background px-2.5 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
- placeholder={t`Search emoji`}
- autoFocus
- />
- <EmojiPicker.Viewport className="relative flex-1 outline-none">
- <EmojiPicker.Loading className="absolute inset-0 flex items-center justify-center text-muted-foreground text-sm">
- <Trans>Loading</Trans>
- </EmojiPicker.Loading>
- <EmojiPicker.Empty className="absolute inset-0 flex items-center justify-center text-muted-foreground text-sm">
- <Trans>No emoji found.</Trans>
- </EmojiPicker.Empty>
- <EmojiPicker.List className="select-none pb-1.5" components={EMOJI_LIST_COMPONENTS} />
- </EmojiPicker.Viewport>
- </EmojiPicker.Root>
- );
-}
diff --git a/packages/app/src/components/emoji-picker.tsx b/packages/app/src/components/emoji-picker.tsx
new file mode 100644
index 000000000..54f1537ad
--- /dev/null
+++ b/packages/app/src/components/emoji-picker.tsx
@@ -0,0 +1,74 @@
+// biome-ignore-all lint/plugin/no-raw-html-interactive-element: frimousse's `EmojiPicker.List` overrides spread the library's own props (active-state data attrs, virtualised-grid wiring) onto a plain element; shadcn Button's variant styling would fight the picker grid. Moved verbatim from PageHeaderWidgets.tsx, which carries the same file-level posture.
+
+/**
+ * Frimousse-backed emoji picker, themed to match OK's shadcn surface
+ * (popover bg, accent on hover, ring on focus). Shared by the page-icon
+ * frontmatter widget and the slash-menu Emoji insertion popover — one
+ * themed surface so the two pickers can't drift apart visually.
+ */
+
+import { Trans, useLingui } from '@lingui/react/macro';
+import { EmojiPicker, type EmojiPickerListComponents } from 'frimousse';
+
+/**
+ * Themed component overrides for `EmojiPicker.List` — extracted to a
+ * module-level constant so React Compiler can hoist the object literal
+ * once (the picker re-renders on every keystroke; an inline object
+ * would create a new identity each pass and force the virtualised
+ * list to remount its rows).
+ */
+const EMOJI_LIST_COMPONENTS: EmojiPickerListComponents = {
+ CategoryHeader: ({ category, ...props }) => (
+ <div
+ {...props}
+ className="bg-popover px-3 pt-3 pb-1.5 font-medium text-muted-foreground text-xs"
+ >
+ {category.label}
+ </div>
+ ),
+ Row: ({ children, ...props }) => (
+ <div {...props} className="scroll-my-1.5 px-1.5">
+ {children}
+ </div>
+ ),
+ Emoji: ({ emoji, ...props }) => (
+ <button
+ type="button"
+ {...props}
+ className="flex size-8 items-center justify-center rounded-md text-lg data-[active]:bg-accent"
+ >
+ {emoji.emoji}
+ </button>
+ ),
+};
+
+/**
+ * Compact (320px) picker constrained vertically so it fits inside a
+ * popover without scrolling the page. The `onSelect` callback fires
+ * with the rendered emoji string (multi-codepoint sequences already
+ * joined by `frimousse`).
+ */
+export function FrimousseEmojiPicker({ onSelect }: { onSelect: (emoji: string) => void }) {
+ const { t } = useLingui();
+ return (
+ <EmojiPicker.Root
+ className="isolate flex h-[326px] w-[320px] flex-col bg-popover text-popover-foreground"
+ onEmojiSelect={({ emoji }) => onSelect(emoji)}
+ >
+ <EmojiPicker.Search
+ className="z-10 mx-2 mt-2 rounded-md border bg-background px-2.5 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ placeholder={t`Search emoji`}
+ autoFocus
+ />
+ <EmojiPicker.Viewport className="relative flex-1 overscroll-contain outline-none">
+ <EmojiPicker.Loading className="absolute inset-0 flex items-center justify-center text-muted-foreground text-sm">
+ <Trans>Loading</Trans>
+ </EmojiPicker.Loading>
+ <EmojiPicker.Empty className="absolute inset-0 flex items-center justify-center text-muted-foreground text-sm">
+ <Trans>No emoji found.</Trans>
+ </EmojiPicker.Empty>
+ <EmojiPicker.List className="select-none pb-1.5" components={EMOJI_LIST_COMPONENTS} />
+ </EmojiPicker.Viewport>
+ </EmojiPicker.Root>
+ );
+}
diff --git a/packages/app/src/editor/components/EmojiInsertPopover.dom.test.tsx b/packages/app/src/editor/components/EmojiInsertPopover.dom.test.tsx
new file mode 100644
index 000000000..aa4ea78c4
--- /dev/null
+++ b/packages/app/src/editor/components/EmojiInsertPopover.dom.test.tsx
@@ -0,0 +1,146 @@
+/**
+ * Pins the `ok:emoji-picker-open` → popover → insert contract:
+ *
+ * 1. Dispatching the open event mounts the caret-anchored picker popover.
+ * 2. `insertEmojiAtCaret` lands the emoji as plain text at the caret (the
+ * select path's only editor mutation).
+ * 3. Dismissing the popover returns focus to the editor.
+ *
+ * Tier: `.dom.test.tsx` (jsdom) — the popover anchors off a mounted TipTap
+ * Editor's `view.coordsAtPos`.
+ */
+
+import { cleanup, render, screen, waitFor } from '@testing-library/react';
+import { Editor } from '@tiptap/core';
+import { afterEach, describe, expect, test } from 'vitest';
+import { sharedExtensions } from '../extensions/shared';
+import { openEmojiPickerForEditor } from '../slash-command/emoji-picker-event';
+import { EmojiInsertPopover, insertEmojiAtCaret } from './EmojiInsertPopover';
+
+function mountEditor(): { editor: Editor; container: HTMLDivElement } {
+ const container = document.createElement('div');
+ document.body.appendChild(container);
+ const editor = new Editor({
+ element: container,
+ extensions: sharedExtensions,
+ editable: true,
+ content: { type: 'doc', content: [{ type: 'paragraph' }] },
+ });
+ return { editor, container };
+}
+
+afterEach(cleanup);
+
+describe('EmojiInsertPopover', () => {
+ test('the open event mounts the picker anchored at the caret', async () => {
+ const { editor, container } = mountEditor();
+ try {
+ render(<EmojiInsertPopover />);
+ expect(screen.queryByTestId('emoji-picker-anchor')).toBeNull();
+
+ openEmojiPickerForEditor({ editor });
+
+ await waitFor(() => {
+ expect(screen.getByTestId('emoji-picker-anchor')).toBeTruthy();
+ });
+ } finally {
+ editor.destroy();
+ container.remove();
+ }
+ });
+
+ test('insertEmojiAtCaret lands the emoji as plain text at the caret', () => {
+ const { editor, container } = mountEditor();
+ try {
+ editor.commands.insertContent({ type: 'text', text: 'before after' });
+ editor.commands.setTextSelection(1 + 'before'.length);
+
+ insertEmojiAtCaret(editor, '🎉');
+
+ expect(editor.state.doc.textContent).toBe('before🎉 after');
+ } finally {
+ editor.destroy();
+ container.remove();
+ }
+ });
+
+ test('the open event with a destroyed editor mounts nothing', () => {
+ const { editor, container } = mountEditor();
+ render(<EmojiInsertPopover />);
+ editor.destroy();
+ container.remove();
+
+ openEmojiPickerForEditor({ editor });
+
+ expect(screen.queryByTestId('emoji-picker-anchor')).toBeNull();
+ });
+
+ test('dismissing after the editor was destroyed closes without throwing', async () => {
+ const { editor, container } = mountEditor();
+ render(<EmojiInsertPopover />);
+ openEmojiPickerForEditor({ editor });
+ await waitFor(() => {
+ expect(screen.getByTestId('emoji-picker-anchor')).toBeTruthy();
+ });
+
+ editor.destroy();
+ container.remove();
+ document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
+
+ await waitFor(() => {
+ expect(screen.queryByTestId('emoji-picker-anchor')).toBeNull();
+ });
+ });
+
+ test('pointer-down outside dismisses WITHOUT stealing focus back to the editor', async () => {
+ const { editor, container } = mountEditor();
+ const outside = document.createElement('button');
+ outside.type = 'button';
+ document.body.appendChild(outside);
+ try {
+ render(<EmojiInsertPopover />);
+ openEmojiPickerForEditor({ editor });
+ await waitFor(() => {
+ expect(screen.getByTestId('emoji-picker-anchor')).toBeTruthy();
+ });
+
+ outside.focus();
+ outside.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true }));
+
+ await waitFor(() => {
+ expect(screen.queryByTestId('emoji-picker-anchor')).toBeNull();
+ });
+ // The refocus split's whole point: the clicked control keeps focus.
+ expect(document.activeElement).toBe(outside);
+ expect(editor.isFocused).toBe(false);
+ } finally {
+ outside.remove();
+ editor.destroy();
+ container.remove();
+ }
+ });
+
+ test('dismissing the popover unmounts it and refocuses the editor', async () => {
+ const { editor, container } = mountEditor();
+ try {
+ render(<EmojiInsertPopover />);
+ openEmojiPickerForEditor({ editor });
+ await waitFor(() => {
+ expect(screen.getByTestId('emoji-picker-anchor')).toBeTruthy();
+ });
+
+ document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }));
+
+ await waitFor(() => {
+ expect(screen.queryByTestId('emoji-picker-anchor')).toBeNull();
+ });
+ // jsdom delivers the focus event (which flips `isFocused`) async.
+ await waitFor(() => {
+ expect(editor.isFocused).toBe(true);
+ });
+ } finally {
+ editor.destroy();
+ container.remove();
+ }
+ });
+});
diff --git a/packages/app/src/editor/components/EmojiInsertPopover.tsx b/packages/app/src/editor/components/EmojiInsertPopover.tsx
new file mode 100644
index 000000000..e6b314de8
--- /dev/null
+++ b/packages/app/src/editor/components/EmojiInsertPopover.tsx
@@ -0,0 +1,138 @@
+/**
+ * EmojiInsertPopover — opens in response to `ok:emoji-picker-open` events
+ * fired by the slash menu's Emoji item. Anchors a frimousse picker at the
+ * caret (tracking editor scroll while open); picking inserts the emoji as
+ * plain text (emoji are ordinary Unicode, so GFM round-trips them
+ * byte-for-byte) and returns focus to the editor. Escape also restores
+ * focus; pointer/focus dismissal deliberately does NOT refocus — the
+ * control the user clicked must keep the focus it just took (TipTap's
+ * `focus` defers to rAF, so an unconditional refocus would land one frame
+ * after the click and steal it back).
+ *
+ * Mounts once at app shell scope (EditorPane) — see TagDialog for the
+ * singleton-listener rationale.
+ */
+
+import { useLingui } from '@lingui/react/macro';
+import type { Editor } from '@tiptap/react';
+import { useEffect, useState } from 'react';
+import { FrimousseEmojiPicker } from '@/components/emoji-picker';
+import { Popover, PopoverAnchor, PopoverContent } from '@/components/ui/popover';
+import {
+ EMOJI_PICKER_OPEN_EVENT,
+ type EmojiPickerOpenDetail,
+} from '@/editor/slash-command/emoji-picker-event';
+
+/**
+ * Insert at the current caret rather than a position captured at open time:
+ * remote CRDT edits can shift positions while the picker is up, and the
+ * editor's own selection is the one thing the collab binding keeps mapped.
+ */
+export function insertEmojiAtCaret(editor: Editor, emoji: string): void {
+ editor.chain().focus().insertContent({ type: 'text', text: emoji }).run();
+}
+
+interface CaretCoords {
+ left: number;
+ top: number;
+ bottom: number;
+}
+
+/** `editor.view` is a throwing proxy before ProseMirror mount (WARN rule). */
+function caretCoords(editor: Editor): CaretCoords | null {
+ if (editor.isDestroyed) return null;
+ try {
+ const c = editor.view.coordsAtPos(editor.state.selection.from);
+ return { left: c.left, top: c.top, bottom: c.bottom };
+ } catch {
+ return null;
+ }
+}
+
+interface OpenState extends CaretCoords {
+ editor: Editor;
+}
+
+export function EmojiInsertPopover() {
+ const { t } = useLingui();
+ const [state, setState] = useState<OpenState | null>(null);
+
+ useEffect(() => {
+ function onOpen(event: Event): void {
+ const detail = (event as CustomEvent<EmojiPickerOpenDetail>).detail;
+ if (!detail?.editor || detail.editor.isDestroyed) return;
+ const coords = caretCoords(detail.editor);
+ if (!coords) return;
+ setState({ editor: detail.editor, ...coords });
+ }
+ document.addEventListener(EMOJI_PICKER_OPEN_EVENT, onOpen);
+ return () => document.removeEventListener(EMOJI_PICKER_OPEN_EVENT, onOpen);
+ }, []);
+
+ // While open, follow the caret through editor scroll / viewport resize —
+ // the fixed-position anchor otherwise parks at the open-time pixels.
+ const openEditor = state?.editor ?? null;
+ useEffect(() => {
+ if (!openEditor) return;
+ function reposition(): void {
+ const editor = openEditor as Editor;
+ const coords = caretCoords(editor);
+ setState((current) => {
+ if (!current || current.editor !== editor) return current;
+ return coords ? { ...current, ...coords } : null;
+ });
+ }
+ document.addEventListener('scroll', reposition, { capture: true, passive: true });
+ window.addEventListener('resize', reposition);
+ return () => {
+ document.removeEventListener('scroll', reposition, { capture: true });
+ window.removeEventListener('resize', reposition);
+ };
+ }, [openEditor]);
+
+ if (!state) return null;
+
+ function close(refocus: boolean): void {
+ if (!state) return;
+ const { editor } = state;
+ setState(null);
+ if (refocus && !editor.isDestroyed) editor.commands.focus();
+ }
+
+ return (
+ <Popover
+ open
+ onOpenChange={(open) => {
+ // Fallback for dismissal paths not covered by the explicit
+ // callbacks below; those run first in the same tick, so this
+ // close is a no-op after them.
+ if (!open) close(false);
+ }}
+ >
+ <PopoverAnchor asChild>
+ <span
+ aria-hidden
+ data-testid="emoji-picker-anchor"
+ className="pointer-events-none fixed"
+ style={{ left: state.left, top: state.top, height: state.bottom - state.top }}
+ />
+ </PopoverAnchor>
+ <PopoverContent
+ className="w-auto p-0"
+ align="start"
+ aria-label={t`Emoji picker`}
+ data-testid="emoji-picker-popover"
+ onEscapeKeyDown={() => close(true)}
+ onInteractOutside={() => close(false)}
+ >
+ <FrimousseEmojiPicker
+ onSelect={(emoji) => {
+ const editor = state.editor;
+ setState(null);
+ insertEmojiAtCaret(editor, emoji);
+ }}
+ />
+ </PopoverContent>
+ </Popover>
+ );
+}
diff --git a/packages/app/src/editor/slash-command/emoji-picker-event.ts b/packages/app/src/editor/slash-command/emoji-picker-event.ts
new file mode 100644
index 000000000..88f078cda
--- /dev/null
+++ b/packages/app/src/editor/slash-command/emoji-picker-event.ts
@@ -0,0 +1,23 @@
+/**
+ * `ok:emoji-picker-open` — fired by the slash menu's Emoji item after its
+ * trigger-range delete commits. The singleton `EmojiInsertPopover` (mounted
+ * at app shell scope, same posture as TagDialog) listens on `document`, so
+ * the mount point stays decoupled from editor lifecycle — every Activity-pool
+ * slot dispatches onto the one listener.
+ */
+
+import type { Editor } from '@tiptap/react';
+
+export const EMOJI_PICKER_OPEN_EVENT = 'ok:emoji-picker-open';
+
+export interface EmojiPickerOpenDetail {
+ /** The editor whose caret the picker anchors to and inserts into. */
+ editor: Editor;
+}
+
+export function openEmojiPickerForEditor(detail: EmojiPickerOpenDetail): void {
+ if (typeof document === 'undefined') return;
+ document.dispatchEvent(
+ new CustomEvent<EmojiPickerOpenDetail>(EMOJI_PICKER_OPEN_EVENT, { detail }),
+ );
+}
diff --git a/packages/app/src/editor/slash-command/items.test.ts b/packages/app/src/editor/slash-command/items.test.ts
index fb21ecee0..36c9bf9ff 100644
--- a/packages/app/src/editor/slash-command/items.test.ts
+++ b/packages/app/src/editor/slash-command/items.test.ts
@@ -206,3 +206,52 @@ describe('Inline Math item composes into the slash-command transaction', () => {
}
});
});
+
+describe('emoji item', () => {
+ const emojiItem = () => {
+ const item = getSlashCommandItems().find((i) => i.name === 'emoji');
+ if (!item) throw new Error('emoji item missing');
+ return item;
+ };
+
+ test('lives in the insert category and is reachable via the ":" alias', () => {
+ expect(emojiItem().category).toBe('insert');
+ const result = filterItems(getSlashCommandItems(), ':');
+ expect(result.some((i) => i.name === 'emoji')).toBe(true);
+ });
+
+ test('contributes no chain steps and defers the picker open to afterCommit', () => {
+ const deferred: Array<() => void> = [];
+ let dispatched = 0;
+ // Node-env double for the document listener target — the dispatch helper
+ // goes through `document.dispatchEvent`, which the jsdom tier covers in
+ // EmojiInsertPopover.dom.test.tsx; here we only pin the deferral contract.
+ const ctx = {
+ chain: () => {
+ throw new Error('emoji item must not touch the chain');
+ },
+ state: {} as never,
+ editor: {} as never,
+ afterCommit: (fn: () => void) => deferred.push(fn),
+ } as unknown as SlashCommandContext;
+
+ const g = globalThis as { document?: unknown };
+ const originalDocument = g.document;
+ g.document = {
+ dispatchEvent: () => {
+ dispatched += 1;
+ return true;
+ },
+ };
+ try {
+ emojiItem().command(ctx);
+ expect(dispatched).toBe(0);
+ expect(deferred).toHaveLength(1);
+ for (const fn of deferred) fn();
+ expect(dispatched).toBe(1);
+ } finally {
+ if (originalDocument === undefined) delete g.document;
+ else g.document = originalDocument;
+ }
+ });
+});
diff --git a/packages/app/src/editor/slash-command/items.tsx b/packages/app/src/editor/slash-command/items.tsx
index 7dc6311b9..cd7b42033 100644
--- a/packages/app/src/editor/slash-command/items.tsx
+++ b/packages/app/src/editor/slash-command/items.tsx
@@ -18,11 +18,13 @@ import {
Minus,
Quote,
Sigma,
+ Smile,
Superscript,
Table2,
} from 'lucide-react';
import type { ReactNode } from 'react';
import { setPendingAutoOpen } from './component-items';
+import { openEmojiPickerForEditor } from './emoji-picker-event';
/**
* What an item's `command` receives when the slash menu runs it.
@@ -419,6 +421,24 @@ export function getSlashCommandItems(): SlashCommandItem[] {
),
},
},
+ {
+ // Emoji inserts plain Unicode text, so it needs no node type and
+ // round-trips GFM byte-for-byte. The item contributes no chain steps —
+ // the trigger-range delete commits alone, then `afterCommit` raises the
+ // app-scope picker popover (`EmojiInsertPopover`) anchored at the caret.
+ name: 'emoji',
+ label: t`Emoji`,
+ icon: Smile,
+ category: 'insert',
+ command: ({ editor, afterCommit }) => {
+ afterCommit(() => openEmojiPickerForEditor({ editor }));
+ },
+ aliases: [':', 'emoticon', 'smiley', 'face', 'reaction'],
+ preview: {
+ description: t`Pick an emoji to insert at the cursor.`,
+ render: () => <p className="text-2xl leading-8">🎉 🚀 ✅ ❤️ 👀</p>,
+ },
+ },
{
// Inline math goes in the static list (not the descriptor-driven
// `getComponentItems`) because `mathInline` is a PM atom node, not a
diff --git a/packages/app/src/locales/en/messages.json b/packages/app/src/locales/en/messages.json
index f749961c7..3556b10fa 100644
--- a/packages/app/src/locales/en/messages.json
+++ b/packages/app/src/locales/en/messages.json
@@ -1200,6 +1200,7 @@
"Insert, delete, move, copy, and indent source editor lines through CodeMirror's default keymap."
],
"MHrjPM": ["Title"],
+ "MI6Z0f": ["Pick an emoji to insert at the cursor."],
"MJqRO6": ["Your report is being sent."],
"MJuO1q": ["Context window:"],
"MKEPCY": ["Follow"],
@@ -2774,6 +2775,7 @@
"pAgkuZ": ["Reopening \"", ["docName"], "\" with a fresh local collaboration cache."],
"pBROkv": ["Thanks for subscribing. Watch your inbox for product updates."],
"pEQFsW": ["No matching projects."],
+ "pFPzHA": ["Emoji picker"],
"pFagOn": ["Source editing"],
"pHYP6v": ["Open <0>Customize</0> in the sidebar <1/> <2>Skills</2>."],
"pQf2Ux": [".ok/skills is back to local-only."],
@@ -2965,6 +2967,7 @@
"t9Qn8y": ["No agents enabled"],
"tAPZEx": ["Below"],
"tHKQ6j": ["Renaming"],
+ "tKlWWY": ["Emoji"],
"tN5WTS": ["The provider rejected the request. Check the API key and the model id."],
"tP5DDk": ["Apply link"],
"tUvUfp": ["Use a folder you already have."],
diff --git a/packages/app/src/locales/en/messages.po b/packages/app/src/locales/en/messages.po
index 1cf1a51df..33d026ab0 100644
--- a/packages/app/src/locales/en/messages.po
+++ b/packages/app/src/locales/en/messages.po
@@ -3573,6 +3573,15 @@ msgstr "Embeddings API key"
msgid "Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."
msgstr "Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."
+#: src/editor/slash-command/items.tsx
+msgid "Emoji"
+msgstr "Emoji"
+
+#: src/components/PageHeaderWidgets.tsx
+#: src/editor/components/EmojiInsertPopover.tsx
+msgid "Emoji picker"
+msgstr "Emoji picker"
+
#: src/components/ArrayOfObjectsWidget.tsx
#: src/components/ObjectWidget.tsx
msgid "empty"
@@ -5286,7 +5295,7 @@ msgstr "List"
msgid "Lists"
msgstr "Lists"
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
#: src/components/SkillsSidebarSection.tsx
#: src/editor/components/TagDialog.tsx
#: src/editor/extensions/InternalLinkPropPanel.tsx
@@ -6015,7 +6024,7 @@ msgstr "No edit session yet"
msgid "No edits yet."
msgstr "No edits yet."
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
msgid "No emoji found."
msgstr "No emoji found."
@@ -7020,6 +7029,10 @@ msgstr "Pick a built-in IDE palette. The dark IDE themes override the light/dark
msgid "Pick a name"
msgstr "Pick a name"
+#: src/editor/slash-command/items.tsx
+msgid "Pick an emoji to insert at the cursor."
+msgstr "Pick an emoji to insert at the cursor."
+
#: src/components/ShareReceiveDialog.tsx
msgid "Pick the folder where you've cloned it."
msgstr "Pick the folder where you've cloned it."
@@ -8055,7 +8068,7 @@ msgstr "Search branches..."
msgid "Search by meaning"
msgstr "Search by meaning"
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
msgid "Search emoji"
msgstr "Search emoji"
diff --git a/packages/app/src/locales/pseudo/messages.json b/packages/app/src/locales/pseudo/messages.json
index 7840ade88..8e21a9180 100644
--- a/packages/app/src/locales/pseudo/messages.json
+++ b/packages/app/src/locales/pseudo/messages.json
@@ -1200,6 +1200,7 @@
"Ĩńśēŕţ, ďēĺēţē, ḿōvē, ćōƥŷ, àńď ĩńďēńţ śōũŕćē ēďĩţōŕ ĺĩńēś ţĥŕōũĝĥ ĆōďēḾĩŕŕōŕ'ś ďēƒàũĺţ ķēŷḿàƥ."
],
"MHrjPM": ["Ţĩţĺē"],
+ "MI6Z0f": ["Ƥĩćķ àń ēḿōĴĩ ţō ĩńśēŕţ àţ ţĥē ćũŕśōŕ."],
"MJqRO6": ["Ŷōũŕ ŕēƥōŕţ ĩś ƀēĩńĝ śēńţ."],
"MJuO1q": ["Ćōńţēxţ ŵĩńďōŵ:"],
"MKEPCY": ["Ƒōĺĺōŵ"],
@@ -2774,6 +2775,7 @@
"pAgkuZ": ["Ŕēōƥēńĩńĝ \"", ["docName"], "\" ŵĩţĥ à ƒŕēśĥ ĺōćàĺ ćōĺĺàƀōŕàţĩōń ćàćĥē."],
"pBROkv": ["Ţĥàńķś ƒōŕ śũƀśćŕĩƀĩńĝ. Ŵàţćĥ ŷōũŕ ĩńƀōx ƒōŕ ƥŕōďũćţ ũƥďàţēś."],
"pEQFsW": ["Ńō ḿàţćĥĩńĝ ƥŕōĴēćţś."],
+ "pFPzHA": ["ĒḿōĴĩ ƥĩćķēŕ"],
"pFagOn": ["Śōũŕćē ēďĩţĩńĝ"],
"pHYP6v": ["Ōƥēń <0>Ćũśţōḿĩźē</0> ĩń ţĥē śĩďēƀàŕ <1/> <2>Śķĩĺĺś</2>."],
"pQf2Ux": [".ōķ/śķĩĺĺś ĩś ƀàćķ ţō ĺōćàĺ-ōńĺŷ."],
@@ -2965,6 +2967,7 @@
"t9Qn8y": ["Ńō àĝēńţś ēńàƀĺēď"],
"tAPZEx": ["ßēĺōŵ"],
"tHKQ6j": ["Ŕēńàḿĩńĝ"],
+ "tKlWWY": ["ĒḿōĴĩ"],
"tN5WTS": ["Ţĥē ƥŕōvĩďēŕ ŕēĴēćţēď ţĥē ŕēǫũēśţ. Ćĥēćķ ţĥē ÀƤĨ ķēŷ àńď ţĥē ḿōďēĺ ĩď."],
"tP5DDk": ["Àƥƥĺŷ ĺĩńķ"],
"tUvUfp": ["Ũśē à ƒōĺďēŕ ŷōũ àĺŕēàďŷ ĥàvē."],
diff --git a/packages/app/src/locales/pseudo/messages.po b/packages/app/src/locales/pseudo/messages.po
index db0b4c29c..e423f3320 100644
--- a/packages/app/src/locales/pseudo/messages.po
+++ b/packages/app/src/locales/pseudo/messages.po
@@ -3569,6 +3569,15 @@ msgstr ""
msgid "Embeddings are computed only when a search runs and are cached locally under <0>.ok/local</0>."
msgstr ""
+#: src/editor/slash-command/items.tsx
+msgid "Emoji"
+msgstr ""
+
+#: src/components/PageHeaderWidgets.tsx
+#: src/editor/components/EmojiInsertPopover.tsx
+msgid "Emoji picker"
+msgstr ""
+
#: src/components/ArrayOfObjectsWidget.tsx
#: src/components/ObjectWidget.tsx
msgid "empty"
@@ -5282,7 +5291,7 @@ msgstr ""
msgid "Lists"
msgstr ""
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
#: src/components/SkillsSidebarSection.tsx
#: src/editor/components/TagDialog.tsx
#: src/editor/extensions/InternalLinkPropPanel.tsx
@@ -6011,7 +6020,7 @@ msgstr ""
msgid "No edits yet."
msgstr ""
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
msgid "No emoji found."
msgstr ""
@@ -7016,6 +7025,10 @@ msgstr ""
msgid "Pick a name"
msgstr ""
+#: src/editor/slash-command/items.tsx
+msgid "Pick an emoji to insert at the cursor."
+msgstr ""
+
#: src/components/ShareReceiveDialog.tsx
msgid "Pick the folder where you've cloned it."
msgstr ""
@@ -8051,7 +8064,7 @@ msgstr ""
msgid "Search by meaning"
msgstr ""
-#: src/components/PageHeaderWidgets.tsx
+#: src/components/emoji-picker.tsx
msgid "Search emoji"
msgstr ""