@qingwu-ui/ai-editor 0.9.0-beta.18 → 0.9.0-beta.19
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/README.md +17 -5
- package/dist/editor/ai-editor.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
## 特性
|
|
10
10
|
|
|
11
11
|
- **智能辅助写作** - 续写、润色、精简、扩写、修正、翻译、自定义指令,基于 Vercel AI SDK 统一接口
|
|
12
|
+
- **AI 替换保护** - 选中 / 全文 AI 替换前弹确认弹窗列出将被移除的媒体;替换后孤儿媒体延迟 30s 删除,期间 `Ctrl+Z` 还原 URL 即取消,避免 undo 后资源 404
|
|
12
13
|
- **丰富的媒体嵌入** - 图片、视频(B站 / 直链 / 小红书)、音频、附件(支持 206+ 格式在线预览)
|
|
13
|
-
- **Markdown 粘贴** - Obsidian 风格的 `[[链接]]` 和 `![[图片]]`
|
|
14
|
+
- **Markdown 粘贴** - Obsidian 风格的 `[[链接]]` 和 `![[图片]]` 语法支持;粘贴外部 Markdown(Obsidian / Typora)时自动检测本地相对路径图片/附件,匹配剪贴板文件上传换链,找不到时引导文件夹选择 / 拖拽补救
|
|
15
|
+
- **文档目录(TOC)** - 宽屏桌面侧栏 + 移动端抽屉 + 只读态悬浮球入口;滚动自动跟踪当前章节并高亮,点击目录平滑跳转,悬浮框滚到顶/底后滚轮接力滚动正文
|
|
14
16
|
- **多存储后端** - 本地存储 / 阿里云 OSS / 腾讯云 COS / S3 兼容存储,配置持久化
|
|
15
17
|
- **中英双语** - 运行时可切换,无需刷新页面
|
|
16
18
|
- **斜杠命令** - `/` 快速插入标题、列表、图片、视频等
|
|
17
|
-
-
|
|
19
|
+
- **代码块** - 30+ 语言语法高亮(lowlight)、行号列、折叠/展开、语言图标,兼容 Obsidian 逐行 div 导出格式;Mermaid 图表渲染
|
|
18
20
|
- **视频播放** - [xgplayer](https://h5player.bytedance.com/)
|
|
19
21
|
- **文件预览** - 基于 @file-viewer/react-full,支持 Office / PDF / CAD / 压缩包等 206+ 格式
|
|
20
22
|
- **导出** - HTML / Markdown / JSON / 纯文本 / PDF
|
|
@@ -287,7 +289,7 @@ startBrowserClipperReceiver({
|
|
|
287
289
|
|
|
288
290
|
| 参数 | 类型 | 默认值 | 说明 |
|
|
289
291
|
|------|------|--------|------|
|
|
290
|
-
| `initialContent` | `string` | `""` |
|
|
292
|
+
| `initialContent` | `string \| object` | `""` | 初始内容:HTML 字符串(自动安全清洗 / Markdown 识别)或 ProseMirror JSON 文档对象(原样使用,宿主回显可直传 `getJSON()` 产物,避免二次解析失真);运行期变化会原地更新文档,不丢撤销栈 |
|
|
291
293
|
| `onChange` | `(html: string, json: object) => void` | - | 内容变化回调 |
|
|
292
294
|
| `placeholder` | `string` | `"输入 '/' 打开菜单…"` | 占位文本 |
|
|
293
295
|
| `mode` | `"edit" \| "view"` | `"edit"` | 编辑模式;`"view"` 为只读查看 |
|
|
@@ -300,8 +302,8 @@ startBrowserClipperReceiver({
|
|
|
300
302
|
| `style` | `React.CSSProperties` | - | 容器自定义样式 |
|
|
301
303
|
| `borderless` | `boolean` | `false` | 隐藏编辑器外边框 |
|
|
302
304
|
| `showToolbar` | `boolean` | `true` | 显示顶部工具栏(导出) |
|
|
303
|
-
| `showToc` | `boolean` | `true` |
|
|
304
|
-
| `showSearch` | `boolean` | `true` |
|
|
305
|
+
| `showToc` | `boolean` | `true` | 目录**默认展开状态**:`true` 默认展开;`false` 控件仍可用但默认收起(工具栏按钮 / 悬浮球 / 抽屉均可展开,不关闭目录功能)。运行期变化会同步进内部状态 |
|
|
306
|
+
| `showSearch` | `boolean` | `true` | 启用全文搜索:`true` 唤起 Ctrl+F 搜索浮层,`false` 禁用且不拦截快捷键 |
|
|
305
307
|
| `onEditorReady` | `(editor: Editor) => void` | - | 编辑器实例就绪回调 |
|
|
306
308
|
| `immediatelyRender` | `boolean` | - | 是否立即渲染编辑器;SSR/Next.js 配合 `dynamic` ssr:false 传 `true` |
|
|
307
309
|
|
|
@@ -362,6 +364,16 @@ setConfirmProvider(({ title, message, confirmText, cancelText, onConfirm, onCanc
|
|
|
362
364
|
|
|
363
365
|
- **导入选择**:拖入 MD 文件时优先走宿主 `chooseMd`(内置 `MdImportDialog`);未接入时回退到内置项目风格选择弹窗(渲染 / 附加 / 取消),不再使用原生 `window.confirm`。
|
|
364
366
|
|
|
367
|
+
#### 目录(TOC)宿主注意事项
|
|
368
|
+
|
|
369
|
+
- 入口:宽屏(≥64rem 且非全屏)显示工具栏「目录」按钮 + 右侧悬浮侧栏;窄屏 / 全屏改由抽屉承载(首次挂载自动展开一次);侧栏 / 抽屉未展示时(用户收起后,或只读 `mode="view"` 态且文档含标题)由悬浮球作为入口。
|
|
370
|
+
- 桌面侧栏与移动抽屉均经 `createPortal` 直挂 `document.body`(避免宿主 GSAP 入场 / 步骤切换动画的祖先 `transform` 抢走 `fixed` 包含块、被站点头部层叠上下文压制)。宿主**不要**以「编辑器容器后代」关系选择这两个面板,请用全局类 `.qingwu-toc-desktop` / `.qingwu-toc-drawer`。
|
|
371
|
+
- 编辑器实例常驻、仅靠祖先 `display:none` 切换视图的宿主:portal 出 body 的面板不会随隐藏容器一起消失,需按自身步骤 / 视图状态额外收掉,例如:
|
|
372
|
+
```css
|
|
373
|
+
body:has(.scene:not([data-step="1"])) > .qingwu-toc-desktop { display: none; }
|
|
374
|
+
```
|
|
375
|
+
- 滚动跟踪:滚动正文时目录实时高亮当前章节、激活项自动保持在目录视野内;悬浮框自身滚到顶 / 底后滚轮接力滚动正文;宿主使用 Lenis 时抽屉内已挂 `data-lenis-prevent` 放行原生滚动。
|
|
376
|
+
|
|
365
377
|
### 写作助手相关
|
|
366
378
|
|
|
367
379
|
```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-editor.d.ts","sourceRoot":"","sources":["../../src/editor/ai-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,OAAO,EACL,KAAK,EAAE,EASR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA4JnE,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,aAAa;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,qBAAqB;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC9E;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ai-editor.d.ts","sourceRoot":"","sources":["../../src/editor/ai-editor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAK3C,OAAO,EACL,KAAK,EAAE,EASR,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA4JnE,MAAM,WAAW,mBAAmB;IAClC,2EAA2E;IAC3E,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,aAAa;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD,qBAAqB;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qCAAqC;IACrC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,YAAY;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,0BAA0B;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4DAA4D;IAC5D,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,oEAAoE;IACpE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAC;CAC9E;AAED,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA8uClD,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=requi
|
|
|
8
8
|
也可以选择稍后把文件直接拖进编辑器。`;let o=document.createElement(`div`);o.className=`flex justify-end gap-2`;let s=e=>{document.removeEventListener(`keydown`,c),n.remove(),t(e)},c=e=>{e.key===`Escape`&&s(`cancel`)};n.addEventListener(`mousedown`,e=>{e.target===n&&s(`cancel`)});let l=document.createElement(`button`);l.type=`button`,l.className=`px-3 py-1.5 text-xs rounded-lg border border-default-200 hover:bg-default-100 text-default-700 dark:text-zinc-300 dark:border-zinc-600 dark:hover:bg-zinc-700`,l.textContent=`稍后处理`,l.addEventListener(`click`,()=>s(`cancel`));let u=document.createElement(`button`);u.type=`button`,u.className=`px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white`,u.textContent=`选择文件夹…`,u.addEventListener(`click`,()=>s(`pick`)),o.append(l,u),r.append(i,a,o),n.appendChild(r),document.addEventListener(`keydown`,c),document.body.appendChild(n)})}function hr(e){let t=document.createElement(`div`);t.className=`fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none`;let n=document.createElement(`div`);n.className=`bg-white dark:bg-zinc-800 rounded-xl p-6 shadow-xl max-w-md w-full mx-4 border border-default-200 dark:border-zinc-700`;let r=document.createElement(`div`);r.className=`text-sm font-medium text-default-800 dark:text-zinc-100 mb-2`,r.textContent=`粘贴内容中包含本地文件`;let i=document.createElement(`div`);i.className=`text-xs text-default-500 dark:text-zinc-400 mb-4 whitespace-pre-line leading-relaxed`,i.textContent=`检测到 ${e} 个本地图片/附件使用相对路径,粘贴时文件本体没有跟过来。\n当前浏览器不支持读取本地文件夹(需要 Chrome / Edge)。请把对应的图片或文件直接拖进编辑器,会自动完成上传。`;let a=document.createElement(`div`);a.className=`flex justify-end`;let o=()=>{document.removeEventListener(`keydown`,s),t.remove()},s=e=>{e.key===`Escape`&&o()};t.addEventListener(`mousedown`,e=>{e.target===t&&o()});let c=document.createElement(`button`);c.type=`button`,c.className=`px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white`,c.textContent=`知道了`,c.addEventListener(`click`,o),a.append(c),n.append(r,i,a),t.appendChild(n),document.addEventListener(`keydown`,s),document.body.appendChild(t)}function gr(e){return new Promise(t=>{let n=document.createElement(`div`);n.className=`fixed inset-0 z-[10001] flex items-center justify-center bg-black/40 backdrop-blur-sm select-none`;let r=document.createElement(`div`);r.className=`bg-white dark:bg-zinc-800 rounded-xl p-6 shadow-xl max-w-md w-full mx-4 border border-default-200 dark:border-zinc-700 relative overflow-hidden`;let i=document.createElement(`div`);i.className=`text-sm font-medium text-default-800 dark:text-zinc-100 mb-2`,i.textContent=`选择文件直接上传`;let a=document.createElement(`div`);a.className=`text-xs text-default-500 dark:text-zinc-400 mb-4 whitespace-pre-line leading-relaxed`,a.textContent=`还有 ${e.length} 个本地文件无法从所选文件夹读取:${e.join(`、`)}。\n点击「选择文件…」后在系统对话框里选中这些文件(可多选),将直接上传到存储。若它们位于云同步目录(OneDrive / 绿联云等),选中后会自动取回本地内容。`;let o=document.createElement(`div`);o.className=`flex justify-end gap-2`;let s=e=>{document.removeEventListener(`keydown`,c),n.remove(),t(e)},c=e=>{e.key===`Escape`&&s(`cancel`)};n.addEventListener(`mousedown`,e=>{e.target===n&&s(`cancel`)});let l=document.createElement(`button`);l.type=`button`,l.className=`px-3 py-1.5 text-xs rounded-lg border border-default-200 hover:bg-default-100 text-default-700 dark:text-zinc-300 dark:border-zinc-600 dark:hover:bg-zinc-700`,l.textContent=`稍后处理`,l.addEventListener(`click`,()=>s(`cancel`));let u=document.createElement(`button`);u.type=`button`,u.className=`px-3 py-1.5 text-xs rounded-lg bg-blue-500 hover:bg-blue-600 text-white`,u.textContent=`选择文件…`,u.addEventListener(`click`,()=>s(`pick`)),o.append(l,u),r.append(i,a,o),n.appendChild(r),document.addEventListener(`keydown`,c),document.body.appendChild(n)})}async function _r(e,t,n){let r=ir(),i=cr(n),a=await Mn();if(!a){for(let e of i)r.missing.push(e[0]);return r}let o=new Map(a.map(e=>[e.name.toLowerCase(),e]));for(let n of i){let i=n[0],a=o.get(i.basename);if(!a){r.missing.push(i);continue}o.delete(i.basename);let s=await lr(e,t,n,a);r[s]++}return r}var vr=d.Extension.create({name:`relativeMedia`,addStorage(){return{clipboardFiles:new Map,pausedUntilPaste:!1}},addProseMirrorPlugins(){let e=this.editor,t=this.storage,r=!1,i=null,a=async(n,r)=>{let a=e.view,o=ir(),{matched:s,unmatched:c}=ur(n,t.clipboardFiles);for(let{refs:t,file:n}of s){let r=await lr(a,e,t,n);o[r]++}if(c.length>0){let t=cr(c).length;if(kn()){let n=r??null;if(n||(await mr(t)===`pick`?(n=await An(),n||J(`没有选择文件夹。本地文件暂以占位显示,稍后可直接把文件拖进编辑器上传`,`info`)):J(`已选择稍后处理。本地文件暂以占位显示,可直接把文件拖进编辑器上传`,`info`)),n){i=n,ar(o,await dr(a,e,c,n));let t=[...o.missing,...o.readFailed];if(t.length>0&&jn()&&await gr(t.map(e=>e.basename))===`pick`){let n=await _r(a,e,t);ar(o,n),o.missing=n.missing,o.readFailed=[]}}}else hr(t)}pr(o)},o=()=>{if(!e||e.isDestroyed||t.pausedUntilPaste)return;let o=n.i(),s=Ln(e.state.doc,o);if(s.length===0||r)return;r=!0;let c=new Set(s.map(e=>e.src));a(s).then(()=>{if(e.isDestroyed)return;let t=Ln(e.state.doc,o).filter(e=>!c.has(e.src));if(t.length!==0)return a(t,i)}).finally(()=>{r=!1,!(!e||e.isDestroyed)&&(t.pausedUntilPaste=Ln(e.state.doc,o).length>0)})};return[new f.Plugin({key:new f.PluginKey(`relativeMedia`),props:{handlePaste(e,n){let r=n.clipboardData?.files;return t.clipboardFiles=new Map(Array.from(r??[]).map(e=>[e.name.toLowerCase(),e])),t.pausedUntilPaste=!1,!1}},appendTransaction(e){return e.some(e=>e.docChanged)&&queueMicrotask(o),null}})]}}),yr=new f.PluginKey(`slashCommand`);function br(e){return d.Extension.create({name:`slashCommand`,addProseMirrorPlugins(){let t={char:`/`,pluginKey:yr,findSuggestionMatch:e=>{let{$position:t}=e;for(let e=t.depth;e>=0;e--)if(t.node(e).type.name===`codeBlock`)return null;return t.marks().some(e=>e.type.name===`code`)?null:(0,P.findSuggestionMatch)(e)},allow:({editor:e,state:t})=>{if(!e.isEditable)return!1;let{$from:n}=t.selection;for(let e=n.depth;e>=0;e--)if(n.node(e).type.name===`codeBlock`)return!1;return!n.marks().some(e=>e.type.name===`code`)},command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).run(),n.command({editor:e})},items:({query:t})=>{let n=e();if(!t)return n;let r=t.toLowerCase();return n.filter(e=>e.title.toLowerCase().includes(r)||(e.description?.toLowerCase().includes(r)??!1))},render:()=>{let e=null,t=null,n=0,r=[],i=null,a=null,o=null;function s(e,o){if(!t)return;r=e,i=o,t.textContent=``;let s=document.createElement(`div`);s.style.cssText=`padding:6px 8px;border-bottom:1px solid #f4f4f5;`;let c=document.createElement(`input`);c.type=`text`,c.placeholder=`搜索命令…`,c.style.cssText=`width:100%;padding:6px 8px;border:1px solid #e4e4e7;border-radius:8px;font-size:13px;outline:none;background:#fafafa;`,s.appendChild(c),t.appendChild(s);let l=document.createElement(`div`);if(l.className=`slash-item-list`,l.style.cssText=`max-height:300px;overflow-y:auto;`,e.length===0){let e=document.createElement(`div`);e.style.cssText=`padding:12px;text-align:center;color:#a1a1aa;font-size:13px;`,e.textContent=`未找到匹配`,l.appendChild(e)}else e.forEach((e,t)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`slash-item${t===n?` slash-item--selected`:``}`,r.dataset.index=String(t),r.style.cssText=`display:flex;align-items:center;gap:12px;width:100%;padding:8px 12px;border:none;background:${t===n?`#f4f4f5`:`transparent`};cursor:pointer;text-align:left;border-radius:8px;font-size:14px;transition:background 0.1s;`;let i=document.createElement(`span`);i.style.cssText=`font-size:16px;width:24px;text-align:center;flex-shrink:0;`,i.textContent=e.icon||``,r.appendChild(i);let a=document.createElement(`div`);a.style.cssText=`min-width:0;`;let s=document.createElement(`div`);if(s.style.cssText=`font-weight:500;color:#18181b;`,s.textContent=e.title,a.appendChild(s),e.description){let t=document.createElement(`div`);t.style.cssText=`font-size:12px;color:#a1a1aa;margin-top:1px;`,t.textContent=e.description,a.appendChild(t)}r.appendChild(a),r.addEventListener(`click`,()=>{o(e)}),l.appendChild(r)});t.appendChild(l);let u=l.querySelector(`.slash-item--selected`);if(u){let e=l.getBoundingClientRect(),t=u.getBoundingClientRect();t.top<e.top?l.scrollTop-=e.top-t.top:t.bottom>e.bottom&&(l.scrollTop+=t.bottom-e.bottom)}let d=()=>Array.from(l.querySelectorAll(`.slash-item`)).filter(e=>e.style.display!==`none`&&!e.disabled),f=e=>{l.querySelectorAll(`.slash-item`).forEach(t=>{t.classList.toggle(`slash-item--selected`,t===e),t.style.background=t===e?`#f4f4f5`:`transparent`});let t=l.getBoundingClientRect(),n=e.getBoundingClientRect();n.top<t.top?l.scrollTop-=t.top-n.top:n.bottom>t.bottom&&(l.scrollTop+=n.bottom-t.bottom)};c.addEventListener(`input`,()=>{let e=c.value.toLowerCase();l.querySelectorAll(`.slash-item`).forEach(t=>{let n=(t.textContent||``).toLowerCase();t.style.display=n.includes(e)?``:`none`});let t=d()[0];t&&(n=Number(t.dataset.index??0),f(t))}),c.addEventListener(`keydown`,e=>{let t=d();if(e.key===`Enter`){e.preventDefault(),(t.find(e=>e.classList.contains(`slash-item--selected`))??t[0])?.click();return}if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),t.length===0)return;let r=t.findIndex(e=>e.classList.contains(`slash-item--selected`)),i=t[e.key===`ArrowDown`?(r+1)%t.length:(r-1+t.length)%t.length];n=Number(i.dataset.index??0),f(i);return}if(e.key===`Escape`){e.preventDefault();let t=a?.view;t&&(0,P.exitSuggestion)(t,yr)}})}let c=null,l=null;function u(){if(!e||!c)return;let t=c();t&&(e.style.top=`${t.bottom+4}px`,e.style.left=`${t.left}px`)}return{onStart:i=>{if(n=0,c=i.clientRect||null,a={view:i.editor.view},e||(e=document.createElement(`div`),e.style.position=`fixed`,e.style.zIndex=`9999`,document.body.appendChild(e)),t||(t=document.createElement(`div`),t.className=`slash-command-popup`,t.style.cssText=`background:#fff;border:1px solid #e4e4e7;border-radius:12px;box-shadow:0 4px 24px rgba(0,0,0,0.12);min-width:260px;max-width:340px;`,t.setAttribute(`data-lenis-prevent`,``),e.appendChild(t)),u(),r=i.items,s(i.items,i.command),e.style.display=`block`,l=()=>u(),window.addEventListener(`scroll`,l,!0),!o){let t=!1;o=n=>{if(!e||e.style.display===`none`||n.target instanceof Node&&e.contains(n.target)||t)return;let r=a?.view;r&&(t=!0,window.setTimeout(()=>{t=!1,e?.style.display!==`none`&&(0,P.exitSuggestion)(r,yr)},0))},document.addEventListener(`mousedown`,o,!0),document.addEventListener(`touchstart`,o,!0)}},onUpdate:e=>{n=0,c=e.clientRect||null,a={view:e.editor.view},r=e.items,s(e.items,e.command),u()},onKeyDown:e=>{if(e.event.key===`ArrowDown`)return e.event.preventDefault(),n=Math.min(n+1,r.length-1),i&&s(r,i),!0;if(e.event.key===`ArrowUp`)return e.event.preventDefault(),n=Math.max(n-1,0),i&&s(r,i),!0;if(e.event.key===`Enter`){e.event.preventDefault();let t=r[n];return t&&typeof t.command==`function`&&i&&i(t),!0}return e.event.key===`Escape`},onExit:()=>{e&&(e.style.display=`none`),n=0,r=[],i=null,c=null,a=null,l&&=(window.removeEventListener(`scroll`,l,!0),null),o&&=(document.removeEventListener(`mousedown`,o,!0),document.removeEventListener(`touchstart`,o,!0),null)}}}};return[(0,P.default)({editor:this.editor,...t}),new f.Plugin({key:new f.PluginKey(`slashCodeBlockGuard`),appendTransaction:(e,t,n)=>{let{$from:r}=n.selection,i=!1;for(let e=r.depth;e>=0;e--)if(r.node(e).type.name===`codeBlock`){i=!0;break}if(!i&&!r.marks().some(e=>e.type.name===`code`))return null;let a=yr.getState(n);return a&&a.active?n.tr.setMeta(yr,{exit:!0}):null}})]}})}function xr(e,t){return[{title:e(`editor.slash.heading1`),description:e(`editor.slash.heading1Desc`),icon:`H1`,command:({editor:e})=>e.chain().focus().toggleHeading({level:1}).run()},{title:e(`editor.slash.heading2`),description:e(`editor.slash.heading2Desc`),icon:`H2`,command:({editor:e})=>e.chain().focus().toggleHeading({level:2}).run()},{title:e(`editor.slash.heading3`),description:e(`editor.slash.heading3Desc`),icon:`H3`,command:({editor:e})=>e.chain().focus().toggleHeading({level:3}).run()},{title:e(`editor.slash.heading4`),description:e(`editor.slash.heading4Desc`),icon:`H4`,command:({editor:e})=>e.chain().focus().toggleHeading({level:4}).run()},{title:e(`editor.slash.heading5`),description:e(`editor.slash.heading5Desc`),icon:`H5`,command:({editor:e})=>e.chain().focus().toggleHeading({level:5}).run()},{title:e(`editor.slash.heading6`),description:e(`editor.slash.heading6Desc`),icon:`H6`,command:({editor:e})=>e.chain().focus().toggleHeading({level:6}).run()},{title:e(`editor.slash.bulletList`),description:e(`editor.slash.bulletListDesc`),icon:`•`,command:({editor:e})=>e.chain().focus().toggleBulletList().run()},{title:e(`editor.slash.numberedList`),description:e(`editor.slash.numberedListDesc`),icon:`1.`,command:({editor:e})=>e.chain().focus().toggleOrderedList().run()},{title:e(`editor.slash.taskList`),description:e(`editor.slash.taskListDesc`),icon:`☑`,command:({editor:e})=>e.chain().focus().toggleTaskList().run()},{title:e(`editor.slash.blockquote`),description:e(`editor.slash.blockquoteDesc`),icon:`❝`,command:({editor:e})=>e.chain().focus().toggleBlockquote().run()},{title:e(`editor.slash.codeBlock`),description:e(`editor.slash.codeBlockDesc`),icon:`</>`,command:({editor:e})=>e.chain().focus().toggleCodeBlock().run()},{title:e(`editor.slash.horizontalRule`),description:e(`editor.slash.horizontalRuleDesc`),icon:`—`,command:({editor:e})=>e.chain().focus().setHorizontalRule().run()},{title:e(`editor.slash.image`),description:e(`editor.slash.imageDesc`),icon:`🖼`,command:({editor:e})=>{e.storage.qingwuUI?.openImageDialog?.()}},{title:e(`editor.slash.video`),description:e(`editor.slash.videoDesc`),icon:`🎬`,command:({editor:e})=>{e.storage.qingwuUI?.openVideoDialog?.()}},{title:e(`editor.slash.audio`),description:e(`editor.slash.audioDesc`),icon:`🎵`,command:({editor:e})=>{let n=document.createElement(`input`);n.type=`file`,n.accept=`audio/*`,n.onchange=async()=>{let r=n.files?.[0];if(!r)return;let i=wt(e)??t,a=i?Tt(e.state.doc,r,i):null;if(a){J(a);return}let o=URL.createObjectURL(r),s=e.schema.nodes.audioEmbed?.create({src:o,name:r.name,size:r.size});s&&(e.chain().focus().insertContent(s).run(),await Un(e.view,r,o))},n.click()}},{title:e(`editor.slash.attachment`),description:e(`editor.slash.attachmentDesc`),icon:`📎`,command:({editor:e})=>{let n=document.createElement(`input`);n.type=`file`,n.accept=`*/*`,n.multiple=!0,n.onchange=async()=>{let r=n.files;if(!(!r||r.length===0))for(let n of Array.from(r)){let r=wt(e)??t,i=r?Tt(e.state.doc,n,r):null;if(i){J(i);continue}let a=URL.createObjectURL(n),o=e.schema.nodes.attachmentEmbed;if(o){try{e.chain().focus().insertContent(o.create({src:a,name:n.name,size:n.size,type:n.type})).run()}catch{continue}await Un(e.view,n,a)}}},n.click()}}]}var Sr=m.Image.extend({addNodeView(){return(0,c.ReactNodeViewRenderer)(It)},addAttributes(){return{...this.parent?.(),width:{default:null,parseHTML:e=>e.getAttribute(`width`)||null,renderHTML:e=>e.width?{width:e.width}:{}},height:{default:null,parseHTML:e=>e.getAttribute(`height`)||null,renderHTML:e=>e.height?{height:e.height}:{}},size:{default:0,parseHTML:e=>Number(e.getAttribute(`data-size`)||0),renderHTML:e=>e.size?{"data-size":e.size}:{}}}}});function Cr(t={}){return[_.default.configure({codeBlock:!1,horizontalRule:!1,underline:!1,link:!1}),g.Underline,h.Link.configure({openOnClick:!0,HTMLAttributes:{rel:`noopener noreferrer`,target:`_blank`}}),Sr.configure({inline:!1,allowBase64:!0}),O.TaskList,D.TaskItem.configure({nested:!0}),b.Highlight.configure({multicolor:!0}),k.TextStyle,y.Color,v.CharacterCount.configure(t.maxLength?{limit:t.maxLength}:{}),x.HorizontalRule,xn,C.Table.configure({resizable:!0}),E.TableRow,w.TableCell,T.TableHeader,A.Markdown.configure({html:!0,transformPastedText:!0,transformCopiedText:!1}),S.Placeholder.configure({placeholder:t.placeholder||`输入 '/' 打开菜单…`}),br(()=>xr(t=>e.o(t),{maxAttachmentSize:t.maxAttachmentSize,maxTotalAttachmentSize:t.maxTotalAttachmentSize})),Gn.configure({maxAttachmentSize:t.maxAttachmentSize,maxTotalAttachmentSize:t.maxTotalAttachmentSize}),vr,er,He,qn,tr,cn,en,Zt]}var wr=`https://www.bing.com/search?q={query}`;function Tr(e){wr=e}function Er(){return wr}function Dr(e){return[{key:`bold`,label:e(`editor.bubble.bold`),icon:(0,a.jsx)(Ge,{}),isActive:e=>e.isActive(`bold`),command:e=>e.isEditable&&e.chain().focus().toggleBold().run()},{key:`italic`,label:e(`editor.bubble.italic`),icon:(0,a.jsx)(Ke,{}),isActive:e=>e.isActive(`italic`),command:e=>e.isEditable&&e.chain().focus().toggleItalic().run()},{key:`underline`,label:e(`editor.bubble.underline`),icon:(0,a.jsx)(qe,{}),isActive:e=>e.isActive(`underline`),command:e=>e.isEditable&&e.chain().focus().toggleUnderline().run()},{key:`strikethrough`,label:e(`editor.bubble.strikethrough`),icon:(0,a.jsx)(Je,{}),isActive:e=>e.isActive(`strike`),command:e=>e.isEditable&&e.chain().focus().toggleStrike().run()},{key:`code`,label:e(`editor.bubble.emphasis`),icon:(0,a.jsx)(Ye,{}),isActive:e=>e.isActive(`code`),command:e=>e.isEditable&&e.chain().focus().toggleCode().run()},{key:`highlight`,label:e(`editor.bubble.highlight`),icon:(0,a.jsx)(Xe,{}),more:!0,isActive:e=>e.isActive(`highlight`),command:()=>{}},{key:`link`,label:e(`editor.bubble.link`),icon:(0,a.jsx)(Ze,{}),more:!0,isActive:e=>e.isActive(`link`),command:()=>{}},{key:`copy`,label:e(`editor.bubble.copy`),icon:(0,a.jsx)($e,{}),more:!0,isActive:()=>!1,command:e=>{let{from:t,to:n}=e.state.selection,r=e.state.doc.textBetween(t,n,`
|
|
9
9
|
`).trim();r&&navigator.clipboard?.writeText(r).catch(()=>{})}},{key:`search`,label:e(`editor.bubble.search`),icon:(0,a.jsx)(et,{}),more:!0,isActive:()=>!1,command:e=>{if(e.isActive(`table`))return;let{from:t,to:n}=e.state.selection,r=e.state.doc.textBetween(t,n,` `).trim();if(!r)return;let i=wr.replace(`{query}`,encodeURIComponent(r));window.open(i,`_blank`,`noopener,noreferrer`)}},{key:`table`,label:e(`editor.bubble.table`),icon:(0,a.jsx)(Qe,{}),more:!0,isActive:e=>e.isActive(`table`),command:e=>{if(!e.isEditable||e.isActive(`table`))return;let{from:t,to:n,$to:r}=e.state.selection,i=e.chain().focus();t!==n&&i.setTextSelection(r.end(r.depth)),i.insertTable({rows:3,cols:3,withHeaderRow:!0}).scrollIntoView().run()}},{key:`ai`,label:e(`editor.ai.trigger`),icon:(0,a.jsx)(tt,{}),isActive:()=>!1,command:e=>{e.isEditable&&e.storage.qingwuUI?.openAI?.()}}]}d.Extension.create({name:`bubbleMenu`});function Or(e){let{$from:t}=e.state.selection;for(let e=t.depth;e>0;e--){let n=t.node(e);if(n.type.name===`table`)return{node:n,pos:t.before(e)}}return null}function kr(e){let t=[];return e.forEach(e=>{let n=[];e.forEach(e=>{n.push(e.textContent.replace(/\n/g,` `).trim())}),t.push(n)}),t}function Ar(e){if(e.length===0)return``;let t=Math.max(...e.map(e=>e.length),1),n=e=>e.concat(Array(Math.max(0,t-e.length)).fill(``)).slice(0,t),r=n(e[0]),i=e.slice(1).map(n),a=e=>`| ${e.join(` | `)} |`;return[a(r),a(Array(t).fill(`---`)),...i.map(a)].join(`
|
|
10
10
|
`)}function jr(e){let t=e=>/[",\n]/.test(e)?`"${e.replace(/"/g,`""`)}"`:e;return e.map(e=>e.map(t).join(`,`)).join(`
|
|
11
|
-
`)}function Mr(e){let t=e.trim();if(!t)return null;let n=t.split(/\r?\n/);if(n.length>=2&&n.every(e=>e.includes(`|`))){let e=n.filter(e=>!/^\s*\|?[\s:|-]+\|?\s*$/.test(e)).map(e=>e.replace(/^\s*\|/,``).replace(/\|\s*$/,``).split(`|`).map(e=>e.trim()));if(e.length>0&&e[0].length>1)return e}if(n.length>=1){let e=n[0].includes(` `)?` `:`,`,t=n.map(t=>t.split(e).map(e=>e.trim()));if(t.length>0&&t[0].length>1)return t}return null}function Nr({editor:e}){let[t,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(!1),[s,c]=(0,i.useState)(!1),l=(0,i.useRef)(null),u=(0,i.useRef)(null),d=e.isEditable,f=(0,i.useCallback)(()=>{u.current!=null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let n=l.current;if(n==null||t==null)return;let r=e.view.nodeDOM(t);if(!(r instanceof HTMLElement))return;let i=r.getBoundingClientRect(),a=i.top>40?i.top-34:Math.min(i.bottom+4,window.innerHeight-40);n.style.top=`${a}px`,n.style.left=`${Math.max(8,Math.min(i.left,window.innerWidth-160))}px`})},[e,t]),p=(0,i.useCallback)(()=>{if(!e.isEditable||!e.isActive(`table`)){n(null);return}let t=Or(e);if(!t){n(null);return}n(e=>e===t.pos?e:t.pos)},[e]);(0,i.useEffect)(()=>(p(),e.on(`selectionUpdate`,p),e.on(`focus`,p),window.addEventListener(`scroll`,f,!0),window.addEventListener(`resize`,f),()=>{e.off(`selectionUpdate`,p),e.off(`focus`,p),window.removeEventListener(`scroll`,f,!0),window.removeEventListener(`resize`,f),u.current!=null&&cancelAnimationFrame(u.current)}),[e,p,f]),(0,i.useEffect)(()=>{f()},[t,f]);let m=t=>{let{schema:n}=e.state;if(!n.nodes.table||!n.nodes.tableRow||!n.nodes.tableCell||!n.nodes.tableHeader)return null;let r=Math.max(...t.map(e=>e.length)),i=t.map((e,t)=>{let i=[];for(let a=0;a<r;a++){let r=e[a]??``,o=t===0?n.nodes.tableHeader:n.nodes.tableCell,s=r?n.text(r):null;i.push(o.create(null,s?[s]:[]))}return n.nodes.tableRow.create(null,i)});return n.nodes.table.create(null,i)},h=()=>{let t=Or(e);if(!t)return;let n=Ar(kr(t.node));navigator.clipboard?.writeText(n),o(!0),setTimeout(()=>o(!1),1500)},g=()=>{let t=Or(e);if(!t)return;let n=jr(kr(t.node)),r=new Blob([`\ufeff${n}`],{type:`text/csv;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`table.csv`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},_=async()=>{if(d)try{let t=await navigator.clipboard?.readText();if(!t)return;let n=Mr(t);if(!n||n.length===0)return;let r=m(n);if(!r)return;let i=Or(e),a=e.chain().focus();if(i){let t=Math.min(i.pos+i.node.nodeSize,e.state.doc.content.size);a.setTextSelection(t)}a.insertContent(r).run()}catch{}},v=()=>{d&&t!=null&&(e.chain().focus().setNodeSelection(t).run(),e.storage.qingwuUI?.openAI?.())},y=()=>{d&&e.chain().focus().deleteTable().run()};return!d||t==null?null:(0,a.jsxs)(`div`,{ref:l,style:{position:`fixed`,top:0,left:0,zIndex:1e5},className:`tbl-toolbar`,contentEditable:!1,children:[(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:h,title:`复制`,children:r?(0,a.jsx)(`svg`,{className:`tbl-btn-icon tbl-btn-icon--check`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}):(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-2M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:g,title:`下载`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:_,title:`粘贴`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn tbl-btn--ai`,onClick:v,title:`AI 助手`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn tbl-btn--del`,onClick:()=>{!d||kt()||($(!0),c(!0))},title:`删除`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})}),(0,a.jsx)(Pt,{open:s,title:`确认删除表格`,message:`此操作不可撤销。`,onCancel:()=>{$(!1),c(!1)},onConfirm:async()=>{await new Promise(e=>setTimeout(e,300)),$(!1),y()}})]})}var Pr=[{color:`#fef08a`,name:`黄`},{color:`#bbf7d0`,name:`绿`},{color:`#bfdbfe`,name:`蓝`},{color:`#fbcfe8`,name:`粉`},{color:`#fed7aa`,name:`橙`},{color:`#ddd6fe`,name:`紫`}],Fr=288,Ir=480,Lr=320;function Rr(e,t,n={}){let r=window.innerWidth,i=window.innerHeight,a=Math.min(n.panelWidth||Fr,Ir,r-32),o=Math.max(t||Lr,160);if(r<640){let t=Math.max(8,Math.min(e.top+10,i-420));return{style:{position:`fixed`,top:t,left:8,right:8,width:`auto`,zIndex:9999,maxHeight:`calc(100dvh - ${t}px - 16px)`,overflow:`hidden`,display:`flex`,flexDirection:`column`},placement:`below`,arrowLeft:50}}let s=e.left+e.width/2,c=typeof n.editorLeft==`number`?n.editorLeft:s-a/2;c=Math.max(16,Math.min(c,r-a-16));let l=i-e.top-16,u=e.top-16,d=l<o+12&&u>=o+12?`above`:`below`,f=d===`below`?e.top+10:e.top-o-10;f=Math.max(16,Math.min(f,i-o-16));let p=Math.max(14,Math.min((s-c)/a*100,86)),m=d===`above`?`${Math.max(e.top-10-f,160)}px`:`calc(100dvh - ${f}px - 16px)`;return{style:{position:`fixed`,top:f,left:c,width:a,zIndex:9999,maxHeight:m,overflow:`hidden`,display:`flex`,flexDirection:`column`},placement:d,arrowLeft:p}}function zr(e){return/(^|\n)```|(^|\n)#{1,6}\s|(^|\n)>\s?|(^|\n)\s*([-*_])(?:\s*\4){2,}\s*(?=\n|$)|(^|\n)\s*[-*+]\s+|(^|\n)\s*\d+[.)]\s+|(^|\n)\s*<img\s+|(^|\n)\s*\|.+\|/i.test(e)}function Br(e,t){try{let n=e.storage?.markdown?.parser;if(!n)return null;let r=n.parse(t),i=document.createElement(`div`);return i.innerHTML=r,s.DOMParser.fromSchema(e.schema).parse(i).content}catch{return null}}var Vr=(0,i.lazy)(()=>Promise.resolve().then(()=>ve).then(e=>({default:e.ImageUploadDialog}))),Hr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./storage-settings-dialog-ZtMUoApJ.cjs")).then(e=>({default:e.StorageSettingsDialog}))),Ur=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./export-dialog-BSEeEEHv.cjs")).then(e=>({default:e.ExportDialog}))),Wr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./video-embed-dialog-BbVHq51W.cjs")).then(e=>({default:e.VideoEmbedDialog}))),Gr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./md-import-dialog-CnstzrIK.cjs")).then(e=>({default:e.MdImportDialog}))),Kr=()=>(0,a.jsxs)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center`,children:[(0,a.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm`}),(0,a.jsx)(`div`,{className:`relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center`,children:(0,a.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin`})})]}),qr=({initialContent:t=``,onChange:n,placeholder:r,mode:o,readonly:d=!1,maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m,className:h=``,borderless:g=!1,style:_,showToolbar:v=!0,showToc:y=!0,showSearch:b=!0,onEditorReady:x,immediatelyRender:S,onToast:C})=>{let w=o===`view`||d,T=(0,i.useMemo)(()=>typeof t==`object`&&t||zr(t)?t:e.n(t),[t]),[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)({}),[A,j]=(0,i.useState)(`below`),[M,N]=(0,i.useState)(50),P=(0,i.useRef)(null),[F,ee]=(0,i.useState)(!1),[I,L]=(0,i.useState)(!1),[te,R]=(0,i.useState)(!1),[ne,re]=(0,i.useState)(!1),[z,B]=(0,i.useState)(`none`),[V,ie]=(0,i.useState)({}),[ae,oe]=(0,i.useState)(``),[H,se]=(0,i.useState)(null),[U,ce]=(0,i.useState)(y),[W,G]=(0,i.useState)(!1);(0,i.useEffect)(()=>{ce(y)},[y]);let[le,ue]=(0,i.useState)(!1),[de,fe]=(0,i.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 80rem)`).matches:!0),[pe,K]=(0,i.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 64rem)`).matches:!0),me=(0,i.useRef)(null),q=(0,i.useRef)(null),he=(0,i.useRef)(null),ge=(0,i.useRef)(0),ve=(0,i.useRef)(null),ye=(0,i.useRef)(null),be=(0,i.useRef)(null),xe=(0,i.useRef)(null),[Se,Ce]=(0,i.useState)(!1),[Y,Te]=(0,i.useState)(!1),[Ee,De]=(0,i.useState)(!1),ke=(0,i.useRef)(null),Ae=(0,i.useCallback)(()=>{let e=q.current,t=he.current;e&&(Y?(document.body.style.overflow=``,Object.assign(e.style,{position:``,top:``,left:``,width:``,height:``,zIndex:``,background:``,borderRadius:``,overflow:``,display:``,flexDirection:``}),t&&Object.assign(t.style,{flex:``,overflow:``,minHeight:``}),Te(!1),requestAnimationFrame(()=>{window.scrollTo(0,ge.current)})):(document.fullscreenElement&&document.exitFullscreen(),ge.current=window.scrollY,Object.assign(e.style,{position:`fixed`,top:`0`,left:`0`,width:`100vw`,height:`100vh`,zIndex:`99999`,background:`var(--background, #fff)`,borderRadius:`0`,overflow:`hidden`,display:`flex`,flexDirection:`column`}),t&&Object.assign(t.style,{flex:`1`,overflow:`auto`,minHeight:`0`}),document.body.style.overflow=`hidden`,Te(!0)))},[Y]),je=(0,i.useCallback)(()=>{let e=q.current;e&&(document.fullscreenElement?document.exitFullscreen():(Y&&Ae(),ge.current=window.scrollY,e.requestFullscreen()))},[Y,Ae]);(0,i.useEffect)(()=>{let e=e=>{e.key===`Escape`&&Y&&Ae()},t=()=>{document.fullscreenElement?De(!0):(De(!1),requestAnimationFrame(()=>{window.scrollTo(0,ge.current)}))};return window.addEventListener(`keydown`,e),document.addEventListener(`fullscreenchange`,t),()=>{window.removeEventListener(`keydown`,e),document.removeEventListener(`fullscreenchange`,t)}},[Y,Ae]),(0,i.useEffect)(()=>{if(!b)return;let e=e=>{if((e.ctrlKey||e.metaKey)&&(e.key===`f`||e.key===`F`)){if(!q.current)return;e.preventDefault(),e.stopPropagation(),ue(!0)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b]),(0,i.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 80rem)`),t=e=>fe(e.matches);return fe(e.matches),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 64rem)`),t=e=>K(e.matches);return K(e.matches),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let X=(0,c.useEditor)({extensions:Cr({placeholder:r||e.o(`editor.placeholder`),maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m}),content:T,editable:!w,immediatelyRender:S,onUpdate:({editor:e})=>{n&&(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{n?.(e.getHTML(),e.getJSON())},300))},onCreate:()=>{},editorProps:{attributes:{class:`prose prose-neutral dark:prose-invert max-w-none focus:outline-none min-h-[200px] px-4 sm:px-8 py-4`,...w?{}:{style:`padding-left: 2.75rem`}},handlePaste(e,t){let n=t.clipboardData;if(!n)return!1;let r=n.getData(`text/plain`);if(!r||!r.includes(`[[`))return!1;t.preventDefault();let i=ye.current?.storage?.relativeMedia;i&&(i.clipboardFiles=new Map(Array.from(n.files??[]).map(e=>[e.name.toLowerCase(),e])),i.pausedUntilPaste=!1);let a=ye.current?Br(ye.current,r):null;if(a){let t=new s.Slice(a,0,0);e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView())}else e.dispatch(e.state.tr.insertText(r).scrollIntoView());return!0}}});(0,i.useEffect)(()=>{ye.current=X,window.__editor=X},[X]),(0,i.useEffect)(()=>{if(X)return()=>dt(X)},[X]),(0,i.useEffect)(()=>{!X||!x||x(X)},[X,x]),(0,i.useEffect)(()=>{if(!X)return;let e=()=>{X.state.selection.empty&&(B(`none`),Ce(!1))};return X.on(`selectionUpdate`,e),()=>{X.off(`selectionUpdate`,e)}},[X]),(0,i.useEffect)(()=>{X&&X.setOptions({extensions:Cr({placeholder:r||e.o(`editor.placeholder`),maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m})})},[r,f,p,m]);let Me=(0,i.useRef)(t);(0,i.useEffect)(()=>{if(!X||t===Me.current)return;Me.current=t;let n=typeof t==`object`&&t||zr(t)?t:e.n(t);X.commands.setContent(n,{emitUpdate:!1})},[X,t]),(0,i.useEffect)(()=>{X&&X.setEditable(!w,!1)},[X,w]),(0,i.useEffect)(()=>{if(C)return _e(C)},[C]),(0,i.useEffect)(()=>{if(!X)return;let e=St(X.state.doc);e>m&&J(`文档内附件总大小 ${Ct(e)} 已超过限制 ${Ct(m)}`,`info`)},[X,m]),(0,i.useEffect)(()=>{if(!X)return;let e=X.storage.qingwuUI;e&&(e.limits={maxAttachmentSize:p,maxTotalAttachmentSize:m})},[X,p,m]);let Ne=(0,i.useCallback)(e=>{let t=xe.current?.getBoundingClientRect();B(e),Ce(!1),ie({position:`fixed`,top:t?t.bottom+8:void 0,left:t?Math.max(8,Math.min(t.left,window.innerWidth-240)):8,zIndex:9999})},[]),Pe=Dr(t=>e.o(t)),Fe=Pe.filter(e=>!e.more),Ie=Pe.filter(e=>e.more),Le=Fe.filter(e=>e.key!==`ai`),Z=Fe.find(e=>e.key===`ai`),Re=(0,i.useCallback)(e=>{if(X)if(Ce(!1),e.key===`link`)if(X.isActive(`link`))X.chain().focus().unsetLink().run();else{let e=X.getAttributes(`link`).href||``;oe(e),Ne(`link`)}else e.key===`highlight`?z===`highlight`?B(`none`):Ne(`highlight`):e.command(X)},[X,z,Ne]),ze=(0,i.useCallback)(e=>X?e.key===`highlight`?z===`highlight`:e.key===`link`?X.isActive(`link`):e.isActive(X):!1,[X,z]),[Be,Ve]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(!X)return;let e=()=>Ve(e=>(e+1)%1e6);return X.on(`update`,e),()=>{X.off(`update`,e)}},[X]);let[He,Ue]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!X)return;let e=()=>{let e=!1;X.state.doc.descendants(t=>{t.type.name===`heading`&&(e=!0)}),Ue(e)};return e(),X.on(`update`,e),()=>{X.off(`update`,e)}},[X]);let Q=(0,i.useMemo)(()=>X?.storage?.characterCount?.characters?.()??0,[X,Be]),Ge=f?Q>f:!1;(0,i.useEffect)(()=>()=>{me.current&&clearTimeout(me.current)},[]),(0,i.useEffect)(()=>()=>{H&&H.resolve(null)},[]);let Ke=(0,i.useCallback)(e=>{if(!X?.isEditable)return;let t=window.getSelection(),n;if(e){let t=e.getBoundingClientRect();n={top:t.bottom,left:t.left,width:t.width}}else if(t&&t.rangeCount>0&&!t.isCollapsed){let e=t.getRangeAt(0).getBoundingClientRect();n={top:e.bottom,left:e.left,width:e.width}}else{let e=X.view.coordsAtPos(X.state.selection.from);n={top:e.bottom,left:e.left,width:0}}ve.current=n;let r=q.current?.getBoundingClientRect(),i=Rr(n,void 0,{panelWidth:r?.width,editorLeft:r?.left});D(!0),k(i.style),j(i.placement),N(i.arrowLeft)},[X]);(0,i.useEffect)(()=>{if(!X)return;let e=X.storage.qingwuUI;if(e)return e.openImageDialog=()=>ee(!0),e.openVideoDialog=()=>L(!0),e.chooseMd=(e,t)=>{se({filename:e,resolve:t})},e.openAI=Ke,e.parseMd=(e,t)=>X?Br(X,t):null,()=>{delete e.openImageDialog,delete e.openVideoDialog,delete e.openAI,delete e.parseMd,delete e.chooseMd}},[X,Ke]),(0,i.useLayoutEffect)(()=>{if(!E||!X)return;let e=ve.current;if(!e)return;let t=P.current,n=q.current?.getBoundingClientRect(),r=Rr(e,t?.offsetHeight||void 0,{panelWidth:n?.width,editorLeft:n?.left});j(r.placement),N(r.arrowLeft),k(r.style)},[E,X]),(0,i.useEffect)(()=>{if(!E||!X)return;let e=()=>{let e=ve.current;if(!e)return;let t=P.current,n=q.current?.getBoundingClientRect(),r=Rr(e,t?.offsetHeight||void 0,{panelWidth:n?.width,editorLeft:n?.left});j(r.placement),N(r.arrowLeft),k(r.style)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[E,X]),(0,i.useEffect)(()=>{E||(ve.current=null)},[E]);let qe=(0,i.useCallback)(e=>{X?.chain().focus().setImage({src:e}).run()},[X]),Je=(0,i.useCallback)(e=>{(X?.commands).insertVideo?.({src:e})},[X]),Ye=U&&de&&!Y&&!Ee,Xe=!Ye&&!W&&(U||He&&!(!w&&pe)),Ze=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{Ze.current||(Ze.current=!0,U&&!Ye&&G(!0))},[U,Ye]),(0,i.useEffect)(()=>{if(!W)return;let e=e=>{let t=e.target;ke.current?.contains(t)||G(!1)},t=e=>{e.key===`Escape`&&G(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[W]),(0,i.useEffect)(()=>{if(!X||!Ye)return;let e=be.current;if(!(e instanceof HTMLElement))return;let t=t=>{let n=t.deltaY;if(n===0)return;let r=e.scrollTop<=0,i=!(e.scrollTop+e.clientHeight>=e.scrollHeight-1);if(n>0&&i||n<0&&!r){e.scrollTop+=n,t.preventDefault(),t.stopPropagation();return}let a=we(X.view.dom);if(a){a.scrollTop+=n,t.preventDefault(),t.stopPropagation();return}};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[X,Ye]),X?(0,a.jsxs)(`div`,{className:`qingwu-editor-row`,children:[(0,a.jsxs)(`div`,{ref:q,className:`qingwu-editor relative flex-1 min-w-0 bg-background ${w?`qingwu-editor--readonly`:``} ${g?``:`rounded-xl border border-default-200`} ${h}`,style:_,children:[v&&(0,a.jsxs)(`div`,{className:`qed-toolbar`,children:[(0,a.jsxs)(`div`,{className:`qed-toolbar__group`,children:[(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--desktop-only${U?` is-active`:``}`,onClick:()=>{U?(ce(!1),G(!1)):(ce(!0),de&&!Y&&!Ee||G(!0))},title:U?`隐藏目录`:`显示目录`,"aria-label":U?`隐藏目录`:`显示目录`,"aria-pressed":U,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 6h16M4 12h10M4 18h7`})})}),b&&(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${le?` is-active`:``}`,onClick:()=>ue(!le),title:`查找 (Ctrl+F)`,"aria-label":`查找`,"aria-pressed":le,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})}),!w&&(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--ai${E?` is-active`:``}`,onClick:e=>E?D(!1):Ke(e.currentTarget),title:e.o(`editor.toolbar.aiTitle`),"aria-label":e.o(`editor.toolbar.ai`),"aria-pressed":E,children:(0,a.jsxs)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3z`}),(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18.5 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7.7-1.9z`})]})})]}),(0,a.jsxs)(`div`,{className:`qed-toolbar__group`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--solid`,onClick:()=>re(!0),title:e.o(`editor.toolbar.exportTitle`),children:[(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})}),(0,a.jsx)(`span`,{className:`qed-tb-btn__label`,children:e.o(`editor.toolbar.export`)})]}),(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${Y?` is-active`:``}`,onClick:Ae,title:Y?`退出网页全屏`:`网页全屏`,"aria-label":Y?`退出网页全屏`:`网页全屏`,"aria-pressed":Y,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3`})})}),(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${Ee?` is-active`:``}`,onClick:je,title:Ee?`退出全屏`:`全屏`,"aria-label":Ee?`退出全屏`:`全屏`,"aria-pressed":Ee,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7`})})})]})]}),X&&!w&&X.isEditable&&(0,a.jsx)(l.BubbleMenu,{editor:X,shouldShow:({editor:e,state:t})=>!(e.isActive(`image`)||e.isActive(`videoEmbed`)||e.isActive(`codeBlock`)||e.isActive(`audioEmbed`)||e.isActive(`attachmentEmbed`)||t.selection.empty),options:{placement:`bottom`,offset:8,flip:!0},className:`bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg`,children:(0,a.jsxs)(`div`,{ref:xe,className:`bubble-menu-items relative flex items-center gap-0.5`,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:[Le.map(e=>(0,a.jsx)(`button`,{type:`button`,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(X)?`bg-primary/10 text-primary`:`text-default-600 hover:bg-default-100`}`,onClick:t=>{t.preventDefault(),Re(e)},title:e.label,"aria-label":e.label,children:e.icon},e.key)),(0,a.jsx)(`span`,{className:`w-px h-4 bg-default-200 mx-0.5 shrink-0`,"aria-hidden":`true`}),(0,a.jsx)(`button`,{type:`button`,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${E?`bg-primary/15 text-primary`:`text-primary hover:bg-primary/10`}`,onClick:e=>{e.preventDefault(),Ce(!1),Z?.command(X)},title:Z?.label,"aria-label":Z?.label,children:(0,a.jsx)(tt,{})}),(0,a.jsx)(`span`,{className:`w-px h-4 bg-default-200 mx-0.5 shrink-0`,"aria-hidden":`true`}),(0,a.jsx)(`button`,{type:`button`,"aria-expanded":Se,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${Se?`bg-default-100 text-default-900`:`text-default-600 hover:bg-default-100`}`,onClick:e=>{e.preventDefault(),Ce(e=>!e)},title:e.o(`editor.bubble.more`),"aria-label":e.o(`editor.bubble.more`),children:(0,a.jsx)(nt,{})}),Se&&(0,a.jsx)(`div`,{role:`menu`,className:`bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70vh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl`,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:Ie.map(e=>(0,a.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${ze(e)?`bg-primary/10 text-primary`:`text-default-600 hover:bg-default-100`}`,onClick:t=>{t.preventDefault(),Re(e)},title:e.label,children:[(0,a.jsx)(`span`,{className:`w-4 h-4 flex items-center justify-center shrink-0`,children:e.icon}),(0,a.jsx)(`span`,{className:`tracking-wide`,children:e.label})]},e.key))})]})}),X&&z!==`none`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`fixed inset-0 z-[9998]`,onClick:()=>B(`none`)}),(0,a.jsx)(`div`,{style:V,className:`bg-background border border-default-200 rounded-xl shadow-xl`,onClick:e=>e.stopPropagation(),children:z===`highlight`?(0,a.jsxs)(`div`,{className:`flex items-center gap-1 p-1.5 flex-wrap`,children:[Pr.map(e=>(0,a.jsx)(`button`,{type:`button`,className:`w-5 h-5 rounded-full border border-default-200 hover:scale-110 transition-transform`,style:{background:e.color},title:e.name,onClick:()=>{X.chain().focus().setHighlight({color:e.color}).run(),B(`none`)}},e.color)),(0,a.jsxs)(`button`,{type:`button`,className:`w-5 h-5 rounded-full border border-default-200 text-default-500 hover:bg-default-100 flex items-center justify-center text-[10px]`,title:`清除高亮`,onClick:()=>{X.chain().focus().unsetHighlight().run(),B(`none`)},children:[`✕`,` `]})]}):(0,a.jsxs)(`div`,{className:`flex items-center gap-1.5 p-1.5`,children:[(0,a.jsx)(`input`,{type:`url`,className:`flex-1 px-2 py-1 text-xs rounded-md border border-default-200 bg-background focus:outline-none focus:border-primary`,placeholder:`https://...`,value:ae,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key===`Enter`?(ae.trim()&&X.chain().focus().setLink({href:ae.trim()}).run(),B(`none`)):e.key===`Escape`&&B(`none`)}}),(0,a.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90`,onClick:()=>{ae.trim()&&X.chain().focus().setLink({href:ae.trim()}).run(),B(`none`)},children:`确定`})]})})]}),!w&&E&&(0,u.createPortal)((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`fixed inset-0 z-[9998]`,onClick:()=>D(!1)}),(0,a.jsxs)(`div`,{ref:P,"data-lenis-prevent":!0,style:O,className:`ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${A===`above`?` ai-panel--above`:``}`,onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(`span`,{className:`ai-panel__arrow`,style:{left:`${M}%`},"aria-hidden":`true`}),(0,a.jsx)(bt,{editor:X,onClose:()=>D(!1)})]})]}),document.body),F&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Vr,{open:F,onClose:()=>ee(!1),onInsert:qe,validate:e=>X?Tt(X.state.doc,e,{maxAttachmentSize:p,maxTotalAttachmentSize:m}):null})}),I&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Wr,{open:I,onClose:()=>L(!1),onInsert:Je})}),te&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Hr,{open:te,onClose:()=>R(!1)})}),ne&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Ur,{open:ne,onClose:()=>re(!1),editor:X})}),H&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Gr,{open:!!H,filename:H.filename,onRender:()=>{H.resolve(`render`),se(null)},onAttach:()=>{H.resolve(`attach`),se(null)},onClose:()=>{H.resolve(null),se(null)}})}),(0,a.jsx)(`div`,{ref:he,className:`flex editor-body`,children:(0,a.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,a.jsx)(c.EditorContent,{editor:X}),!w&&(0,a.jsx)(Nr,{editor:X}),(0,a.jsx)(`div`,{className:`${Y||Ee?`fixed`:`absolute`} bottom-2 right-4 z-10 pointer-events-none select-none`,children:(0,a.jsxs)(`span`,{className:`text-xs ${Ge?`bg-danger/10 text-danger font-medium px-2 py-0.5 rounded`:f&&Q>f*.9?`bg-warning/10 text-warning px-2 py-0.5 rounded`:`text-default-300`}`,children:[Q,f?` / ${f}`:``,` 字`]})})]})}),b&&le&&(0,a.jsx)(We,{editor:X,onClose:()=>ue(!1)}),Xe&&(0,a.jsx)(`button`,{type:`button`,className:`qingwu-toc-fab`,onClick:()=>G(!0),title:`目录`,"aria-label":`打开目录`,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 6h16M4 12h10M4 18h7`})})}),W&&(0,u.createPortal)((0,a.jsxs)(`div`,{ref:ke,className:`qingwu-toc-drawer toc-scroll`,"data-lenis-prevent":!0,children:[(0,a.jsxs)(`div`,{className:`qed-drawer-head`,children:[(0,a.jsx)(`span`,{className:`qed-drawer-head__title`,children:`目录`}),(0,a.jsx)(`button`,{type:`button`,className:`qed-drawer-head__close`,onClick:()=>G(!1),"aria-label":`关闭目录`,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})})]}),(0,a.jsx)(Oe,{editor:X,className:`!p-3`,onClose:()=>{G(!1),ce(!1)}})]}),document.body)]}),Ye&&(0,a.jsx)(`aside`,{ref:be,className:`qingwu-toc-desktop toc-scroll`,children:(0,a.jsx)(Oe,{editor:X,onClose:()=>ce(!1)})})]}):(0,a.jsx)(`div`,{className:`flex items-center justify-center h-32 text-default-400`,children:e.o(`editor.loading`)})};function Jr(e){let t=async t=>{let n=t.data;if(!n||typeof n!=`object`||n.kind!==`qingwu-clip`)return;let r=t.origin;if(r&&r!==`null`&&r!==window.location.origin)return;let i=n.clip;if(i?.markdown)try{await e.onClip(i,t)}catch(e){console.warn(`[qingwu-clipper] 处理剪藏失败:`,e)}};return window.addEventListener(`message`,t),{close:()=>window.removeEventListener(`message`,t)}}function Yr(e){return r.n({endpoint:`https://cos.${e.region}.myqcloud.com`,bucket:e.bucket,region:e.region,accessKeyId:e.secretId,secretAccessKey:e.secretKey,customDomain:e.customDomain,uploadPrefix:e.uploadPrefix,nameTemplate:e.nameTemplate})}function Xr(e){return r.n({endpoint:`https://${e.bucket}.${e.region}.aliyuncs.com`,bucket:e.bucket,region:e.region,accessKeyId:e.accessKeyId,secretAccessKey:e.accessKeySecret,customDomain:e.customDomain,uploadPrefix:e.uploadPrefix,nameTemplate:e.nameTemplate})}exports.CODE_LANGUAGES=hn,exports.CodeBlock=xn,exports.ImageUpload=Gn,exports.ImageUploadDialog=ye,exports.QingWuAIEditor=qr,exports.RelativeMedia=vr,exports.SearchHighlight=He,exports.TocPanel=Oe,exports.VideoEmbed=cn,exports.buildSystemPrompt=ke,exports.createAILanguageModelProvider=je,exports.createCOSStorage=Yr,exports.createDeepSeekProvider=Pe,exports.createLocalStorage=r.t,exports.createOSSStorage=Xr,exports.createOpenAICompatProvider=Ne,exports.createOpenAIProvider=Fe,exports.createQwenProvider=Ie,exports.createS3Storage=r.n,exports.createSlashCommandExtension=br,exports.escapeHtml=e.t,exports.formatBytes=Ct,exports.getAIProvider=Me,exports.getBubbleMenuActions=Dr,exports.getDefaultSlashCommands=xr,exports.getDocAttachmentTotal=St,exports.getEditorExtensions=Cr,exports.getLocale=e.i,exports.getSearchEngine=Er,exports.getSearchState=Ue,exports.getStorageInfo=n.t,exports.getStorageProvider=n.n,exports.loadStorageConfig=n.r,exports.registerS3PreviewConfig=t.t,exports.sanitizeHtml=e.n,exports.sanitizeSvg=e.r,exports.setAIProvider=X,exports.setConfirmProvider=jt,exports.setLocale=e.a,exports.setSearchEngine=Tr,exports.setStorageProvider=n.a,exports.setToastProvider=ge,exports.signPreviewUrlHeaders=t.r,exports.startBrowserClipperReceiver=Jr,exports.subscribeToast=_e,exports.t=e.o,exports.tf=e.s,exports.toast=J,exports.validateAttachmentFile=Tt;
|
|
11
|
+
`)}function Mr(e){let t=e.trim();if(!t)return null;let n=t.split(/\r?\n/);if(n.length>=2&&n.every(e=>e.includes(`|`))){let e=n.filter(e=>!/^\s*\|?[\s:|-]+\|?\s*$/.test(e)).map(e=>e.replace(/^\s*\|/,``).replace(/\|\s*$/,``).split(`|`).map(e=>e.trim()));if(e.length>0&&e[0].length>1)return e}if(n.length>=1){let e=n[0].includes(` `)?` `:`,`,t=n.map(t=>t.split(e).map(e=>e.trim()));if(t.length>0&&t[0].length>1)return t}return null}function Nr({editor:e}){let[t,n]=(0,i.useState)(null),[r,o]=(0,i.useState)(!1),[s,c]=(0,i.useState)(!1),l=(0,i.useRef)(null),u=(0,i.useRef)(null),d=e.isEditable,f=(0,i.useCallback)(()=>{u.current!=null&&cancelAnimationFrame(u.current),u.current=requestAnimationFrame(()=>{u.current=null;let n=l.current;if(n==null||t==null)return;let r=e.view.nodeDOM(t);if(!(r instanceof HTMLElement))return;let i=r.getBoundingClientRect(),a=i.top>40?i.top-34:Math.min(i.bottom+4,window.innerHeight-40);n.style.top=`${a}px`,n.style.left=`${Math.max(8,Math.min(i.left,window.innerWidth-160))}px`})},[e,t]),p=(0,i.useCallback)(()=>{if(!e.isEditable||!e.isActive(`table`)){n(null);return}let t=Or(e);if(!t){n(null);return}n(e=>e===t.pos?e:t.pos)},[e]);(0,i.useEffect)(()=>(p(),e.on(`selectionUpdate`,p),e.on(`focus`,p),window.addEventListener(`scroll`,f,!0),window.addEventListener(`resize`,f),()=>{e.off(`selectionUpdate`,p),e.off(`focus`,p),window.removeEventListener(`scroll`,f,!0),window.removeEventListener(`resize`,f),u.current!=null&&cancelAnimationFrame(u.current)}),[e,p,f]),(0,i.useEffect)(()=>{f()},[t,f]);let m=t=>{let{schema:n}=e.state;if(!n.nodes.table||!n.nodes.tableRow||!n.nodes.tableCell||!n.nodes.tableHeader)return null;let r=Math.max(...t.map(e=>e.length)),i=t.map((e,t)=>{let i=[];for(let a=0;a<r;a++){let r=e[a]??``,o=t===0?n.nodes.tableHeader:n.nodes.tableCell,s=r?n.text(r):null;i.push(o.create(null,s?[s]:[]))}return n.nodes.tableRow.create(null,i)});return n.nodes.table.create(null,i)},h=()=>{let t=Or(e);if(!t)return;let n=Ar(kr(t.node));navigator.clipboard?.writeText(n),o(!0),setTimeout(()=>o(!1),1500)},g=()=>{let t=Or(e);if(!t)return;let n=jr(kr(t.node)),r=new Blob([`\ufeff${n}`],{type:`text/csv;charset=utf-8`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`table.csv`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)},_=async()=>{if(d)try{let t=await navigator.clipboard?.readText();if(!t)return;let n=Mr(t);if(!n||n.length===0)return;let r=m(n);if(!r)return;let i=Or(e),a=e.chain().focus();if(i){let t=Math.min(i.pos+i.node.nodeSize,e.state.doc.content.size);a.setTextSelection(t)}a.insertContent(r).run()}catch{}},v=()=>{d&&t!=null&&(e.chain().focus().setNodeSelection(t).run(),e.storage.qingwuUI?.openAI?.())},y=()=>{d&&e.chain().focus().deleteTable().run()};return!d||t==null?null:(0,a.jsxs)(`div`,{ref:l,style:{position:`fixed`,top:0,left:0,zIndex:1e5},className:`tbl-toolbar`,contentEditable:!1,children:[(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:h,title:`复制`,children:r?(0,a.jsx)(`svg`,{className:`tbl-btn-icon tbl-btn-icon--check`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M5 13l4 4L19 7`})}):(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 5H6a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2v-2M8 5a2 2 0 002 2h2a2 2 0 002-2M8 5a2 2 0 012-2h2a2 2 0 012 2m0 0h2a2 2 0 012 2v3`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:g,title:`下载`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn`,onClick:_,title:`粘贴`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn tbl-btn--ai`,onClick:v,title:`AI 助手`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M13 10V3L4 14h7v7l9-11h-7z`})})}),(0,a.jsx)(`button`,{type:`button`,className:`tbl-btn tbl-btn--del`,onClick:()=>{!d||kt()||($(!0),c(!0))},title:`删除`,children:(0,a.jsx)(`svg`,{className:`tbl-btn-icon`,width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16`})})}),(0,a.jsx)(Pt,{open:s,title:`确认删除表格`,message:`此操作不可撤销。`,onCancel:()=>{$(!1),c(!1)},onConfirm:async()=>{await new Promise(e=>setTimeout(e,300)),$(!1),y()}})]})}var Pr=[{color:`#fef08a`,name:`黄`},{color:`#bbf7d0`,name:`绿`},{color:`#bfdbfe`,name:`蓝`},{color:`#fbcfe8`,name:`粉`},{color:`#fed7aa`,name:`橙`},{color:`#ddd6fe`,name:`紫`}],Fr=288,Ir=480,Lr=320;function Rr(e,t,n={}){let r=window.innerWidth,i=window.innerHeight,a=Math.min(n.panelWidth||Fr,Ir,r-32),o=Math.max(t||Lr,160);if(r<640){let t=Math.max(8,Math.min(e.top+10,i-420));return{style:{position:`fixed`,top:t,left:8,right:8,width:`auto`,zIndex:9999,maxHeight:`calc(100dvh - ${t}px - 16px)`,overflow:`hidden`,display:`flex`,flexDirection:`column`},placement:`below`,arrowLeft:50}}let s=e.left+e.width/2,c=typeof n.editorLeft==`number`?n.editorLeft:s-a/2;c=Math.max(16,Math.min(c,r-a-16));let l=i-e.top-16,u=e.top-16,d=l<o+12&&u>=o+12?`above`:`below`,f=d===`below`?e.top+10:e.top-o-10;f=Math.max(16,Math.min(f,i-o-16));let p=Math.max(14,Math.min((s-c)/a*100,86)),m=d===`above`?`${Math.max(e.top-10-f,160)}px`:`calc(100dvh - ${f}px - 16px)`;return{style:{position:`fixed`,top:f,left:c,width:a,zIndex:9999,maxHeight:m,overflow:`hidden`,display:`flex`,flexDirection:`column`},placement:d,arrowLeft:p}}function zr(e){return/(^|\n)```|(^|\n)#{1,6}\s|(^|\n)>\s?|(^|\n)\s*([-*_])(?:\s*\4){2,}\s*(?=\n|$)|(^|\n)\s*[-*+]\s+|(^|\n)\s*\d+[.)]\s+|(^|\n)\s*<img\s+|(^|\n)\s*\|.+\|/i.test(e)}function Br(e,t){try{let n=e.storage?.markdown?.parser;if(!n)return null;let r=n.parse(t),i=document.createElement(`div`);return i.innerHTML=r,s.DOMParser.fromSchema(e.schema).parse(i).content}catch{return null}}var Vr=(0,i.lazy)(()=>Promise.resolve().then(()=>ve).then(e=>({default:e.ImageUploadDialog}))),Hr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./storage-settings-dialog-ZtMUoApJ.cjs")).then(e=>({default:e.StorageSettingsDialog}))),Ur=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./export-dialog-BSEeEEHv.cjs")).then(e=>({default:e.ExportDialog}))),Wr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./video-embed-dialog-BbVHq51W.cjs")).then(e=>({default:e.VideoEmbedDialog}))),Gr=(0,i.lazy)(()=>Promise.resolve().then(()=>require("./md-import-dialog-CnstzrIK.cjs")).then(e=>({default:e.MdImportDialog}))),Kr=()=>(0,a.jsxs)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center`,children:[(0,a.jsx)(`div`,{className:`absolute inset-0 bg-black/40 backdrop-blur-sm`}),(0,a.jsx)(`div`,{className:`relative bg-background rounded-2xl border border-default-200 p-8 flex items-center justify-center`,children:(0,a.jsx)(`div`,{className:`w-6 h-6 border-2 border-primary border-t-transparent rounded-full animate-spin`})})]}),qr=({initialContent:t=``,onChange:n,placeholder:r,mode:o,readonly:d=!1,maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m,className:h=``,borderless:g=!1,style:_,showToolbar:v=!0,showToc:y=!0,showSearch:b=!0,onEditorReady:x,immediatelyRender:S,onToast:C})=>{let w=o===`view`||d,T=(0,i.useMemo)(()=>typeof t==`object`&&t||zr(t)?t:e.n(t),[t]),[E,D]=(0,i.useState)(!1),[O,k]=(0,i.useState)({}),[A,j]=(0,i.useState)(`below`),[M,N]=(0,i.useState)(50),P=(0,i.useRef)(null),[F,ee]=(0,i.useState)(!1),[I,L]=(0,i.useState)(!1),[te,R]=(0,i.useState)(!1),[ne,re]=(0,i.useState)(!1),[z,B]=(0,i.useState)(`none`),[V,ie]=(0,i.useState)({}),[ae,oe]=(0,i.useState)(``),[H,se]=(0,i.useState)(null),[U,ce]=(0,i.useState)(y),[W,G]=(0,i.useState)(!1);(0,i.useEffect)(()=>{ce(y)},[y]);let[le,ue]=(0,i.useState)(!1),[de,fe]=(0,i.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 80rem)`).matches:!0),[pe,K]=(0,i.useState)(()=>typeof window<`u`&&typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 64rem)`).matches:!0),me=(0,i.useRef)(null),q=(0,i.useRef)(null),he=(0,i.useRef)(null),ge=(0,i.useRef)(0),ve=(0,i.useRef)(null),ye=(0,i.useRef)(null),be=(0,i.useRef)(null),xe=(0,i.useRef)(null),[Se,Ce]=(0,i.useState)(!1),[Y,Te]=(0,i.useState)(!1),[Ee,De]=(0,i.useState)(!1),ke=(0,i.useRef)(null),Ae=(0,i.useCallback)(()=>{let e=q.current,t=he.current;e&&(Y?(document.body.style.overflow=``,Object.assign(e.style,{position:``,top:``,left:``,width:``,height:``,zIndex:``,background:``,borderRadius:``,overflow:``,display:``,flexDirection:``}),t&&Object.assign(t.style,{flex:``,overflow:``,minHeight:``}),Te(!1),requestAnimationFrame(()=>{window.scrollTo(0,ge.current)})):(document.fullscreenElement&&document.exitFullscreen(),ge.current=window.scrollY,Object.assign(e.style,{position:`fixed`,top:`0`,left:`0`,width:`100vw`,height:`100vh`,zIndex:`99999`,background:`var(--background, #fff)`,borderRadius:`0`,overflow:`hidden`,display:`flex`,flexDirection:`column`}),t&&Object.assign(t.style,{flex:`1`,overflow:`auto`,minHeight:`0`}),document.body.style.overflow=`hidden`,Te(!0)))},[Y]),je=(0,i.useCallback)(()=>{let e=q.current;e&&(document.fullscreenElement?document.exitFullscreen():(Y&&Ae(),ge.current=window.scrollY,e.requestFullscreen()))},[Y,Ae]);(0,i.useEffect)(()=>{let e=e=>{e.key===`Escape`&&Y&&Ae()},t=()=>{document.fullscreenElement?De(!0):(De(!1),requestAnimationFrame(()=>{window.scrollTo(0,ge.current)}))};return window.addEventListener(`keydown`,e),document.addEventListener(`fullscreenchange`,t),()=>{window.removeEventListener(`keydown`,e),document.removeEventListener(`fullscreenchange`,t)}},[Y,Ae]),(0,i.useEffect)(()=>{if(!b)return;let e=e=>{if((e.ctrlKey||e.metaKey)&&(e.key===`f`||e.key===`F`)){if(!q.current)return;e.preventDefault(),e.stopPropagation(),ue(!0)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[b]),(0,i.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 80rem)`),t=e=>fe(e.matches);return fe(e.matches),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]),(0,i.useEffect)(()=>{if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 64rem)`),t=e=>K(e.matches);return K(e.matches),e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);let X=(0,c.useEditor)({extensions:Cr({placeholder:r||e.o(`editor.placeholder`),maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m}),content:T,editable:!w,immediatelyRender:S,onUpdate:({editor:e})=>{n&&(me.current&&clearTimeout(me.current),me.current=setTimeout(()=>{n?.(e.getHTML(),e.getJSON())},300))},onCreate:()=>{},editorProps:{attributes:{class:`prose prose-neutral dark:prose-invert max-w-none focus:outline-none min-h-[200px] px-4 sm:px-8 py-4`,...w?{}:{style:`padding-left: 2.75rem`}},handlePaste(e,t){let n=t.clipboardData;if(!n)return!1;let r=n.getData(`text/plain`);if(!r||!r.includes(`[[`))return!1;t.preventDefault();let i=ye.current?.storage?.relativeMedia;i&&(i.clipboardFiles=new Map(Array.from(n.files??[]).map(e=>[e.name.toLowerCase(),e])),i.pausedUntilPaste=!1);let a=ye.current?Br(ye.current,r):null;if(a){let t=new s.Slice(a,0,0);e.dispatch(e.state.tr.replaceSelection(t).scrollIntoView())}else e.dispatch(e.state.tr.insertText(r).scrollIntoView());return!0}}});(0,i.useEffect)(()=>{ye.current=X,window.__editor=X},[X]),(0,i.useEffect)(()=>{if(X)return()=>dt(X)},[X]),(0,i.useEffect)(()=>{!X||!x||x(X)},[X,x]),(0,i.useEffect)(()=>{if(!X)return;let e=()=>{X.state.selection.empty&&(B(`none`),Ce(!1))};return X.on(`selectionUpdate`,e),()=>{X.off(`selectionUpdate`,e)}},[X]),(0,i.useEffect)(()=>{X&&X.setOptions({extensions:Cr({placeholder:r||e.o(`editor.placeholder`),maxLength:f,maxAttachmentSize:p,maxTotalAttachmentSize:m})})},[r,f,p,m]);let Me=(0,i.useRef)(t);(0,i.useEffect)(()=>{if(!X||t===Me.current)return;Me.current=t;let n=typeof t==`object`&&t||zr(t)?t:e.n(t);X.commands.setContent(n,{emitUpdate:!1})},[X,t]),(0,i.useEffect)(()=>{X&&X.setEditable(!w,!1)},[X,w]),(0,i.useEffect)(()=>{if(C)return _e(C)},[C]),(0,i.useEffect)(()=>{if(!X)return;let e=St(X.state.doc);e>m&&J(`文档内附件总大小 ${Ct(e)} 已超过限制 ${Ct(m)}`,`info`)},[X,m]),(0,i.useEffect)(()=>{if(!X)return;let e=X.storage.qingwuUI;e&&(e.limits={maxAttachmentSize:p,maxTotalAttachmentSize:m})},[X,p,m]);let Ne=(0,i.useCallback)(e=>{let t=xe.current?.getBoundingClientRect();B(e),Ce(!1),ie({position:`fixed`,top:t?t.bottom+8:void 0,left:t?Math.max(8,Math.min(t.left,window.innerWidth-240)):8,zIndex:9999})},[]),Pe=Dr(t=>e.o(t)),Fe=Pe.filter(e=>!e.more),Ie=Pe.filter(e=>e.more),Le=Fe.filter(e=>e.key!==`ai`),Z=Fe.find(e=>e.key===`ai`),Re=(0,i.useCallback)(e=>{if(X)if(Ce(!1),e.key===`link`)if(X.isActive(`link`))X.chain().focus().unsetLink().run();else{let e=X.getAttributes(`link`).href||``;oe(e),Ne(`link`)}else e.key===`highlight`?z===`highlight`?B(`none`):Ne(`highlight`):e.command(X)},[X,z,Ne]),ze=(0,i.useCallback)(e=>X?e.key===`highlight`?z===`highlight`:e.key===`link`?X.isActive(`link`):e.isActive(X):!1,[X,z]),[Be,Ve]=(0,i.useState)(0);(0,i.useEffect)(()=>{if(!X)return;let e=()=>Ve(e=>(e+1)%1e6);return X.on(`update`,e),()=>{X.off(`update`,e)}},[X]);let[He,Ue]=(0,i.useState)(!1);(0,i.useEffect)(()=>{if(!X)return;let e=()=>{let e=!1;X.state.doc.descendants(t=>{t.type.name===`heading`&&(e=!0)}),Ue(e)};return e(),X.on(`update`,e),()=>{X.off(`update`,e)}},[X]);let Q=(0,i.useMemo)(()=>X?.storage?.characterCount?.characters?.()??0,[X,Be]),Ge=f?Q>f:!1;(0,i.useEffect)(()=>()=>{me.current&&clearTimeout(me.current)},[]),(0,i.useEffect)(()=>()=>{H&&H.resolve(null)},[]);let Ke=(0,i.useCallback)(e=>{if(!X?.isEditable)return;let t=window.getSelection(),n;if(e){let t=e.getBoundingClientRect();n={top:t.bottom,left:t.left,width:t.width}}else if(t&&t.rangeCount>0&&!t.isCollapsed){let e=t.getRangeAt(0).getBoundingClientRect();n={top:e.bottom,left:e.left,width:e.width}}else{let e=X.view.coordsAtPos(X.state.selection.from);n={top:e.bottom,left:e.left,width:0}}ve.current=n;let r=q.current?.getBoundingClientRect(),i=Rr(n,void 0,{panelWidth:r?.width,editorLeft:r?.left});D(!0),k(i.style),j(i.placement),N(i.arrowLeft)},[X]);(0,i.useEffect)(()=>{if(!X)return;let e=X.storage.qingwuUI;if(e)return e.openImageDialog=()=>ee(!0),e.openVideoDialog=()=>L(!0),e.chooseMd=(e,t)=>{se({filename:e,resolve:t})},e.openAI=Ke,e.parseMd=(e,t)=>X?Br(X,t):null,()=>{delete e.openImageDialog,delete e.openVideoDialog,delete e.openAI,delete e.parseMd,delete e.chooseMd}},[X,Ke]),(0,i.useLayoutEffect)(()=>{if(!E||!X)return;let e=ve.current;if(!e)return;let t=P.current,n=q.current?.getBoundingClientRect(),r=Rr(e,t?.offsetHeight||void 0,{panelWidth:n?.width,editorLeft:n?.left});j(r.placement),N(r.arrowLeft),k(r.style)},[E,X]),(0,i.useEffect)(()=>{if(!E||!X)return;let e=()=>{let e=ve.current;if(!e)return;let t=P.current,n=q.current?.getBoundingClientRect(),r=Rr(e,t?.offsetHeight||void 0,{panelWidth:n?.width,editorLeft:n?.left});j(r.placement),N(r.arrowLeft),k(r.style)};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[E,X]),(0,i.useEffect)(()=>{E||(ve.current=null)},[E]);let qe=(0,i.useCallback)(e=>{X?.chain().focus().setImage({src:e}).run()},[X]),Je=(0,i.useCallback)(e=>{(X?.commands).insertVideo?.({src:e})},[X]),Ye=U&&de&&!Y&&!Ee,Xe=!Ye&&!W&&(U||He&&!(!w&&pe)),Ze=(0,i.useRef)(!1);return(0,i.useEffect)(()=>{Ze.current||(Ze.current=!0,U&&!Ye&&G(!0))},[U,Ye]),(0,i.useEffect)(()=>{if(!W)return;let e=e=>{let t=e.target;ke.current?.contains(t)||G(!1)},t=e=>{e.key===`Escape`&&G(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`touchstart`,e,{passive:!0}),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`touchstart`,e),document.removeEventListener(`keydown`,t)}},[W]),(0,i.useEffect)(()=>{if(!X||!Ye)return;let e=be.current;if(!(e instanceof HTMLElement))return;let t=t=>{let n=t.deltaY;if(n===0)return;let r=e.scrollTop<=0,i=!(e.scrollTop+e.clientHeight>=e.scrollHeight-1);if(n>0&&i||n<0&&!r){e.scrollTop+=n,t.preventDefault(),t.stopPropagation();return}let a=we(X.view.dom);if(a){a.scrollTop+=n,t.preventDefault(),t.stopPropagation();return}};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[X,Ye]),X?(0,a.jsxs)(`div`,{className:`qingwu-editor-row`,children:[(0,a.jsxs)(`div`,{ref:q,className:`qingwu-editor relative flex-1 min-w-0 bg-background ${w?`qingwu-editor--readonly`:``} ${g?``:`rounded-xl border border-default-200`} ${h}`,style:_,children:[v&&(0,a.jsxs)(`div`,{className:`qed-toolbar`,children:[(0,a.jsxs)(`div`,{className:`qed-toolbar__group`,children:[(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--desktop-only${U?` is-active`:``}`,onClick:()=>{U?(ce(!1),G(!1)):(ce(!0),de&&!Y&&!Ee||G(!0))},title:U?`隐藏目录`:`显示目录`,"aria-label":U?`隐藏目录`:`显示目录`,"aria-pressed":U,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 6h16M4 12h10M4 18h7`})})}),b&&(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${le?` is-active`:``}`,onClick:()=>ue(!le),title:`查找 (Ctrl+F)`,"aria-label":`查找`,"aria-pressed":le,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z`})})}),!w&&(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--ai${E?` is-active`:``}`,onClick:e=>E?D(!1):Ke(e.currentTarget),title:e.o(`editor.toolbar.aiTitle`),"aria-label":e.o(`editor.toolbar.ai`),"aria-pressed":E,children:(0,a.jsxs)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:[(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M12 3l1.6 4.4L18 9l-4.4 1.6L12 15l-1.6-4.4L6 9l4.4-1.6L12 3z`}),(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M18.5 14l.7 1.9 1.9.7-1.9.7-.7 1.9-.7-1.9-1.9-.7 1.9-.7.7-1.9z`})]})})]}),(0,a.jsxs)(`div`,{className:`qed-toolbar__group`,children:[(0,a.jsxs)(`button`,{type:`button`,className:`qed-tb-btn qed-tb-btn--solid`,onClick:()=>re(!0),title:e.o(`editor.toolbar.exportTitle`),children:[(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4`})}),(0,a.jsx)(`span`,{className:`qed-tb-btn__label`,children:e.o(`editor.toolbar.export`)})]}),(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${Y?` is-active`:``}`,onClick:Ae,title:Y?`退出网页全屏`:`网页全屏`,"aria-label":Y?`退出网页全屏`:`网页全屏`,"aria-pressed":Y,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3`})})}),(0,a.jsx)(`button`,{type:`button`,className:`qed-tb-btn${Ee?` is-active`:``}`,onClick:je,title:Ee?`退出全屏`:`全屏`,"aria-label":Ee?`退出全屏`:`全屏`,"aria-pressed":Ee,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M15 3h6v6M9 21H3v-6M21 3l-7 7M3 21l7-7`})})})]})]}),X&&!w&&X.isEditable&&(0,a.jsx)(l.BubbleMenu,{editor:X,shouldShow:({editor:e,state:t})=>!(e.isActive(`image`)||e.isActive(`videoEmbed`)||e.isActive(`codeBlock`)||e.isActive(`audioEmbed`)||e.isActive(`attachmentEmbed`)||t.selection.empty),options:{placement:`bottom`,offset:8,flip:!0},className:`bubble-menu-pop bg-background border border-default-200 rounded-xl p-1 shadow-lg`,children:(0,a.jsxs)(`div`,{ref:xe,className:`bubble-menu-items relative flex items-center gap-0.5`,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:[Le.map(e=>(0,a.jsx)(`button`,{type:`button`,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${e.isActive(X)?`bg-primary/10 text-primary`:`text-default-600 hover:bg-default-100`}`,onClick:t=>{t.preventDefault(),Re(e)},title:e.label,"aria-label":e.label,children:e.icon},e.key)),(0,a.jsx)(`span`,{className:`w-px h-4 bg-default-200 mx-0.5 shrink-0`,"aria-hidden":`true`}),(0,a.jsx)(`button`,{type:`button`,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${E?`bg-primary/15 text-primary`:`text-primary hover:bg-primary/10`}`,onClick:e=>{e.preventDefault(),Ce(!1),Z?.command(X)},title:Z?.label,"aria-label":Z?.label,children:(0,a.jsx)(tt,{})}),(0,a.jsx)(`span`,{className:`w-px h-4 bg-default-200 mx-0.5 shrink-0`,"aria-hidden":`true`}),(0,a.jsx)(`button`,{type:`button`,"aria-expanded":Se,className:`flex items-center justify-center w-7 h-7 rounded-lg transition-colors ${Se?`bg-default-100 text-default-900`:`text-default-600 hover:bg-default-100`}`,onClick:e=>{e.preventDefault(),Ce(e=>!e)},title:e.o(`editor.bubble.more`),"aria-label":e.o(`editor.bubble.more`),children:(0,a.jsx)(nt,{})}),Se&&(0,a.jsx)(`div`,{role:`menu`,className:`bubble-more-menu absolute right-0 top-full z-[9999] mt-1 w-max max-h-[70vh] overflow-y-auto flex-col gap-1 rounded-xl border border-default-200 bg-background p-1.5 shadow-xl`,onPointerDown:e=>{e.target.closest(`button`)&&e.preventDefault()},children:Ie.map(e=>(0,a.jsxs)(`button`,{type:`button`,role:`menuitem`,className:`flex items-center gap-2 w-full whitespace-nowrap px-3 py-1.5 text-xs rounded-md transition-colors ${ze(e)?`bg-primary/10 text-primary`:`text-default-600 hover:bg-default-100`}`,onClick:t=>{t.preventDefault(),Re(e)},title:e.label,children:[(0,a.jsx)(`span`,{className:`w-4 h-4 flex items-center justify-center shrink-0`,children:e.icon}),(0,a.jsx)(`span`,{className:`tracking-wide`,children:e.label})]},e.key))})]})}),X&&z!==`none`&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`fixed inset-0 z-[9998]`,onClick:()=>B(`none`)}),(0,a.jsx)(`div`,{style:V,className:`bg-background border border-default-200 rounded-xl shadow-xl`,onClick:e=>e.stopPropagation(),children:z===`highlight`?(0,a.jsxs)(`div`,{className:`flex items-center gap-1 p-1.5 flex-wrap`,children:[Pr.map(e=>(0,a.jsx)(`button`,{type:`button`,className:`w-5 h-5 rounded-full border border-default-200 hover:scale-110 transition-transform`,style:{background:e.color},title:e.name,onClick:()=>{X.chain().focus().setHighlight({color:e.color}).run(),B(`none`)}},e.color)),(0,a.jsxs)(`button`,{type:`button`,className:`w-5 h-5 rounded-full border border-default-200 text-default-500 hover:bg-default-100 flex items-center justify-center text-[10px]`,title:`清除高亮`,onClick:()=>{X.chain().focus().unsetHighlight().run(),B(`none`)},children:[`✕`,` `]})]}):(0,a.jsxs)(`div`,{className:`flex items-center gap-1.5 p-1.5`,children:[(0,a.jsx)(`input`,{type:`url`,className:`flex-1 px-2 py-1 text-xs rounded-md border border-default-200 bg-background focus:outline-none focus:border-primary`,placeholder:`https://...`,value:ae,onChange:e=>oe(e.target.value),onKeyDown:e=>{e.key===`Enter`?(ae.trim()&&X.chain().focus().setLink({href:ae.trim()}).run(),B(`none`)):e.key===`Escape`&&B(`none`)}}),(0,a.jsx)(`button`,{type:`button`,className:`px-2 py-1 text-xs rounded-md bg-primary text-white hover:opacity-90`,onClick:()=>{ae.trim()&&X.chain().focus().setLink({href:ae.trim()}).run(),B(`none`)},children:`确定`})]})})]}),!w&&E&&(0,u.createPortal)((0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`fixed inset-0 z-[9998]`,onClick:()=>D(!1)}),(0,a.jsxs)(`div`,{ref:P,"data-lenis-prevent":!0,style:O,className:`ai-panel relative flex flex-col bg-background border border-default-200 rounded-xl shadow-xl${A===`above`?` ai-panel--above`:``}`,onClick:e=>e.stopPropagation(),children:[(0,a.jsx)(`span`,{className:`ai-panel__arrow`,style:{left:`${M}%`},"aria-hidden":`true`}),(0,a.jsx)(bt,{editor:X,onClose:()=>D(!1)})]})]}),document.body),F&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Vr,{open:F,onClose:()=>ee(!1),onInsert:qe,validate:e=>X?Tt(X.state.doc,e,{maxAttachmentSize:p,maxTotalAttachmentSize:m}):null})}),I&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Wr,{open:I,onClose:()=>L(!1),onInsert:Je})}),te&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Hr,{open:te,onClose:()=>R(!1)})}),ne&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Ur,{open:ne,onClose:()=>re(!1),editor:X})}),H&&(0,a.jsx)(i.Suspense,{fallback:(0,a.jsx)(Kr,{}),children:(0,a.jsx)(Gr,{open:!!H,filename:H.filename,onRender:()=>{H.resolve(`render`),se(null)},onAttach:()=>{H.resolve(`attach`),se(null)},onClose:()=>{H.resolve(null),se(null)}})}),(0,a.jsx)(`div`,{ref:he,className:`flex editor-body`,children:(0,a.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,a.jsx)(c.EditorContent,{editor:X}),!w&&(0,a.jsx)(Nr,{editor:X}),(0,a.jsx)(`div`,{className:`${Y||Ee?`fixed`:`absolute`} bottom-2 right-4 z-10 pointer-events-none select-none`,children:(0,a.jsxs)(`span`,{className:`text-xs ${Ge?`bg-danger/10 text-danger font-medium px-2 py-0.5 rounded`:f&&Q>f*.9?`bg-warning/10 text-warning px-2 py-0.5 rounded`:`text-default-300`}`,children:[Q,f?` / ${f}`:``,` 字`]})})]})}),b&&le&&(0,a.jsx)(We,{editor:X,onClose:()=>ue(!1)}),Xe&&(0,a.jsx)(`button`,{type:`button`,className:`qingwu-toc-fab`,onClick:()=>G(!0),title:`目录`,"aria-label":`打开目录`,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M4 6h16M4 12h10M4 18h7`})})}),W&&(0,u.createPortal)((0,a.jsxs)(`div`,{ref:ke,className:`qingwu-toc-drawer toc-scroll`,"data-lenis-prevent":!0,children:[(0,a.jsxs)(`div`,{className:`qed-drawer-head`,children:[(0,a.jsx)(`span`,{className:`qed-drawer-head__title`,children:`目录`}),(0,a.jsx)(`button`,{type:`button`,className:`qed-drawer-head__close`,onClick:()=>G(!1),"aria-label":`关闭目录`,children:(0,a.jsx)(`svg`,{fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,strokeWidth:2,"aria-hidden":`true`,children:(0,a.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,d:`M6 18L18 6M6 6l12 12`})})})]}),(0,a.jsx)(Oe,{editor:X,className:`!p-3`,onClose:()=>{G(!1),ce(!1)}})]}),document.body)]}),Ye&&(0,u.createPortal)((0,a.jsx)(`aside`,{ref:be,className:`qingwu-toc-desktop toc-scroll`,children:(0,a.jsx)(Oe,{editor:X,onClose:()=>ce(!1)})}),document.body)]}):(0,a.jsx)(`div`,{className:`flex items-center justify-center h-32 text-default-400`,children:e.o(`editor.loading`)})};function Jr(e){let t=async t=>{let n=t.data;if(!n||typeof n!=`object`||n.kind!==`qingwu-clip`)return;let r=t.origin;if(r&&r!==`null`&&r!==window.location.origin)return;let i=n.clip;if(i?.markdown)try{await e.onClip(i,t)}catch(e){console.warn(`[qingwu-clipper] 处理剪藏失败:`,e)}};return window.addEventListener(`message`,t),{close:()=>window.removeEventListener(`message`,t)}}function Yr(e){return r.n({endpoint:`https://cos.${e.region}.myqcloud.com`,bucket:e.bucket,region:e.region,accessKeyId:e.secretId,secretAccessKey:e.secretKey,customDomain:e.customDomain,uploadPrefix:e.uploadPrefix,nameTemplate:e.nameTemplate})}function Xr(e){return r.n({endpoint:`https://${e.bucket}.${e.region}.aliyuncs.com`,bucket:e.bucket,region:e.region,accessKeyId:e.accessKeyId,secretAccessKey:e.accessKeySecret,customDomain:e.customDomain,uploadPrefix:e.uploadPrefix,nameTemplate:e.nameTemplate})}exports.CODE_LANGUAGES=hn,exports.CodeBlock=xn,exports.ImageUpload=Gn,exports.ImageUploadDialog=ye,exports.QingWuAIEditor=qr,exports.RelativeMedia=vr,exports.SearchHighlight=He,exports.TocPanel=Oe,exports.VideoEmbed=cn,exports.buildSystemPrompt=ke,exports.createAILanguageModelProvider=je,exports.createCOSStorage=Yr,exports.createDeepSeekProvider=Pe,exports.createLocalStorage=r.t,exports.createOSSStorage=Xr,exports.createOpenAICompatProvider=Ne,exports.createOpenAIProvider=Fe,exports.createQwenProvider=Ie,exports.createS3Storage=r.n,exports.createSlashCommandExtension=br,exports.escapeHtml=e.t,exports.formatBytes=Ct,exports.getAIProvider=Me,exports.getBubbleMenuActions=Dr,exports.getDefaultSlashCommands=xr,exports.getDocAttachmentTotal=St,exports.getEditorExtensions=Cr,exports.getLocale=e.i,exports.getSearchEngine=Er,exports.getSearchState=Ue,exports.getStorageInfo=n.t,exports.getStorageProvider=n.n,exports.loadStorageConfig=n.r,exports.registerS3PreviewConfig=t.t,exports.sanitizeHtml=e.n,exports.sanitizeSvg=e.r,exports.setAIProvider=X,exports.setConfirmProvider=jt,exports.setLocale=e.a,exports.setSearchEngine=Tr,exports.setStorageProvider=n.a,exports.setToastProvider=ge,exports.signPreviewUrlHeaders=t.r,exports.startBrowserClipperReceiver=Jr,exports.subscribeToast=_e,exports.t=e.o,exports.tf=e.s,exports.toast=J,exports.validateAttachmentFile=Tt;
|
package/dist/index.js
CHANGED
|
@@ -7471,14 +7471,14 @@ var Ti = y(() => Promise.resolve().then(() => $e).then((e) => ({ default: e.Imag
|
|
|
7471
7471
|
})]
|
|
7472
7472
|
}), document.body)
|
|
7473
7473
|
]
|
|
7474
|
-
}), rt && /* @__PURE__ */ D("aside", {
|
|
7474
|
+
}), rt && ne(/* @__PURE__ */ D("aside", {
|
|
7475
7475
|
ref: ke,
|
|
7476
7476
|
className: "qingwu-toc-desktop toc-scroll",
|
|
7477
7477
|
children: /* @__PURE__ */ D(ut, {
|
|
7478
7478
|
editor: X,
|
|
7479
7479
|
onClose: () => me(!1)
|
|
7480
7480
|
})
|
|
7481
|
-
})]
|
|
7481
|
+
}), document.body)]
|
|
7482
7482
|
}) : /* @__PURE__ */ D("div", {
|
|
7483
7483
|
className: "flex items-center justify-center h-32 text-default-400",
|
|
7484
7484
|
children: f("editor.loading")
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qingwu-ui/ai-editor",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
4
|
-
"description": "青梧
|
|
3
|
+
"version": "0.9.0-beta.19",
|
|
4
|
+
"description": "青梧 AI 编辑器 —— 面向中文用户的智能富文本编辑器,基于 Tiptap + React 19",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"packageManager": "bun@1.3.13",
|