@yosai/cli 0.2.1-test.1 → 0.2.1-test.11
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 +11 -9
- package/dist/cli.js +3 -2
- package/dist/commands/doctor.js +14 -13
- package/dist/commands/login.js +8 -12
- package/dist/commands/ping.js +4 -4
- package/dist/commands/skill.js +3 -3
- package/dist/commands/update.js +59 -20
- package/dist/commands/version.js +8 -8
- package/dist/config.js +12 -23
- package/dist/domain-commands.js +13 -4
- package/dist/domain-executor.js +3 -0
- package/dist/endpoints.js +13 -8
- package/dist/errors.js +6 -0
- package/dist/npm-meta.js +88 -11
- package/dist/openapis-client.js +27 -8
- package/dist/skill-sync.js +16 -4
- package/dist/skills/yos/SKILL.md +23 -14
- package/dist/skills/yos-doc/SKILL.md +221 -0
- package/dist/skills/yos-doc/references/AGENT_SCHEMA.doc.md +69 -0
- package/dist/skills/yos-doc/references/DOC_DATA_API.md +624 -0
- package/dist/skills/yos-doc/references/doc-draft.template.json +721 -0
- package/dist/skills/yos-doc/references/few-shot.draft.json +195 -0
- package/dist/skills/yos-doc/scripts/validate-runtime-doc.mjs +370 -0
- package/dist/skills/yos-doc/scripts/yos-doc.mjs +157 -0
- package/dist/skills/yos-install/SKILL.md +46 -20
- package/dist/skills/{yos-kb → yos-knowledge}/SKILL.md +21 -8
- package/dist/skills/yos-retrieval/SKILL.md +1 -1
- package/dist/skills/yos-shared/SKILL.md +23 -14
- package/dist/skills/yos-sheet/SKILL.md +233 -0
- package/dist/skills/yos-sheet/references/AGENT_SCHEMA.sheet.md +105 -0
- package/dist/skills/yos-sheet/references/SHEET_DATA_API.md +356 -0
- package/dist/skills/yos-sheet/references/few-shot.workbook.json +50 -0
- package/dist/skills/yos-sheet/references/sheet-workbook.template.json +147 -0
- package/dist/skills/yos-sheet/scripts/validate-runtime-sheet.mjs +404 -0
- package/dist/skills/yos-sheet/scripts/yos-sheet.mjs +157 -0
- package/dist/skills/yos-support/SKILL.md +1 -1
- package/dist/skills/yos-transcript/SKILL.md +1 -1
- package/dist/update-check-worker.js +35 -0
- package/dist/update-notice.js +86 -0
- package/package.json +4 -2
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
# 文档页数据字段全量枚举
|
|
2
|
+
|
|
3
|
+
> 按 TipTap JSON 的 **`type` 逐个列出全部 `attrs`(及 `text` / `marks`)** 与含义。
|
|
4
|
+
> 依据:本仓库扩展源码 + TipTap/StarterKit 默认字段;形态对照真实草稿(如 `paragraph` + `attrs`)。
|
|
5
|
+
> 正文无内嵌服务端 HTTP;媒体二进制经宿主 `DocMediaHooks`(或 Demo IndexedDB)。本文是草稿 JSON 契约。存储键见文末。
|
|
6
|
+
> **Agent 生成请用精简契约** [`AGENT_SCHEMA.doc.md`](./AGENT_SCHEMA.doc.md) + `node "<技能目录>/scripts/yos-doc.mjs" validate`,勿把本文整份塞进 prompt。
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## 0. 节点通用形
|
|
11
|
+
|
|
12
|
+
```json
|
|
13
|
+
{
|
|
14
|
+
"type": "<节点名>",
|
|
15
|
+
"attrs": {},
|
|
16
|
+
"content": [],
|
|
17
|
+
"marks": [],
|
|
18
|
+
"text": "仅 text 节点"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
| 字段 | 含义 |
|
|
23
|
+
| --------- | --------------------------------------- |
|
|
24
|
+
| `type` | 节点/标记种类 |
|
|
25
|
+
| `attrs` | 该 type 的参数表;无参数时可省略或 `{}` |
|
|
26
|
+
| `content` | 子节点数组 |
|
|
27
|
+
| `marks` | 仅挂在 `text` 上的行内样式 |
|
|
28
|
+
| `text` | 纯文本内容(仅 `type: "text"`) |
|
|
29
|
+
|
|
30
|
+
草稿根:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"title": "文档标题(不在 doc 树内)",
|
|
35
|
+
"content": { "type": "doc", "content": [/* 块节点 */] }
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 1. `doc`(根)
|
|
42
|
+
|
|
43
|
+
| 参数 | 有无 | 说明 |
|
|
44
|
+
| ------------ | ---- | ------------ |
|
|
45
|
+
| (无 attrs) | — | 根容器 |
|
|
46
|
+
| `content` | 必有 | 块级节点列表 |
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## 2. `paragraph`(段落)
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"type": "paragraph",
|
|
55
|
+
"attrs": { "indent": 0, "textAlign": null },
|
|
56
|
+
"content": [{ "type": "text", "text": "…" }]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
61
|
+
| ----------- | ---------------- | ------ | ---------------------------- | --------------------------------------------------------------- |
|
|
62
|
+
| `indent` | `number` | `0` | 段落左缩进级数(非列表嵌套) | `0`~`8`;每级 24px |
|
|
63
|
+
| `textAlign` | `string \| null` | `null` | 水平对齐 | `null`(未设)/ `"left"` / `"center"` / `"right"` / `"justify"` |
|
|
64
|
+
| `content` | 节点[] | | 行内:`text` 等 | 可空(空段) |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 3. `heading`(标题)
|
|
69
|
+
|
|
70
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
71
|
+
| ----------- | ---------------- | ------- | ---------------------------- | ----------------- |
|
|
72
|
+
| `level` | `number` | `1` | 标题级别 | `1`~`6`(H1–H6) |
|
|
73
|
+
| `indent` | `number` | `0` | 缩进级数 | `0`~`8` |
|
|
74
|
+
| `textAlign` | `string \| null` | `null` | 对齐 | 同 paragraph |
|
|
75
|
+
| `collapsed` | `boolean` | `false` | 是否折叠本节(至同级/更高级标题前) | `true` / `false` |
|
|
76
|
+
| `content` | 节点[] | | 行内文本 | |
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"type": "heading",
|
|
81
|
+
"attrs": { "level": 1, "indent": 0, "textAlign": null, "collapsed": false },
|
|
82
|
+
"content": [{ "type": "text", "text": "一级标题" }]
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 4. `blockquote`(引用)
|
|
89
|
+
|
|
90
|
+
| 参数 | 有无 | 含义 |
|
|
91
|
+
| ------------ | ---- | ------------------------------ |
|
|
92
|
+
| (无 attrs) | — | 左侧竖线引用块 |
|
|
93
|
+
| `content` | 必有 | 一块或多块(多为 `paragraph`) |
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## 5. `horizontalRule`(分割线)
|
|
98
|
+
|
|
99
|
+
| 参数 | 有无 | 含义 |
|
|
100
|
+
| ------------ | ---- | ----------------------------- |
|
|
101
|
+
| (无 attrs) | — | 水平分割线 atom,无 `content` |
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{ "type": "horizontalRule" }
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## 5.1 `hardBreak`(软换行)
|
|
110
|
+
|
|
111
|
+
| 参数 | 有无 | 含义 |
|
|
112
|
+
| ------------ | ---- | --------------------------------------- |
|
|
113
|
+
| (无 attrs) | — | 行内硬换行(Shift+Enter),无 `content` |
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{ "type": "hardBreak" }
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
> 属 StarterKit 内联节点;落在 `paragraph` / `heading` 等的 `content` 里,与 `text` 并列。
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 6. `bulletList`(无序列表)
|
|
124
|
+
|
|
125
|
+
| 参数 | 有无 | 含义 |
|
|
126
|
+
| ------------ | ---- | ---------------------------------------- |
|
|
127
|
+
| (无 attrs) | — | 项目符号列表 |
|
|
128
|
+
| `content` | 必有 | `listItem` 数组;可多层嵌套 `bulletList` |
|
|
129
|
+
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## 7. `orderedList`(有序列表)
|
|
133
|
+
|
|
134
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
135
|
+
| --------- | ---------------- | ------ | --------------- | ---------------------------------------------- |
|
|
136
|
+
| `start` | `number` | `1` | 起始序号 | 正整数 |
|
|
137
|
+
| `type` | `string \| null` | `null` | HTML ol 的 type | 本 Demo 常为 `null`(由层级样式控制 1./a./i.) |
|
|
138
|
+
| `content` | 节点[] | | `listItem` 列表 | |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## 8. `listItem`(列表项)
|
|
143
|
+
|
|
144
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
145
|
+
| ----------- | --------- | ------- | ---------------------------------------------- | ---------------- |
|
|
146
|
+
| `collapsed` | `boolean` | `false` | 是否折叠本项下嵌套的有序/无序列表 | `true` / `false` |
|
|
147
|
+
| `content` | 节点[] | | 通常为 `paragraph`/`heading`,其后可再跟嵌套列表 | |
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"type": "listItem",
|
|
152
|
+
"attrs": { "collapsed": false },
|
|
153
|
+
"content": [
|
|
154
|
+
{ "type": "paragraph", "content": [{ "type": "text", "text": "一级" }] },
|
|
155
|
+
{
|
|
156
|
+
"type": "bulletList",
|
|
157
|
+
"content": [
|
|
158
|
+
{
|
|
159
|
+
"type": "listItem",
|
|
160
|
+
"attrs": { "collapsed": false },
|
|
161
|
+
"content": [
|
|
162
|
+
{ "type": "paragraph", "content": [{ "type": "text", "text": "二级" }] }
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 9. `taskList`(任务列表)
|
|
174
|
+
|
|
175
|
+
| 参数 | 有无 | 含义 |
|
|
176
|
+
| ------------ | ---- | --------------- |
|
|
177
|
+
| (无 attrs) | — | 待办列表容器 |
|
|
178
|
+
| `content` | 必有 | `taskItem` 数组 |
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## 10. `taskItem`(任务项)
|
|
183
|
+
|
|
184
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
185
|
+
| --------- | --------- | ------- | ------------------------ | ---------------- |
|
|
186
|
+
| `checked` | `boolean` | `false` | 是否勾选完成 | `true` / `false` |
|
|
187
|
+
| `content` | 节点[] | | 多为带文本的 `paragraph` | |
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"type": "taskItem",
|
|
192
|
+
"attrs": { "checked": true },
|
|
193
|
+
"content": [
|
|
194
|
+
{
|
|
195
|
+
"type": "paragraph",
|
|
196
|
+
"attrs": { "indent": 0, "textAlign": null },
|
|
197
|
+
"content": [{ "type": "text", "text": "123123123" }]
|
|
198
|
+
}
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## 11. `codeBlock`(代码块)
|
|
206
|
+
|
|
207
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
208
|
+
| ------------- | ----------- | ------------- | ----------------------------------------- | ---------------------------------------------------------------------------- |
|
|
209
|
+
| `language` | `string` | `"plaintext"` | 语法高亮语言 id | 如 `javascript`、`python`、`plaintext` 等(见 `constants/codeLanguages.ts`) |
|
|
210
|
+
| `wrap` | `boolean` | `false` | 是否自动换行 | `true` / `false` |
|
|
211
|
+
| `caption` | `string` | `"代码块"` | 顶栏标题 | 任意字符串 |
|
|
212
|
+
| `collapsed` | `boolean` | `false` | 整块是否折叠(仅展示顶栏) | `true` / `false` |
|
|
213
|
+
| `regionFolds` | `number[]` | `[]` | 块内已折叠区域的起始行号(1-based) | 如 `[1, 10]`;无效行号加载后会被校正丢掉 |
|
|
214
|
+
| `content` | 节点[] | | 一般为单个 `text`(整段代码) | |
|
|
215
|
+
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"type": "codeBlock",
|
|
219
|
+
"attrs": {
|
|
220
|
+
"language": "javascript",
|
|
221
|
+
"wrap": false,
|
|
222
|
+
"caption": "代码块",
|
|
223
|
+
"collapsed": false,
|
|
224
|
+
"regionFolds": [1]
|
|
225
|
+
},
|
|
226
|
+
"content": [{ "type": "text", "text": "function demo() {\n console.log(1)\n}" }]
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
> `collapsed` / `regionFolds` 随文档 JSON 持久化;Markdown / DOCX 导出不保留折叠 UI(正文仍为完整代码)。`regionFolds` 按行号锚定,在折叠点上方增删行可能导致错位。
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 12. `callout`(高亮块)
|
|
235
|
+
|
|
236
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
237
|
+
| ----------------- | ---------------- | ------ | -------------- | --------------------------------------------------------------------- |
|
|
238
|
+
| `emoji` | `string` | `"💡"` | 左侧图标 emoji | 任意短字符串 |
|
|
239
|
+
| `backgroundColor` | `string \| null` | `null` | 填充色 | CSS 色如 `"#e1eafe"`;`null` 用默认浅红底;`"transparent"` 无填充 |
|
|
240
|
+
| `borderColor` | `string \| null` | `null` | 边框色 | CSS 色如 `"#80a7f9"`;`null` 用默认浅红描边;`"transparent"` 无边框色 |
|
|
241
|
+
| `content` | 节点[] | | 一块或多块正文 | |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 13. `table`(表格)
|
|
246
|
+
|
|
247
|
+
| 参数 | 有无 | 含义 |
|
|
248
|
+
| ------------ | ---- | --------------- |
|
|
249
|
+
| (无 attrs) | — | 表格容器 |
|
|
250
|
+
| `content` | 必有 | `tableRow` 数组 |
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## 14. `tableRow`(表行)
|
|
255
|
+
|
|
256
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
257
|
+
| --------- | ---------------- | ------ | --------------------------- | --------------------------------- |
|
|
258
|
+
| `height` | `number \| null` | `null` | 行高(px) | `null` 用默认最小行高;数字为像素 |
|
|
259
|
+
| `content` | 节点[] | | `tableHeader` / `tableCell` | |
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 15. `tableHeader`(表头格)
|
|
264
|
+
|
|
265
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
266
|
+
| ----------------- | ------------------ | ------ | ------------------------------ | ------------------------------------------ |
|
|
267
|
+
| `colspan` | `number` | `1` | 横向合并列数 | ≥1 |
|
|
268
|
+
| `rowspan` | `number` | `1` | 纵向合并行数 | ≥1 |
|
|
269
|
+
| `colwidth` | `number[] \| null` | `null` | 本格覆盖的各列像素宽 | 长度应等于 `colspan`;删列后应保留剩余列宽 |
|
|
270
|
+
| `align` | `string \| null` | `null` | 单元格内容对齐(TipTap Table) | `null` / 对齐字面量 |
|
|
271
|
+
| `backgroundColor` | `string \| null` | `null` | 单元格背景色 | CSS 色,如 `"#f8e6a0"`;`null` 无底色 |
|
|
272
|
+
| `content` | 节点[] | | 多为 `paragraph` | |
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## 16. `tableCell`(表体格)
|
|
277
|
+
|
|
278
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 |
|
|
279
|
+
| ----------------- | ------------------ | ------ | -------------------- | -------------------- |
|
|
280
|
+
| `colspan` | `number` | `1` | 横向合并列数 | ≥1 |
|
|
281
|
+
| `rowspan` | `number` | `1` | 纵向合并行数 | ≥1 |
|
|
282
|
+
| `colwidth` | `number[] \| null` | `null` | 本格覆盖的各列像素宽 | 长度应等于 `colspan` |
|
|
283
|
+
| `align` | `string \| null` | `null` | 单元格内容对齐 | `null` / 对齐字面量 |
|
|
284
|
+
| `backgroundColor` | `string \| null` | `null` | 单元格背景色 | CSS 色或 `null` |
|
|
285
|
+
| `content` | 节点[] | | 多为 `paragraph` | |
|
|
286
|
+
|
|
287
|
+
(与 `tableHeader` 字段集合相同,语义同 §15。)
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 17. `image`(图片)
|
|
292
|
+
|
|
293
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 / 说明 |
|
|
294
|
+
| ------------- | ---------------- | -------- | -------------- | ------------------------------------- |
|
|
295
|
+
| `src` | `string \| null` | `null` | 展示图地址 | 生产为 `upload` 回传的 `http(s)`;会话内可为 `blob:`;旧草稿多为 `data:` |
|
|
296
|
+
| `mediaId` | `string` | `""` | 媒体持久化主键 | 由 `DocMediaHooks.upload` 返回;旧草稿可无 |
|
|
297
|
+
| `alt` | `string \| null` | `null` | 替代文本 | 常为文件名 |
|
|
298
|
+
| `title` | `string \| null` | `null` | 标题属性 | |
|
|
299
|
+
| `width` | `number \| null` | `null` | 展示宽度(px) | 拖拽改宽后写入;最小约 80 |
|
|
300
|
+
| `height` | `number \| null` | `null` | 展示高度 | Demo 通常 `null`(高度随图) |
|
|
301
|
+
| `align` | `string` | `"left"` | 块对齐 | `"left"` / `"center"` / `"right"` |
|
|
302
|
+
| `caption` | `string` | `""` | 图注 | |
|
|
303
|
+
| `originalSrc` | `string \| null` | `null` | 裁剪前原图 | 有值时可「还原原图」 |
|
|
304
|
+
| `uploadStatus`| `string \| null` | `null` | 上传瞬态 | `"uploading"` / `"error"`;成功后清除 |
|
|
305
|
+
| `uploadId` | `string` | `""` | 临时上传键 | 仅会话内占位回填用;成功后清除 |
|
|
306
|
+
|
|
307
|
+
无 `content`(atom)。插入时先本地 `blob:` 占位并展示进度,再 `upload` 回填。
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## 18. `video`(视频)
|
|
312
|
+
|
|
313
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 / 说明 |
|
|
314
|
+
| ---------- | ---------------- | -------- | ------------------------ | ------------------------------------ |
|
|
315
|
+
| `src` | `string` | `""` | 播放地址 | 生产为 `upload` 回传的 `http(s)`;否则会话内 `blob:` |
|
|
316
|
+
| `mediaId` | `string` | `""` | 媒体持久化主键 | 由 `DocMediaHooks.upload` 返回;Demo 为 IndexedDB key |
|
|
317
|
+
| `filename` | `string` | `""` | 原始文件名 | |
|
|
318
|
+
| `mime` | `string` | `""` | MIME | 如 `video/mp4` |
|
|
319
|
+
| `align` | `string` | `"left"` | 对齐 | `"left"` / `"center"` / `"right"` |
|
|
320
|
+
| `caption` | `string` | `""` | 图注 | |
|
|
321
|
+
| `width` | `number \| null` | `null` | 宽度(px) | 拖拽改宽;最小约 160 |
|
|
322
|
+
| `uploadStatus` | `string \| null` | `null` | 上传瞬态 | `"uploading"` / `"error"`;成功后清除 |
|
|
323
|
+
| `uploadId` | `string` | `""` | 临时上传键 | 会话内占位回填;成功后清除 |
|
|
324
|
+
|
|
325
|
+
无 `content`。单文件上限 80MB。插入时先占位再异步上传。
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## 19. `audio`(音频)
|
|
330
|
+
|
|
331
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 / 说明 |
|
|
332
|
+
| ---------- | ---------------- | -------- | ------------------ | --------------------------------- |
|
|
333
|
+
| `src` | `string` | `""` | 播放地址 | 同视频:生产为线上 URL,否则会话内 `blob:` |
|
|
334
|
+
| `mediaId` | `string` | `""` | 媒体持久化主键 | 同视频,来自 `upload` |
|
|
335
|
+
| `filename` | `string` | `""` | 文件名 | |
|
|
336
|
+
| `mime` | `string` | `""` | MIME | 如 `audio/wav` |
|
|
337
|
+
| `align` | `string` | `"left"` | 对齐 | `"left"` / `"center"` / `"right"` |
|
|
338
|
+
| `caption` | `string` | `""` | 图注 | |
|
|
339
|
+
| `duration` | `number \| null` | `null` | 预解析总时长(秒) | AAC 等用于锁定结束时间;可 `null` |
|
|
340
|
+
| `width` | `number \| null` | `null` | 播放条宽度(px) | **只改宽,高度固定**;最小约 200 |
|
|
341
|
+
| `uploadStatus` | `string \| null` | `null` | 上传瞬态 | `"uploading"` / `"error"`;成功后清除 |
|
|
342
|
+
| `uploadId` | `string` | `""` | 临时上传键 | 会话内占位回填;成功后清除 |
|
|
343
|
+
|
|
344
|
+
无 `content`。插入时先占位再异步上传。
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## 20. `mindmap`(思维导图)
|
|
349
|
+
|
|
350
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 / 说明 |
|
|
351
|
+
| --------- | -------- | ------------------------ | -------------------- | -------------------------------- |
|
|
352
|
+
| `mapData` | `string` | 默认中心主题 JSON 字符串 | mind-elixir 整图数据 | **必须是 JSON 字符串**,不是对象 |
|
|
353
|
+
| `outline` | `string` | `""` | 旧版大纲文本 | 仅迁移兼容;新数据应 `""` |
|
|
354
|
+
|
|
355
|
+
无 `content`。
|
|
356
|
+
|
|
357
|
+
`mapData` 解析后核心字段:
|
|
358
|
+
|
|
359
|
+
| 字段 | 含义 |
|
|
360
|
+
| ------------------- | ------------------------------------------ |
|
|
361
|
+
| `nodeData.id` | 节点 id |
|
|
362
|
+
| `nodeData.topic` | 节点文案 |
|
|
363
|
+
| `nodeData.children` | 子节点数组(同结构) |
|
|
364
|
+
| `nodeData.image` | 可选;节点配图 `{ url, width, height, fit? }`(画板粘贴写入,多为 data URL) |
|
|
365
|
+
| `direction` | 布局方向(如 SIDE=`2`) |
|
|
366
|
+
| `theme` 等 | 画板可能写入的扩展字段,导入时建议原样保留 |
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## 20.1 `flowchart`(流程图)
|
|
371
|
+
|
|
372
|
+
| 参数 | 类型 | 默认 | 含义 | 取值 / 说明 |
|
|
373
|
+
| ----------- | -------- | -------------------------- | ------------------ | ----------------------------------------------- |
|
|
374
|
+
| `graphData` | `string` | 默认示例流程图 JSON 字符串 | LogicFlow 整图数据 | **必须是 JSON 字符串**,不是对象 |
|
|
375
|
+
| `themeId` | `string` | `"feishu"` | 历史兼容字段(已固定默认色板,切换 UI 已去除) | 读写仍保留;画板始终按默认色渲染 |
|
|
376
|
+
|
|
377
|
+
`graphData.nodes[].type` 除内置 `ellipse` / `rect` / `diamond` / `text` / `polyline` 外,还可含自定义:`free-line`、`sticky`、`partition`、`fc-group`(组合框,`properties.children` 为直接成员 id,可嵌套组;`properties.isCollapsed` 表示折叠;成员 `properties.groupId` 指向所属组)、`fc-table`、`fc-icon`、`fc-image`、`free-path`,以及泳道 `pool` / `lane`(LogicFlow PoolElements);扩展几何/流程形:`fc-parallelogram`、`fc-trapezoid`、`fc-triangle`、`fc-right-triangle`、`fc-pentagon`、`fc-hexagon`、`fc-octagon`、`fc-star`、`fc-arrow-left` / `fc-arrow-right` / `fc-arrow-double`、`fc-manual-input`、`fc-offpage`、`fc-cylinder`、`fc-document`、`fc-delay`、`fc-predefined`、`fc-bubble`、`fc-rect-bubble`、`fc-cloud`。
|
|
378
|
+
|
|
379
|
+
跨线圆弧(B14)为**运行时渲染**:覆盖内置 `polyline` 的 View,在交点插入 SVG 圆弧;**不**在 edge attrs / `properties` 中持久化 `jumps`。
|
|
380
|
+
|
|
381
|
+
无 `content`。
|
|
382
|
+
|
|
383
|
+
`graphData` 解析后核心字段:
|
|
384
|
+
|
|
385
|
+
| 字段 | 含义 |
|
|
386
|
+
| --------- | ------------------------------------------------------------------------------------------ |
|
|
387
|
+
| `nodes[]` | 节点:`id` / `type`(`ellipse`\|`rect`\|`diamond` 等)/ `x` / `y` / `text` / `properties` |
|
|
388
|
+
| `edges[]` | 边:`id` / `type`(多为 `polyline`)/ `sourceNodeId` / `targetNodeId` / `text`(连线说明) |
|
|
389
|
+
|
|
390
|
+
节点 `properties` 常用子字段:
|
|
391
|
+
|
|
392
|
+
| 字段 | 含义 |
|
|
393
|
+
| ---- | ---- |
|
|
394
|
+
| `style` | 填充/描边/虚实/粗细/透明度/翻转等 |
|
|
395
|
+
| `textStyle` | **整节点**文本样式(非行内混排):`fontSize` / `color` / `backgroundColor` / `fontWeight` / `fontStyle` / `textDecoration` / `textAlign`;LogicFlow `getTextStyle` 原生合并 |
|
|
396
|
+
| `locked` | 锁定 |
|
|
397
|
+
| `nodeKind` | Demo 语义标签(start / process 等) |
|
|
398
|
+
| `direction` | 泳道 `pool`:`horizontal` / `vertical` |
|
|
399
|
+
| `rows` / `cols` / `cells` | 表格 `fc-table`:行列数与 `{ text, fill }[][]` |
|
|
400
|
+
| `icon` | 图标 `fc-icon` 字形 |
|
|
401
|
+
| `src` | 图片 `fc-image` 的 data URL |
|
|
402
|
+
|
|
403
|
+
---
|
|
404
|
+
|
|
405
|
+
## 20.2 `columnBlock`(分栏容器)
|
|
406
|
+
|
|
407
|
+
| 参数 | 类型 | 默认 | 含义 |
|
|
408
|
+
| -------- | ---------- | ----------- | ---------------------------- |
|
|
409
|
+
| `widths` | `number[]` | `[50, 50]` | 各列宽度百分比,和为 100 |
|
|
410
|
+
| `content` | 节点[] | | 2~5 个 `column` |
|
|
411
|
+
|
|
412
|
+
不允许嵌套分栏。Markdown 导出按列顺序拼接,列间 `---`。
|
|
413
|
+
|
|
414
|
+
## 20.3 `column`(分栏列)
|
|
415
|
+
|
|
416
|
+
| 参数 | 有无 | 含义 |
|
|
417
|
+
| --------- | ---- | --------------- |
|
|
418
|
+
| (无 attrs) | — | 一列正文容器 |
|
|
419
|
+
| `content` | 必有 | `block+`(段落、图、表等,不含 `columnBlock` 插入) |
|
|
420
|
+
|
|
421
|
+
## 20.4 `file`(正文文件卡片)
|
|
422
|
+
|
|
423
|
+
| 参数 | 类型 | 默认 | 含义 |
|
|
424
|
+
| ---------- | -------- | ---- | ----------------- |
|
|
425
|
+
| `src` | `string` | `""` | 线上 / 会话内预览 URL(生产应为 `http(s)`,来自 `upload.src`) |
|
|
426
|
+
| `mediaId` | `string` | `""` | 媒体持久化主键(`upload` 返回) |
|
|
427
|
+
| `filename` | `string` | `""` | 原始文件名 |
|
|
428
|
+
| `mime` | `string` | `""` | MIME |
|
|
429
|
+
| `size` | `number` | `0` | 字节数 |
|
|
430
|
+
| `displayMode` | `"text" \| "card" \| "preview" \| null` | `null` | 展示形态(空则按类型默认) |
|
|
431
|
+
| `uploadStatus` | `"uploading" \| "error" \| null` | `null` | 上传瞬态;成功后清除 |
|
|
432
|
+
| `uploadId` | `string` | `""` | 临时上传键;成功后清除 |
|
|
433
|
+
|
|
434
|
+
无 `content`。与标题下文档级附件互相独立。插入时先按后缀出预览壳再异步上传。
|
|
435
|
+
|
|
436
|
+
---
|
|
437
|
+
|
|
438
|
+
## 21. `text`(文本叶子)
|
|
439
|
+
|
|
440
|
+
| 参数 | 类型 | 含义 |
|
|
441
|
+
| ------------ | -------- | --------------------------- |
|
|
442
|
+
| `text` | `string` | 可见字符(不在 `attrs` 里) |
|
|
443
|
+
| `marks` | Mark[] | 可选,行内样式列表 |
|
|
444
|
+
| (无 attrs) | — | |
|
|
445
|
+
|
|
446
|
+
```json
|
|
447
|
+
{
|
|
448
|
+
"type": "text",
|
|
449
|
+
"marks": [{ "type": "bold" }],
|
|
450
|
+
"text": "123123"
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
454
|
+
---
|
|
455
|
+
|
|
456
|
+
## 22. Marks(挂在 `text.marks[]`)
|
|
457
|
+
|
|
458
|
+
### 22.1 无参数
|
|
459
|
+
|
|
460
|
+
| `type` | 含义 |
|
|
461
|
+
| ----------- | -------- |
|
|
462
|
+
| `bold` | 加粗 |
|
|
463
|
+
| `italic` | 斜体 |
|
|
464
|
+
| `strike` | 删除线 |
|
|
465
|
+
| `underline` | 下划线 |
|
|
466
|
+
| `code` | 行内代码 |
|
|
467
|
+
|
|
468
|
+
```json
|
|
469
|
+
{ "type": "bold" }
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### 22.2 `link`
|
|
473
|
+
|
|
474
|
+
| 参数 | 类型 | 默认/常见 | 含义 |
|
|
475
|
+
| -------- | ---------------- | -------------------------------- | ---------- |
|
|
476
|
+
| `href` | `string` | | 链接地址 |
|
|
477
|
+
| `target` | `string` | `"_blank"` | 打开方式 |
|
|
478
|
+
| `rel` | `string` | `"noopener noreferrer nofollow"` | rel |
|
|
479
|
+
| `class` | `string` | `"yos-docs-editor-link"` | CSS class |
|
|
480
|
+
| `title` | `string \| null` | `null` | title 属性 |
|
|
481
|
+
|
|
482
|
+
### 22.3 `textStyle`(字体颜色)
|
|
483
|
+
|
|
484
|
+
| 参数 | 类型 | 含义 | 取值示例 |
|
|
485
|
+
| ------- | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
486
|
+
| `color` | `string \| null` | 文字颜色 | `null` 未设/默认;亦可为 `""`;色板如 `#8f959e` 灰、`#f54a45` 红、`#ff8800` 橙、`#f5c60a` 黄、`#34c724` 绿、`#3370ff` 蓝、`#7b61ff` 紫 |
|
|
487
|
+
|
|
488
|
+
### 22.4 `highlight`(文字背景)
|
|
489
|
+
|
|
490
|
+
| 参数 | 类型 | 含义 | 取值示例 |
|
|
491
|
+
| ------- | ---------------- | ------ | ---------------------------------------------------------------------- |
|
|
492
|
+
| `color` | `string \| null` | 背景色 | `null` 无;否则见 `DOC_BG_COLORS`(如 `#faf1d1` 浅黄、`#f8e6a0` 黄等) |
|
|
493
|
+
|
|
494
|
+
### 22.5 `glossaryTerm`(词条)
|
|
495
|
+
|
|
496
|
+
| 参数 | 类型 | 含义 |
|
|
497
|
+
| -------- | ---------------- | --------------------- |
|
|
498
|
+
| `termId` | `string \| null` | 对应词条库条目的 `id` |
|
|
499
|
+
|
|
500
|
+
释义不在 mark 里,在旁路词条库(见下)。
|
|
501
|
+
|
|
502
|
+
---
|
|
503
|
+
|
|
504
|
+
## 23. 旁路存储(非 TipTap 节点)
|
|
505
|
+
|
|
506
|
+
### 23.1 词条库
|
|
507
|
+
|
|
508
|
+
`glossaryTerm` mark 只存 `termId`;释义在旁路词条库,**不进** TipTap JSON。
|
|
509
|
+
|
|
510
|
+
**生产**:宿主传入 `DocEditor` 的 `glossary` prop(`GlossaryHooks`):
|
|
511
|
+
|
|
512
|
+
| 方法 | 含义 |
|
|
513
|
+
| ---- | ---- |
|
|
514
|
+
| `listTerms` | 列出全部词条(打开草稿时用于正文补 mark) |
|
|
515
|
+
| `getTerm` | 按 id 取词条 |
|
|
516
|
+
| `findTermByTitle` | 按标题精确匹配(新建时复用 id) |
|
|
517
|
+
| `upsertTerm` | 新增或更新词条 |
|
|
518
|
+
|
|
519
|
+
`GlossaryTerm` 字段:
|
|
520
|
+
|
|
521
|
+
| 参数 | 类型 | 含义 |
|
|
522
|
+
| ------------ | -------- | ----------------------------- |
|
|
523
|
+
| `id` | `string` | = `glossaryTerm.attrs.termId` |
|
|
524
|
+
| `title` | `string` | 词条名 |
|
|
525
|
+
| `definition` | `string` | 释义 |
|
|
526
|
+
| `createdAt` | `number` | 创建时间戳(ms) |
|
|
527
|
+
|
|
528
|
+
不传 `glossary` 时隐藏词条入口;**Demo 回退**(`persist`):`localStorage["demo.doc.glossary.v1"]`,数组元素字段同上。
|
|
529
|
+
|
|
530
|
+
### 23.2 媒体库与 `DocMediaHooks`
|
|
531
|
+
|
|
532
|
+
图片 / 音视频 / 正文 `file` / 文档级附件的二进制**不进** TipTap JSON;JSON 存 `mediaId`,生产还应把 `upload` 回传的线上 `src` 写入节点 / 附件,**DOM 渲染优先用该地址**。插入时包内先占位展示进度,再异步调用 `upload`。
|
|
533
|
+
|
|
534
|
+
**生产**:宿主传入 `DocEditor` 的 `media` prop(`DocMediaHooks`):
|
|
535
|
+
|
|
536
|
+
| 方法 | 签名 | 含义 |
|
|
537
|
+
| ---- | ---- | ---- |
|
|
538
|
+
| `upload` | `(file: File, options?: { onProgress?: (percent: number) => void }) => Promise<{ mediaId: string; src?: string }>` | 上传后返回持久化主键;**应同时返回线上 URL 作 `src`**;可选 `onProgress`(0–100)驱动 UI 进度条 |
|
|
539
|
+
| `load` | `(mediaId: string) => Promise<Blob \| null>` | 无可用线上 `src` 时,播放 / 导出按 id 取回二进制 |
|
|
540
|
+
|
|
541
|
+
解析顺序:优先 `load(mediaId)` → 再 `http(s)` / `//` 的 `src` → 其它 `src`(如会话内 `blob:`)。
|
|
542
|
+
|
|
543
|
+
`mediaId` **只来自** `upload` 的返回值(或宿主自行生成后写入返回);包内不会向服务端要 id。可选导出 `createMediaId()` 作客户端 UUID。
|
|
544
|
+
|
|
545
|
+
**Demo 回退**(未传 `media` 且 `persist`):IndexedDB `demo.doc.media.v1` / `files`
|
|
546
|
+
|
|
547
|
+
| 项 | 含义 |
|
|
548
|
+
| ----- | ---------------- |
|
|
549
|
+
| key | `mediaId` 字符串 |
|
|
550
|
+
| value | 音视频 / 文件 `Blob` |
|
|
551
|
+
|
|
552
|
+
### 23.3 草稿 `localStorage["demo.doc.draft.v1"]`
|
|
553
|
+
|
|
554
|
+
| 参数 | 含义 |
|
|
555
|
+
| ---------- | ------------------------------------------------------------ |
|
|
556
|
+
| `title` | 文档标题 |
|
|
557
|
+
| `content` | 上文整棵 `doc` 树 |
|
|
558
|
+
| `readOnly` | 可选;`true` 时恢复为只读模式;旧草稿无此字段视为可编辑 |
|
|
559
|
+
| `attachments` | 可选;文档级附件元数据(标题下方附件栏,**不进** `content`);与正文 `file` 节点互相独立 |
|
|
560
|
+
|
|
561
|
+
`attachments[]` 元素(`DocAttachment`):
|
|
562
|
+
|
|
563
|
+
| 参数 | 类型 | 含义 |
|
|
564
|
+
| ---------- | -------- | ----------------------------- |
|
|
565
|
+
| `id` | `string` | 附件记录 id |
|
|
566
|
+
| `name` | `string` | 文件名 |
|
|
567
|
+
| `size` | `number` | 字节数 |
|
|
568
|
+
| `mime` | `string` | MIME |
|
|
569
|
+
| `mediaId` | `string` | 媒体键(`DocMediaHooks.upload` / Demo IndexedDB);上传中可为空 |
|
|
570
|
+
| `src` | `string` | 可选;线上可访问 URL(`upload` 回传);有则预览 / 下载优先用 |
|
|
571
|
+
| `createdAt`| `number` | 创建时间戳(ms) |
|
|
572
|
+
| `uploadStatus` | `"uploading" \| "error" \| null` | 可选;上传瞬态,成功后应清除 |
|
|
573
|
+
|
|
574
|
+
可粘贴整篇骨架见 [`doc-draft.template.json`](./doc-draft.template.json)(含 `attachments` 示例)。
|
|
575
|
+
|
|
576
|
+
查询参数:`?readonly=1` 进入页时强制只读(可与 `?skipDraft=1` 并存)。
|
|
577
|
+
|
|
578
|
+
---
|
|
579
|
+
|
|
580
|
+
## 24. 类型索引(速查)
|
|
581
|
+
|
|
582
|
+
| type | 有 attrs? | 关键 |
|
|
583
|
+
| --------------------------- | ----------------------------------------------------------------------------------------- | ------ |
|
|
584
|
+
| `doc` | 无 | §1 |
|
|
585
|
+
| `paragraph` | `indent`, `textAlign` | §2 |
|
|
586
|
+
| `heading` | `level`, `indent`, `textAlign`, `collapsed` | §3 |
|
|
587
|
+
| `blockquote` | 无 | §4 |
|
|
588
|
+
| `horizontalRule` | 无 | §5 |
|
|
589
|
+
| `hardBreak` | 无 | §5.1 |
|
|
590
|
+
| `bulletList` | 无 | §6 |
|
|
591
|
+
| `orderedList` | `start`, `type` | §7 |
|
|
592
|
+
| `listItem` | `collapsed` | §8 |
|
|
593
|
+
| `taskList` | 无 | §9 |
|
|
594
|
+
| `taskItem` | `checked` | §10 |
|
|
595
|
+
| `codeBlock` | `language`, `wrap`, `caption`, `collapsed`, `regionFolds` | §11 |
|
|
596
|
+
| `callout` | `emoji` / `backgroundColor` / `borderColor` | §12 |
|
|
597
|
+
| `table` | 无 | §13 |
|
|
598
|
+
| `tableRow` | `height` | §14 |
|
|
599
|
+
| `tableHeader` / `tableCell` | `colspan`, `rowspan`, `colwidth`, `align`, `backgroundColor` | §15–16 |
|
|
600
|
+
| `image` | `src`, `mediaId`, `alt`, `title`, `width`, `height`, `align`, `caption`, `originalSrc`, `uploadStatus`, `uploadId` | §17 |
|
|
601
|
+
| `video` | `src`, `mediaId`, `filename`, `mime`, `align`, `caption`, `width`, `uploadStatus`, `uploadId` | §18 |
|
|
602
|
+
| `audio` | 视频字段 + `duration` + `width` + 上传瞬态 | §19 |
|
|
603
|
+
| `mindmap` | `mapData`, `outline` | §20 |
|
|
604
|
+
| `flowchart` | `graphData`, `themeId` | §20.1 |
|
|
605
|
+
| `columnBlock` | `widths` | §20.2 |
|
|
606
|
+
| `column` | 无 | §20.3 |
|
|
607
|
+
| `file` | `src`, `mediaId`, `filename`, `mime`, `size`, `displayMode`, `uploadStatus`, `uploadId` | §20.4 |
|
|
608
|
+
| `text` | 用 `text`/`marks`,无 attrs | §21 |
|
|
609
|
+
| Marks | `bold` `italic` `strike` `underline` `code` `link` `textStyle` `highlight` `glossaryTerm` | §22 |
|
|
610
|
+
|
|
611
|
+
### 24.1 与运行时 Schema 核对
|
|
612
|
+
|
|
613
|
+
在 `/main/doc?skipDraft=1` 对 `editor.schema` dump,结论:
|
|
614
|
+
|
|
615
|
+
| 项 | 结果 |
|
|
616
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
617
|
+
| 节点 | 与文档对齐后 **26 个**一致(含 `flowchart` / `columnBlock` / `column` / `file`) |
|
|
618
|
+
| Mark | **9 个**与文档一致 |
|
|
619
|
+
| 各 type 的 attrs 名 | 与 `spec.attrs` **一一对应** |
|
|
620
|
+
| 不进 JSON 的扩展 | Placeholder / Dropcursor / Gapcursor / UndoRedo / NodeRange / SlashCommand / MarkdownPaste / DocTableCellDrag 等 **无需枚举** |
|
|
621
|
+
|
|
622
|
+
可粘贴整篇骨架:[`doc-draft.template.json`](./doc-draft.template.json)。
|
|
623
|
+
|
|
624
|
+
该模版已覆盖 **全部 26 个节点 + 9 个 marks**,以及草稿级 `attachments`(含 `blockquote` / `orderedList` / `hardBreak` / `columnBlock` / `column` / `file`,以及 `italic` `strike` `underline` `code` `highlight` `glossaryTerm` 等);并示范表格 `colspan`/`rowspan`>1、`image.mediaId` / `originalSrc`、有序列表 `start`/`type` 与 `listItem` 内 `heading`、分栏 `widths`、文件 `displayMode`(`card` / `text` / `preview`)。
|