@textbus/collaborate 2.0.0-beta.2 → 2.0.0-beta.22
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/{collab/collaborate-cursor.d.ts → collaborate-cursor.d.ts} +11 -6
- package/bundles/collaborate-cursor.js +265 -0
- package/bundles/collaborate.d.ts +5 -5
- package/bundles/collaborate.js +58 -43
- package/bundles/fixed-caret.plugin.d.ts +9 -0
- package/bundles/fixed-caret.plugin.js +41 -0
- package/bundles/public-api.d.ts +4 -1
- package/bundles/public-api.js +16 -2
- package/bundles/unknown.component.d.ts +1 -0
- package/bundles/unknown.component.js +22 -0
- package/package.json +6 -6
- package/src/{collab/collaborate-cursor.ts → collaborate-cursor.ts} +77 -53
- package/src/collaborate.ts +63 -52
- package/src/fixed-caret.plugin.ts +35 -0
- package/src/public-api.ts +18 -1
- package/src/unknown.component.ts +22 -0
- package/bundles/collab/_api.d.ts +0 -1
- package/bundles/collab/_api.js +0 -2
- package/bundles/collab/collaborate-cursor.js +0 -245
- package/src/collab/_api.ts +0 -1
@@ -1,33 +1,38 @@
|
|
1
1
|
import { SelectionBridge } from '@textbus/browser';
|
2
|
-
import { Selection, SelectionPaths } from '@textbus/core';
|
2
|
+
import { Selection, SelectionPaths, Range as TBRange } from '@textbus/core';
|
3
3
|
export interface RemoteSelection {
|
4
4
|
color: string;
|
5
5
|
username: string;
|
6
6
|
paths: SelectionPaths;
|
7
7
|
}
|
8
|
-
export interface
|
9
|
-
color: string;
|
10
|
-
username: string;
|
8
|
+
export interface Rect {
|
11
9
|
x: number;
|
12
10
|
y: number;
|
13
11
|
width: number;
|
14
12
|
height: number;
|
15
13
|
}
|
14
|
+
export interface SelectionRect extends Rect {
|
15
|
+
color: string;
|
16
|
+
username: string;
|
17
|
+
}
|
16
18
|
export interface RemoteSelectionCursor {
|
17
19
|
cursor: HTMLElement;
|
18
20
|
anchor: HTMLElement;
|
19
21
|
userTip: HTMLElement;
|
20
22
|
}
|
23
|
+
export declare abstract class CollaborateCursorAwarenessDelegate {
|
24
|
+
abstract getRects(range: TBRange, nativeRange: Range): false | Rect[];
|
25
|
+
}
|
21
26
|
export declare class CollaborateCursor {
|
22
27
|
private container;
|
23
|
-
private
|
28
|
+
private awarenessDelegate;
|
24
29
|
private nativeSelection;
|
25
30
|
private selection;
|
26
31
|
private canvas;
|
27
32
|
private context;
|
28
33
|
private tooltips;
|
29
34
|
private onRectsChange;
|
30
|
-
constructor(container: HTMLElement,
|
35
|
+
constructor(container: HTMLElement, awarenessDelegate: CollaborateCursorAwarenessDelegate, nativeSelection: SelectionBridge, selection: Selection);
|
31
36
|
draw(paths: RemoteSelection[]): void;
|
32
37
|
private drawUserCursor;
|
33
38
|
private getUserCursor;
|
@@ -0,0 +1,265 @@
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
6
|
+
};
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
9
|
+
};
|
10
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
11
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
12
|
+
};
|
13
|
+
import { Inject, Injectable, Optional } from '@tanbo/di';
|
14
|
+
import { createElement, EDITOR_CONTAINER, getLayoutRectByRange, SelectionBridge } from '@textbus/browser';
|
15
|
+
import { Selection } from '@textbus/core';
|
16
|
+
import { Subject } from '@tanbo/stream';
|
17
|
+
export class CollaborateCursorAwarenessDelegate {
|
18
|
+
}
|
19
|
+
let CollaborateCursor = class CollaborateCursor {
|
20
|
+
constructor(container, awarenessDelegate, nativeSelection, selection) {
|
21
|
+
Object.defineProperty(this, "container", {
|
22
|
+
enumerable: true,
|
23
|
+
configurable: true,
|
24
|
+
writable: true,
|
25
|
+
value: container
|
26
|
+
});
|
27
|
+
Object.defineProperty(this, "awarenessDelegate", {
|
28
|
+
enumerable: true,
|
29
|
+
configurable: true,
|
30
|
+
writable: true,
|
31
|
+
value: awarenessDelegate
|
32
|
+
});
|
33
|
+
Object.defineProperty(this, "nativeSelection", {
|
34
|
+
enumerable: true,
|
35
|
+
configurable: true,
|
36
|
+
writable: true,
|
37
|
+
value: nativeSelection
|
38
|
+
});
|
39
|
+
Object.defineProperty(this, "selection", {
|
40
|
+
enumerable: true,
|
41
|
+
configurable: true,
|
42
|
+
writable: true,
|
43
|
+
value: selection
|
44
|
+
});
|
45
|
+
Object.defineProperty(this, "canvas", {
|
46
|
+
enumerable: true,
|
47
|
+
configurable: true,
|
48
|
+
writable: true,
|
49
|
+
value: createElement('canvas', {
|
50
|
+
styles: {
|
51
|
+
position: 'absolute',
|
52
|
+
opacity: 0.5,
|
53
|
+
left: 0,
|
54
|
+
top: 0,
|
55
|
+
width: '100%',
|
56
|
+
height: '100%',
|
57
|
+
pointerEvents: 'none'
|
58
|
+
}
|
59
|
+
})
|
60
|
+
});
|
61
|
+
Object.defineProperty(this, "context", {
|
62
|
+
enumerable: true,
|
63
|
+
configurable: true,
|
64
|
+
writable: true,
|
65
|
+
value: this.canvas.getContext('2d')
|
66
|
+
});
|
67
|
+
Object.defineProperty(this, "tooltips", {
|
68
|
+
enumerable: true,
|
69
|
+
configurable: true,
|
70
|
+
writable: true,
|
71
|
+
value: createElement('div', {
|
72
|
+
styles: {
|
73
|
+
position: 'absolute',
|
74
|
+
left: 0,
|
75
|
+
top: 0,
|
76
|
+
width: '100%',
|
77
|
+
height: '100%',
|
78
|
+
pointerEvents: 'none',
|
79
|
+
fontSize: '12px',
|
80
|
+
zIndex: 10
|
81
|
+
}
|
82
|
+
})
|
83
|
+
});
|
84
|
+
Object.defineProperty(this, "onRectsChange", {
|
85
|
+
enumerable: true,
|
86
|
+
configurable: true,
|
87
|
+
writable: true,
|
88
|
+
value: new Subject()
|
89
|
+
});
|
90
|
+
container.prepend(this.canvas, this.tooltips);
|
91
|
+
this.onRectsChange.subscribe(rects => {
|
92
|
+
for (const rect of rects) {
|
93
|
+
this.context.fillStyle = rect.color;
|
94
|
+
this.context.beginPath();
|
95
|
+
this.context.rect(rect.x, rect.y, rect.width, rect.height);
|
96
|
+
this.context.fill();
|
97
|
+
this.context.closePath();
|
98
|
+
}
|
99
|
+
});
|
100
|
+
}
|
101
|
+
draw(paths) {
|
102
|
+
const containerRect = this.container.getBoundingClientRect();
|
103
|
+
this.canvas.width = containerRect.width;
|
104
|
+
this.canvas.height = containerRect.height;
|
105
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
106
|
+
const users = [];
|
107
|
+
paths.filter(i => {
|
108
|
+
return i.paths.anchor.length && i.paths.focus.length;
|
109
|
+
}).forEach(item => {
|
110
|
+
const anchorOffset = item.paths.anchor.pop();
|
111
|
+
const anchorSlot = this.selection.findSlotByPaths(item.paths.anchor);
|
112
|
+
const focusOffset = item.paths.focus.pop();
|
113
|
+
const focusSlot = this.selection.findSlotByPaths(item.paths.focus);
|
114
|
+
if (!anchorSlot || !focusSlot) {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
const { focus, anchor } = this.nativeSelection.getPositionByRange({
|
118
|
+
focusOffset,
|
119
|
+
anchorOffset,
|
120
|
+
focusSlot,
|
121
|
+
anchorSlot
|
122
|
+
});
|
123
|
+
if (!focus || !anchor) {
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
const nativeRange = document.createRange();
|
127
|
+
nativeRange.setStart(anchor.node, anchor.offset);
|
128
|
+
nativeRange.setEnd(focus.node, focus.offset);
|
129
|
+
if ((anchor.node !== focus.node || anchor.offset !== focus.offset) && nativeRange.collapsed) {
|
130
|
+
nativeRange.setStart(focus.node, focus.offset);
|
131
|
+
nativeRange.setEnd(anchor.node, anchor.offset);
|
132
|
+
}
|
133
|
+
let rects = false;
|
134
|
+
if (this.awarenessDelegate) {
|
135
|
+
rects = this.awarenessDelegate.getRects({
|
136
|
+
focusOffset,
|
137
|
+
anchorOffset,
|
138
|
+
focusSlot,
|
139
|
+
anchorSlot
|
140
|
+
}, nativeRange);
|
141
|
+
}
|
142
|
+
if (!rects) {
|
143
|
+
rects = nativeRange.getClientRects();
|
144
|
+
}
|
145
|
+
const selectionRects = [];
|
146
|
+
for (let i = rects.length - 1; i >= 0; i--) {
|
147
|
+
const rect = rects[i];
|
148
|
+
selectionRects.push({
|
149
|
+
color: item.color,
|
150
|
+
username: item.username,
|
151
|
+
x: rect.x - containerRect.x,
|
152
|
+
y: rect.y - containerRect.y,
|
153
|
+
width: rect.width,
|
154
|
+
height: rect.height,
|
155
|
+
});
|
156
|
+
}
|
157
|
+
this.onRectsChange.next(selectionRects);
|
158
|
+
const cursorRange = nativeRange.cloneRange();
|
159
|
+
cursorRange.setStart(focus.node, focus.offset);
|
160
|
+
cursorRange.collapse(true);
|
161
|
+
const cursorRect = getLayoutRectByRange(cursorRange);
|
162
|
+
users.push({
|
163
|
+
username: item.username,
|
164
|
+
color: item.color,
|
165
|
+
x: cursorRect.x - containerRect.x,
|
166
|
+
y: cursorRect.y - containerRect.y,
|
167
|
+
width: 2,
|
168
|
+
height: cursorRect.height
|
169
|
+
});
|
170
|
+
});
|
171
|
+
this.drawUserCursor(users);
|
172
|
+
}
|
173
|
+
drawUserCursor(rects) {
|
174
|
+
for (let i = 0; i < rects.length; i++) {
|
175
|
+
const rect = rects[i];
|
176
|
+
const { cursor, userTip, anchor } = this.getUserCursor(i);
|
177
|
+
Object.assign(cursor.style, {
|
178
|
+
left: rect.x + 'px',
|
179
|
+
top: rect.y + 'px',
|
180
|
+
width: rect.width + 'px',
|
181
|
+
height: rect.height + 'px',
|
182
|
+
background: rect.color,
|
183
|
+
display: 'block'
|
184
|
+
});
|
185
|
+
anchor.style.background = rect.color;
|
186
|
+
userTip.innerText = rect.username;
|
187
|
+
userTip.style.background = rect.color;
|
188
|
+
}
|
189
|
+
for (let i = rects.length; i < this.tooltips.children.length; i++) {
|
190
|
+
this.tooltips.removeChild(this.tooltips.children[i]);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
getUserCursor(index) {
|
194
|
+
let child = this.tooltips.children[index];
|
195
|
+
if (child) {
|
196
|
+
const anchor = child.children[0];
|
197
|
+
return {
|
198
|
+
cursor: child,
|
199
|
+
anchor,
|
200
|
+
userTip: anchor.children[0]
|
201
|
+
};
|
202
|
+
}
|
203
|
+
const userTip = createElement('span', {
|
204
|
+
styles: {
|
205
|
+
position: 'absolute',
|
206
|
+
display: 'none',
|
207
|
+
left: '50%',
|
208
|
+
transform: 'translateX(-50%)',
|
209
|
+
marginBottom: '2px',
|
210
|
+
bottom: '100%',
|
211
|
+
whiteSpace: 'nowrap',
|
212
|
+
color: '#fff',
|
213
|
+
boxShadow: '0 1px 2px rgba(0,0,0,.1)',
|
214
|
+
borderRadius: '3px',
|
215
|
+
padding: '3px 5px',
|
216
|
+
pointerEvents: 'none',
|
217
|
+
}
|
218
|
+
});
|
219
|
+
const anchor = createElement('span', {
|
220
|
+
styles: {
|
221
|
+
position: 'absolute',
|
222
|
+
top: '-2px',
|
223
|
+
left: '-2px',
|
224
|
+
width: '6px',
|
225
|
+
height: '6px',
|
226
|
+
pointerEvents: 'auto',
|
227
|
+
pointer: 'cursor',
|
228
|
+
},
|
229
|
+
children: [userTip],
|
230
|
+
on: {
|
231
|
+
mouseenter() {
|
232
|
+
userTip.style.display = 'block';
|
233
|
+
},
|
234
|
+
mouseleave() {
|
235
|
+
userTip.style.display = 'none';
|
236
|
+
}
|
237
|
+
}
|
238
|
+
});
|
239
|
+
child = createElement('span', {
|
240
|
+
styles: {
|
241
|
+
position: 'absolute',
|
242
|
+
},
|
243
|
+
children: [
|
244
|
+
anchor
|
245
|
+
]
|
246
|
+
});
|
247
|
+
this.tooltips.append(child);
|
248
|
+
return {
|
249
|
+
cursor: child,
|
250
|
+
anchor,
|
251
|
+
userTip
|
252
|
+
};
|
253
|
+
}
|
254
|
+
};
|
255
|
+
CollaborateCursor = __decorate([
|
256
|
+
Injectable(),
|
257
|
+
__param(0, Inject(EDITOR_CONTAINER)),
|
258
|
+
__param(1, Optional()),
|
259
|
+
__metadata("design:paramtypes", [HTMLElement,
|
260
|
+
CollaborateCursorAwarenessDelegate,
|
261
|
+
SelectionBridge,
|
262
|
+
Selection])
|
263
|
+
], CollaborateCursor);
|
264
|
+
export { CollaborateCursor };
|
265
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29sbGFib3JhdGUtY3Vyc29yLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL2NvbGxhYm9yYXRlLWN1cnNvci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsTUFBTSxXQUFXLENBQUE7QUFDeEQsT0FBTyxFQUNMLGFBQWEsRUFDYixnQkFBZ0IsRUFDaEIsb0JBQW9CLEVBQ3BCLGVBQWUsRUFDaEIsTUFBTSxrQkFBa0IsQ0FBQTtBQUN6QixPQUFPLEVBQUUsU0FBUyxFQUFvQyxNQUFNLGVBQWUsQ0FBQTtBQUMzRSxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sZUFBZSxDQUFBO0FBMEJ2QyxNQUFNLE9BQWdCLGtDQUFrQztDQUV2RDtBQUdELElBQWEsaUJBQWlCLEdBQTlCLE1BQWEsaUJBQWlCO0lBNEI1QixZQUE4QyxTQUFzQixFQUNwQyxpQkFBcUQsRUFDakUsZUFBZ0MsRUFDaEMsU0FBb0I7Ozs7O21CQUhNOzs7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cjogaXRlbS5jb2xvcixcbiAgICAgICAgICB1c2VybmFtZTogaXRlbS51c2VybmFtZSxcbiAgICAgICAgICB4OiByZWN0LnggLSBjb250YWluZXJSZWN0LngsXG4gICAgICAgICAgeTogcmVjdC55IC0gY29udGFpbmVyUmVjdC55LFxuICAgICAgICAgIHdpZHRoOiByZWN0LndpZHRoLFxuICAgICAgICAgIGhlaWdodDogcmVjdC5oZWlnaHQsXG4gICAgICAgIH0pXG4gICAgICB9XG4gICAgICB0aGlzLm9uUmVjdHNDaGFuZ2UubmV4dChzZWxlY3Rpb25SZWN0cylcblxuICAgICAgY29uc3QgY3Vyc29yUmFuZ2UgPSBuYXRpdmVSYW5nZS5jbG9uZVJhbmdlKClcbiAgICAgIGN1cnNvclJhbmdlLnNldFN0YXJ0KGZvY3VzLm5vZGUsIGZvY3VzLm9mZnNldClcbiAgICAgIGN1cnNvclJhbmdlLmNvbGxhcHNlKHRydWUpXG5cbiAgICAgIGNvbnN0IGN1cnNvclJlY3QgPSBnZXRMYXlvdXRSZWN0QnlSYW5nZShjdXJzb3JSYW5nZSlcblxuICAgICAgdXNlcnMucHVzaCh7XG4gICAgICAgIHVzZXJuYW1lOiBpdGVtLnVzZXJuYW1lLFxuICAgICAgICBjb2xvcjogaXRlbS5jb2xvcixcbiAgICAgICAgeDogY3Vyc29yUmVjdC54IC0gY29udGFpbmVyUmVjdC54LFxuICAgICAgICB5OiBjdXJzb3JSZWN0LnkgLSBjb250YWluZXJSZWN0LnksXG4gICAgICAgIHdpZHRoOiAyLFxuICAgICAgICBoZWlnaHQ6IGN1cnNvclJlY3QuaGVpZ2h0XG4gICAgICB9KVxuICAgIH0pXG4gICAgdGhpcy5kcmF3VXNlckN1cnNvcih1c2VycylcbiAgfVxuXG4gIHByaXZhdGUgZHJhd1VzZXJDdXJzb3IocmVjdHM6IFNlbGVjdGlvblJlY3RbXSkge1xuICAgIGZvciAobGV0IGkgPSAwOyBpIDwgcmVjdHMubGVuZ3RoOyBpKyspIHt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HJlbjogW3VzZXJUaXBdLFxuICAgICAgb246IHtcbiAgICAgICAgbW91c2VlbnRlcigpIHtcbiAgICAgICAgICB1c2VyVGlwLnN0eWxlLmRpc3BsYXkgPSAnYmxvY2snXG4gICAgICAgIH0sXG4gICAgICAgIG1vdXNlbGVhdmUoKSB7XG4gICAgICAgICAgdXNlclRpcC5zdHlsZS5kaXNwbGF5ID0gJ25vbmUnXG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9KVxuICAgIGNoaWxkID0gY3JlYXRlRWxlbWVudCgnc3BhbicsIHtcbiAgICAgIHN0eWxlczoge1xuICAgICAgICBwb3NpdGlvbjogJ2Fic29sdXRlJyxcbiAgICAgIH0sXG4gICAgICBjaGlsZHJlbjogW1xuICAgICAgICBhbmNob3JcbiAgICAgIF1cbiAgICB9KVxuICAgIHRoaXMudG9vbHRpcHMuYXBwZW5kKGNoaWxkKVxuICAgIHJldHVybiB7XG4gICAgICBjdXJzb3I6IGNoaWxkLFxuICAgICAgYW5jaG9yLFxuICAgICAgdXNlclRpcFxuICAgIH1cbiAgfVxufVxuIl19
|
package/bundles/collaborate.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
import { Observable } from '@tanbo/stream';
|
2
|
-
import {
|
2
|
+
import { History, Registry, RootComponentRef, Scheduler, Selection, SelectionPaths, Starter, Translator } from '@textbus/core';
|
3
3
|
import { Doc as YDoc } from 'yjs';
|
4
|
-
import { CollaborateCursor, RemoteSelection } from './
|
4
|
+
import { CollaborateCursor, RemoteSelection } from './collaborate-cursor';
|
5
5
|
export declare class Collaborate implements History {
|
6
6
|
private rootComponentRef;
|
7
7
|
private collaborateCursor;
|
8
|
+
private scheduler;
|
8
9
|
private translator;
|
9
|
-
private renderer;
|
10
10
|
private registry;
|
11
11
|
private selection;
|
12
12
|
private starter;
|
@@ -31,14 +31,14 @@ export declare class Collaborate implements History {
|
|
31
31
|
private componentStateSyncCaches;
|
32
32
|
private selectionChangeEvent;
|
33
33
|
private updateRemoteActions;
|
34
|
-
constructor(rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor,
|
34
|
+
constructor(rootComponentRef: RootComponentRef, collaborateCursor: CollaborateCursor, scheduler: Scheduler, translator: Translator, registry: Registry, selection: Selection, starter: Starter);
|
35
35
|
setup(): void;
|
36
36
|
updateRemoteSelection(paths: RemoteSelection[]): void;
|
37
37
|
listen(): void;
|
38
38
|
back(): void;
|
39
39
|
forward(): void;
|
40
40
|
destroy(): void;
|
41
|
-
private
|
41
|
+
private syncRootComponent;
|
42
42
|
private syncContent;
|
43
43
|
private syncSlot;
|
44
44
|
private syncSlots;
|