Skip to content

功能一览 ​

一切都来自一个入口——ai-sparkwrite-editor(React)或 ai-sparkwrite-editor/vue(Vue)——或者用 RichTextKit 一次注册全部。在 useEditor 中注册扩展,在 RichTextProvider 内放置控件。“引入”一列列出的是每个功能的子路径,供不做 tree-shake 的打包器使用,效果等价。选项通过 .configure({ ... }) 传入;每个扩展也都支持共享的 toolbar、divider、spacer 和 shortcutKeys 选项。

核心 ​

功能引入控件值得注意的选项
RichTextKitai-sparkwrite-editor、ai-sparkwrite-editor/vueRichTextKit、RichTextKitToolbar、RichTextKitMenus每个功能一个键:false 或该扩展自己的选项
Provider、工具栏原语ai-sparkwrite-editorRichTextProvider、RichTextToolbar、RichTextToolbarMore、RichTextToolbarButton …见自定义
框架无关的核心ai-sparkwrite-editor/core—扩展、粘贴规则、录制器、AI 传输层、翻译;不含 React——见框架支持
Vue 3 UIai-sparkwrite-editor/vueRichTextProvider、工具栏原语、控件、气泡菜单、对话框、AI 面板与写作台、节点视图与 React 控件共用同一份样式表;见框架支持
Historyai-sparkwrite-editor/historyRichTextHistory(撤销/重做)depth
Headingai-sparkwrite-editor/headingRichTextHeadinglevels;点击块上方的空隙会作用于该块
Bold、Italic、Underline、Strike、Codeai-sparkwrite-editor/bold …RichTextBold …—
MoreMarkai-sparkwrite-editor/moremarkRichTextMoreMark(上标、下标)—
Color、Highlightai-sparkwrite-editor/color、ai-sparkwrite-editor/highlightRichTextColor、RichTextHighlightcolors
FontFamilyai-sparkwrite-editor/fontfamilyRichTextFontFamilyfontFamilyList;按语言和文档展示中日韩、天城文、孟加拉文字体栈
FontSizeai-sparkwrite-editor/fontsizeRichTextFontSize(compact)fontSizes
LineHeightai-sparkwrite-editor/lineheightRichTextLineHeightlineHeights
TextAlignai-sparkwrite-editor/textalignRichTextTextAlignalignments、types
TextDirectionai-sparkwrite-editor/textdirectionRichTextTextDirectiondirections
Indentai-sparkwrite-editor/indentRichTextIndentminIndent、maxIndent
Clearai-sparkwrite-editor/clearRichTextClear(清除格式)—
FormatPainterai-sparkwrite-editor/formatpainterRichTextFormatPainter—

块 ​

功能引入控件值得注意的选项
BulletList、OrderedList、TaskListai-sparkwrite-editor/bulletlist …RichTextBulletList …—
Blockquoteai-sparkwrite-editor/blockquoteRichTextBlockquote—
CodeBlockai-sparkwrite-editor/codeblockRichTextCodeBlock语言选择节点视图、detectLanguageFn、GitHub 明暗配色;导出 guessLanguage
Tableai-sparkwrite-editor/tableRichTextTable、RichTextBubbleTable圆角、insertParagraphAfterTable(点击旁侧、⌘/Ctrl+Enter、右键菜单)
Dividerai-sparkwrite-editor/dividerRichTextDividervariants(内置 9 种、可编辑文字、编号)、defaultVariant、renderDivider、parseRules
Columnai-sparkwrite-editor/columnRichTextColumninsertColumns({ cols })
Calloutai-sparkwrite-editor/calloutRichTextCallout、RichTextBubbleCallout提示、技巧、重要、警告、危险
Noticeai-sparkwrite-editor/noticeRichTextNotice、RichTextBubbleNotice信息、成功、警告、技巧 —— 可编辑块组成的彩色提示框
Detailsai-sparkwrite-editor/detailsRichTextDetails可折叠块
TableOfContentsai-sparkwrite-editor/tableofcontentsRichTextTableOfContents实时更新的大纲节点
HorizontalRuleai-sparkwrite-editor/horizontalruleRichTextHorizontalRule已被 Divider 取代;两者只注册其中一个

媒体与嵌入 ​

功能引入控件值得注意的选项
Imageai-sparkwrite-editor/imageRichTextImage、RichTextBubbleImageupload、acceptMimes、maxSize、resourceImage;裁剪、图注、旋转;getImageChanges / markImagesSaved 用于处理已删除的上传
ImageGifai-sparkwrite-editor/imagegifRichTextImageGifGIPHY_API_KEY
Videoai-sparkwrite-editor/videoRichTextVideo、RichTextBubbleVideoupload、resourceVideo
Attachmentai-sparkwrite-editor/attachmentRichTextAttachmentupload
Embedai-sparkwrite-editor/iframeRichTextIframe、RichTextBubbleIframeYouTube、Vimeo、B 站、Loom、Spotify、Google 地图、Figma、Canva、Miro、CodePen、Gist、Google 文档/表格/幻灯片/表单、Airtable…… 共 35 个服务,或任意网页
Twitterai-sparkwrite-editor/twitterRichTextTwitterx.com 与 twitter.com 链接
Katexai-sparkwrite-editor/katexRichTextKatex、RichTextBubbleKatexloadKatex(懒加载);AI"描述公式"
Mermaidai-sparkwrite-editor/mermaidRichTextMermaid、RichTextBubbleMermaidAI"描述图表"
Excalidrawai-sparkwrite-editor/excalidrawRichTextExcalidraw、RichTextBubbleExcalidraw—
Drawerai-sparkwrite-editor/drawerRichTextDrawer、RichTextBubbleDrawer自由手绘
Emojiai-sparkwrite-editor/emojiRichTextEmoji懒加载 emoji 数据
Mentionai-sparkwrite-editor/mention—suggestion
Linkai-sparkwrite-editor/linkRichTextLink、RichTextBubbleLink(悬停)openOnClick、autolink

写作辅助 ​

功能引入控件值得注意的选项
AIai-sparkwrite-editor/aiRichTextAI(工具栏按钮)、RichTextAIComposer(编辑器下方的写作台)、RichTextAIImprove(选区菜单)、/ai 斜杠命令条目、空行按空格键endpoint(你后端的一个接口地址)、generate(request, onChunk)、stream、spaceTrigger、documentContext、translateLanguages、renderResult、components.Panel;writeWithAI 将 Markdown 以真实节点的形式流入文档
AI 自动补全ai-sparkwrite-editor/ai(AIAutocomplete)停顿后出现的灰色续写;Tab 采纳,Escape 取消enabled、delay、minChars、contextChars、maxTokens、prompt;toggleAIAutocomplete()
SlashCommandai-sparkwrite-editor/slashcommandSlashCommandListcommandList、hiddenUntilSearched
RichPasteai-sparkwrite-editor/richpaste—wordLists、codeBlocks、detectLanguage
MarkdownPasteai-sparkwrite-editor/markdownpaste—粘贴的 markdown 文本会变为内容
SearchAndReplaceai-sparkwrite-editor/searchandreplaceRichTextSearchAndReplace—
ShortMessageai-sparkwrite-editor/shortmessage—shortcut、messages(文本扩展)
Recorderai-sparkwrite-editor/recorder—autoStart、recordSelection、onEntry;replayRecording
CodeViewai-sparkwrite-editor/codeviewRichTextCodeView编辑 HTML 源码

导入与导出 ​

功能引入控件值得注意的选项
ImportWordai-sparkwrite-editor/importwordRichTextImportWord内嵌图片的 upload
ExportWordai-sparkwrite-editor/exportwordRichTextExportWord—
ExportPdfai-sparkwrite-editor/exportpdfRichTextExportPdf使用编辑器样式表打印
ExportMarkdownai-sparkwrite-editor/exportmarkdownRichTextExportMarkdown没有 markdown 形式的节点会回退为 HTML

气泡菜单 ​

分别从 ai-sparkwrite-editor/bubble/<name> 引入:text、table、media(图片)、video、link、callout、notice、drawer、excalidraw、iframe、katex、mermaid、drag-handle。见气泡菜单。

语言 ​

ai-sparkwrite-editor/locales/<code> 支持 en、zh_CN、hi、es、fr、bn、pt_BR、ru、id、de、ja、tr、vi、ko、it、hu_HU、fi。见国际化。

主题 ​

ai-sparkwrite-editor/theme 导出 themeActions(setTheme、setBorderRadius、强调色)和 CODE_THEME。样式来自 ai-sparkwrite-editor/style.css;根元素带有 ai-sparkwrite-editor 类名。

用 ❤️ 打造