@textbus/collaborate 3.5.0 → 4.0.0-alpha.0
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/bundles/collaborate.d.ts +4 -6
- package/bundles/index.esm.js +12 -9
- package/bundles/index.js +11 -8
- package/package.json +3 -3
package/bundles/collaborate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable, Subject, Subscription } from '@tanbo/stream';
|
|
2
|
-
import { AbstractSelection, ComponentInstance,
|
|
2
|
+
import { AbstractSelection, ComponentInstance, Registry, History, RootComponentRef, Scheduler, Selection, SelectionPaths, Slot } from '@textbus/core';
|
|
3
3
|
import { Array as YArray, Doc as YDoc, Map as YMap, RelativePosition, Text as YText, Transaction, UndoManager, Item } from 'yjs';
|
|
4
4
|
interface CursorPosition {
|
|
5
5
|
anchor: RelativePosition;
|
|
@@ -29,11 +29,9 @@ interface CollaborateHistorySelectionPosition {
|
|
|
29
29
|
export declare class Collaborate implements History {
|
|
30
30
|
protected stackSize: number;
|
|
31
31
|
protected rootComponentRef: RootComponentRef;
|
|
32
|
-
protected controller: Controller;
|
|
33
32
|
protected scheduler: Scheduler;
|
|
34
33
|
protected registry: Registry;
|
|
35
34
|
protected selection: Selection;
|
|
36
|
-
protected starter: Starter;
|
|
37
35
|
protected undoManagerConfig: CustomUndoManagerConfig;
|
|
38
36
|
onLocalChangesApplied: Observable<void>;
|
|
39
37
|
yDoc: YDoc;
|
|
@@ -52,8 +50,8 @@ export declare class Collaborate implements History {
|
|
|
52
50
|
protected updateFromRemote: boolean;
|
|
53
51
|
protected contentSyncCaches: WeakMap<Slot<any>, () => void>;
|
|
54
52
|
protected slotStateSyncCaches: WeakMap<Slot<any>, () => void>;
|
|
55
|
-
protected slotsSyncCaches: WeakMap<ComponentInstance<
|
|
56
|
-
protected componentStateSyncCaches: WeakMap<ComponentInstance<
|
|
53
|
+
protected slotsSyncCaches: WeakMap<ComponentInstance<unknown, unknown, unknown>, () => void>;
|
|
54
|
+
protected componentStateSyncCaches: WeakMap<ComponentInstance<unknown, unknown, unknown>, () => void>;
|
|
57
55
|
protected localChangesAppliedEvent: Subject<void>;
|
|
58
56
|
protected selectionChangeEvent: Subject<SelectionPaths>;
|
|
59
57
|
protected contentMap: ContentMap;
|
|
@@ -61,7 +59,7 @@ export declare class Collaborate implements History {
|
|
|
61
59
|
protected noRecord: {};
|
|
62
60
|
protected historyItems: Array<CollaborateHistorySelectionPosition>;
|
|
63
61
|
protected index: number;
|
|
64
|
-
constructor(stackSize: number, rootComponentRef: RootComponentRef,
|
|
62
|
+
constructor(stackSize: number, rootComponentRef: RootComponentRef, scheduler: Scheduler, registry: Registry, selection: Selection, undoManagerConfig: CustomUndoManagerConfig);
|
|
65
63
|
listen(): void;
|
|
66
64
|
back(): void;
|
|
67
65
|
forward(): void;
|
package/bundles/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeError, HISTORY_STACK_SIZE, ChangeOrigin, Slot, RootComponentRef,
|
|
1
|
+
import { makeError, HISTORY_STACK_SIZE, ChangeOrigin, Slot, RootComponentRef, Scheduler, Registry, Selection, History } from '@textbus/core';
|
|
2
2
|
import { Injectable, Inject, Optional } from '@tanbo/di';
|
|
3
3
|
import { Subject, map, filter } from '@tanbo/stream';
|
|
4
4
|
import { Doc, UndoManager, Array, createAbsolutePositionFromRelativePosition, createRelativePositionFromTypeIndex, Map, Text } from 'yjs';
|
|
@@ -17,6 +17,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
17
17
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
18
18
|
PERFORMANCE OF THIS SOFTWARE.
|
|
19
19
|
***************************************************************************** */
|
|
20
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
21
|
+
|
|
20
22
|
|
|
21
23
|
function __decorate(decorators, target, key, desc) {
|
|
22
24
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -31,7 +33,12 @@ function __param(paramIndex, decorator) {
|
|
|
31
33
|
|
|
32
34
|
function __metadata(metadataKey, metadataValue) {
|
|
33
35
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
34
|
-
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
39
|
+
var e = new Error(message);
|
|
40
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
41
|
+
};
|
|
35
42
|
|
|
36
43
|
const collaborateErrorFn = makeError('Collaborate');
|
|
37
44
|
class ContentMap {
|
|
@@ -83,14 +90,12 @@ let Collaborate = class Collaborate {
|
|
|
83
90
|
var _a;
|
|
84
91
|
return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
|
|
85
92
|
}
|
|
86
|
-
constructor(stackSize, rootComponentRef,
|
|
93
|
+
constructor(stackSize, rootComponentRef, scheduler, registry, selection, undoManagerConfig) {
|
|
87
94
|
this.stackSize = stackSize;
|
|
88
95
|
this.rootComponentRef = rootComponentRef;
|
|
89
|
-
this.controller = controller;
|
|
90
96
|
this.scheduler = scheduler;
|
|
91
97
|
this.registry = registry;
|
|
92
98
|
this.selection = selection;
|
|
93
|
-
this.starter = starter;
|
|
94
99
|
this.undoManagerConfig = undoManagerConfig;
|
|
95
100
|
this.yDoc = new Doc();
|
|
96
101
|
this.backEvent = new Subject();
|
|
@@ -591,7 +596,7 @@ let Collaborate = class Collaborate {
|
|
|
591
596
|
});
|
|
592
597
|
}
|
|
593
598
|
runLocalUpdate(fn, record = true) {
|
|
594
|
-
if (this.updateFromRemote
|
|
599
|
+
if (this.updateFromRemote) {
|
|
595
600
|
return;
|
|
596
601
|
}
|
|
597
602
|
this.updateRemoteActions.push({
|
|
@@ -750,13 +755,11 @@ let Collaborate = class Collaborate {
|
|
|
750
755
|
Collaborate = __decorate([
|
|
751
756
|
Injectable(),
|
|
752
757
|
__param(0, Inject(HISTORY_STACK_SIZE)),
|
|
753
|
-
__param(
|
|
758
|
+
__param(5, Optional()),
|
|
754
759
|
__metadata("design:paramtypes", [Number, RootComponentRef,
|
|
755
|
-
Controller,
|
|
756
760
|
Scheduler,
|
|
757
761
|
Registry,
|
|
758
762
|
Selection,
|
|
759
|
-
Starter,
|
|
760
763
|
CustomUndoManagerConfig])
|
|
761
764
|
], Collaborate);
|
|
762
765
|
function remoteFormatsToLocal(registry, attrs) {
|
package/bundles/index.js
CHANGED
|
@@ -19,6 +19,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
19
19
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
20
20
|
PERFORMANCE OF THIS SOFTWARE.
|
|
21
21
|
***************************************************************************** */
|
|
22
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
23
|
+
|
|
22
24
|
|
|
23
25
|
function __decorate(decorators, target, key, desc) {
|
|
24
26
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -33,7 +35,12 @@ function __param(paramIndex, decorator) {
|
|
|
33
35
|
|
|
34
36
|
function __metadata(metadataKey, metadataValue) {
|
|
35
37
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
36
|
-
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
41
|
+
var e = new Error(message);
|
|
42
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
43
|
+
};
|
|
37
44
|
|
|
38
45
|
const collaborateErrorFn = core.makeError('Collaborate');
|
|
39
46
|
class ContentMap {
|
|
@@ -85,14 +92,12 @@ exports.Collaborate = class Collaborate {
|
|
|
85
92
|
var _a;
|
|
86
93
|
return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
|
|
87
94
|
}
|
|
88
|
-
constructor(stackSize, rootComponentRef,
|
|
95
|
+
constructor(stackSize, rootComponentRef, scheduler, registry, selection, undoManagerConfig) {
|
|
89
96
|
this.stackSize = stackSize;
|
|
90
97
|
this.rootComponentRef = rootComponentRef;
|
|
91
|
-
this.controller = controller;
|
|
92
98
|
this.scheduler = scheduler;
|
|
93
99
|
this.registry = registry;
|
|
94
100
|
this.selection = selection;
|
|
95
|
-
this.starter = starter;
|
|
96
101
|
this.undoManagerConfig = undoManagerConfig;
|
|
97
102
|
this.yDoc = new yjs.Doc();
|
|
98
103
|
this.backEvent = new stream.Subject();
|
|
@@ -593,7 +598,7 @@ exports.Collaborate = class Collaborate {
|
|
|
593
598
|
});
|
|
594
599
|
}
|
|
595
600
|
runLocalUpdate(fn, record = true) {
|
|
596
|
-
if (this.updateFromRemote
|
|
601
|
+
if (this.updateFromRemote) {
|
|
597
602
|
return;
|
|
598
603
|
}
|
|
599
604
|
this.updateRemoteActions.push({
|
|
@@ -752,13 +757,11 @@ exports.Collaborate = class Collaborate {
|
|
|
752
757
|
exports.Collaborate = __decorate([
|
|
753
758
|
di.Injectable(),
|
|
754
759
|
__param(0, di.Inject(core.HISTORY_STACK_SIZE)),
|
|
755
|
-
__param(
|
|
760
|
+
__param(5, di.Optional()),
|
|
756
761
|
__metadata("design:paramtypes", [Number, core.RootComponentRef,
|
|
757
|
-
core.Controller,
|
|
758
762
|
core.Scheduler,
|
|
759
763
|
core.Registry,
|
|
760
764
|
core.Selection,
|
|
761
|
-
core.Starter,
|
|
762
765
|
CustomUndoManagerConfig])
|
|
763
766
|
], exports.Collaborate);
|
|
764
767
|
function remoteFormatsToLocal(registry, attrs) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@textbus/collaborate",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
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,7 +27,7 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tanbo/di": "^1.1.5",
|
|
29
29
|
"@tanbo/stream": "^1.2.0",
|
|
30
|
-
"@textbus/core": "^
|
|
30
|
+
"@textbus/core": "^4.0.0-alpha.0",
|
|
31
31
|
"reflect-metadata": "^0.1.13",
|
|
32
32
|
"y-protocols": "^1.0.5",
|
|
33
33
|
"yjs": "^13.6.7"
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"bugs": {
|
|
51
51
|
"url": "https://github.com/textbus/textbus.git/issues"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "cf4fd289b73bc777124a32fe42bb58eba05a34f1"
|
|
54
54
|
}
|