y-mxgraph 0.1.2 → 0.1.3
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 +15 -0
- package/README.zh-CN.md +6 -0
- package/package.json +14 -1
package/README.md
CHANGED
|
@@ -29,6 +29,12 @@ import { Binding, LOCAL_ORIGIN } from 'y-mxgraph';
|
|
|
29
29
|
const doc = new Y.Doc();
|
|
30
30
|
|
|
31
31
|
App.main((app) => {
|
|
32
|
+
// 确保多端初始文件一致;draw.io 默认创建时 diagram id 是随机的,
|
|
33
|
+
// 若各客户端起点不同会导致协同异常。可用 generateFileTemplate 生成统一模板。
|
|
34
|
+
if (!app.currentFile.data) {
|
|
35
|
+
app.currentFile.data = Binding.generateFileTemplate('diagram-0');
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
const binding = new Binding(app.currentFile, { doc });
|
|
33
39
|
|
|
34
40
|
window.addEventListener('beforeunload', () => binding.destroy());
|
|
@@ -58,10 +64,19 @@ pnpm --filter y-mxgraph build
|
|
|
58
64
|
pnpm --filter y-mxgraph test
|
|
59
65
|
|
|
60
66
|
# Demo
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 单页模式(draw.io 直接加载在当前页面)
|
|
61
70
|
pnpm --filter @y-mxgraph/demo dev
|
|
62
71
|
|
|
72
|
+
# iframe 模式(父页运行 WebRTC Provider,两个 iframe 各跑一套 draw.io + y-mxgraph,通过 postMessage 同步)
|
|
73
|
+
# 访问 http://localhost:5173/iframe-mode.html
|
|
74
|
+
```
|
|
75
|
+
|
|
63
76
|
# Docs
|
|
77
|
+
|
|
64
78
|
pnpm --filter @y-mxgraph/docs dev
|
|
79
|
+
|
|
65
80
|
```
|
|
66
81
|
|
|
67
82
|
## License
|
package/README.zh-CN.md
CHANGED
|
@@ -29,6 +29,12 @@ import { Binding, LOCAL_ORIGIN } from 'y-mxgraph';
|
|
|
29
29
|
const doc = new Y.Doc();
|
|
30
30
|
|
|
31
31
|
App.main((app) => {
|
|
32
|
+
// 必须保证多端初始文件一致;draw.io 默认新建 diagram 时 id 是随机的,
|
|
33
|
+
// 若各客户端起点不同会导致协同异常。可用 generateFileTemplate 生成统一模板。
|
|
34
|
+
if (!app.currentFile.data) {
|
|
35
|
+
app.currentFile.data = Binding.generateFileTemplate('diagram-0');
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
const binding = new Binding(app.currentFile, { doc });
|
|
33
39
|
|
|
34
40
|
window.addEventListener('beforeunload', () => binding.destroy());
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "y-mxgraph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Yjs binding for draw.io (mxGraph) documents",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"yjs",
|
|
7
|
+
"mxgraph",
|
|
8
|
+
"drawio",
|
|
9
|
+
"draw.io",
|
|
10
|
+
"crdt",
|
|
11
|
+
"collaboration",
|
|
12
|
+
"real-time",
|
|
13
|
+
"operational-transformation",
|
|
14
|
+
"diagram",
|
|
15
|
+
"graph",
|
|
16
|
+
"sync"
|
|
17
|
+
],
|
|
5
18
|
"type": "module",
|
|
6
19
|
"main": "./y-mxgraph.cjs.js",
|
|
7
20
|
"module": "./y-mxgraph.es.js",
|