@xiongtao.xt/tau-plugins 0.56.0 → 0.58.0
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/CHANGELOG.md +5 -1
- package/docs/README.md +16 -17
- package/docs/ai.md +1 -1
- package/docs/app-surfaces.md +1 -1
- package/docs/backend.md +5 -6
- package/docs/blog-templates.md +199 -0
- package/docs/getting-started.md +1 -1
- package/docs/notifications-and-voice.md +3 -1
- package/docs/pages.md +2 -2
- package/docs/permissions.md +1 -1
- package/docs/plugin-basics.md +1 -1
- package/docs/portability.md +5 -4
- package/docs/services.md +15 -9
- package/docs/site-data.md +30 -9
- package/docs/ui.md +16 -15
- package/docs/windows.md +83 -0
- package/package.json +1 -1
- package/publish-artifacts.js +57 -13
- package/tailwind.css +20 -0
- package/types/packages/collaboration/src/document-membership.d.ts +4 -0
- package/types/packages/collaboration/src/document-operations.d.ts +8 -2
- package/types/packages/collaboration/src/document-protocol.d.ts +13 -0
- package/types/packages/collaboration/src/encoding.d.ts +1 -1
- package/types/packages/collaboration/src/index.d.ts +3 -0
- package/types/packages/collaboration/src/member-activities.d.ts +8 -0
- package/types/packages/collaboration/src/node-tree.d.ts +4 -1
- package/types/packages/collaboration/src/protocol.d.ts +7 -3
- package/types/packages/collaboration/src/scoped-content-edit.d.ts +91 -0
- package/types/packages/editor/src/core/CoreEditor.d.ts +3 -0
- package/types/packages/editor/src/core/api/clipboardFragment.d.ts +14 -0
- package/types/packages/editor/src/core/api/drag.d.ts +1 -1
- package/types/packages/editor/src/core/api/index.d.ts +3 -0
- package/types/packages/editor/src/core/api/marks.d.ts +2 -0
- package/types/packages/editor/src/core/index.d.ts +1 -0
- package/types/packages/editor/src/core/inlineSuggestion/controller.d.ts +29 -0
- package/types/packages/editor/src/core/inlineSuggestion/providerContext.d.ts +3 -0
- package/types/packages/editor/src/core/utils/nodeOperations.d.ts +1 -1
- package/types/packages/editor/src/extensions/table/src/types.d.ts +4 -0
- package/types/packages/editor/text-field-contract.d.ts +3 -0
- package/types/packages/plugins/src/contract.d.ts +3 -0
- package/types/packages/plugins/src/index.d.ts +1 -0
- package/types/packages/plugins/src/notifications.d.ts +2 -0
- package/types/packages/plugins/src/windows.d.ts +76 -0
- package/types/packages/themes/src/tokenContract.d.ts +1 -0
- package/types/packages/ui/src/hooks/scrollbarAutoHide.d.ts +1 -1
- package/types/packages/ui/src/primitives/Notification.d.ts +2 -0
package/docs/ui.md
CHANGED
|
@@ -4,21 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
界面都用 React 写,先读[界面组件与样式](ui-components.md):怎样用 `@tau/ui` 组件、怎样写样式才不会和 Tau 冲突。然后按你想出现的位置查下表。
|
|
6
6
|
|
|
7
|
-
| 想出现在
|
|
8
|
-
|
|
|
9
|
-
| 一个完整的页面,和 Tau 自己的页面一样前进、后退
|
|
10
|
-
|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
|
20
|
-
|
|
|
7
|
+
| 想出现在 | 用 | 见 |
|
|
8
|
+
| ---------------------------------------------------- | ---------------------------------------------- | ----------------------------------------------- |
|
|
9
|
+
| 一个完整的页面,和 Tau 自己的页面一样前进、后退 | `context.pages` | [页面](pages.md#页面) |
|
|
10
|
+
| 独立的桌面普通窗、固定尺寸小窗或全屏窗 | `definePlugin({ windows })`、`context.windows` | [桌面插件窗口](windows.md) |
|
|
11
|
+
| 桌面侧边栏、手机「我的」顶部的功能宫格,点击打开页面 | `context.navigation` | [功能入口](pages.md#功能入口) |
|
|
12
|
+
| 桌面侧边栏的指定分组,带角标和子项 | `context.sidebar` | [侧边栏](pages.md#侧边栏) |
|
|
13
|
+
| 插件详情页的「设置」 | `context.settings` | [设置](settings-and-commands.md#设置) |
|
|
14
|
+
| 桌面的 Ctrl+K 命令面板 | `context.commands` | [命令](settings-and-commands.md#命令) |
|
|
15
|
+
| 桌面「今日」首页、手机「今天」页上的一块面板 | `context.home` | [首页面板](app-surfaces.md#首页面板) |
|
|
16
|
+
| 卡片、文章、项目文档等对象的「⋯」菜单 | `context.actions` | [对象动作](app-surfaces.md#对象动作) |
|
|
17
|
+
| 卡片、文章、项目文档详情的正文上方 | `context.views` | [详情区块](app-surfaces.md#详情区块) |
|
|
18
|
+
| Notebook 的「生成」菜单 | `context.notebooks` | [Notebook 输出](app-surfaces.md#notebook-输出) |
|
|
19
|
+
| 窗口内或独立的通知窗口 | `context.notifications` | [通知](notifications-and-voice.md#通知) |
|
|
20
|
+
| 插件自己的按钮:用户按住说话,插件拿到文字 | `context.speech` | [语音输入](notifications-and-voice.md#语音输入) |
|
|
21
|
+
| 用用户选的语音服务把文字念出来 | `context.tts` | [朗读](notifications-and-voice.md#朗读) |
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
独立窗口、侧边栏、命令面板、详情区块、Notebook 输出、通知和朗读只在桌面可用,语音输入只在手机可用,其余两端都能用。完整的差异见[多端适配](portability.md#各平台可用的接口)。
|
|
23
24
|
|
|
24
25
|
第一次做界面,从[页面与入口](pages.md)开始:注册一个页面和它的入口,用户就能在 Tau 里打开你的插件。
|
package/docs/windows.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# 桌面插件窗口
|
|
2
|
+
|
|
3
|
+
窗口 API 仅在 Tau 桌面端可用。依赖独立窗口的插件,在平台声明里只声明桌面端即可,见[多端适配](portability.md)。
|
|
4
|
+
|
|
5
|
+
## 声明与打开窗口
|
|
6
|
+
|
|
7
|
+
在 `definePlugin({ windows })` 中声明每个窗口的 ID、标题、选项和渲染用的 React 组件。下面的插件注册了一条桌面命令,用户可以从命令面板打开预览窗口:
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { definePlugin, type PluginWindowProps } from "@tau/plugins";
|
|
11
|
+
import { Button } from "@tau/ui";
|
|
12
|
+
|
|
13
|
+
declare const __PLUGIN_META__: { id: string; name: string; version: string };
|
|
14
|
+
|
|
15
|
+
function Preview({ params, close }: PluginWindowProps) {
|
|
16
|
+
return (
|
|
17
|
+
<section className="yourname-preview">
|
|
18
|
+
<h2>{String(params.title ?? "预览")}</h2>
|
|
19
|
+
<Button onClick={() => void close()}>关闭</Button>
|
|
20
|
+
</section>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default definePlugin({
|
|
25
|
+
...__PLUGIN_META__,
|
|
26
|
+
windows: [
|
|
27
|
+
{
|
|
28
|
+
id: "preview",
|
|
29
|
+
title: "预览",
|
|
30
|
+
options: { kind: "normal", width: 720, height: 480 },
|
|
31
|
+
component: Preview,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
create: () => ({
|
|
35
|
+
activate(context) {
|
|
36
|
+
context.commands.register({
|
|
37
|
+
id: "open-preview",
|
|
38
|
+
title: "打开预览",
|
|
39
|
+
async run() {
|
|
40
|
+
await context.windows?.open("preview", { title: "本次预览" });
|
|
41
|
+
return null;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
- `open(id, params?)` 要在用户点击或按键时调用。参数值只支持字符串、有限数字和布尔值。重复打开同一个 ID 不会新建窗口,而是聚焦已有窗口并整体替换参数,组件保持挂载。
|
|
50
|
+
- 窗口有三种形态:`kind: "normal"` 是可调整尺寸的普通窗口;`kind: "compact"` 是尺寸固定的小窗,可以声明 `alwaysOnTop: true` 置顶;`kind: "fullscreen"` 是全屏窗口,显示器适配与退出操作由宿主处理。
|
|
51
|
+
- `open()` 返回本次窗口的句柄,用它关闭这个窗口;组件内部则用 `props.close()` 关闭自己。窗口关闭后再打开会挂载新的组件。`props.signal` 会随窗口结束而中止,用它取消随窗口进行的工作。
|
|
52
|
+
- 窗口组件运行在独立的渲染环境中,插件的 `activate()` 只在主窗口执行。需要在两端共享的值,通过下面介绍的通信接口传递。
|
|
53
|
+
|
|
54
|
+
## 外观自动跟随 Tau
|
|
55
|
+
|
|
56
|
+
组件挂载前,宿主会先把 Tau 的主题、明暗和用户设置的字体、字号应用到窗口;这些设置变化时,已打开的窗口也会同步更新。界面用 `@tau/ui` 或语义 token 编写即可继承外观,CSS 的编译方式见[界面组件与样式](ui-components.md)。
|
|
57
|
+
|
|
58
|
+
```css
|
|
59
|
+
.yourname-preview {
|
|
60
|
+
background: var(--tau-bg-page);
|
|
61
|
+
color: var(--tau-ink-1);
|
|
62
|
+
font: var(--tau-text-body) var(--tau-font);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
全屏等场景可以在窗口选项里声明 `theme: "dark"`,把窗口固定为深色;主题族和字体仍跟随用户的选择。
|
|
67
|
+
|
|
68
|
+
画布等自绘组件可以用只读快照获取外观:`system.get("system.appearance")` 读初值,`system.subscribe("system.appearance", redraw)` 监听变化。快照中 `themeId` 是当前主题,`appearance` 是用户的全局明暗偏好,`mode` 是本窗口实际生效的明暗,`font` 提供 `chineseFont`、`englishFont`、`codeFont` 和 `fontSize`。
|
|
69
|
+
|
|
70
|
+
## 同步状态与发送消息
|
|
71
|
+
|
|
72
|
+
主窗口代码从 `context.windows.communication` 取通信接口,独立窗口组件从 `props.communication` 取,两边访问的是同一插件在当前工作区的通道。键、消息名和 JSON 值的格式由插件自己定义,`system.` 前缀保留给 Tau。
|
|
73
|
+
|
|
74
|
+
| 接口 | 用法 |
|
|
75
|
+
| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
76
|
+
| `state.get(key)` / `state.set(key, value)` | 读取或整体替换键的值。未设置过的键读到 `undefined`。 |
|
|
77
|
+
| `await state.subscribe(key, listener)` | 订阅时先回调一次当前值,之后每次变化再回调。返回的订阅调用 `dispose()` 即可取消。 |
|
|
78
|
+
| `messages.on(name, listener)` | 监听即时消息,回调收到 JSON 载荷和发送方的窗口类型。 |
|
|
79
|
+
| `await messages.send(name, payload, target)` | 发送即时消息。`"main"` 发给其他在线的主窗口端点,`"all"` 发给同插件的其他在线端点,`{ windowId: "preview" }` 发给指定窗口。返回已受理投递的端点数,没有在线目标时返回 `0`。 |
|
|
80
|
+
|
|
81
|
+
例如主窗口用 `state.set("selection", { id: "draft" })` 保存当前选中项,预览窗稍后才打开也不要紧——订阅 `selection` 时会先收到这份值。反过来,预览窗在用户完成操作后可以调用 `messages.send("refresh", null, "main")`,让在线的主窗口刷新。状态只在当前插件会话内保留;消息即时投递、不回放。要在重启后保留的数据,用[插件私有存储](storage-and-network.md)。
|
|
82
|
+
|
|
83
|
+
组件卸载时记得调用 `dispose()` 取消订阅。插件停用、切换工作区或窗口关闭时,宿主会统一清理相关端点。注意 `send()` 的返回值只代表宿主已受理投递,接收窗口是否处理完成,要由插件自己确认。
|
package/package.json
CHANGED
package/publish-artifacts.js
CHANGED
|
@@ -6037,7 +6037,11 @@ var paper_theme_default = defineTheme({
|
|
|
6037
6037
|
"shadow-card": "0 1px 2px rgba(120, 100, 70, 0.05), 0 10px 24px -14px rgba(120, 100, 70, 0.18)",
|
|
6038
6038
|
"shadow-lift": "0 1px 2px rgba(120, 100, 70, 0.06), 0 6px 16px -10px rgba(120, 100, 70, 0.22)",
|
|
6039
6039
|
"shadow-float": "0 16px 40px -12px rgba(120, 100, 70, 0.4)",
|
|
6040
|
-
"shadow-paper": "0 0 0 1px rgba(120, 100, 70, 0.07), 0 2px 4px -1px rgba(120, 100, 70, 0.12), 0 22px 44px -18px rgba(120, 100, 70, 0.45)"
|
|
6040
|
+
"shadow-paper": "0 0 0 1px rgba(120, 100, 70, 0.07), 0 2px 4px -1px rgba(120, 100, 70, 0.12), 0 22px 44px -18px rgba(120, 100, 70, 0.45)",
|
|
6041
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6042
|
+
"glow-1": "#f6d3b6",
|
|
6043
|
+
"glow-2": "#f1d4ca",
|
|
6044
|
+
"glow-3": "#f4e3ae"
|
|
6041
6045
|
})
|
|
6042
6046
|
},
|
|
6043
6047
|
dark: {
|
|
@@ -6108,7 +6112,10 @@ var paper_theme_default = defineTheme({
|
|
|
6108
6112
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6109
6113
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6110
6114
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6111
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6115
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6116
|
+
"glow-1": "#492c18",
|
|
6117
|
+
"glow-2": "#47221f",
|
|
6118
|
+
"glow-3": "#3b3215"
|
|
6112
6119
|
})
|
|
6113
6120
|
}
|
|
6114
6121
|
});
|
|
@@ -6186,7 +6193,11 @@ var ocean_theme_default = defineTheme({
|
|
|
6186
6193
|
"shadow-card": "0 1px 2px rgba(60, 80, 120, 0.06), 0 10px 24px -14px rgba(60, 80, 120, 0.2)",
|
|
6187
6194
|
"shadow-lift": "0 1px 2px rgba(60, 80, 120, 0.07), 0 6px 16px -10px rgba(60, 80, 120, 0.24)",
|
|
6188
6195
|
"shadow-float": "0 16px 40px -12px rgba(60, 80, 120, 0.4)",
|
|
6189
|
-
"shadow-paper": "0 0 0 1px rgba(60, 80, 120, 0.07), 0 2px 4px -1px rgba(60, 80, 120, 0.12), 0 22px 44px -18px rgba(60, 80, 120, 0.45)"
|
|
6196
|
+
"shadow-paper": "0 0 0 1px rgba(60, 80, 120, 0.07), 0 2px 4px -1px rgba(60, 80, 120, 0.12), 0 22px 44px -18px rgba(60, 80, 120, 0.45)",
|
|
6197
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6198
|
+
"glow-1": "#d3e2f7",
|
|
6199
|
+
"glow-2": "#dfdff6",
|
|
6200
|
+
"glow-3": "#c0e8e6"
|
|
6190
6201
|
})
|
|
6191
6202
|
},
|
|
6192
6203
|
dark: {
|
|
@@ -6256,7 +6267,10 @@ var ocean_theme_default = defineTheme({
|
|
|
6256
6267
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6257
6268
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6258
6269
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6259
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6270
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6271
|
+
"glow-1": "#15305a",
|
|
6272
|
+
"glow-2": "#272656",
|
|
6273
|
+
"glow-3": "#0e3a40"
|
|
6260
6274
|
})
|
|
6261
6275
|
}
|
|
6262
6276
|
});
|
|
@@ -6327,7 +6341,11 @@ var mint_theme_default = defineTheme({
|
|
|
6327
6341
|
"shadow-card": "0 1px 2px rgba(60, 90, 70, 0.06), 0 10px 24px -14px rgba(60, 90, 70, 0.2)",
|
|
6328
6342
|
"shadow-lift": "0 1px 2px rgba(60, 90, 70, 0.07), 0 6px 16px -10px rgba(60, 90, 70, 0.24)",
|
|
6329
6343
|
"shadow-float": "0 16px 40px -12px rgba(60, 90, 70, 0.4)",
|
|
6330
|
-
"shadow-paper": "0 0 0 1px rgba(60, 90, 70, 0.07), 0 2px 4px -1px rgba(60, 90, 70, 0.12), 0 22px 44px -18px rgba(60, 90, 70, 0.45)"
|
|
6344
|
+
"shadow-paper": "0 0 0 1px rgba(60, 90, 70, 0.07), 0 2px 4px -1px rgba(60, 90, 70, 0.12), 0 22px 44px -18px rgba(60, 90, 70, 0.45)",
|
|
6345
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6346
|
+
"glow-1": "#c2ebd2",
|
|
6347
|
+
"glow-2": "#bfe5e2",
|
|
6348
|
+
"glow-3": "#e1efb8"
|
|
6331
6349
|
})
|
|
6332
6350
|
},
|
|
6333
6351
|
dark: {
|
|
@@ -6395,7 +6413,10 @@ var mint_theme_default = defineTheme({
|
|
|
6395
6413
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6396
6414
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6397
6415
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6398
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6416
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6417
|
+
"glow-1": "#0f3a24",
|
|
6418
|
+
"glow-2": "#0f3534",
|
|
6419
|
+
"glow-3": "#2a3714"
|
|
6399
6420
|
})
|
|
6400
6421
|
}
|
|
6401
6422
|
});
|
|
@@ -6466,7 +6487,11 @@ var wisteria_theme_default = defineTheme({
|
|
|
6466
6487
|
"shadow-card": "0 1px 2px rgba(80, 64, 120, 0.06), 0 10px 24px -14px rgba(80, 64, 120, 0.2)",
|
|
6467
6488
|
"shadow-lift": "0 1px 2px rgba(80, 64, 120, 0.07), 0 6px 16px -10px rgba(80, 64, 120, 0.24)",
|
|
6468
6489
|
"shadow-float": "0 16px 40px -12px rgba(80, 64, 120, 0.4)",
|
|
6469
|
-
"shadow-paper": "0 0 0 1px rgba(80, 64, 120, 0.07), 0 2px 4px -1px rgba(80, 64, 120, 0.12), 0 22px 44px -18px rgba(80, 64, 120, 0.45)"
|
|
6490
|
+
"shadow-paper": "0 0 0 1px rgba(80, 64, 120, 0.07), 0 2px 4px -1px rgba(80, 64, 120, 0.12), 0 22px 44px -18px rgba(80, 64, 120, 0.45)",
|
|
6491
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6492
|
+
"glow-1": "#dbcff6",
|
|
6493
|
+
"glow-2": "#c9d6f6",
|
|
6494
|
+
"glow-3": "#f1cfe7"
|
|
6470
6495
|
})
|
|
6471
6496
|
},
|
|
6472
6497
|
dark: {
|
|
@@ -6533,7 +6558,10 @@ var wisteria_theme_default = defineTheme({
|
|
|
6533
6558
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6534
6559
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6535
6560
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6536
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6561
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6562
|
+
"glow-1": "#2f1f58",
|
|
6563
|
+
"glow-2": "#1a2752",
|
|
6564
|
+
"glow-3": "#421c40"
|
|
6537
6565
|
})
|
|
6538
6566
|
}
|
|
6539
6567
|
});
|
|
@@ -6605,7 +6633,11 @@ var sakura_theme_default = defineTheme({
|
|
|
6605
6633
|
"shadow-card": "0 1px 2px rgba(110, 70, 85, 0.06), 0 10px 24px -14px rgba(110, 70, 85, 0.2)",
|
|
6606
6634
|
"shadow-lift": "0 1px 2px rgba(110, 70, 85, 0.07), 0 6px 16px -10px rgba(110, 70, 85, 0.24)",
|
|
6607
6635
|
"shadow-float": "0 16px 40px -12px rgba(110, 70, 85, 0.4)",
|
|
6608
|
-
"shadow-paper": "0 0 0 1px rgba(110, 70, 85, 0.07), 0 2px 4px -1px rgba(110, 70, 85, 0.12), 0 22px 44px -18px rgba(110, 70, 85, 0.45)"
|
|
6636
|
+
"shadow-paper": "0 0 0 1px rgba(110, 70, 85, 0.07), 0 2px 4px -1px rgba(110, 70, 85, 0.12), 0 22px 44px -18px rgba(110, 70, 85, 0.45)",
|
|
6637
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6638
|
+
"glow-1": "#f7cad9",
|
|
6639
|
+
"glow-2": "#e6cdf0",
|
|
6640
|
+
"glow-3": "#fbd8c4"
|
|
6609
6641
|
})
|
|
6610
6642
|
},
|
|
6611
6643
|
dark: {
|
|
@@ -6673,7 +6705,10 @@ var sakura_theme_default = defineTheme({
|
|
|
6673
6705
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6674
6706
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6675
6707
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6676
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6708
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6709
|
+
"glow-1": "#4a1a2e",
|
|
6710
|
+
"glow-2": "#341d44",
|
|
6711
|
+
"glow-3": "#43251a"
|
|
6677
6712
|
})
|
|
6678
6713
|
}
|
|
6679
6714
|
});
|
|
@@ -6746,7 +6781,11 @@ var ink_theme_default = defineTheme({
|
|
|
6746
6781
|
"shadow-card": "0 1px 2px rgba(40, 38, 30, 0.04), 0 10px 24px -14px rgba(40, 38, 30, 0.14)",
|
|
6747
6782
|
"shadow-lift": "0 1px 2px rgba(40, 38, 30, 0.05), 0 6px 16px -10px rgba(40, 38, 30, 0.18)",
|
|
6748
6783
|
"shadow-float": "0 16px 40px -12px rgba(40, 38, 30, 0.3)",
|
|
6749
|
-
"shadow-paper": "0 0 0 1px rgba(40, 38, 30, 0.07), 0 2px 4px -1px rgba(40, 38, 30, 0.12), 0 22px 44px -18px rgba(40, 38, 30, 0.45)"
|
|
6784
|
+
"shadow-paper": "0 0 0 1px rgba(40, 38, 30, 0.07), 0 2px 4px -1px rgba(40, 38, 30, 0.12), 0 22px 44px -18px rgba(40, 38, 30, 0.45)",
|
|
6785
|
+
// 壳层极光背景的三团色(模糊后铺在侧栏与大卡留白下,峰值处 ink-2 仍过 AA)
|
|
6786
|
+
"glow-1": "#dde3e8",
|
|
6787
|
+
"glow-2": "#e2e2dc",
|
|
6788
|
+
"glow-3": "#ece4d6"
|
|
6750
6789
|
})
|
|
6751
6790
|
},
|
|
6752
6791
|
dark: {
|
|
@@ -6813,7 +6852,10 @@ var ink_theme_default = defineTheme({
|
|
|
6813
6852
|
"shadow-card": "0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 24px -14px rgba(0, 0, 0, 0.5)",
|
|
6814
6853
|
"shadow-lift": "0 1px 2px rgba(0, 0, 0, 0.26), 0 6px 16px -10px rgba(0, 0, 0, 0.52)",
|
|
6815
6854
|
"shadow-float": "0 16px 40px -12px rgba(0, 0, 0, 0.65)",
|
|
6816
|
-
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)"
|
|
6855
|
+
"shadow-paper": "0 0 0 1px rgba(255, 255, 255, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.4), 0 24px 48px -16px rgba(0, 0, 0, 0.72)",
|
|
6856
|
+
"glow-1": "#232a31",
|
|
6857
|
+
"glow-2": "#262624",
|
|
6858
|
+
"glow-3": "#2d2820"
|
|
6817
6859
|
})
|
|
6818
6860
|
}
|
|
6819
6861
|
});
|
|
@@ -6840,7 +6882,9 @@ var tokenContract = {
|
|
|
6840
6882
|
"tag-5",
|
|
6841
6883
|
"tag-5-soft"
|
|
6842
6884
|
],
|
|
6843
|
-
float: ["overlay", "shadow-card", "shadow-lift", "shadow-float", "shadow-paper"]
|
|
6885
|
+
float: ["overlay", "shadow-card", "shadow-lift", "shadow-float", "shadow-paper"],
|
|
6886
|
+
// 壳层渐变背景(极光)的三团色:只由壳层背景层消费,组件不要拿来做填充色
|
|
6887
|
+
backdrop: ["glow-1", "glow-2", "glow-3"]
|
|
6844
6888
|
};
|
|
6845
6889
|
var ALL_TOKEN_WORDS = Object.values(tokenContract).flat();
|
|
6846
6890
|
|
package/tailwind.css
CHANGED
|
@@ -86,6 +86,26 @@
|
|
|
86
86
|
|
|
87
87
|
/* 域内动效(keyframes 与词表同处声明,hover:animate-hm-pulse 消费) */
|
|
88
88
|
--animate-hm-pulse: hmPulse 0.5s linear alternate infinite;
|
|
89
|
+
/* 壳层极光背景三团色的漂移(只动 transform,合成层完成) */
|
|
90
|
+
--animate-aurora-1: auroraDrift1 26s ease-in-out infinite alternate;
|
|
91
|
+
--animate-aurora-2: auroraDrift2 32s ease-in-out infinite alternate;
|
|
92
|
+
--animate-aurora-3: auroraDrift3 38s ease-in-out infinite alternate;
|
|
93
|
+
|
|
94
|
+
@keyframes auroraDrift1 {
|
|
95
|
+
to {
|
|
96
|
+
transform: translate(35%, 23%) scale(1.15);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
@keyframes auroraDrift2 {
|
|
100
|
+
to {
|
|
101
|
+
transform: translate(-46%, 33%) scale(0.9);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
@keyframes auroraDrift3 {
|
|
105
|
+
to {
|
|
106
|
+
transform: translate(-29%, -30%) scale(1.2);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
89
109
|
|
|
90
110
|
@keyframes hmPulse {
|
|
91
111
|
0% {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { DocumentSql, DocumentProtocol } from "./document-protocol";
|
|
2
|
+
import { type ScopedContentConflict, type ScopedContentEdits } from "./scoped-content-edit";
|
|
2
3
|
export interface DocumentOperationRequest {
|
|
3
4
|
operationId: string;
|
|
4
5
|
epoch: number;
|
|
@@ -8,18 +9,22 @@ export interface DocumentOperationRequest {
|
|
|
8
9
|
expiresAt: number;
|
|
9
10
|
expectedRevision?: string;
|
|
10
11
|
expectedSequence?: number;
|
|
12
|
+
kind?: "scoped-edit";
|
|
13
|
+
source?: ScopedContentEdits["source"];
|
|
11
14
|
}
|
|
12
15
|
export interface DocumentOperation extends DocumentOperationRequest {
|
|
13
16
|
documentId: string;
|
|
14
17
|
actorId: string;
|
|
15
18
|
state: "PENDING" | "COMMITTED" | "ABORTED" | "EXPIRED";
|
|
16
19
|
reason?: string;
|
|
20
|
+
conflicts?: ScopedContentConflict[];
|
|
17
21
|
receipt?: {
|
|
18
22
|
documentId: string;
|
|
19
23
|
epoch: number;
|
|
20
24
|
baselineId: string;
|
|
21
25
|
revision: string;
|
|
22
26
|
sequence: number;
|
|
27
|
+
inverse?: ScopedContentEdits;
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
30
|
/** 普通条件提交保留 epoch,回执与更新必须同事务提交。 */
|
|
@@ -31,7 +36,8 @@ export declare class DocumentOperationLedger {
|
|
|
31
36
|
advance(documentId: string): number;
|
|
32
37
|
private save;
|
|
33
38
|
get(documentId: string, operationId: string, actorId: string): DocumentOperation | null;
|
|
39
|
+
isScopedUndo(operation: DocumentOperation, scope: ScopedContentEdits): boolean;
|
|
34
40
|
begin(documentId: string, actorId: string, request: DocumentOperationRequest): DocumentOperation;
|
|
35
|
-
abort(operation: DocumentOperation, reason: string): DocumentOperation;
|
|
36
|
-
commit(operation: DocumentOperation, read: () => DocumentProtocol, revision: string, install: () => void): DocumentOperation;
|
|
41
|
+
abort(operation: DocumentOperation, reason: string, conflicts?: ScopedContentConflict[]): DocumentOperation;
|
|
42
|
+
commit(operation: DocumentOperation, read: () => DocumentProtocol, revision: string, install: () => void, inverse?: ScopedContentEdits): DocumentOperation;
|
|
37
43
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type SharedDocumentListing } from "./protocol";
|
|
1
2
|
export interface DocumentProtocol {
|
|
2
3
|
id: string;
|
|
3
4
|
ownerId: string;
|
|
@@ -11,6 +12,16 @@ export interface DocumentProtocol {
|
|
|
11
12
|
version: number;
|
|
12
13
|
};
|
|
13
14
|
}
|
|
15
|
+
export interface DocumentStateResponse {
|
|
16
|
+
state: string;
|
|
17
|
+
protocol: DocumentProtocol & {
|
|
18
|
+
sequence: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface DocumentCloseReceipt {
|
|
22
|
+
ok: true;
|
|
23
|
+
revision: string | null;
|
|
24
|
+
}
|
|
14
25
|
type Parameter = string | number | null;
|
|
15
26
|
export interface DocumentSql {
|
|
16
27
|
exec(sql: string, ...parameters: Parameter[]): void;
|
|
@@ -25,6 +36,8 @@ export declare class DocumentProtocolStore {
|
|
|
25
36
|
private readonly readCurrent;
|
|
26
37
|
private readonly verified;
|
|
27
38
|
constructor(sql: DocumentSql, readCurrent: (id: string) => DocumentProtocol);
|
|
39
|
+
private stored;
|
|
40
|
+
describe(documentId: string): Pick<SharedDocumentListing, "kind" | "protocolVersion">;
|
|
28
41
|
publication(documentId: string): {
|
|
29
42
|
candidateHash: string;
|
|
30
43
|
baselineId: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
2
|
-
export declare function base64ToBytes(value: string): Uint8Array
|
|
2
|
+
export declare function base64ToBytes(value: string): Uint8Array<ArrayBuffer>;
|
|
@@ -9,6 +9,7 @@ export * from "./model-limits";
|
|
|
9
9
|
export * from "./whiteboard-contract";
|
|
10
10
|
export * from "./node-document";
|
|
11
11
|
export * from "./document-protocol";
|
|
12
|
+
export { leaveDocument } from "./document-membership";
|
|
12
13
|
export * from "./document-installation";
|
|
13
14
|
export * from "./document-write-queue";
|
|
14
15
|
export * from "./whiteboard-types";
|
|
@@ -17,10 +18,12 @@ export * from "./whiteboard-relations";
|
|
|
17
18
|
export * from "./whiteboard-document";
|
|
18
19
|
export * from "./document-adapter";
|
|
19
20
|
export * from "./document-operations";
|
|
21
|
+
export * from "./scoped-content-edit";
|
|
20
22
|
export * from "./document-sync";
|
|
21
23
|
export { exportWhiteboardTransfer, prepareWhiteboardTransfer, whiteboardTransferResources, } from "./whiteboard-transfer";
|
|
22
24
|
export type { WhiteboardTransfer } from "./whiteboard-types";
|
|
23
25
|
export { isSafeResource, isVideoResource, imageMimeFromBytes, collaborationAssetMime, } from "./resource-policy";
|
|
24
26
|
export * from "./whiteboard-baseline";
|
|
25
27
|
export { assertPresenceBudget } from "./presence-budget";
|
|
28
|
+
export { memberActivities } from "./member-activities";
|
|
26
29
|
export * from "./whiteboard-presence";
|
|
@@ -75,6 +75,7 @@ export declare class NodeTree {
|
|
|
75
75
|
private readSpans;
|
|
76
76
|
snapshot(): readonly ContentNode[];
|
|
77
77
|
nodeSnapshot(id: string): ContentNode;
|
|
78
|
+
rootBlockId(id: string): string | undefined;
|
|
78
79
|
read(): ContentNode[];
|
|
79
80
|
physicalOffset(parent: string | null, index: number): number;
|
|
80
81
|
textLocation(parent: string | null, index: number): {
|
|
@@ -83,7 +84,7 @@ export declare class NodeTree {
|
|
|
83
84
|
segment?: string;
|
|
84
85
|
};
|
|
85
86
|
visibleOffset(parent: string | null, index: number): number;
|
|
86
|
-
capturePosition(parent: string, index: number): Y.RelativePosition;
|
|
87
|
+
capturePosition(parent: string, index: number, assoc?: number): Y.RelativePosition;
|
|
87
88
|
resolvePosition(position: Y.RelativePosition): {
|
|
88
89
|
parent: string;
|
|
89
90
|
offset: number;
|
|
@@ -102,6 +103,8 @@ export declare class NodeTree {
|
|
|
102
103
|
convertNode(id: string, targetId: string, changes: Record<string, unknown>, origin: unknown): void;
|
|
103
104
|
insertText(id: string, index: number, text: string, origin: unknown, marks?: Record<string, unknown>): void;
|
|
104
105
|
deleteText(id: string, index: number, length: number, origin: unknown): void;
|
|
106
|
+
/** 目标偏移以移除源文字后的内容为准。 */
|
|
107
|
+
moveText(source: string, start: number, target: string, index: number, length: number, origin: unknown): void;
|
|
105
108
|
formatText(id: string, index: number, length: number, marks: Record<string, unknown>, origin: unknown): void;
|
|
106
109
|
private textRanges;
|
|
107
110
|
}
|
|
@@ -43,6 +43,10 @@ export interface SharedDocumentInfo {
|
|
|
43
43
|
members: Member[];
|
|
44
44
|
updatedAt: number;
|
|
45
45
|
}
|
|
46
|
+
export interface SharedDocumentListing extends SharedDocumentInfo {
|
|
47
|
+
kind: "content" | "whiteboard" | "unknown";
|
|
48
|
+
protocolVersion: number | null;
|
|
49
|
+
}
|
|
46
50
|
export interface JoinRequest {
|
|
47
51
|
id: string;
|
|
48
52
|
documentId: string;
|
|
@@ -68,8 +72,7 @@ export interface SourceBinding {
|
|
|
68
72
|
contentDocumentId?: string;
|
|
69
73
|
/** 本机缓存最后确认的主库投影修订,不随文档共享。 */
|
|
70
74
|
projectionRevision?: string;
|
|
71
|
-
/**
|
|
72
|
-
titleAuthority?: "database";
|
|
75
|
+
/** 本机数据库替换后隔离旧缓存与延迟写入。 */
|
|
73
76
|
generation?: string;
|
|
74
77
|
sourceType?: SourceType;
|
|
75
78
|
sourceId?: number;
|
|
@@ -85,7 +88,7 @@ export interface CollaborationSession extends SharedDocumentInfo {
|
|
|
85
88
|
mode?: "local" | "shared";
|
|
86
89
|
frozen?: boolean;
|
|
87
90
|
serverUrl: string;
|
|
88
|
-
connection: "connecting" | "connected" | "offline" | "error";
|
|
91
|
+
connection: "idle" | "connecting" | "connected" | "offline" | "error";
|
|
89
92
|
pending: boolean;
|
|
90
93
|
leaving: boolean;
|
|
91
94
|
source?: SourceBinding;
|
|
@@ -123,6 +126,7 @@ export interface ContentInputDraft {
|
|
|
123
126
|
value: string;
|
|
124
127
|
revision: string;
|
|
125
128
|
sequence: number;
|
|
129
|
+
baseValue?: string;
|
|
126
130
|
}
|
|
127
131
|
export type CollaborationEvent = {
|
|
128
132
|
type: "refresh";
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as Y from "yjs";
|
|
2
|
+
import type { ContentContractDictionary } from "../../db-schema/content-contracts";
|
|
3
|
+
import { NodeTree } from "./node-tree";
|
|
4
|
+
import { CollaborationError, type ContentNode } from "./protocol";
|
|
5
|
+
type TextRun = {
|
|
6
|
+
text: string;
|
|
7
|
+
marks: Record<string, unknown>;
|
|
8
|
+
};
|
|
9
|
+
type TextEdit = {
|
|
10
|
+
kind: "text";
|
|
11
|
+
id: string;
|
|
12
|
+
blockId: string;
|
|
13
|
+
start: string;
|
|
14
|
+
end: string;
|
|
15
|
+
expected: TextRun[];
|
|
16
|
+
text: string;
|
|
17
|
+
runs?: TextRun[];
|
|
18
|
+
/** 逆操作额外记录提交后插入点的两侧,供逐段编辑安全接续。 */
|
|
19
|
+
continuation?: {
|
|
20
|
+
start: string;
|
|
21
|
+
end: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
type BlockEdit = {
|
|
25
|
+
kind: "blocks";
|
|
26
|
+
id: string;
|
|
27
|
+
left: string | null;
|
|
28
|
+
right: string | null;
|
|
29
|
+
expected: (ContentNode & {
|
|
30
|
+
collabId: string;
|
|
31
|
+
})[];
|
|
32
|
+
nodes: ContentNode[];
|
|
33
|
+
};
|
|
34
|
+
export type ScopedContentEdit = TextEdit | BlockEdit;
|
|
35
|
+
export interface ScopedContentEdits {
|
|
36
|
+
edits: ScopedContentEdit[];
|
|
37
|
+
contracts?: ContentContractDictionary;
|
|
38
|
+
source?: {
|
|
39
|
+
proposalId: string;
|
|
40
|
+
agentId?: string;
|
|
41
|
+
runId?: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface ScopedContentBaseline {
|
|
45
|
+
documentId: string;
|
|
46
|
+
baselineId: string;
|
|
47
|
+
epoch: number;
|
|
48
|
+
}
|
|
49
|
+
export interface ScopedContentSubmission extends ScopedContentBaseline {
|
|
50
|
+
operationId: string;
|
|
51
|
+
scope: ScopedContentEdits;
|
|
52
|
+
}
|
|
53
|
+
export type ScopedContentResult = {
|
|
54
|
+
status: "committed";
|
|
55
|
+
inverse?: ScopedContentEdits;
|
|
56
|
+
} | {
|
|
57
|
+
status: "conflict";
|
|
58
|
+
conflicts: ScopedContentConflict[];
|
|
59
|
+
} | {
|
|
60
|
+
status: "pending";
|
|
61
|
+
} | {
|
|
62
|
+
status: "rejected";
|
|
63
|
+
reason: string;
|
|
64
|
+
};
|
|
65
|
+
export interface ScopedContentConflict {
|
|
66
|
+
opId: string;
|
|
67
|
+
blockId?: string;
|
|
68
|
+
}
|
|
69
|
+
export declare class ScopedContentConflictError extends CollaborationError {
|
|
70
|
+
readonly conflicts: ScopedContentConflict[];
|
|
71
|
+
constructor(conflicts: ScopedContentConflict[]);
|
|
72
|
+
}
|
|
73
|
+
export declare function captureScopedTextEdit(tree: NodeTree, id: string, blockId: string, start: number, end: number, text: string): TextEdit;
|
|
74
|
+
export declare const scopedUndoOperationId: (operationId: string) => string;
|
|
75
|
+
export declare const scopedUndoSourceId: (operationId: string) => string | undefined;
|
|
76
|
+
export declare class ScopedUndoLimitError extends CollaborationError {
|
|
77
|
+
static readonly code = "UNDO_LIMIT";
|
|
78
|
+
static readonly description = "\u6539\u52A8\u8D85\u51FA\u53EF\u64A4\u9500\u5BB9\u91CF\uFF0C\u8BF7\u62C6\u6210\u8F83\u5C0F\u7684\u4FEE\u6539";
|
|
79
|
+
constructor();
|
|
80
|
+
}
|
|
81
|
+
/** 逐条判断编辑在当前正文上是否仍成立(锚点能解析且原文前提一致),不修改文档。 */
|
|
82
|
+
export declare function scopedEditsApplicable(current: Y.Doc, edits: ScopedContentEdit[]): boolean[];
|
|
83
|
+
export declare function validateScopedContentEdits(value: ScopedContentEdits): void;
|
|
84
|
+
/** 在写入队列内从同一份正文校验所有前提,候选失败时不触碰原文档。 */
|
|
85
|
+
export declare function buildScopedContentUpdate(current: Y.Doc, request: ScopedContentEdits, { undo }?: {
|
|
86
|
+
undo?: boolean;
|
|
87
|
+
}): Promise<{
|
|
88
|
+
update: Uint8Array;
|
|
89
|
+
inverse?: ScopedContentEdits;
|
|
90
|
+
}>;
|
|
91
|
+
export {};
|
|
@@ -2,6 +2,7 @@ import type { Node, Path } from "slate";
|
|
|
2
2
|
import { Descendant, Editor, Range } from "slate";
|
|
3
3
|
import type { EditorKit } from "./kit/EditorKit";
|
|
4
4
|
import type { EditorDocument } from "./document/EditorDocument";
|
|
5
|
+
import type { InlineSuggestionProvider } from "./inlineSuggestion/controller";
|
|
5
6
|
import type { EditorExtension } from "./api/extension";
|
|
6
7
|
import type { EditorRef } from "./types/editor";
|
|
7
8
|
import type { MarkRenderProps } from "./api/marks";
|
|
@@ -34,6 +35,8 @@ export interface IEditorProps {
|
|
|
34
35
|
decorate?: (entry: [Node, Path]) => Range[];
|
|
35
36
|
/** 包装已经应用标记的内容,不接管 Slate attributes。 */
|
|
36
37
|
leafWrapper?: ComponentType<MarkRenderProps>;
|
|
38
|
+
/** 当前视图的行内纯文本建议来源。 */
|
|
39
|
+
inlineSuggestions?: InlineSuggestionProvider;
|
|
37
40
|
/**
|
|
38
41
|
* 聚焦模式:沿光标所在的文档路径,同级兄弟元素退后(其余顶层块、列表的其他项、表格的其他单元格…)。
|
|
39
42
|
* 退后程度由宿主在容器上设置 `--ed-focus-dim`(缺省 0.26)。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Descendant, Editor, Node } from "slate";
|
|
2
|
+
export declare const CONTENT_FRAGMENT_MIME = "application/x-tau-content";
|
|
3
|
+
interface ContentFragmentTransfer {
|
|
4
|
+
documentKey(): string;
|
|
5
|
+
flushInputs(): void;
|
|
6
|
+
serialize(nodes: readonly Node[]): string;
|
|
7
|
+
prepare(fragment: string, signal?: AbortSignal): Promise<Descendant[] | undefined>;
|
|
8
|
+
flushWrites?(): Promise<void> | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function setContentFragmentTransfer(editor: Editor, transfer: ContentFragmentTransfer): void;
|
|
11
|
+
export declare const contentFragmentTransferOf: (editor: Editor) => ContentFragmentTransfer | undefined;
|
|
12
|
+
export declare function attachContentFragment(element: HTMLElement, fragment: string): void;
|
|
13
|
+
export declare function readContentFragment(data: DataTransfer): string | undefined;
|
|
14
|
+
export {};
|
|
@@ -6,7 +6,7 @@ import type { Element } from "slate";
|
|
|
6
6
|
export interface ElementDragSpec {
|
|
7
7
|
/** 自身可拖(显示手柄);false 时本块仅作为放置目标参与 */
|
|
8
8
|
self: boolean;
|
|
9
|
-
/**
|
|
9
|
+
/** 内部子块是否参与块级拖拽;false 时子块没有手柄,也不作为放置目标。 */
|
|
10
10
|
children: boolean;
|
|
11
11
|
/**
|
|
12
12
|
* 放置谓词:拖动元素能否落到本块(含本块内部)。缺省接受任何块。
|