@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 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
 
@@ -4567,6 +4567,9 @@ class AtComponent extends Component {
4567
4567
  this.selectedIndex = createSignal(0);
4568
4568
  }
4569
4569
  getSlots() {
4570
+ if (this.state.userInfo) {
4571
+ return [];
4572
+ }
4570
4573
  if (this.state.slot) {
4571
4574
  return [this.state.slot];
4572
4575
  }
package/bundles/index.js CHANGED
@@ -4569,6 +4569,9 @@ class AtComponent extends core$1.Component {
4569
4569
  this.selectedIndex = core.createSignal(0);
4570
4570
  }
4571
4571
  getSlots() {
4572
+ if (this.state.userInfo) {
4573
+ return [];
4574
+ }
4572
4575
  if (this.state.slot) {
4573
4576
  return [this.state.slot];
4574
4577
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@textbus/xnote",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "A high-performance rich text editor that supports multiplayer online collaboration.",
5
5
  "main": "./bundles/index.js",
6
6
  "module": "./bundles/index.esm.js",