feat: add transport-independent Yjs collaboration - #363
Open
peanut4556 wants to merge 1 commit into
Open
peanut4556 wants to merge 1 commit into
peanut4556 wants to merge 1 commit into
Conversation
|
ljxxy seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary / 摘要
新增可选的 Yjs 实时协作编辑包,为 Markdown 编辑器提供增量同步、离线合并、独立撤销/重做和远端光标能力。
Motivation / 背景与动机
通过整篇 Markdown 替换进行同步会丢失并发编辑,并将远端修改混入本地撤销历史。本次实现使用 Yjs CRDT 同步增量操作,同时保持 Nexus 作为无头 Markdown 编辑器引擎的定位。
add-crdt-collaboration,位于openspec/changes/add-crdt-collaboration/。Changes / 变更内容
packages/core:editorHistory后端,用于接管公开 undo/redo API;未配置时保留原有行为。livePreview.tableMode: "source",保留表格 Markdown 源码编辑及其他节点的实时预览。packages/plugin-*:@floatboat/nexus-plugin-collab和createCollaborativeEditor()。Y.Text双向绑定,同步增量编辑。apps/electron-demo:packages/plugin-collab/examples/。openspec/:Testing / 测试
pnpm testpasses / 全绿:全仓库 72 个测试文件、932 个测试用例通过。pnpm build) / 受影响包构建通过:工作区包构建通过。其他已通过检查:
pnpm typecheckpnpm check:apipnpm --filter @floatboat/nexus-plugin-collab build:demoopenspec validate add-crdt-collaboration --strictgit diff --check验证使用 pnpm 9.15.4。示例构建存在大体积 chunk 提示;尚未完成交互式浏览器验收。
Compliance / 合规自检
AI-assisted notes / AI 使用说明:
本次部分功能实现、测试和文档由 OpenAI Codex 根据需求生成并迭代,包含AI 生成的功能代码。
-
yjs@^13.6.27— MIT — peer dependency;提供 CRDT 文本、更新编码、状态向量、相对位置及选择性撤销。自行实现会引入并发收敛与历史恢复的复杂性。-
y-protocols@^1.0.6— MIT — peer dependency;提供 awareness 状态协议,避免自定义一套与常见 Yjs provider 不兼容的协议。- 新包复用已有工作区依赖:
@codemirror/commands@^6.8.1、@codemirror/state@^6.6.0、@codemirror/view@^6.41.0和@floatboat/nexus-core@workspace:*,用于编辑器状态、视图、历史及核心 API 集成。-
vite@^6.3.0— MIT — 开发依赖,仅用于运行和构建双副本示例。- 新依赖仍需维护者批准。
dist/,dist-electron/, compiled.jsfrom.ts) / 未提交构建产物.env/ personal vault data committed / 无敏感信息Checklist / 自检清单
feat: add transport-independent Yjs collaboration;按 CONTRIBUTING.md §2 省略 scope。live-preview-table.ts→ walked through the 12 Table Widget rules in CLAUDE.md / 不适用:未修改该文件。add-crdt-collaboration;维护者批准尚待完成。Screenshots / Recordings · 截图或录屏 (UI changes)