@textbus/xnote 0.0.1 → 0.0.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/README.md +38 -2
- package/bundles/index.esm.js +3 -0
- package/bundles/index.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,8 +56,6 @@ const editor = new Editor({
|
|
|
56
56
|
|
|
57
57
|
## 粘贴图片 Base64 转 URL
|
|
58
58
|
|
|
59
|
-
base64 转 url 实现思路为 base64 转
|
|
60
|
-
|
|
61
59
|
```ts
|
|
62
60
|
import { Commander } from '@textbus/core'
|
|
63
61
|
import { Injectable } from '@viewfly/core'
|
|
@@ -102,4 +100,42 @@ const editor = new Editor({
|
|
|
102
100
|
})
|
|
103
101
|
```
|
|
104
102
|
|
|
103
|
+
## @ 人
|
|
104
|
+
|
|
105
|
+
在文档中 @ 人功能需实现以下接口,以对接用户信息
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
export abstract class Organization {
|
|
109
|
+
abstract getMembers(name?: string): Promise<Member[]>
|
|
110
|
+
|
|
111
|
+
abstract getMemberById(id: string): Promise<Member | null>
|
|
112
|
+
}
|
|
113
|
+
```
|
|
114
|
+
然后在编辑器初始化时传入你的实现
|
|
115
|
+
```ts
|
|
116
|
+
const editor = new Editor({
|
|
117
|
+
providers: [{
|
|
118
|
+
provide: Organization,
|
|
119
|
+
useValue: new YourOrganization()
|
|
120
|
+
}]
|
|
121
|
+
})
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 协作支持
|
|
125
|
+
|
|
126
|
+
Textbus 天然支持协作,只需要在编辑器配置项中添加协作配置信息即可,具体配置你可以参考 [https://textbus.io/guide/collab/](https://textbus.io/guide/collab/)
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const editor = new Editor({
|
|
130
|
+
collaborateConfig: {
|
|
131
|
+
userinfo: user, // 用户信息
|
|
132
|
+
createConnector(yDoc): SyncConnector {
|
|
133
|
+
// 返回连接器
|
|
134
|
+
return new YWebsocketConnector('wss://example.com', 'docName', yDoc)
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
})
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
|
|
105
141
|
|
package/bundles/index.esm.js
CHANGED
package/bundles/index.js
CHANGED
package/package.json
CHANGED