@qingwu-ui/ai-editor 1.1.2 → 1.1.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qingwu-ui/ai-editor",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "青梧 AI 编辑器 —— 面向中文用户的智能富文本编辑器,基于 Tiptap + React 19",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -87,7 +87,7 @@
87
87
  "@tiptap/react": "^3.28.0",
88
88
  "@tiptap/starter-kit": "^3.28.0",
89
89
  "@tiptap/suggestion": "^3.28.0",
90
- "beautiful-mermaid": "^1.1.3",
90
+ "pele": "^1.8.0",
91
91
  "cmdk": "^1.1.1",
92
92
  "dompurify": "^3.4.12",
93
93
  "highlight.js": "~11.11.0",
@@ -1 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("dompurify");l=c(l,1);var u={"zh-CN":{editor:{placeholder:`输入 '/' 打开命令菜单,或继续输入内容…`,wordCount:`共 {count} 字`,characterCount:`共 {count} 字符`,toolbar:{export:`导出`,exportTitle:`导出文档`,ai:`AI 编写`,aiTitle:`AI 编写助手`},loading:`加载编辑器中…`,prompt:`输入 / 打开命令菜单 · 选中文本弹出格式菜单 · 点击写作助手辅助写作`,attachment:{preview:`预览`,download:`下载`,delete:`删除`,loadingPreview:`加载预览中…`,lost:`附件已丢失`},slash:{heading1:`一级标题`,heading1Desc:`大号标题`,heading2:`二级标题`,heading2Desc:`中号标题`,heading3:`三级标题`,heading3Desc:`小号标题`,heading4:`四级标题`,heading4Desc:`更小标题`,heading5:`五级标题`,heading5Desc:`小小标题`,heading6:`六级标题`,heading6Desc:`最小标题`,searchPlaceholder:`搜索命令…`,bulletList:`无序列表`,bulletListDesc:`创建无序列表`,numberedList:`有序列表`,numberedListDesc:`创建有序列表`,taskList:`任务列表`,taskListDesc:`创建可勾选的任务`,blockquote:`引用块`,blockquoteDesc:`插入引用`,codeBlock:`代码块`,codeBlockDesc:`插入代码块`,image:`图片`,imageDesc:`上传或粘贴图片`,horizontalRule:`分隔线`,horizontalRuleDesc:`插入分隔线`,video:`导入视频`,videoDesc:`导入 B站、直链 mp4/m3u8、小红书等视频`,audio:`导入音频`,audioDesc:`从本地选择音频文件,支持 mp3/wav/flac/aac 等`,attachment:`添加附件`,attachmentDesc:`上传任意类型文件,以附件链接形式插入`,mathInline:`行内公式`,mathInlineDesc:`插入 LaTeX 行内公式,如 $E=mc^2$`,mathBlock:`块级公式`,mathBlockDesc:`插入 LaTeX 块级公式,支持多行`,xiaohongshu:`小红书`,xiaohongshuDesc:`嵌入小红书笔记`},math:{inlineTitle:`编辑行内公式`,blockTitle:`编辑块级公式`,placeholder:`输入 LaTeX,例如 \\frac{a}{b}`,empty:`点击输入公式`,emptyPreview:`输入 LaTeX 后在此预览`,hint:`支持 LaTeX 语法;Ctrl/Cmd + Enter 保存`,cancel:`取消`,save:`保存`},bubble:{bold:`加粗`,italic:`斜体`,underline:`下划线`,strikethrough:`删除线`,code:`行内代码`,emphasis:`强调`,link:`链接`,highlight:`高亮`,copy:`复制`,search:`搜索`,table:`表格`,more:`更多`},ai:{trigger:`写作助手`,triggerDesc:`选中文字后选择 AI 操作,生成结果可替换或插入原文。`,close:`关闭`,continue:`续写`,continueDesc:`从当前位置继续写作`,improve:`润色`,improveDesc:`优化表达,提升文采`,shorter:`精简`,shorterDesc:`让文字更简洁`,longer:`扩写`,longerDesc:`丰富内容细节`,fix:`修正`,fixDesc:`修正语法和错别字`,translate:`翻译`,translateDesc:`翻译为其他语言`,zap:`自定义指令`,zapDesc:`输入自定义指令`,thinking:`正在思考…`,replace:`替换选中`,replaceAll:`全文替换`,replaceTitle:`确认替换选中`,replaceAllTitle:`确认全文替换`,replaceText:`将用 AI 生成结果替换当前选中内容。`,replaceAllText:`将用 AI 生成结果替换当前全部内容。`,removeNodes:`以下媒体节点将被移除:`,nodeImage:`图片`,nodeAttachment:`附件`,nodeVideo:`视频`,nodeAudio:`音频`,confirmReplace:`确认替换`,cancel:`取消`,insert:`在下方插入`,discard:`放弃`,error:`请求失败,请重试`,confirm:`确定`,back:`返回`,customPlaceholder:`例如:把这段内容改写成小红书风格`},export:{title:`导出文档`,html:`HTML`,htmlDesc:`导出为 HTML 文件`,json:`JSON (Tiptap)`,jsonDesc:`导出为 Tiptap JSON 格式`,md:`Markdown`,mdDesc:`导出为 Markdown 文件`,plainText:`纯文本`,plainTextDesc:`导出为纯文本`,pdf:`PDF`,pdfDesc:`打印为 PDF`,copy:`复制到剪贴板`,copied:`已复制`,download:`下载`},image:{upload:`上传图片`,uploading:`上传中…`,error:`上传失败`,dragTip:`拖拽图片到此处或点击上传`},link:{placeholder:`输入链接地址…`,save:`确定`,remove:`移除链接`}},app:{title:`青梧`,subtitle:`智能编辑器`,settings:`设置`,theme:{label:`主题`,light:`浅色`,dark:`深色`,system:`跟随系统`},themeToggle:{toDark:`切换深色`,toLight:`切换浅色`},font:{label:`字体`,sans:`默认字体`,serif:`宋体/衬线`,mono:`等宽字体`},language:`语言`,about:`关于青梧`,footer:{line1:`青梧 QingWu · 基于 Tiptap 构建 · 支持 DeepSeek / 通义千问 / OpenAI 等大模型`,license:`Apache-2.0 License`}},tour:{welcome:{title:`欢迎使用青梧编辑器`,description:`青梧是一款面向中文用户的 AI 智能编辑器,支持 Markdown、代码高亮、Mermaid 图表等丰富功能。点击「下一步」开始了解。`},mode:{title:`编辑 / 查看模式`,description:`点击此按钮可在「编辑模式」和「查看模式」之间切换。查看模式下内容只读,操作按钮会隐藏,适合阅读和展示。`},fullscreen:{title:`全屏模式`,description:`提供「网页全屏」和「浏览器全屏」两种沉浸式写作体验,让你专注于内容创作。`},ai:{title:`AI 写作助手`,description:`配置 DeepSeek、通义千问、OpenAI 等大模型后,可使用续写、润色、精简、扩写、修正、翻译等 AI 辅助功能。`},lang:{title:`中英文切换`,description:`编辑器和界面支持中文和英文两种语言,点击即可切换。`},font:{title:`字体切换`,description:`提供默认字体、衬线字体和等宽字体三种阅读体验,满足不同场景需求。`},editor:{title:`编辑器内容区`,description:`在此区域输入内容。输入 / 打开命令菜单插入各种元素,选中文本弹出格式菜单,点击写作助手触发 AI 辅助。`}}},"en-US":{editor:{placeholder:`Type '/' for commands, or continue writing…`,wordCount:`{count} words`,characterCount:`{count} characters`,toolbar:{export:`Export`,exportTitle:`Export Document`,ai:`AI Write`,aiTitle:`AI Writing Assistant`},loading:`Loading editor…`,prompt:`Type / for commands · Select text for formatting · Click Writing Assistant for help`,attachment:{preview:`Preview`,download:`Download`,delete:`Delete`,loadingPreview:`Loading preview…`,lost:`Attachment lost`},slash:{heading1:`Heading 1`,heading1Desc:`Large heading`,heading2:`Heading 2`,heading2Desc:`Medium heading`,heading3:`Heading 3`,heading3Desc:`Small heading`,heading4:`Heading 4`,heading4Desc:`Smaller heading`,heading5:`Heading 5`,heading5Desc:`Tiny heading`,heading6:`Heading 6`,heading6Desc:`Smallest heading`,searchPlaceholder:`Search commands…`,bulletList:`Bullet List`,bulletListDesc:`Create a bullet list`,numberedList:`Numbered List`,numberedListDesc:`Create a numbered list`,taskList:`Task List`,taskListDesc:`Create a task list`,blockquote:`Blockquote`,blockquoteDesc:`Insert a blockquote`,codeBlock:`Code Block`,codeBlockDesc:`Insert code block`,image:`Image`,imageDesc:`Upload or paste an image`,horizontalRule:`Divider`,horizontalRuleDesc:`Insert a divider`,video:`Import Video`,videoDesc:`Import Bilibili, direct mp4/m3u8, RedNote videos`,audio:`Import Audio`,audioDesc:`Select audio file from local (mp3/wav/flac/aac)`,attachment:`Add Attachment`,attachmentDesc:`Upload any file type as attachment link`,mathInline:`Inline Formula`,mathInlineDesc:`Insert an inline LaTeX formula, e.g. $E=mc^2$`,mathBlock:`Block Formula`,mathBlockDesc:`Insert a block LaTeX formula with multi-line support`,xiaohongshu:`RedNote`,xiaohongshuDesc:`Embed RedNote post`},math:{inlineTitle:`Edit Inline Formula`,blockTitle:`Edit Block Formula`,placeholder:`Enter LaTeX, e.g. \\frac{a}{b}`,empty:`Click to add formula`,emptyPreview:`Preview appears here`,hint:`LaTeX supported; Ctrl/Cmd + Enter to save`,cancel:`Cancel`,save:`Save`},bubble:{bold:`Bold`,italic:`Italic`,underline:`Underline`,strikethrough:`Strikethrough`,code:`Inline Code`,emphasis:`Emphasis`,link:`Link`,highlight:`Highlight`,copy:`Copy`,search:`Search`,table:`Table`,more:`More`},ai:{trigger:`Writing Assistant`,triggerDesc:`Select text and pick an AI action. The result can replace or insert into the document.`,close:`Close`,continue:`Continue`,continueDesc:`Continue writing from here`,improve:`Improve`,improveDesc:`Polish and improve text`,shorter:`Shorten`,shorterDesc:`Make it more concise`,longer:`Expand`,longerDesc:`Add more detail`,fix:`Fix`,fixDesc:`Fix grammar and typos`,translate:`Translate`,translateDesc:`Translate to another language`,zap:`Custom`,zapDesc:`Enter a custom command`,thinking:`Thinking…`,replace:`Replace selection`,replaceAll:`Replace all`,replaceTitle:`Replace selection`,replaceAllTitle:`Replace all content`,replaceText:`The AI result will replace the current selection.`,replaceAllText:`The AI result will replace the entire document.`,removeNodes:`The following media nodes will be removed:`,nodeImage:`Image`,nodeAttachment:`Attachment`,nodeVideo:`Video`,nodeAudio:`Audio`,confirmReplace:`Replace`,cancel:`Cancel`,insert:`Insert below`,discard:`Discard`,error:`Request failed, please retry`,confirm:`Confirm`,back:`Back`,customPlaceholder:`e.g. Rewrite this in a more casual tone`},export:{title:`Export Document`,html:`HTML`,htmlDesc:`Export as HTML`,json:`JSON (Tiptap)`,jsonDesc:`Export as Tiptap JSON`,md:`Markdown`,mdDesc:`Export as Markdown`,plainText:`Plain Text`,plainTextDesc:`Export as plain text`,pdf:`PDF`,pdfDesc:`Print as PDF`,copy:`Copy to clipboard`,copied:`Copied`,download:`Download`},image:{upload:`Upload image`,uploading:`Uploading…`,error:`Upload failed`,dragTip:`Drag image here or click to upload`},link:{placeholder:`Enter link URL…`,save:`Save`,remove:`Remove link`}},app:{title:`QingWu`,subtitle:`Smart Editor`,settings:`Settings`,theme:{label:`Theme`,light:`Light`,dark:`Dark`,system:`System`},themeToggle:{toDark:`Switch to dark`,toLight:`Switch to light`},font:{label:`Font`,sans:`Default`,serif:`Serif`,mono:`Mono`},language:`Language`,about:`About QingWu`,footer:{line1:`QingWu · Built on Tiptap · Supports DeepSeek / Qwen / OpenAI models`,license:`Apache-2.0 License`}},tour:{welcome:{title:`Welcome to QingWu Editor`,description:`QingWu is an AI-powered smart editor for Chinese users, supporting Markdown, code highlighting, Mermaid diagrams, and more. Click 'Next' to get started.`},mode:{title:`Edit / View Mode`,description:`Toggle between edit mode and view (read-only) mode. In view mode, content is read-only and action buttons are hidden — ideal for reading and presenting.`},fullscreen:{title:`Fullscreen Mode`,description:`Choose between 'page fullscreen' and 'browser fullscreen' for a focused, distraction-free writing experience.`},ai:{title:`AI Writing Assistant`,description:`After configuring DeepSeek, Qwen, OpenAI, or compatible models, access AI features like continue writing, polish, shorten, expand, fix grammar, and translate.`},lang:{title:`Language Toggle`,description:`Switch between Chinese and English for the editor interface and UI.`},font:{title:`Font Switcher`,description:`Choose between default, serif, and monospace fonts for different reading experiences.`},editor:{title:`Editor Content Area`,description:`Type your content here. Type '/' to open the command menu, select text for the formatting bubble menu, and use the AI assistant for smart writing help.`}}}},d=`zh-CN`;function f(e){d=e,typeof document<`u`&&(document.documentElement.lang=e)}function p(){return d}function m(e){let t=u[d],n=e.split(`.`),r=t;for(let t of n)if(r&&typeof r==`object`&&t in r)r=r[t];else return e;return typeof r==`string`?r:e}function h(e,...t){let n=m(e);if(t.length===0)return n;if(t.length===1&&typeof t[0]==`object`){let e=t[0];for(let[t,r]of Object.entries(e))n=n.replaceAll(`{${t}}`,String(r));return n}for(let e=0;e<t.length;e++)n=n.replaceAll(`{${e}}`,String(t[e]));return t.length===1&&/\{\w+\}/.test(n)&&(n=n.replace(/\{\w+\}/,String(t[0]))),n}var g=null;function _(){return g===!1?null:g===!0?l.default:typeof window>`u`||!window.document?(g=!1,null):(g=!!l.default.isSupported,g?l.default:null)}function v(e){let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`};return e.replace(/[&<>"']/g,e=>t[e]||e)}function y(e){return e.replace(/<(script|style|iframe|object|embed|svg|math|frame|applet|link|meta|base)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,``).replace(/<(script|style|iframe|object|embed|svg|math|frame|applet|link|meta|base)\b[^>]*\/?>/gi,``).replace(/(?:\s|\/)+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,` `).replace(/((?:href|src|action|formaction|xlink:href|data|background|dynsrc|lowsrc)\s*=\s*["'])\s*(?:javascript|vbscript|livescript|mocha):/gi,`$1#`).replace(/((?:href|src|action|formaction)\s*=\s*["'])\s*data:\s*(?:text\/html|image\/svg\+xml|application\/x-javascript|application\/javascript)/gi,`$1#`).replace(/expression\s*\(/gi,`(`).replace(/url\s*\(\s*["']?\s*(?:javascript|vbscript|data:text\/html|data:image\/svg\+xml)[^)]*\)/gi,`url(#)`)}function b(e){let t=_();return t?t.sanitize(e,{ALLOW_DATA_ATTR:!0,ADD_ATTR:[`target`,`rel`],ALLOWED_URI_REGEXP:/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|blob):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i}):y(e)}function x(e){return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,``).replace(/<foreignObject\b[^>]*>[\s\S]*?<\/foreignObject\s*>/gi,``).replace(/\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,``).replace(/((?:href|xlink:href|src)\s*=\s*["'])\s*(?:javascript|vbscript|livescript|mocha):/gi,`$1#`).replace(/((?:href|xlink:href|src)\s*=\s*["'])\s*data:\s*(?:text\/html|application\/javascript)/gi,`$1#`)}Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return v}});