@textbus/collaborate 3.0.0-alpha.17 → 3.0.0-alpha.19
Sign up to get free protection for your applications and to get access to all the features.
- package/bundles/collaborate-cursor.d.ts +5 -3
- package/bundles/index.esm.js +10 -11
- package/bundles/index.js +8 -9
- package/package.json +4 -4
- package/rollup.config.ts +0 -20
@@ -1,3 +1,4 @@
|
|
1
|
+
import { Injector } from '@tanbo/di';
|
1
2
|
import { SelectionBridge } from '@textbus/browser';
|
2
3
|
import { Selection, SelectionPaths, AbstractSelection, Scheduler, Rect } from '@textbus/core';
|
3
4
|
export interface RemoteSelection {
|
@@ -20,11 +21,11 @@ export declare abstract class CollaborateSelectionAwarenessDelegate {
|
|
20
21
|
abstract getRects(abstractSelection: AbstractSelection, nativeRange: Range): false | Rect[];
|
21
22
|
}
|
22
23
|
export declare class CollaborateCursor {
|
23
|
-
private
|
24
|
-
private awarenessDelegate;
|
24
|
+
private injector;
|
25
25
|
private nativeSelection;
|
26
26
|
private scheduler;
|
27
27
|
private selection;
|
28
|
+
private awarenessDelegate;
|
28
29
|
private host;
|
29
30
|
private canvasContainer;
|
30
31
|
private canvas;
|
@@ -33,7 +34,8 @@ export declare class CollaborateCursor {
|
|
33
34
|
private onRectsChange;
|
34
35
|
private subscription;
|
35
36
|
private currentSelection;
|
36
|
-
|
37
|
+
private container;
|
38
|
+
constructor(injector: Injector, nativeSelection: SelectionBridge, scheduler: Scheduler, selection: Selection, awarenessDelegate?: CollaborateSelectionAwarenessDelegate | null);
|
37
39
|
refresh(): void;
|
38
40
|
destroy(): void;
|
39
41
|
draw(paths: RemoteSelection[]): void;
|
package/bundles/index.esm.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Scheduler, Selection, defineComponent, ContentType, VElement, makeError, HISTORY_STACK_SIZE, ChangeOrigin, Slot, RootComponentRef, Controller, Factory, Starter, History } from '@textbus/core';
|
2
|
-
import { Injectable,
|
2
|
+
import { Injectable, Optional, Injector, Inject } from '@tanbo/di';
|
3
3
|
import { Subject, Subscription, fromEvent, delay, map, filter } from '@tanbo/stream';
|
4
4
|
import { Doc, UndoManager, Array, createAbsolutePositionFromRelativePosition, createRelativePositionFromTypeIndex, Map, Text } from 'yjs';
|
5
|
-
import {
|
5
|
+
import { createElement, VIEW_CONTAINER, getLayoutRectByRange, SelectionBridge } from '@textbus/browser';
|
6
6
|
|
7
7
|
/*! *****************************************************************************
|
8
8
|
Copyright (c) Microsoft Corporation.
|
@@ -37,12 +37,12 @@ function __metadata(metadataKey, metadataValue) {
|
|
37
37
|
class CollaborateSelectionAwarenessDelegate {
|
38
38
|
}
|
39
39
|
let CollaborateCursor = class CollaborateCursor {
|
40
|
-
constructor(
|
41
|
-
this.
|
42
|
-
this.awarenessDelegate = awarenessDelegate;
|
40
|
+
constructor(injector, nativeSelection, scheduler, selection, awarenessDelegate = null) {
|
41
|
+
this.injector = injector;
|
43
42
|
this.nativeSelection = nativeSelection;
|
44
43
|
this.scheduler = scheduler;
|
45
44
|
this.selection = selection;
|
45
|
+
this.awarenessDelegate = awarenessDelegate;
|
46
46
|
this.host = createElement('div', {
|
47
47
|
styles: {
|
48
48
|
position: 'absolute',
|
@@ -91,9 +91,10 @@ let CollaborateCursor = class CollaborateCursor {
|
|
91
91
|
this.onRectsChange = new Subject();
|
92
92
|
this.subscription = new Subscription();
|
93
93
|
this.currentSelection = [];
|
94
|
+
this.container = injector.get(VIEW_CONTAINER);
|
94
95
|
this.canvasContainer.append(this.canvas);
|
95
96
|
this.host.append(this.canvasContainer, this.tooltips);
|
96
|
-
container.prepend(this.host);
|
97
|
+
this.container.prepend(this.host);
|
97
98
|
this.subscription.add(this.onRectsChange.subscribe(rects => {
|
98
99
|
for (const rect of rects) {
|
99
100
|
this.context.fillStyle = rect.color;
|
@@ -281,13 +282,11 @@ let CollaborateCursor = class CollaborateCursor {
|
|
281
282
|
};
|
282
283
|
CollaborateCursor = __decorate([
|
283
284
|
Injectable(),
|
284
|
-
__param(
|
285
|
-
|
286
|
-
__metadata("design:paramtypes", [HTMLElement,
|
287
|
-
CollaborateSelectionAwarenessDelegate,
|
285
|
+
__param(4, Optional()),
|
286
|
+
__metadata("design:paramtypes", [Injector,
|
288
287
|
SelectionBridge,
|
289
288
|
Scheduler,
|
290
|
-
Selection])
|
289
|
+
Selection, Object])
|
291
290
|
], CollaborateCursor);
|
292
291
|
|
293
292
|
function createUnknownComponent(factoryName, canInsertInlineComponent) {
|
package/bundles/index.js
CHANGED
@@ -39,12 +39,12 @@ function __metadata(metadataKey, metadataValue) {
|
|
39
39
|
class CollaborateSelectionAwarenessDelegate {
|
40
40
|
}
|
41
41
|
exports.CollaborateCursor = class CollaborateCursor {
|
42
|
-
constructor(
|
43
|
-
this.
|
44
|
-
this.awarenessDelegate = awarenessDelegate;
|
42
|
+
constructor(injector, nativeSelection, scheduler, selection, awarenessDelegate = null) {
|
43
|
+
this.injector = injector;
|
45
44
|
this.nativeSelection = nativeSelection;
|
46
45
|
this.scheduler = scheduler;
|
47
46
|
this.selection = selection;
|
47
|
+
this.awarenessDelegate = awarenessDelegate;
|
48
48
|
this.host = browser.createElement('div', {
|
49
49
|
styles: {
|
50
50
|
position: 'absolute',
|
@@ -93,9 +93,10 @@ exports.CollaborateCursor = class CollaborateCursor {
|
|
93
93
|
this.onRectsChange = new stream.Subject();
|
94
94
|
this.subscription = new stream.Subscription();
|
95
95
|
this.currentSelection = [];
|
96
|
+
this.container = injector.get(browser.VIEW_CONTAINER);
|
96
97
|
this.canvasContainer.append(this.canvas);
|
97
98
|
this.host.append(this.canvasContainer, this.tooltips);
|
98
|
-
container.prepend(this.host);
|
99
|
+
this.container.prepend(this.host);
|
99
100
|
this.subscription.add(this.onRectsChange.subscribe(rects => {
|
100
101
|
for (const rect of rects) {
|
101
102
|
this.context.fillStyle = rect.color;
|
@@ -283,13 +284,11 @@ exports.CollaborateCursor = class CollaborateCursor {
|
|
283
284
|
};
|
284
285
|
exports.CollaborateCursor = __decorate([
|
285
286
|
di.Injectable(),
|
286
|
-
__param(
|
287
|
-
|
288
|
-
__metadata("design:paramtypes", [HTMLElement,
|
289
|
-
CollaborateSelectionAwarenessDelegate,
|
287
|
+
__param(4, di.Optional()),
|
288
|
+
__metadata("design:paramtypes", [di.Injector,
|
290
289
|
browser.SelectionBridge,
|
291
290
|
core.Scheduler,
|
292
|
-
core.Selection])
|
291
|
+
core.Selection, Object])
|
293
292
|
], exports.CollaborateCursor);
|
294
293
|
|
295
294
|
function createUnknownComponent(factoryName, canInsertInlineComponent) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/collaborate",
|
3
|
-
"version": "3.0.0-alpha.
|
3
|
+
"version": "3.0.0-alpha.19",
|
4
4
|
"description": "Textbus is a rich text editor and framework that is highly customizable and extensible to achieve rich wysiwyg effects.",
|
5
5
|
"main": "./bundles/index.js",
|
6
6
|
"module": "./bundles/index.esm.js",
|
@@ -27,8 +27,8 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@tanbo/di": "^1.1.3",
|
29
29
|
"@tanbo/stream": "^1.1.8",
|
30
|
-
"@textbus/browser": "^3.0.0-alpha.
|
31
|
-
"@textbus/core": "^3.0.0-alpha.
|
30
|
+
"@textbus/browser": "^3.0.0-alpha.19",
|
31
|
+
"@textbus/core": "^3.0.0-alpha.19",
|
32
32
|
"reflect-metadata": "^0.1.13",
|
33
33
|
"y-protocols": "^1.0.5",
|
34
34
|
"yjs": "^13.5.39"
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"bugs": {
|
50
50
|
"url": "https://github.com/textbus/textbus.git/issues"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "98b8264421cc3ba40cbbb58a72414587cfa42715"
|
53
53
|
}
|
package/rollup.config.ts
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
import commonjs from '@rollup/plugin-commonjs'
|
2
|
-
import typescript from '@rollup/plugin-typescript'
|
3
|
-
|
4
|
-
export default {
|
5
|
-
input: 'src/public-api.ts',
|
6
|
-
output: [
|
7
|
-
{
|
8
|
-
file: './bundles/index.js',
|
9
|
-
format: 'cjs'
|
10
|
-
},
|
11
|
-
{
|
12
|
-
file: './bundles/index.esm.js',
|
13
|
-
format: 'esm'
|
14
|
-
}
|
15
|
-
],
|
16
|
-
plugins: [
|
17
|
-
commonjs(),
|
18
|
-
typescript()
|
19
|
-
]
|
20
|
-
}
|