tiptap-markdown-react 0.19.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +23 -37
  2. package/THIRD_PARTY_LICENSES.md +155 -1
  3. package/dist/{ReportContent-B8jIzhy3.js → ReportContent-w08GFm8v.js} +16 -8
  4. package/dist/{ReportContent-B8jIzhy3.js.map → ReportContent-w08GFm8v.js.map} +1 -1
  5. package/dist/blockDrag/actions.d.ts +30 -0
  6. package/dist/blockDrag/actions.test.d.ts +1 -0
  7. package/dist/blockDrag/listDrop.d.ts +21 -0
  8. package/dist/blockDrag/listDrop.test.d.ts +1 -0
  9. package/dist/blurSelection.dom.test.d.ts +1 -0
  10. package/dist/characterCount.d.ts +1 -0
  11. package/dist/characterCount.dom.test.d.ts +1 -0
  12. package/dist/characterCount.test.d.ts +1 -0
  13. package/dist/chart/createChart.d.ts +0 -3
  14. package/dist/components/BlockDragHandle.d.ts +14 -0
  15. package/dist/components/BlockDragHandle.dom.test.d.ts +1 -0
  16. package/dist/components/CodeBlockView.d.ts +2 -2
  17. package/dist/components/ColorPalette.d.ts +4 -3
  18. package/dist/components/EditorToolbar.d.ts +4 -3
  19. package/dist/components/FindReplaceBar.d.ts +4 -3
  20. package/dist/components/LinkPopover.d.ts +4 -3
  21. package/dist/components/MarkdownPreview.d.ts +4 -1
  22. package/dist/components/MarkdownWysiwygEditor.d.ts +30 -9
  23. package/dist/components/TocPanel.d.ts +4 -3
  24. package/dist/detailsMarkdown.d.ts +4 -0
  25. package/dist/detailsMarkdown.test.d.ts +1 -0
  26. package/dist/emoji/EmojiSuggestion.d.ts +23 -0
  27. package/dist/emoji/emojiCategories.d.ts +52 -0
  28. package/dist/emoji/emojiMarkdown.test.d.ts +1 -0
  29. package/dist/emoji/emojiSuggestion.dom.test.d.ts +1 -0
  30. package/dist/emoji/filterEmoji.d.ts +7 -0
  31. package/dist/emoji/markdownEmoji.d.ts +8 -0
  32. package/dist/{extractToc-CGrBMGvM.js → extractToc-Cr470fBy.js} +659 -5
  33. package/dist/extractToc-Cr470fBy.js.map +1 -0
  34. package/dist/fonts/OFL.txt +95 -0
  35. package/dist/i18n/index.d.ts +4 -0
  36. package/dist/i18n/store.d.ts +16 -0
  37. package/dist/i18n/types.d.ts +19 -0
  38. package/dist/i18n/zh.d.ts +3 -0
  39. package/dist/icons/index.d.ts +5 -0
  40. package/dist/imageUpload.d.ts +0 -3
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +1983 -407
  43. package/dist/index.js.map +1 -1
  44. package/dist/labels.d.ts +56 -2
  45. package/dist/numberingFormat.d.ts +67 -0
  46. package/dist/numberingFormat.test.d.ts +1 -0
  47. package/dist/reader.js +2 -2
  48. package/dist/{scrollToTocHeading-B2QmL4wi.js → scrollToTocHeading-kPgsn3cu.js} +2 -2
  49. package/dist/{scrollToTocHeading-B2QmL4wi.js.map → scrollToTocHeading-kPgsn3cu.js.map} +1 -1
  50. package/dist/server.js +4 -4
  51. package/dist/shortcuts/ShortcutPanel.d.ts +4 -4
  52. package/dist/shortcuts/types.d.ts +2 -2
  53. package/dist/slashMenu/SlashMenuExtension.d.ts +0 -3
  54. package/dist/slashMenu/items.d.ts +2 -2
  55. package/dist/style-inline.css +2097 -287
  56. package/dist/style.css +2097 -287
  57. package/dist/typography.test.d.ts +1 -0
  58. package/package.json +19 -3
  59. package/dist/extractToc-CGrBMGvM.js.map +0 -1
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import { Node as PMNode, Slice } from '@tiptap/pm/model';
2
+ import { Plugin, PluginKey } from '@tiptap/pm/state';
3
+ import { EditorView } from '@tiptap/pm/view';
4
+ export declare const blockDragListGuardKey: PluginKey<any>;
5
+ export declare function setBlockHandleDragging(view: EditorView, dragging: boolean): void;
6
+ export declare function isBlockHandleDragging(view: EditorView): boolean;
7
+ /** 坐标落在某份列表(含其中的条目)里面。 */
8
+ export declare function isPosInsideList(doc: PMNode, pos: number): boolean;
9
+ /**
10
+ * 把列表内部的位置抬到最外层那份列表的边界。
11
+ * `after` 为真时放在列表后面,否则放在前面。
12
+ */
13
+ export declare function listEscapePos(doc: PMNode, pos: number, after: boolean): number | null;
14
+ /** 指针在列表盒的下半段时落到列表后面,否则落到前面。 */
15
+ export declare function listEscapeEdge(view: EditorView, pos: number, clientY: number): number | null;
16
+ /**
17
+ * 把手柄拖来的切片挪到 `insertPos`。位置落在被拖的选区内部时不挪。
18
+ * 返回 true 表示这次落点已经由我们处理(包括故意不挪)。
19
+ */
20
+ export declare function moveDraggedSlice(view: EditorView, slice: Slice, insertPos: number): boolean;
21
+ export declare function blockDragListGuardPlugin(): Plugin;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function countWords(text: string): number;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,16 +1,13 @@
1
1
  import { ReportChartOptions } from './ChartExtension';
2
2
  import { ChartTheme } from './types';
3
- import { ChartLabels } from '../labels';
4
3
  export interface CreateChartOptions {
5
4
  /** When true, reserved for future in-place chart editing. Currently unused (no edit UI). Default false. */
6
5
  editable?: boolean;
7
6
  chartTheme?: ChartTheme | null;
8
- chartLabels?: Partial<ChartLabels>;
9
7
  }
10
8
  export interface InteractiveChartOptions extends ReportChartOptions {
11
9
  chartEditable: boolean;
12
10
  chartTheme: ChartTheme | null;
13
- chartLabels?: Partial<ChartLabels>;
14
11
  }
15
12
  /**
16
13
  * Client chart extension with React NodeView.
@@ -0,0 +1,14 @@
1
+ import { Editor } from '@tiptap/core';
2
+ export interface BlockDragHandleProps {
3
+ editor: Editor;
4
+ }
5
+ /**
6
+ * 块拖拽:悬停时在块左侧露出手柄(拖动重排),点手柄打开菜单
7
+ * (转换 / 复制 / 再制一份 / 删除)。交互对齐 Tiptap Drag Context Menu,
8
+ * 样式走本库的 `--tmr-*`。手柄跟着文档最外层的块走,列表和引用整块移动。
9
+ * 松开时如果指针在列表上,块落到整份列表的前面或后面,不会变成其中一条。
10
+ *
11
+ * 不注册 NodeRange 扩展:它会接管 Shift+方向键和 Mod-a。拖拽要用的
12
+ * NodeRangeSelection 在加载 drag-handle 时已经注册进 Selection。
13
+ */
14
+ export declare function BlockDragHandle({ editor }: BlockDragHandleProps): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,11 +1,11 @@
1
1
  import { NodeViewProps } from '@tiptap/react';
2
2
  /**
3
3
  * 代码块自定义 NodeView:右上角语言选择器(Radix DropdownMenu,支持方向键导航)+ 删除。
4
- * 文案(Auto-detect / 删除标题)从扩展 options.codeBlockLabels 读取,缺省用英文默认。
4
+ * 文案从编辑器的 locale 读取,缺省英文。
5
5
  *
6
6
  * 只读态(预览 / 只读编辑器)走另一套头部:左侧语言标签,右侧复制 + 展开收起;
7
7
  * 超出 `--tmr-code-max-height`(缺省 480px)的代码块默认限高块内滚动,行号槽
8
8
  * 用 MutationObserver 跟踪 PM 管理的 code 内容保持同步(纯文本变化不触发 React
9
9
  * 重渲染,gutter 行数靠观察器自刷新)。
10
10
  */
11
- export declare function CodeBlockView({ node, updateAttributes, deleteNode, extension, editor, }: NodeViewProps): import("react").JSX.Element;
11
+ export declare function CodeBlockView({ node, updateAttributes, deleteNode, editor, }: NodeViewProps): import("react").JSX.Element;
@@ -1,10 +1,11 @@
1
- import { ColorPaletteLabels } from '../labels';
1
+ import { LocaleCode } from '../i18n';
2
2
  export interface ColorPaletteProps {
3
3
  /** 当前已应用的颜色(用于打勾),无则不选中。 */
4
4
  value?: string;
5
5
  /** 点击某色块。null 表示「None」(清除)。 */
6
6
  onPick: (color: string | null) => void;
7
- labels?: Partial<ColorPaletteLabels>;
7
+ /** 内置语言,默认英文。 */
8
+ locale?: LocaleCode;
8
9
  }
9
10
  /** 颜色面板:None 清除行 + 色板网格 + THEME 品牌色。 */
10
- export declare function ColorPalette({ value, onPick, labels }: ColorPaletteProps): import("react").JSX.Element;
11
+ export declare function ColorPalette({ value, onPick, locale }: ColorPaletteProps): import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
  import { ReactNode } from 'react';
3
- import { ToolbarLabels } from '../labels';
3
+ import { LocaleCode } from '../i18n';
4
4
  import { ImportMenuItem } from '../importMenu';
5
5
  import { SourceRef } from '../citationUtils';
6
6
  /** `onImportDocument` 的成功返回。给字符串等价于 `{ markdown }`。 */
@@ -60,7 +60,8 @@ export interface EditorToolbarProps {
60
60
  importMenuItems?: ImportMenuItem[];
61
61
  /** 是否显示导入下拉,默认 `true`。卡片等场景可关掉。 */
62
62
  showImport?: boolean;
63
- labels?: Partial<ToolbarLabels>;
63
+ /** 内置语言,默认英文。 */
64
+ locale?: LocaleCode;
64
65
  /**
65
66
  * 工具栏最右端的搜索入口(放大镜)。**不传就不渲染**——条子本身归
66
67
  * `<MarkdownWysiwygEditor>`,这里只给一个入口,宿主接上自己的编辑器句柄即可:
@@ -81,4 +82,4 @@ export type { ImportMenuItem };
81
82
  * 顶部操作栏(零 UI 框架依赖,Radix Popover 菜单 + 内联 SVG 图标)。位置由父级控制,
82
83
  * 这里只渲染按钮 + 反映 editor 激活态。不含业务耦合,扩展项经 extraToolbarItems 注入。
83
84
  */
84
- export declare function EditorToolbar({ editor, onImageUpload, onError, onImportDocument, importAccept, importMenuItems, showImport, labels, onSearch, searchActive, extraToolbarItems, className, }: EditorToolbarProps): import("react").JSX.Element;
85
+ export declare function EditorToolbar({ editor, onImageUpload, onError, onImportDocument, importAccept, importMenuItems, showImport, locale, onSearch, searchActive, extraToolbarItems, className, }: EditorToolbarProps): import("react").JSX.Element;
@@ -1,12 +1,13 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
  import { CSSProperties, RefObject } from 'react';
3
- import { FindLabels } from '../labels';
3
+ import { LocaleCode } from '../i18n';
4
4
  export interface FindReplaceBarProps {
5
5
  /** 编辑器实例(由 `<MarkdownWysiwygEditor>` 提供,浮动条不自行创建编辑器)。 */
6
6
  editor: Editor;
7
7
  /** 关闭(Esc / ×):宿主负责收起浮动条并把焦点还给编辑器。 */
8
8
  onClose: () => void;
9
- labels?: Partial<FindLabels>;
9
+ /** 内置语言,默认英文。 */
10
+ locale?: LocaleCode;
10
11
  /**
11
12
  * 查找输入框 ref。宿主拿它实现「再按一次 Mod+F 聚焦并全选当前查询」。
12
13
  * 也用于浮动条打开时自动聚焦。
@@ -17,4 +18,4 @@ export interface FindReplaceBarProps {
17
18
  /** 根节点内联样式(编辑器用它落 findBarOffset;宿主自绘时也可用)。 */
18
19
  style?: CSSProperties;
19
20
  }
20
- export declare function FindReplaceBar({ editor, onClose, labels, inputRef, className, style, }: FindReplaceBarProps): import("react").JSX.Element | null;
21
+ export declare function FindReplaceBar({ editor, onClose, locale, inputRef, className, style, }: FindReplaceBarProps): import("react").JSX.Element | null;
@@ -1,6 +1,6 @@
1
1
  import { Editor } from '@tiptap/react';
2
2
  import { CSSProperties, ReactNode } from 'react';
3
- import { LinkPopoverLabels } from '../labels';
3
+ import { LocaleCode } from '../i18n';
4
4
  export interface LinkPopoverProps {
5
5
  /** 编辑器实例。 */
6
6
  editor: Editor;
@@ -9,7 +9,8 @@ export interface LinkPopoverProps {
9
9
  * 传函数组件时得先 `forwardRef`(本库的 `<EditorToolbar>` 就是这么接的)。
10
10
  */
11
11
  trigger: ReactNode;
12
- labels?: Partial<LinkPopoverLabels>;
12
+ /** 内置语言,默认英文。 */
13
+ locale?: LocaleCode;
13
14
  /** 挂到浮层根节点上的 class / 内联样式(定位与层级归宿主,Radix 只管浮层方向)。 */
14
15
  className?: string;
15
16
  style?: CSSProperties;
@@ -25,4 +26,4 @@ export interface LinkPopoverProps {
25
26
  * 地址被编辑器拒掉时(Tiptap 的 `isAllowedUri`)浮层不关,输入框转成危险色并带上 title,
26
27
  * 让用户改——静默什么都不发生是最难查的。
27
28
  */
28
- export declare function LinkPopover({ editor, trigger, labels, className, style, }: LinkPopoverProps): import("react").JSX.Element;
29
+ export declare function LinkPopover({ editor, trigger, locale, className, style, }: LinkPopoverProps): import("react").JSX.Element;
@@ -1,3 +1,4 @@
1
+ import { LocaleCode } from '../i18n';
1
2
  import { SourceRef } from '../citationUtils';
2
3
  import { RenderCitation } from '../citationTypes';
3
4
  export interface MarkdownPreviewProps {
@@ -14,6 +15,8 @@ export interface MarkdownPreviewProps {
14
15
  */
15
16
  renderCitation?: RenderCitation;
16
17
  className?: string;
18
+ /** 内置界面语言,默认英文。代码块与图表文案跟着变。 */
19
+ locale?: LocaleCode;
17
20
  }
18
21
  /**
19
22
  * 轻量只读 markdown 预览(Tiptap + 官方 @tiptap/markdown,editable:false)。
@@ -24,4 +27,4 @@ export interface MarkdownPreviewProps {
24
27
  * 这是「客户端只读预览」;若需 SEO / 无 JS 静态渲染,请改用 server 入口的
25
28
  * renderReportHtml + ReportContent / ReportContentWithCharts。
26
29
  */
27
- export declare function MarkdownPreview({ markdown, sources, renderCitation, className, }: MarkdownPreviewProps): import("react").JSX.Element;
30
+ export declare function MarkdownPreview({ markdown, sources, renderCitation, className, locale, }: MarkdownPreviewProps): import("react").JSX.Element;
@@ -4,7 +4,7 @@ import { SourceRef } from '../citationUtils';
4
4
  import { RenderCitation } from '../citationTypes';
5
5
  import { CommentClickPayload, CommentRef } from '../commentAnchor/commentTypes';
6
6
  import { ImageUploadConfig } from '../imageUpload';
7
- import { CodeBlockLabels, FindLabels, ShortcutLabels, SlashMenuLabels } from '../labels';
7
+ import { LocaleCode } from '../i18n';
8
8
  import { PendingAnchor } from '../pendingAnchor';
9
9
  import { SelectionKind } from '../selectionKind';
10
10
  import { TocItem } from '../toc/extractToc';
@@ -76,6 +76,8 @@ export interface MarkdownWysiwygEditorProps {
76
76
  * 只读态不应用评论锚定(comments 被忽略),与 MarkdownPreview 语义一致。
77
77
  */
78
78
  editable?: boolean;
79
+ /** 内置界面语言,默认英文。工具栏、目录等并列组件需各自传同一个值。 */
80
+ locale?: LocaleCode;
79
81
  /**
80
82
  * 初始脚注来源:按 index 对齐 `[^n]`,写入 citationRef 的 url/title。
81
83
  * 仅影响初始 content;后续插入请用 `insertMarkdown(editor, md, sources)`。
@@ -103,8 +105,6 @@ export interface MarkdownWysiwygEditorProps {
103
105
  markdownFileDrop?: boolean;
104
106
  /** 追加的 Tiptap 扩展(在内置扩展之后注册)。 */
105
107
  extraExtensions?: AnyExtension[];
106
- /** 代码块 NodeView 的本地化文案。 */
107
- codeBlockLabels?: Partial<CodeBlockLabels>;
108
108
  /**
109
109
  * 「这段正在被 AI 改写」的高亮:宿主在提交请求时给上、回填或冲突时传空数组清空。
110
110
  * 走 decoration,**不进 markdown、不进 undo 历史**,能盖住表格与图表这类块级节点。
@@ -177,8 +177,6 @@ export interface MarkdownWysiwygEditorProps {
177
177
  * 保留浏览器原生查找,或自己摆入口。焦点不在编辑器内时不接管,同页多编辑器不会互相抢。
178
178
  */
179
179
  findShortcut?: boolean;
180
- /** 查找替换浮动条的本地化文案。 */
181
- findLabels?: Partial<FindLabels>;
182
180
  /**
183
181
  * 浮动条开合状态变化的通知(条子开着时 `handle.openFind()`、Esc / × 关掉都会触发)。
184
182
  * 典型用法是驱动别处的入口按钮:`<EditorToolbar onSearch={open} searchActive={isOpen} />`。
@@ -191,8 +189,6 @@ export interface MarkdownWysiwygEditorProps {
191
189
  * 「格式 / 快捷键 / Markdown」三列对照抽屉(默认 true,只读态隐藏)。
192
190
  */
193
191
  shortcutPanel?: boolean;
194
- /** 快捷键抽屉的本地化文案。 */
195
- shortcutLabels?: Partial<ShortcutLabels>;
196
192
  /**
197
193
  * 把快捷键悬浮键挂到宿主的容器里(与 `findBarContainer` 同一套):
198
194
  * 给元素或返回元素的函数即可,开合状态与抽屉归库——只换按钮落点。
@@ -207,8 +203,26 @@ export interface MarkdownWysiwygEditorProps {
207
203
  * 追加自定义命令项请传 `extraExtensions` 注册 `SlashMenu.configure({ items })`。
208
204
  */
209
205
  slashMenu?: boolean;
210
- /** 斜杠菜单的本地化文案。 */
211
- slashMenuLabels?: Partial<SlashMenuLabels>;
206
+ /**
207
+ * 智能标点(官方 `@tiptap/extension-typography`,MIT,不是 Pro)。
208
+ * 键入时把直引号收成弯引号、`--` 收成破折号、`...` 收成省略号,以及箭头、©、分数等。
209
+ * 代码块和行内代码里不触发;Backspace 撤销刚发生的替换。`---` 仍是分隔线。
210
+ * 默认 true。仅初始化时生效。
211
+ */
212
+ typography?: boolean;
213
+ /**
214
+ * 表情建议列表:键入 `:`(行首或空白后)弹出,选中后插入 emoji 节点。
215
+ * Markdown 存成 `:shortcode:`。传 false 只是不弹列表——节点、完整短码输入和往返仍在。
216
+ * 只读态不弹出。默认 true。仅初始化时生效。
217
+ */
218
+ emojiSuggestion?: boolean;
219
+ /**
220
+ * 块拖拽(对齐 Tiptap Drag Context Menu):悬停块时左侧出现手柄,拖动重排,
221
+ * 点击打开菜单(转成别的块 / 复制 / 再制一份 / 删除,图片还可下载)。
222
+ * 手柄旁的「+」在块首插入 `/`,唤起斜杠菜单(`slashMenu={false}` 时不显示加号)。
223
+ * 默认 true。只读态和窄屏(宽度小于 768px)不显示,并收起左侧留白。
224
+ */
225
+ blockDrag?: boolean;
212
226
  /**
213
227
  * 图片上传(对齐官方 ImageUploadNode 的交互):配置后工具栏的图片按钮变成
214
228
  * 「插入上传块」——文档里出现拖拽 / 点击的占位块,上传进度就地显示,全部成功后就地
@@ -226,6 +240,13 @@ export interface MarkdownWysiwygEditorProps {
226
240
  * imageMarkdown.ts)。传 `false` 关闭;传对象透传官方 resize 配置。仅初始化时生效。
227
241
  */
228
242
  imageResize?: boolean | ImageResizeOptions;
243
+ /**
244
+ * 全文统计(默认关):传 `true` 才注册 MIT 包 `@tiptap/extensions` 的 CharacterCount
245
+ * (开源扩展,不是付费的 `@tiptap-pro`),在编辑器底部实时显示字符数与词数。
246
+ * 统计条是本库自绘。词数把每个汉字算作 1 个词(该扩展默认按空格切,整段中文会是 1)。
247
+ * 数字也可从 `editor.storage.characterCount` 读取。仅初始化时生效。
248
+ */
249
+ characterCount?: boolean;
229
250
  }
230
251
  /**
231
252
  * 所见即所得 Markdown 编辑器(基于 Tiptap v3 + 官方 @tiptap/markdown)。
@@ -1,4 +1,4 @@
1
- import { TocLabels } from '../labels';
1
+ import { LocaleCode } from '../i18n';
2
2
  import { TocItem } from '../toc/extractToc';
3
3
  export interface TocPanelProps {
4
4
  items: TocItem[];
@@ -6,7 +6,8 @@ export interface TocPanelProps {
6
6
  activeId?: string;
7
7
  /** 点击目录项。锁住项不触发。默认行为由调用方决定(滚动 / 跳转)。 */
8
8
  onItemClick?: (item: TocItem) => void;
9
- labels?: Partial<TocLabels>;
9
+ /** 内置语言,默认英文。 */
10
+ locale?: LocaleCode;
10
11
  }
11
12
  /**
12
13
  * 目录面板(阅读页 + 编辑页共用)。
@@ -17,4 +18,4 @@ export interface TocPanelProps {
17
18
  *
18
19
  * 纯展示:滚动 / active 计算交给调用方,本组件只渲染 + 派发点击。
19
20
  */
20
- export declare function TocPanel({ items, activeId, onItemClick, labels }: TocPanelProps): import("react").JSX.Element | null;
21
+ export declare function TocPanel({ items, activeId, onItemClick, locale, }: TocPanelProps): import("react").JSX.Element | null;
@@ -0,0 +1,4 @@
1
+ import { JSONContent, MarkdownParseHelpers, MarkdownRendererHelpers, MarkdownToken, MarkdownTokenizer } from '@tiptap/core';
2
+ export declare const detailsMarkdownTokenizer: MarkdownTokenizer;
3
+ export declare function detailsParseMarkdown(token: MarkdownToken, helpers: MarkdownParseHelpers): JSONContent;
4
+ export declare function detailsRenderMarkdown(node: JSONContent, helpers: MarkdownRendererHelpers): string;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,23 @@
1
+ import { EmojiItem } from '@tiptap/extension-emoji';
2
+ import { AnyExtension } from '@tiptap/core';
3
+ export interface EmojiSuggestionPopupHandle {
4
+ /** 编辑器键盘事件经 IME 守卫后委托进来;返回 true 表示已消费。 */
5
+ onKeyDown: (event: KeyboardEvent) => boolean;
6
+ }
7
+ export interface EmojiSuggestionPopupProps {
8
+ items: EmojiItem[];
9
+ query: string;
10
+ menuLabel: string;
11
+ command: (item: EmojiItem) => void;
12
+ }
13
+ /**
14
+ * 冒号表情格子。空查询按底部分类标签浏览;继续打短码则在全部分类里筛选。
15
+ * 定位由 @tiptap/suggestion 的 mount 接管。
16
+ */
17
+ export declare const EmojiSuggestionPopup: import('react').ForwardRefExoticComponent<EmojiSuggestionPopupProps & import('react').RefAttributes<EmojiSuggestionPopupHandle>>;
18
+ /**
19
+ * 把 schema 上的 emoji 扩展配成带(或不带)建议列表的那一份。
20
+ * configure 深合并 options,官方的 command / char / pluginKey 留着。
21
+ * 关掉时 allow 恒为 false:不弹层,`:smile:` 输入规则仍在。
22
+ */
23
+ export declare function configureEmojiSuggestion(extension: AnyExtension, enabled: boolean): AnyExtension;
@@ -0,0 +1,52 @@
1
+ import { EmojiItem } from '@tiptap/extension-emoji';
2
+ /** 底部标签。顺序与官方数据的 group 一致;图标是分类代表,不依赖某一条数据还在不在。 */
3
+ export declare const EMOJI_CATEGORIES: readonly [{
4
+ readonly id: "smileys";
5
+ readonly group: "";
6
+ readonly label: "Smileys";
7
+ readonly icon: "😀";
8
+ }, {
9
+ readonly id: "people";
10
+ readonly group: "people & body";
11
+ readonly label: "People";
12
+ readonly icon: "👋";
13
+ }, {
14
+ readonly id: "nature";
15
+ readonly group: "animals & nature";
16
+ readonly label: "Animals & nature";
17
+ readonly icon: "🐻";
18
+ }, {
19
+ readonly id: "food";
20
+ readonly group: "food & drink";
21
+ readonly label: "Food & drink";
22
+ readonly icon: "🍔";
23
+ }, {
24
+ readonly id: "travel";
25
+ readonly group: "travel & places";
26
+ readonly label: "Travel & places";
27
+ readonly icon: "✈️";
28
+ }, {
29
+ readonly id: "activities";
30
+ readonly group: "activities";
31
+ readonly label: "Activities";
32
+ readonly icon: "⚽";
33
+ }, {
34
+ readonly id: "objects";
35
+ readonly group: "objects";
36
+ readonly label: "Objects";
37
+ readonly icon: "💡";
38
+ }, {
39
+ readonly id: "symbols";
40
+ readonly group: "symbols";
41
+ readonly label: "Symbols";
42
+ readonly icon: "💯";
43
+ }, {
44
+ readonly id: "flags";
45
+ readonly group: "flags";
46
+ readonly label: "Flags";
47
+ readonly icon: "🏁";
48
+ }];
49
+ export type EmojiCategoryId = (typeof EMOJI_CATEGORIES)[number]['id'];
50
+ /** 肤色和发型零件。官方扩展不支持肤色修饰,单独显示也不是可选表情。 */
51
+ export declare function isEmojiComponent(item: EmojiItem): boolean;
52
+ export declare function itemsInCategory(items: EmojiItem[], id: EmojiCategoryId): EmojiItem[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { EmojiItem } from '@tiptap/extension-emoji';
2
+ /**
3
+ * 按短码 / 名称优先、标签其次过滤表情。
4
+ * 空查询返回全部可用表情,弹层再按分类切开。
5
+ * 区域指示符和肤色零件不进列表。没有 Unicode 字符的自定义图也不进。
6
+ */
7
+ export declare function filterEmojiItems(items: EmojiItem[], query: string): EmojiItem[];
@@ -0,0 +1,8 @@
1
+ /**
2
+ * 官方 Emoji 节点 + `:shortcode:` 的 markdown 往返。
3
+ *
4
+ * 官方只有 renderMarkdown(输出 `:name:`),没有 tokenizer,读回会变成普通文本。
5
+ * 建议列表的 React 弹层不在这里:server / 预览共用这份 schema,弹层由编辑器
6
+ * configure 贴上去。
7
+ */
8
+ export declare const MarkdownEmoji: import('@tiptap/core').Node<import('@tiptap/extension-emoji').EmojiOptions, import('@tiptap/extension-emoji').EmojiStorage>;