@fgbg/mdocs 1.1.1 → 1.1.2
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/agent-skills/changelog/SKILL.md +12 -1
- package/agent-skills/index.json +1 -1
- package/dist/web/assets/{AgentChatPanel-KiTv5uCF.js → AgentChatPanel-Bt38gm3b.js} +1 -1
- package/dist/web/assets/{AgentSkillFormCard-CP-HN--U.js → AgentSkillFormCard-CtfWIf7Y.js} +1 -1
- package/dist/web/assets/{AiWriteWorkbench-0wEf6qur.js → AiWriteWorkbench-Boie5E_-.js} +1 -1
- package/dist/web/assets/{DiagramEditor-NtNY3sZL-XBBS6Mu4.js → DiagramEditor-NtNY3sZL-CZy-tmEe.js} +1 -1
- package/dist/web/assets/{DocumentEditor-CeaspJgX.js → DocumentEditor-1A6lpvV-.js} +1 -1
- package/dist/web/assets/{MergeView-y24LKycd.js → MergeView-Dip0aW7s.js} +1 -1
- package/dist/web/assets/{PlaygroundPage-CYx8X23_.js → PlaygroundPage-C4X6Lj-Q.js} +1 -1
- package/dist/web/assets/{SettingsPage-Bor0wh4z.js → SettingsPage-nlnmzNZK.js} +1 -1
- package/dist/web/assets/{Toolbar-uyj1sA_r.js → Toolbar-BHLX-ug4.js} +1 -1
- package/dist/web/assets/{VisitorPickerModal-DljB4USS.js → VisitorPickerModal-BPyEWlQo.js} +1 -1
- package/dist/web/assets/{copy-DZj0Bj86.js → copy-BE64wQqi.js} +1 -1
- package/dist/web/assets/{index-CqUWQ28V.js → index-BkKvQv2F.js} +2 -2
- package/dist/web/assets/index-DKshvHIN.css +1 -0
- package/dist/web/assets/{meta2dEngine-BD2XbzaV-D2yFsZ_P.js → meta2dEngine-BD2XbzaV-z-eR7E_V.js} +1 -1
- package/dist/web/assets/{plus-Bcg3ots1.js → plus-ECzYbQfA.js} +1 -1
- package/dist/web/assets/{react-kYvt_3tR.js → react-GP8hKHRA.js} +3 -3
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-C4ESYs7f.css +0 -1
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
id: changelog
|
|
3
3
|
name: "更新日志"
|
|
4
|
-
description: "
|
|
4
|
+
description: "---"
|
|
5
5
|
keywords: []
|
|
6
6
|
source: changelog.md
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# 更新日志
|
|
10
10
|
|
|
11
|
+
## v1.1.2
|
|
12
|
+
|
|
13
|
+
### 修复与体验
|
|
14
|
+
- **拉取更新 + 本地草稿**:落后且有未发布草稿时,「拉取更新」会打开合并视图,而不再静默无反应
|
|
15
|
+
- **AI 帮写 diff**:接受/拒绝后布局不再因失焦整段 LCS 重算而「旧上新下」错位
|
|
16
|
+
- **路径式文档链接**:兼容 `/doc/<id>`,自动转到 HashRouter 的 `#/doc/<id>`
|
|
17
|
+
- **手机图谱详情**:窄屏下节点详情全屏铺满图谱区,便于阅读关闭
|
|
18
|
+
- **附件上传**:放宽 PDF MIME 校验;PDF 强制下载;插入附件文件选择器补上 pdf/zip 等扩展名
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
11
22
|
## v1.1.1
|
|
12
23
|
|
|
13
24
|
- **Markdown 粘贴转换**:多段落正文不再只剩一级标题;嵌套列表父项与子项可完整保留(依赖 `@fgbg/lobe-editor@1.0.0-fork.21`)
|
package/agent-skills/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{
|
|
3
3
|
"id": "changelog",
|
|
4
4
|
"name": "更新日志",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "---",
|
|
6
6
|
"keywords": [],
|
|
7
7
|
"source": "changelog.md"
|
|
8
8
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,j as e}from"./react-vendor-BuABiQkA.js";import{c as Le,ag as be,ah as Ke,i as ve,ai as Se,aj as Oe,ak as Ue,al as We,am as Ge,an as Xe,ao as Re,ap as Ye,aq as Ve,ar as Je}from"./index-
|
|
1
|
+
import{r as o,j as e}from"./react-vendor-BuABiQkA.js";import{c as Le,ag as be,ah as Ke,i as ve,ai as Se,aj as Oe,ak as Ue,al as We,am as Ge,an as Xe,ao as Re,ap as Ye,aq as Ve,ar as Je}from"./index-BkKvQv2F.js";import{H as Qe,A as we,S as Ze,a as es}from"./AgentSkillFormCard-CtfWIf7Y.js";import{P as ss}from"./plus-ECzYbQfA.js";import{ae as ts,af as ns}from"./ui-BQStT3dY.js";import{C as as,a as is}from"./copy-BE64wQqi.js";import"./diagram-CT58wBdU.js";import"./motion-DX3HNq_4.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as K,a2 as q,b as L,a0 as R,at as T,ap as B,au as P}from"./index-
|
|
1
|
+
import{c as K,a2 as q,b as L,a0 as R,at as T,ap as B,au as P}from"./index-BkKvQv2F.js";import{r as n,j as e}from"./react-vendor-BuABiQkA.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,j as n}from"./react-vendor-BuABiQkA.js";import{ag as ne,ah as de,i as ue,ak as me,as as he,al as fe,am as ge,an as xe}from"./index-
|
|
1
|
+
import{r as d,j as n}from"./react-vendor-BuABiQkA.js";import{ag as ne,ah as de,i as ue,ak as me,as as he,al as fe,am as ge,an as xe}from"./index-BkKvQv2F.js";import{H as ke,A as te,S as ye,a as we}from"./AgentSkillFormCard-CtfWIf7Y.js";import{P as pe}from"./plus-ECzYbQfA.js";import{ae as je,af as Ne}from"./ui-BQStT3dY.js";import"./diagram-CT58wBdU.js";import"./motion-DX3HNq_4.js";function X(e){return e===""?[]:e.split(`
|
|
2
2
|
`)}function be(e){return e.join(`
|
|
3
3
|
`)}function Z(e,i){const s=X(e),l=X(i),m=s.length,k=l.length,y=Array.from({length:m+1},()=>Array.from({length:k+1},()=>0));for(let N=m-1;N>=0;N--)for(let v=k-1;v>=0;v--)s[N]===l[v]?y[N][v]=y[N+1][v+1]+1:y[N][v]=Math.max(y[N+1][v],y[N][v+1]);const C=[];let g=0,x=0;for(;g<m||x<k;)if(g<m&&x<k&&s[g]===l[x])C.push({kind:"eq",oi:g,ni:x}),g++,x++;else if(x<k&&(g===m||y[g][x+1]>=y[g+1][x]))C.push({kind:"ins",oi:g,ni:x}),x++;else if(g<m)C.push({kind:"del",oi:g,ni:x}),g++;else break;const j=[];let f=0,P=0;for(;f<C.length;){if(C[f].kind==="eq"){f++;continue}const N=C[f].oi,v=C[f].ni,R=[],b=[];let A=N,D=v;for(;f<C.length&&C[f].kind!=="eq";){const $=C[f];$.kind==="del"?(R.push(s[$.oi]),A=$.oi+1):(b.push(l[$.ni]),D=$.ni+1),f++}j.push({id:`h${P++}`,oldStart:N,oldEnd:A,newStart:v,newEnd:D,oldLines:R,newLines:b})}return j}function Se(e,i){const s=X(e);return be([...s.slice(0,i.oldStart),...i.newLines,...s.slice(i.oldEnd)])}function Y(e){return e===""?[]:e.split(`
|
|
4
4
|
`)}function K(e){return e.join(`
|
package/dist/web/assets/{DiagramEditor-NtNY3sZL-XBBS6Mu4.js → DiagramEditor-NtNY3sZL-CZy-tmEe.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Q as I,S as H,T as F,U as O,V as G}from"./react-
|
|
1
|
+
import{Q as I,S as H,T as F,U as O,V as G}from"./react-GP8hKHRA.js";import{r as c,j as e}from"./react-vendor-BuABiQkA.js";import{ensureMeta2dShapes as X,generateSvgFromMeta2d as Q,generateSvgFromDiagram as Y}from"./meta2dEngine-BD2XbzaV-z-eR7E_V.js";import{M as _}from"./meta2d-1-g23JOU.js";import"./editor-CL03se2B.js";import"./ui-BQStT3dY.js";import"./motion-DX3HNq_4.js";import"./diagram-CT58wBdU.js";import"./index-BkKvQv2F.js";import"./plus-ECzYbQfA.js";import"./copy-BE64wQqi.js";let q=0;const P=new Set;function $(n){return P.add(n),()=>{P.delete(n)}}function M(){return q}function J(){q++,P.forEach(n=>n())}function z(n){let t=null;try{const[r]=I();t=r}catch{}const i=t;if(!i)throw new Error("[useEditorLocale] No editor found. Pass an editor instance or use this hook inside an <Editor> tree.");return c.useSyncExternalStore($,M,M),{setLocale:c.useCallback(r=>{i.setLocale(r),J()},[i]),t:c.useCallback((r,u)=>i.t(r,u),[i])}}const K={Activity:"meta2d.palette.groups.activity",Basic:"meta2d.palette.groups.basic","Fault tree":"meta2d.palette.groups.faultTree",Flow:"meta2d.palette.groups.flow","Sequence & class":"meta2d.palette.groups.sequenceClass"};function W(n){return`meta2d.palette.${n}`}const s={background:"#fff",color:"#1f1f1f",height:60,lineWidth:1,textColor:"#1f1f1f",width:120};function U(){return[{group:"Basic",key:"square",label:"Square",pen:{...s,height:100,name:"square",text:"",width:100}},{group:"Basic",key:"rect",label:"Rectangle",pen:{...s,name:"rectangle",text:"Rectangle"}},{group:"Basic",key:"roundRect",label:"Rounded",pen:{...s,borderRadius:.2,name:"rectangle",text:"Rounded"}},{group:"Basic",key:"circle",label:"Circle",pen:{...s,height:80,name:"circle",text:"Circle",width:80}},{group:"Basic",key:"triangle",label:"Triangle",pen:{...s,height:90,name:"triangle",text:"Triangle",width:100}},{group:"Basic",key:"diamond",label:"Diamond",pen:{...s,height:100,name:"diamond",text:"Decision",width:100}},{group:"Basic",key:"pentagon",label:"Pentagon",pen:{...s,height:100,name:"pentagon",text:"Pentagon",width:100}},{group:"Basic",key:"hexagon",label:"Hexagon",pen:{...s,height:100,name:"hexagon",text:"Hexagon",width:100}},{group:"Basic",key:"pentagram",label:"Star",pen:{...s,height:100,name:"pentagram",text:"",width:100}},{group:"Basic",key:"leftArrow",label:"Left arrow",pen:{height:60,name:"leftArrow",width:120}},{group:"Basic",key:"rightArrow",label:"Right arrow",pen:{height:60,name:"rightArrow",width:120}},{group:"Basic",key:"twowayArrow",label:"Two-way",pen:{height:60,name:"twowayArrow",width:150}},{group:"Basic",key:"cloud",label:"Cloud",pen:{height:100,name:"cloud",width:100}},{group:"Basic",key:"message",label:"Message",pen:{height:100,name:"message",textTop:-.1,width:100}},{group:"Basic",key:"file",label:"File",pen:{height:100,name:"file",width:80}},{group:"Basic",key:"cube",label:"Cube",pen:{height:100,name:"cube",width:60,z:.25}},{group:"Basic",key:"people",label:"Actor",pen:{height:100,name:"people",width:70}},{group:"Basic",key:"text",label:"Text",pen:{...s,background:"transparent",color:"transparent",height:32,name:"text",text:"text",width:120}},{group:"Basic",key:"line",label:"Line",pen:{color:"#1f1f1f",height:1,lineWidth:1,name:"line",width:160}},{group:"Flow",key:"flowTerminal",label:"Terminal",pen:{...s,borderRadius:.5,height:40,name:"rectangle",text:"Start / End",width:120}},{group:"Flow",key:"flowProcess",label:"Process",pen:{...s,height:40,name:"rectangle",text:"Process",width:120}},{group:"Flow",key:"flowDecision",label:"Decision",pen:{...s,height:60,name:"diamond",text:"Decision",width:120}},{group:"Flow",key:"flowData",label:"Data",pen:{...s,name:"flowData",offsetX:.14,text:"Data"}},{group:"Flow",key:"flowPrepare",label:"Prepare",pen:{...s,height:50,name:"hexagon",text:"Prepare",width:120}},{group:"Flow",key:"flowSubprocess",label:"Subprocess",pen:{...s,height:50,name:"flowSubprocess",text:"Subprocess",width:120}},{group:"Flow",key:"flowDb",label:"Database",pen:{...s,height:100,name:"flowDb",text:"DB",width:80}},{group:"Flow",key:"flowDocument",label:"Document",pen:{...s,height:100,name:"flowDocument",text:"Document",width:120}},{group:"Flow",key:"flowInternalStorage",label:"Int. storage",pen:{...s,height:80,name:"flowInternalStorage",text:"Internal",width:120}},{group:"Flow",key:"flowExternStorage",label:"Ext. storage",pen:{...s,height:80,name:"flowExternStorage",text:"External",width:120}},{group:"Flow",key:"flowQueue",label:"Queue",pen:{...s,height:100,name:"flowQueue",text:"Queue",width:100}},{group:"Flow",key:"flowManually",label:"Manual input",pen:{...s,height:80,name:"flowManually",text:"Manual",width:120}},{group:"Flow",key:"flowDisplay",label:"Display",pen:{...s,height:80,name:"flowDisplay",text:"Display",width:120}},{group:"Flow",key:"flowParallel",label:"Parallel",pen:{...s,height:50,name:"flowParallel",text:"Parallel",width:120}},{group:"Flow",key:"flowComment",label:"Comment",pen:{...s,height:100,name:"flowComment",text:"Note",width:100}},{group:"Activity",key:"actStart",label:"Start",pen:{background:"#555",height:30,lineWidth:0,name:"circle",text:"",width:30}},{group:"Activity",key:"actFinal",label:"Final",pen:{height:30,name:"activityFinal",width:30}},{group:"Activity",key:"actStep",label:"Action",pen:{...s,borderRadius:.25,height:50,name:"rectangle",text:"Action",width:120}},{group:"Activity",key:"actMerge",label:"Merge",pen:{...s,height:50,name:"diamond",text:"Merge",width:120}},{group:"Activity",key:"swimlaneV",label:"Swimlane V",pen:{height:500,lineTop:.08,name:"swimlaneV",text:"Swimlane",textBaseline:"top",textTop:20,width:200}},{group:"Activity",key:"swimlaneH",label:"Swimlane H",pen:{height:200,lineLeft:.08,name:"swimlaneH",text:"Swimlane",textAlign:"left",textLeft:.04,textWidth:.01,width:500}},{group:"Activity",key:"forkV",label:"Fork V",pen:{fillStyle:"#555",height:150,name:"forkV",strokeStyle:"transparent",text:"",width:10}},{group:"Activity",key:"forkH",label:"Fork H",pen:{fillStyle:"#555",height:10,name:"forkH",strokeStyle:"transparent",text:"",width:150}},{group:"Sequence & class",key:"lifeline",label:"Lifeline",pen:{height:400,name:"lifeline",text:"Object",textHeight:50,width:150}},{group:"Sequence & class",key:"sequenceFocus",label:"Activation",pen:{height:200,name:"sequenceFocus",text:"",width:12}},{group:"Sequence & class",key:"simpleClass",label:"Simple class",pen:{height:200,list:[{text:`- name: string
|
|
2
2
|
+ setName(name: string): void`}],name:"simpleClass",text:"ClassName",textAlign:"center",textBaseline:"top",textHeight:200,textTop:10,width:270}},{group:"Sequence & class",key:"interfaceClass",label:"Class",pen:{height:200,list:[{text:"- name: string"},{text:"+ setName(name: string): void"}],name:"interfaceClass",text:"ClassName",textAlign:"center",textBaseline:"top",textHeight:200,textTop:10,width:270}},{group:"Fault tree",key:"andGate",label:"AND gate",pen:{height:150,name:"andGate",width:100}},{group:"Fault tree",key:"orGate",label:"OR gate",pen:{height:150,name:"orGate",width:100}},{group:"Fault tree",key:"basicEvent",label:"Basic event",pen:{height:150,name:"basicEvent",width:100}},{group:"Fault tree",key:"xorGate",label:"XOR gate",pen:{height:150,name:"xorGate",width:100}},{group:"Fault tree",key:"votingGate",label:"Voting gate",pen:{height:150,name:"votingGate",width:100}}]}function V(n){return G(structuredClone(n))}function Z(n){const t=new Map;for(const i of n){const r=t.get(i.group)??[];r.push(i),t.set(i.group,r)}return Array.from(t.entries())}function ee({name:n}){const t={fill:"#fff",stroke:"#1f1f1f",strokeWidth:1.2};return n==="circle"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("circle",{cx:"14",cy:"14",r:"10",...t})}):n==="diamond"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("polygon",{points:"14,3 25,14 14,25 3,14",...t})}):n==="triangle"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("polygon",{points:"14,4 25,24 3,24",...t})}):n==="pentagon"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("polygon",{points:"14,3 25,12 21,25 7,25 3,12",...t})}):n==="hexagon"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("polygon",{points:"8,4 20,4 25,14 20,24 8,24 3,14",...t})}):n==="pentagram"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("polygon",{points:"14,3 17,11 26,11 18,16 21,25 14,20 7,25 10,16 2,11 11,11",...t})}):n==="line"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("line",{x1:"4",x2:"24",y1:"14",y2:"14",...t})}):n==="text"?e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("text",{dominantBaseline:"middle",fill:"#1f1f1f",fontSize:"14",textAnchor:"middle",x:"14",y:"15",children:"T"})}):e.jsx("svg",{height:"24",viewBox:"0 0 28 28",width:"24",children:e.jsx("rect",{height:"14",rx:"2",width:"20",x:"4",y:"7",...t})})}function te({disabled:n,engineRef:t,item:i,t:r}){const u=()=>{const a=t.current;if(!(!a||n))try{a.canvas.addCaches=[V(i.pen)]}catch{}};return e.jsxs("div",{draggable:!n,onClick:a=>{a.stopPropagation(),u()},onDragStart:a=>{if(n){a.preventDefault();return}const f=JSON.stringify(V(i.pen));a.dataTransfer.setData("Meta2d",f),a.dataTransfer.setData("Text",f),a.dataTransfer.effectAllowed="copy"},onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),u())},role:"button",style:{alignItems:"center",border:"1px solid #efefef",borderRadius:6,cursor:n?"not-allowed":"grab",display:"flex",flexDirection:"column",gap:4,justifyContent:"center",minHeight:56,opacity:n?.5:1,outline:"none",padding:6},tabIndex:n?-1:0,title:`${r(W(i.key))||i.label} — drag or click to add`,children:[e.jsx(ee,{name:String(i.pen.name??"rectangle")}),e.jsx("span",{style:{fontSize:11},children:r(W(i.key))||i.label})]})}function ne({disabled:n,engineRef:t}){const{t:i}=z(),r=c.useMemo(()=>Z(U()),[]);return e.jsxs("aside",{style:{borderRight:"1px solid #f0f0f0",flexShrink:0,maxHeight:"100%",overflowX:"hidden",overflowY:"auto",overscrollBehavior:"contain",padding:12,touchAction:"pan-y",width:240},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,marginBottom:4},children:i("meta2d.palette.title")}),e.jsx("div",{style:{color:"#8c8c8c",fontSize:12,marginBottom:12},children:i("meta2d.palette.hint")}),r.map(([u,a])=>e.jsxs("div",{style:{marginBottom:12},children:[e.jsx("div",{style:{color:"#8c8c8c",fontSize:12,marginBottom:6},children:i(K[u]||u)}),e.jsx("div",{style:{display:"grid",gap:8,gridTemplateColumns:"repeat(2, minmax(0, 1fr))"},children:a.map(f=>e.jsx(te,{disabled:n,engineRef:t,item:f,t:i},f.key))})]},u))]})}const N={borderLeft:"1px solid #f0f0f0",flexShrink:0,maxHeight:"100%",overflowX:"hidden",overflowY:"auto",overscrollBehavior:"contain",touchAction:"pan-y",width:220},A={color:"#8c8c8c",fontSize:12,marginBottom:4},D={borderBottom:"1px solid #f0f0f0",padding:"10px 12px"},y={alignItems:"center",display:"flex",gap:6,marginBottom:6},w={background:"#fafafa",border:"1px solid #e5e5e5",borderRadius:4,fontSize:12,height:28,outline:"none",padding:"0 6px"},b={color:"#8c8c8c",fontSize:11,minWidth:22},T={background:"#fff",border:"1px solid #d9d9d9",borderRadius:4,cursor:"pointer",fontSize:11,minWidth:48,padding:"4px 8px"},le=120;function ie({engine:n}){const{t}=z(),[i,r]=c.useState(null),[u,a]=c.useState(null),[f,v]=c.useState(""),p=c.useRef(null),j=c.useRef(null),B=c.useCallback((l,d)=>{!n||l===null||l===void 0||n.setValue({id:l,text:d},{render:!0})},[n]),k=c.useCallback(l=>{if(!l||l.length!==1){p.current&&(clearTimeout(p.current),p.current=null),r(null),a(null),v(""),j.current=null;return}const d=l[0];if((d.globalAlpha===null||d.globalAlpha===void 0)&&(d.globalAlpha=1),d.id!==j.current&&(p.current&&(clearTimeout(p.current),p.current=null),j.current=d.id,v(d.text??"")),r(d),n)try{a(n.getPenRect(d))}catch{a(null)}},[n]),C=c.useCallback(()=>{p.current&&(clearTimeout(p.current),p.current=null),r(null),a(null),v(""),j.current=null},[]);if(c.useEffect(()=>{if(n)return n.on("active",k),n.on("inactive",C),()=>{n.off("active",k),n.off("inactive",C),p.current&&(clearTimeout(p.current),p.current=null)}},[n,k,C]),!i||!n)return e.jsx("aside",{style:N,children:e.jsx("div",{style:{color:"#bbb",fontSize:12,padding:16,textAlign:"center"},children:t("meta2d.props.empty")})});const h=(l,d)=>{const m={id:i.id};m[l]=d,l==="dash"&&(m.lineDash=[void 0,[5,5]][d]),l!=="text"&&r(S=>S&&{...S,...m}),n.setValue(m,{render:!0})},o=l=>{v(l);const d=i.id;p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{p.current=null,B(d,l)},le)},x=()=>{p.current&&(clearTimeout(p.current),p.current=null),B(i.id,f)},g=(l,d)=>{if(!u)return;const m={id:i.id};m[l]=d,n.setValue(m,{render:!0}),a(S=>S?{...S,[l]:d}:null)},R=l=>{l(n),n.render(!0)};return e.jsxs("aside",{style:N,children:[e.jsxs("div",{style:D,children:[e.jsx("div",{style:A,children:t("meta2d.props.text")}),e.jsx("div",{style:y,children:e.jsx("input",{onBlur:x,onChange:l=>o(l.target.value),onKeyDown:l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),l.target.blur())},style:{...w,flex:1,width:"100%"},type:"text",value:f})})]}),e.jsxs("div",{style:D,children:[e.jsx("div",{style:{...A,marginBottom:6},children:t("meta2d.props.appearance")}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.color")}),e.jsx("input",{onChange:l=>h("color",l.target.value),style:{...w,flex:1},type:"color",value:i.color||"#1f1f1f"})]}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.bg")}),e.jsx("input",{onChange:l=>h("background",l.target.value),style:{...w,flex:1},type:"color",value:i.background||"#ffffff"})]}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.dash")}),e.jsxs("select",{onChange:l=>h("dash",Number(l.target.value)),style:{...w,flex:1},value:String(i.dash??0),children:[e.jsx("option",{value:"0",children:t("meta2d.props.solid")}),e.jsx("option",{value:"1",children:t("meta2d.props.dashLine")})]})]}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.radius")}),e.jsx("input",{max:1,min:0,onChange:l=>h("borderRadius",Number(l.target.value)),step:.01,style:{...w,flex:1},type:"range",value:String(i.borderRadius??0)}),e.jsx("span",{style:{color:"#8c8c8c",fontSize:11,width:32},children:i.borderRadius??0})]}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.alpha")}),e.jsx("input",{max:1,min:0,onChange:l=>h("globalAlpha",Number(l.target.value)),step:.01,style:{...w,flex:1},type:"range",value:String(i.globalAlpha??1)}),e.jsx("span",{style:{color:"#8c8c8c",fontSize:11,width:32},children:(i.globalAlpha??1).toFixed(2)})]})]}),e.jsxs("div",{style:D,children:[e.jsx("div",{style:{...A,marginBottom:6},children:t("meta2d.props.position")}),[["X","x"],["Y","y"],["W","width"],["H","height"]].map(([l,d])=>e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:l}),e.jsx("input",{onChange:m=>g(d,Number(m.target.value)),style:{...w,flex:1},type:"number",value:u?u[d]:0})]},d))]}),e.jsxs("div",{style:D,children:[e.jsx("div",{style:{...A,marginBottom:6},children:t("meta2d.props.textAlign")}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.h")}),e.jsxs("select",{onChange:l=>h("textAlign",l.target.value),style:{...w,flex:1},value:i.textAlign||"center",children:[e.jsx("option",{value:"left",children:t("meta2d.props.left")}),e.jsx("option",{value:"center",children:t("meta2d.props.center")}),e.jsx("option",{value:"right",children:t("meta2d.props.right")})]})]}),e.jsxs("div",{style:y,children:[e.jsx("span",{style:b,children:t("meta2d.props.v")}),e.jsxs("select",{onChange:l=>h("textBaseline",l.target.value),style:{...w,flex:1},value:i.textBaseline||"middle",children:[e.jsx("option",{value:"top",children:t("meta2d.props.topAlign")}),e.jsx("option",{value:"middle",children:t("meta2d.props.middle")}),e.jsx("option",{value:"bottom",children:t("meta2d.props.bottomAlign")})]})]})]}),e.jsxs("div",{style:D,children:[e.jsx("div",{style:{...A,marginBottom:6},children:t("meta2d.props.layer")}),e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[e.jsx("button",{onClick:()=>R(l=>l.top()),style:T,type:"button",children:t("meta2d.props.top")}),e.jsx("button",{onClick:()=>R(l=>l.up()),style:T,type:"button",children:t("meta2d.props.up")}),e.jsx("button",{onClick:()=>R(l=>l.down()),style:T,type:"button",children:t("meta2d.props.down")}),e.jsx("button",{onClick:()=>R(l=>l.bottom()),style:T,type:"button",children:t("meta2d.props.bottom")})]})]})]})}const L={background:"#fff",border:"1px solid #d9d9d9",borderRadius:6,cursor:"pointer",minWidth:68,padding:"6px 12px"},E={...L,fontSize:12,minWidth:52,padding:"4px 10px"};function re(n){c.useEffect(()=>{const t=document.documentElement,i=document.body,r=t.style.overflow,u=i.style.overflow;return t.style.overflow="hidden",i.style.overflow="hidden",()=>{t.style.overflow=r,i.style.overflow=u}},[n])}function me({diagram:n,onClose:t,onSave:i}){const{t:r}=z(),u=c.useRef(null),a=c.useRef(null),f=c.useRef(n),v=c.useRef(t),[p,j]=c.useState(null),[B,k]=c.useState(!1);re(!0),c.useLayoutEffect(()=>{v.current=t}),c.useEffect(()=>{if(!u.current)return;X();const o=new _(u.current,{grid:!0,rule:!1});a.current=o,j(o);try{const g=f.current;g!=null&&g.trim()?o.open(JSON.parse(g)):o.open(H()),F(o.data()),o.render(!0)}catch{o.open(H()),F(o.data()),o.render(!0)}const x=g=>{g.key==="Escape"&&v.current()};return window.addEventListener("keydown",x),()=>{window.removeEventListener("keydown",x);try{o.destroy()}catch{}a.current=null}},[]);const C=async()=>{const o=a.current;if(o){k(!0);try{F(o.data()),o.render(!0);const x=O(o.data()),g=JSON.stringify(x);i(g,await Q(o)||await Y(g)||'<svg xmlns="http://www.w3.org/2000/svg" width="320" height="180" viewBox="0 0 320 180"><rect width="100%" height="100%" fill="#fafafa" stroke="#eee"/></svg>')}finally{k(!1)}}},h=o=>{const x=a.current;x&&o(x)};return e.jsx("div",{onClick:t,style:{alignItems:"center",background:"rgb(0 0 0 / 35%)",display:"flex",inset:0,justifyContent:"center",overflow:"hidden",position:"fixed",zIndex:1e3},children:e.jsxs("div",{onClick:o=>o.stopPropagation(),onWheel:o=>o.stopPropagation(),style:{background:"#fff",borderRadius:10,boxShadow:"0 12px 30px rgb(0 0 0 / 20%)",display:"flex",flexDirection:"column",height:"86vh",maxHeight:"100%",maxWidth:"1200px",overflow:"hidden",width:"92vw"},children:[e.jsxs("div",{style:{alignItems:"center",borderBottom:"1px solid #f0f0f0",display:"flex",flexWrap:"wrap",gap:8,justifyContent:"space-between",padding:"10px 14px"},children:[e.jsx("span",{style:{fontWeight:600},children:r("meta2d.editor.title")}),e.jsxs("div",{style:{alignItems:"center",display:"flex",flexWrap:"wrap",gap:8},children:[e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[e.jsx("button",{onClick:()=>h(o=>o.undo()),style:E,title:`${r("meta2d.editor.undo")} (Ctrl+Z)`,type:"button",children:r("meta2d.editor.undo")}),e.jsx("button",{onClick:()=>h(o=>o.redo()),style:E,title:`${r("meta2d.editor.redo")} (Ctrl+Y)`,type:"button",children:r("meta2d.editor.redo")}),e.jsx("button",{onClick:()=>h(o=>o.delete()),style:E,title:r("meta2d.editor.delete"),type:"button",children:r("meta2d.editor.delete")}),e.jsx("button",{onClick:()=>h(o=>o.fitView(!0)),style:E,title:r("meta2d.editor.fit"),type:"button",children:r("meta2d.editor.fit")}),e.jsx("button",{onClick:()=>h(o=>{o.scale(1),o.centerView()}),style:E,title:r("meta2d.editor.zoom100"),type:"button",children:r("meta2d.editor.zoom100")})]}),e.jsxs("div",{style:{display:"flex",gap:8},children:[e.jsx("button",{onClick:t,style:L,type:"button",children:r("meta2d.editor.close")}),e.jsx("button",{disabled:B,onClick:()=>void C(),style:{...L,background:"#1677ff",border:"none",color:"#fff"},type:"button",children:r(B?"meta2d.editor.saving":"meta2d.editor.save")})]})]})]}),e.jsxs("div",{style:{display:"flex",flex:1,minHeight:0,overflow:"hidden"},children:[e.jsx(ne,{engineRef:a}),e.jsx("div",{ref:u,style:{flex:1,minHeight:0,minWidth:0}}),e.jsx(ie,{engine:p})]})]})})}export{me as DiagramEditor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as i,j as n}from"./react-vendor-BuABiQkA.js";import{ad as ke}from"./ui-BQStT3dY.js";import{c as Y,g as Re,u as Ae,a as Ie,d as $e,b as Ye,f as Je,e as Ge,h as Ke,N as Xe,P as Qe,D as je,F as Ce,l as le,S as Se,i as Ze,M as pe,r as et,j as tt,k as nt,m as X,n as at,o as it,p as we}from"./index-
|
|
1
|
+
import{r as i,j as n}from"./react-vendor-BuABiQkA.js";import{ad as ke}from"./ui-BQStT3dY.js";import{c as Y,g as Re,u as Ae,a as Ie,d as $e,b as Ye,f as Je,e as Ge,h as Ke,N as Xe,P as Qe,D as je,F as Ce,l as le,S as Se,i as Ze,M as pe,r as et,j as tt,k as nt,m as X,n as at,o as it,p as we}from"./index-BkKvQv2F.js";import{z as ot,A as st,m as de,n as rt,o as ct,p as lt,r as dt,s as ut,t as mt,v as ft,x as ht,B as yt,R as gt,a as xt,b as Me,c as vt,d as bt,e as kt,f as It,g as jt,h as Ct,i as St,w as ue,j as wt,O as Mt,E as Et,q as Nt,l as Dt,C as Rt,D as At}from"./react-GP8hKHRA.js";import{H as Pt,a as Tt,b as Lt,M as Bt,T as _t,S as Ot,W as zt,o as Ht,c as Ee}from"./Toolbar-BHLX-ug4.js";import{V as Ft}from"./VisitorPickerModal-BPyEWlQo.js";import"./motion-DX3HNq_4.js";import"./diagram-CT58wBdU.js";import"./editor-CL03se2B.js";import"./plus-ECzYbQfA.js";import"./copy-BE64wQqi.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as b,j as o}from"./react-vendor-BuABiQkA.js";import{b as V,av as _,aw as J,ax as Q,ay as X}from"./index-
|
|
1
|
+
import{r as b,j as o}from"./react-vendor-BuABiQkA.js";import{b as V,av as _,aw as J,ax as Q,ay as X}from"./index-BkKvQv2F.js";import{E as Y,B as Z}from"./react-GP8hKHRA.js";import"./ui-BQStT3dY.js";import"./motion-DX3HNq_4.js";import"./diagram-CT58wBdU.js";import"./editor-CL03se2B.js";import"./plus-ECzYbQfA.js";import"./copy-BE64wQqi.js";function B({lexicalJson:e,onMarkdown:n,onError:s}){const[u,l]=b.useState(null),i=b.useRef(!1);return b.useEffect(()=>{i.current=!1},[e]),b.useEffect(()=>{if(!(!u||i.current))try{u.setDocument("json",e);const c=u.getDocument("markdown");typeof c=="string"&&(i.current=!0,n(c))}catch{s==null||s()}},[u,e,n,s]),o.jsx("div",{className:"mdocs-lexical-md-bridge","aria-hidden":!0,children:o.jsx(Y,{content:e,type:"json",editable:!1,onInit:l,plugins:[Z]})})}function ee(e){const{t:n}=V(),[s,u]=b.useState(0),l=e.segments.filter(t=>t.kind==="conflict"),i=e.unresolvedCount>0;b.useEffect(()=>{if(l.length===0){u(0);return}u(t=>Math.min(t,l.length-1))},[l.length]);function c(t){l.length!==0&&u(d=>{var f;const a=(d+t+l.length)%l.length;return(f=document.getElementById(`mdocs-merge-hunk-${a}`))==null||f.scrollIntoView({block:"center",behavior:"smooth"}),a})}let r=-1;return o.jsxs("div",{className:"mdocs-merge-inline-pane",children:[o.jsxs("div",{className:"mdocs-merge-inline-toolbar",children:[o.jsx("span",{className:"mdocs-merge-inline-hint",children:i?n("mergeReviewHint"):l.length===0?n("mergeNoConflicts"):n("mergeEditAfterResolve")}),l.length>0?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",onClick:e.onUseAllMine,children:n("mergeUseAllMine")}),o.jsx("button",{type:"button",onClick:e.onUseAllTheirs,children:n("mergeUseAllTheirs")})]}):null]}),i?o.jsxs("div",{className:"mdocs-merge-inline",role:"document",children:[e.segments.map((t,d)=>{if(t.kind==="unchanged")return o.jsx("pre",{className:"mdocs-merge-inline-same",children:t.lines.map((x,g)=>o.jsxs("div",{className:"mdocs-ai-write-line ctx",children:[o.jsx("span",{className:"mdocs-ai-write-rail","aria-hidden":!0}),o.jsx("span",{className:"mdocs-ai-write-code",children:x||" "})]},g))},`u-${d}`);r+=1;const a=r,f=t.resolution!=="unresolved",m=a===s;return o.jsxs("div",{id:`mdocs-merge-hunk-${a}`,className:"mdocs-merge-inline-hunk"+(m?" is-active":"")+(f?" is-resolved":""),onClick:()=>u(a),children:[f?o.jsx("div",{className:"mdocs-merge-hunk-resolved-tag",children:t.resolution==="remote"?n("mergeReceive"):n("mergeReject")}):o.jsxs("div",{className:"mdocs-merge-hunk-actions",children:[o.jsx("button",{type:"button",className:"mdocs-ai-write-hunk-reject",onClick:x=>{x.stopPropagation(),e.onReject(t.id)},children:n("mergeReject")}),o.jsx("button",{type:"button",className:"mdocs-ai-write-hunk-accept",onClick:x=>{x.stopPropagation(),e.onReceive(t.id)},children:n("mergeReceive")})]}),o.jsxs("pre",{className:"mdocs-ai-write-hunk-pre",children:[t.localLines.map((x,g)=>o.jsxs("div",{className:"mdocs-ai-write-line del",children:[o.jsx("span",{className:"mdocs-ai-write-rail","aria-hidden":!0}),o.jsx("span",{className:"mdocs-ai-write-code",children:x||" "})]},`l${g}`)),t.remoteLines.map((x,g)=>o.jsxs("div",{className:"mdocs-ai-write-line add",children:[o.jsx("span",{className:"mdocs-ai-write-rail","aria-hidden":!0}),o.jsx("span",{className:"mdocs-ai-write-code",children:x||" "})]},`r${g}`))]})]},t.id)}),l.length>0?o.jsxs("div",{className:"mdocs-ai-write-float-nav",role:"toolbar","aria-label":"冲突导航",children:[o.jsx("button",{type:"button","aria-label":"上一段",onClick:()=>c(-1),children:"↑"}),o.jsxs("span",{children:[s+1," / ",l.length]}),o.jsx("button",{type:"button","aria-label":"下一段",onClick:()=>c(1),children:"↓"}),l[s]&&l[s].resolution==="unresolved"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"mdocs-ai-write-hunk-reject",onClick:()=>e.onReject(l[s].id),children:n("mergeReject")}),o.jsx("button",{type:"button",className:"mdocs-ai-write-hunk-accept",onClick:()=>e.onReceive(l[s].id),children:n("mergeReceive")})]}):null]}):null]}):o.jsx("textarea",{className:"mdocs-merge-inline-editor",value:e.editableMarkdown,onChange:t=>e.onEditableChange(t.target.value),spellCheck:!1})]})}function te(e,n){let s={};for(let i=0;i<n.length;i++){const c=n[i];s[c]?s[c].push(i):s[c]=[i]}let l=[{buffer1index:-1,buffer2index:-1,chain:null}];for(let i=0;i<e.length;i++){const c=e[i],r=s[c]||[];let t=0,d=l[0];for(let a=0;a<r.length;a++){const f=r[a];let m;for(m=t;m<l.length&&!(l[m].buffer2index<f&&(m===l.length-1||l[m+1].buffer2index>f));m++);if(m<l.length){const x={buffer1index:i,buffer2index:f,chain:l[m]};if(t===l.length?l.push(d):l[t]=d,t=m+1,d=x,t===l.length)break}}l[t]=d}return l[l.length-1]}function q(e,n){const s=te(e,n);let u=[],l=e.length,i=n.length;for(let c=s;c!==null;c=c.chain){const r=l-c.buffer1index-1,t=i-c.buffer2index-1;l=c.buffer1index,i=c.buffer2index,(r||t)&&u.push({buffer1:[l+1,r],buffer1Content:e.slice(l+1,l+1+r),buffer2:[i+1,t],buffer2Content:n.slice(i+1,i+1+t)})}return u.reverse(),u}function ne(e,n,s){let u=[];function l(t,d){u.push({ab:d,oStart:t.buffer1[0],oLength:t.buffer1[1],abStart:t.buffer2[0],abLength:t.buffer2[1]})}q(n,e).forEach(t=>l(t,"a")),q(n,s).forEach(t=>l(t,"b")),u.sort((t,d)=>t.oStart-d.oStart);let i=[],c=0;function r(t){t>c&&(i.push({stable:!0,buffer:"o",bufferStart:c,bufferLength:t-c,bufferContent:n.slice(c,t)}),c=t)}for(;u.length;){let t=u.shift(),d=t.oStart,a=t.oStart+t.oLength,f=[t];for(r(d);u.length;){const m=u[0],x=m.oStart;if(x>a)break;a=Math.max(a,x+m.oLength),f.push(u.shift())}if(f.length===1){if(t.abLength>0){const m=t.ab==="a"?e:s;i.push({stable:!0,buffer:t.ab,bufferStart:t.abStart,bufferLength:t.abLength,bufferContent:m.slice(t.abStart,t.abStart+t.abLength)})}}else{let m={a:[e.length,-1,n.length,-1],b:[s.length,-1,n.length,-1]};for(;f.length;){t=f.shift();const v=t.oStart,p=v+t.oLength,L=t.abStart,w=L+t.abLength;let S=m[t.ab];S[0]=Math.min(L,S[0]),S[1]=Math.max(w,S[1]),S[2]=Math.min(v,S[2]),S[3]=Math.max(p,S[3])}const x=m.a[0]+(d-m.a[2]),g=m.a[1]+(a-m.a[3]),j=m.b[0]+(d-m.b[2]),h=m.b[1]+(a-m.b[3]);let y={stable:!1,aStart:x,aLength:g-x,aContent:e.slice(x,g),oStart:d,oLength:a-d,oContent:n.slice(d,a),bStart:j,bLength:h-j,bContent:s.slice(j,h)};i.push(y)}c=a}return r(n.length),i}function le(e,n,s,u){u=Object.assign({excludeFalseConflicts:!0,stringSeparator:/\s+/},u),typeof e=="string"&&(e=e.split(u.stringSeparator)),typeof n=="string"&&(n=n.split(u.stringSeparator)),typeof s=="string"&&(s=s.split(u.stringSeparator));let i=[];const c=ne(e,n,s);let r=[];function t(){r.length&&i.push({ok:r}),r=[]}function d(a,f){if(a.length!==f.length)return!1;for(let m=0;m<a.length;m++)if(a[m]!==f[m])return!1;return!0}return c.forEach(a=>{a.stable?r.push(...a.bufferContent):u.excludeFalseConflicts&&d(a.aContent,a.bContent)?r.push(...a.aContent):(t(),i.push({conflict:{a:a.aContent,aIndex:a.aStart,o:a.oContent,oIndex:a.oStart,b:a.bContent,bIndex:a.bStart}}))}),t(),i}const se=/^<!--\s*mdocs-merge-conflict:([^\s]+)\s*-->$/;function ie(e){return`<!-- mdocs-merge-conflict:${e} -->`}function oe(e){const n=e.trim().match(se);return(n==null?void 0:n[1])??null}function M(e){return e===""?[]:e.split(`
|
|
2
2
|
`)}function H(e,n){return e.length===n.length&&e.every((s,u)=>s===n[u])}function ce(e,n,s){const u=M(e),l=M(n),i=M(s);if(l.length===0&&n==="")return re(e,s);const c=le(u,l,i),r=[];let t=0,d=0,a=0,f=0;const m=(g,j,h,y)=>{r.push({kind:"conflict",id:`conflict-${t}`,conflictKind:y,baseLines:g,localLines:j,remoteLines:h,resolution:"unresolved"}),t+=1},x=(g,j,h)=>{if(j.length===0&&g.length===0&&h.length===0)return;if(H(g,j)&&H(h,j)){j.length>0&&r.push({kind:"unchanged",lines:[...j]});return}if(g.length===j.length&&h.length===j.length){let v=[];const p=()=>{v.length>0&&(r.push({kind:"unchanged",lines:v}),v=[])};for(let L=0;L<j.length;L+=1){const w=j[L],S=g[L],N=h[L];S===w&&N===w?v.push(w):(p(),m([w],[S],[N],S!==w&&N!==w&&S!==N?"true_conflict":"change"))}p();return}const y=g.join(`
|
|
3
3
|
`)!==j.join(`
|
|
4
4
|
`)&&h.join(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as n,j as o,ad as C}from"./react-vendor-BuABiQkA.js";import{u as N,E as T,R as I,a as E,b as M,c as j,d as O,e as P,f as A,g as _,h as D,i as L,w as f,j as H,k as F,l as q,I as U,m as b,n as V,o as J,p as W,q as z,r as B,s as $,t as K,v as Y,x as G,y as Z}from"./react-
|
|
1
|
+
import{r as n,j as o,ad as C}from"./react-vendor-BuABiQkA.js";import{u as N,E as T,R as I,a as E,b as M,c as j,d as O,e as P,f as A,g as _,h as D,i as L,w as f,j as H,k as F,l as q,I as U,m as b,n as V,o as J,p as W,q as z,r as B,s as $,t as K,v as Y,x as G,y as Z}from"./react-GP8hKHRA.js";import{a7 as Q,a8 as X,a9 as ee,aa as te,ab as k,ac as oe}from"./ui-BQStT3dY.js";import{H as re,a as ae,b as ne,M as le,T as ie,S as se,W as de,c as R,o as ce}from"./Toolbar-BHLX-ug4.js";import{N as me}from"./index-BkKvQv2F.js";import"./editor-CL03se2B.js";import"./diagram-CT58wBdU.js";import"./plus-ECzYbQfA.js";import"./copy-BE64wQqi.js";import"./motion-DX3HNq_4.js";const ue=({children:h,json:r,markdown:a,collapsible:m=!1,defaultActiveKey:y=["editor","text","json"],onJSONChange:p})=>{const[g,c]=n.useState(r),s=n.useRef(r);n.useEffect(()=>{r!==s.current&&(c(r),s.current=r)},[r]);const x=n.useCallback(d=>{s.current=d,c(d)},[]);return o.jsxs(o.Fragment,{children:[o.jsx(Q,{}),o.jsx(X,{collapsible:m,defaultActiveKey:y,items:[{children:h,key:"editor",label:"Playground"},{children:o.jsx(ee,{language:"markdown",style:{fontSize:12,padding:16},variant:"borderless",children:a}),key:"text",label:"Text Output"},{children:o.jsx(te,{language:"json",onBlur:()=>{if(r!==s.current)try{const d=JSON.parse(s.current||"");p==null||p(d)}catch(d){console.error("Invalid JSON:",d)}},onValueChange:x,value:g,variant:"borderless"}),key:"json",label:"JSON Output"}],padding:{body:0},style:{border:"none",borderRadius:0,width:"100%"},variant:"outlined"})]})},he={children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Welcome to the Lobe Editor Demo!",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"heading",version:1,tag:"h1"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"In case you were wondering what the black box at the bottom is – it's the debug view, showing the current state of the editor. You can disable it by pressing on the settings control in the bottom-left of your screen and toggling the debug view setting.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"quote",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"The playground is a demo environment built with ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:"@lobehub/editor",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"codeInline",version:1},{detail:0,format:0,mode:"normal",style:"",text:"\uFEFF",type:"cursor",version:1},{detail:0,format:0,mode:"normal",style:"",text:". Try typing in ",type:"text",version:1},{detail:0,format:1,mode:"normal",style:"",text:"some text",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:" with ",type:"text",version:1},{detail:0,format:2,mode:"normal",style:"",text:"different formats",type:"text",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{children:[{detail:0,format:0,mode:"normal",style:"",text:"Visit the ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lobe Editor website",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://editor.lobehub.com"},{detail:0,format:0,mode:"normal",style:"",text:" for documentation and more information.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Check out the code on our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"GitHub repository",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://github.com/lobehub/lobe-editor",url:"https://github.com/lobehub/lobe-editor"},{detail:0,format:0,mode:"normal",style:"",text:".",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:2},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Playground code",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:"noreferrer",target:null,title:null,url:"https://github.com/lobehub/lobe-editor/blob/master/src/react/Editor/demos/index.tsx"},{detail:0,format:0,mode:"normal",style:"",text:" can be found here.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:3},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Join our ",type:"text",version:1},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Discover Server",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"link",version:1,rel:null,target:null,title:"https://discord.gg/AYFPHvv2jT",url:"https://discord.gg/AYFPHvv2jT"},{detail:0,format:0,mode:"normal",style:"",text:" and chat with the team.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"listitem",version:1,value:4}],direction:"ltr",format:"",indent:0,type:"list",version:1,listType:"bullet",start:1,tag:"ul"},{children:[{detail:0,format:0,mode:"normal",style:"",text:"Lastly, we're constantly adding cool new features to this playground. So make sure you check back here when you next get a chance 🙂.",type:"text",version:1}],direction:"ltr",format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""},{children:[{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"import",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"{",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:"Editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-error);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"}",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"from",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-text);",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-success);",text:"@lobehub/editor",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:"'",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"color: var(--ant-color-info);",text:";",type:"code-highlight",version:1}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript",theme:"lobe-theme"},{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:"ltr",format:"",indent:0,type:"root",version:1},ye={root:he};function S(h,r){let a;const m=(...y)=>{a!==void 0&&clearTimeout(a),a=setTimeout(()=>h(...y),r)};return m.cancel=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},m}window.__scrollIntoView=Z;const pe=h=>{const r=N(),a=n.useRef([]),[m,y]=n.useState(""),[p,g]=n.useState(""),c=n.useMemo(()=>S(t=>{const e=t.getDocument("markdown"),l=t.getDocument("json");g(e||""),y(JSON.stringify(l||{},null,2))},200),[]),s=n.useMemo(()=>S(t=>{r&&(console.info("handleJSONChange",t),r.setDocument("json",t))},200),[r]),x=t=>{window.editor=t,c(t)};n.useEffect(()=>()=>{for(const t of a.current)URL.revokeObjectURL(t);a.current=[],c.cancel(),s.cancel(),delete window.editor,delete window.__scrollIntoView},[c,s]);const d=n.useMemo(()=>[{icon:o.jsx(k,{avatar:"💻",size:24}),key:"bot1",label:"前端研发专家",metadata:{id:"bot1"}},{icon:o.jsx(k,{avatar:"🌍",size:24}),key:"bot2",label:"中英文互译助手",metadata:{id:"bot2"}},{icon:o.jsx(k,{avatar:"📖",size:24}),key:"bot3",label:"学术写作增强专家",metadata:{id:"bot3"}}],[]),w=n.useMemo(()=>[{icon:re,key:"h1",label:"Heading 1",onSelect:e=>{e.dispatchCommand(b,{tag:"h1"})}},{icon:ae,key:"h2",label:"Heading 2",onSelect:e=>{e.dispatchCommand(b,{tag:"h2"})}},{icon:ne,key:"h3",label:"Heading 3",onSelect:e=>{e.dispatchCommand(b,{tag:"h3"})}},{type:"divider"},{icon:le,key:"hr",label:"Hr",onSelect:e=>{e.dispatchCommand(V,{})}},{icon:ie,key:"table",label:"Table",onSelect:e=>{e.dispatchCommand(J,{columns:"3",rows:"3"})}},{icon:se,key:"tex",label:"Tex",onSelect:e=>{e.dispatchCommand(W,{code:"x^2 + y^2 = z^2"}),queueMicrotask(()=>{e.focus()})}},{type:"divider"},{key:"file",label:"File",onSelect:e=>{ce(l=>{for(const u of l)e.dispatchCommand(z,{file:u})})}},{key:"set-text-content",label:"SetTextContent",onSelect:e=>{e.setDocument("text",`123
|
|
2
2
|
123`),queueMicrotask(()=>{e.focus()})}},{key:"insert-link",label:"InsertLink",onSelect:e=>{e.dispatchCommand(B,{url:"https://example.com"}),queueMicrotask(()=>{e.focus()})}},{key:"insert-codeInline",label:"InsertCodeInline",onSelect:e=>{e.dispatchCommand($,void 0),queueMicrotask(()=>{e.focus()})}},{key:"insert-codeBlock",label:"InsertCodeBlock",onSelect:e=>{e.dispatchCommand(K,void 0),queueMicrotask(()=>{e.focus()})}},{icon:de,key:"meta2d",label:"Meta2d",onSelect:e=>{e.dispatchCommand(Y,void 0),queueMicrotask(()=>{e.focus()})}},{icon:me,key:"markmap",label:"Markmap",onSelect:e=>{e.dispatchCommand(G,void 0),queueMicrotask(()=>{e.focus()})}}].map(e=>e.type==="divider"?e:{...e,extra:o.jsx(oe,{code:!0,fontSize:12,type:"secondary",children:e.key})}),[]);return o.jsxs(ue,{json:m,markdown:p,onJSONChange:s,...h,children:[o.jsx(R,{editor:r}),o.jsx(T,{className:"mdocs-playground-editor",content:ye,editor:r,lineEmptyPlaceholder:"Start typing here...",mentionOption:{items:d,markdownWriter:t=>{var e;return`
|
|
3
3
|
<mention>${t.label}[${((e=t.metadata)==null?void 0:e.id)||t.label}]</mention>
|
|
4
4
|
`},onSelect:(t,e)=>{t.dispatchCommand(U,{label:String(e.label),metadata:{id:e.key}})},searchKeys:["label"]},onInit:x,onTextChange:c,pasteVSCodeAsCodeBlock:!0,placeholder:"Type something...",plugins:[I,E,M,j,O,P,A,_,D,L,f(H,{children:o.jsx(R,{editor:r,floating:!0})}),f(F,{delay:1e3,onAutoComplete:async({input:t,afterText:e,selectionType:l,abortSignal:u})=>{console.log("Auto-complete triggered:",{afterText:e,input:t,selectionType:l});try{const v=await fetch(`${location.origin}/nodeserver/completion`,{body:JSON.stringify({prompt:`Please complete the following text:
|