@textbus/collaborate 4.4.2 → 4.5.1
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/base/collab-history.d.ts +2 -3
- package/bundles/collaborate-module.d.ts +1 -0
- package/bundles/index.esm.js +14 -13
- package/bundles/index.js +14 -13
- package/package.json +7 -7
@@ -1,4 +1,4 @@
|
|
1
|
-
import { History, RootComponentRef, Scheduler
|
1
|
+
import { History, RootComponentRef, Scheduler } from '@textbus/core';
|
2
2
|
import { Observable } from '@tanbo/stream';
|
3
3
|
import { Item, Transaction } from 'yjs';
|
4
4
|
import { Collaborate } from './collaborate';
|
@@ -10,7 +10,6 @@ export declare class CollabHistory implements History {
|
|
10
10
|
private rootComponentRef;
|
11
11
|
private collaborate;
|
12
12
|
private scheduler;
|
13
|
-
private selection;
|
14
13
|
private stackSize;
|
15
14
|
private undoManagerConfig;
|
16
15
|
onBack: Observable<void>;
|
@@ -27,7 +26,7 @@ export declare class CollabHistory implements History {
|
|
27
26
|
private forwardEvent;
|
28
27
|
private changeEvent;
|
29
28
|
private pushEvent;
|
30
|
-
constructor(rootComponentRef: RootComponentRef, collaborate: Collaborate, scheduler: Scheduler,
|
29
|
+
constructor(rootComponentRef: RootComponentRef, collaborate: Collaborate, scheduler: Scheduler, stackSize: number, undoManagerConfig: CustomUndoManagerConfig);
|
31
30
|
listen(): void;
|
32
31
|
back(): void;
|
33
32
|
forward(): void;
|
@@ -4,6 +4,7 @@ import { Doc as YDoc } from 'yjs';
|
|
4
4
|
import { SyncConnector } from './base/_api';
|
5
5
|
export interface CollaborateConfig {
|
6
6
|
createConnector(yDoc: YDoc): SyncConnector;
|
7
|
+
beforeSync?(yDoc: YDoc): Promise<void> | void;
|
7
8
|
}
|
8
9
|
export declare class CollaborateModule implements Module {
|
9
10
|
config: CollaborateConfig;
|
package/bundles/index.esm.js
CHANGED
@@ -946,7 +946,7 @@ let CollabHistory = class CollabHistory {
|
|
946
946
|
var _a;
|
947
947
|
return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
|
948
948
|
}
|
949
|
-
constructor(rootComponentRef, collaborate, scheduler,
|
949
|
+
constructor(rootComponentRef, collaborate, scheduler, stackSize, undoManagerConfig) {
|
950
950
|
Object.defineProperty(this, "rootComponentRef", {
|
951
951
|
enumerable: true,
|
952
952
|
configurable: true,
|
@@ -965,12 +965,6 @@ let CollabHistory = class CollabHistory {
|
|
965
965
|
writable: true,
|
966
966
|
value: scheduler
|
967
967
|
});
|
968
|
-
Object.defineProperty(this, "selection", {
|
969
|
-
enumerable: true,
|
970
|
-
configurable: true,
|
971
|
-
writable: true,
|
972
|
-
value: selection
|
973
|
-
});
|
974
968
|
Object.defineProperty(this, "stackSize", {
|
975
969
|
enumerable: true,
|
976
970
|
configurable: true,
|
@@ -1157,12 +1151,11 @@ let CollabHistory = class CollabHistory {
|
|
1157
1151
|
};
|
1158
1152
|
CollabHistory = __decorate([
|
1159
1153
|
Injectable(),
|
1160
|
-
__param(
|
1161
|
-
__param(
|
1154
|
+
__param(3, Inject(HISTORY_STACK_SIZE)),
|
1155
|
+
__param(4, Optional()),
|
1162
1156
|
__metadata("design:paramtypes", [RootComponentRef,
|
1163
1157
|
Collaborate,
|
1164
|
-
Scheduler,
|
1165
|
-
Selection, Number, CustomUndoManagerConfig])
|
1158
|
+
Scheduler, Number, CustomUndoManagerConfig])
|
1166
1159
|
], CollabHistory);
|
1167
1160
|
|
1168
1161
|
/**
|
@@ -1648,6 +1641,7 @@ class CollaborateModule {
|
|
1648
1641
|
setup(textbus) {
|
1649
1642
|
const messageBus = textbus.get(MessageBus, null);
|
1650
1643
|
const connector = textbus.get(SyncConnector);
|
1644
|
+
const collab = textbus.get(Collaborate);
|
1651
1645
|
if (messageBus) {
|
1652
1646
|
const selection = textbus.get(Selection);
|
1653
1647
|
connector.setLocalStateField('message', messageBus.get(textbus));
|
@@ -1659,7 +1653,10 @@ class CollaborateModule {
|
|
1659
1653
|
messageBus.consume(states, textbus);
|
1660
1654
|
}));
|
1661
1655
|
}
|
1662
|
-
return connector.onLoad.toPromise()
|
1656
|
+
return connector.onLoad.toPromise().then(() => {
|
1657
|
+
var _a, _b;
|
1658
|
+
return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
|
1659
|
+
});
|
1663
1660
|
}
|
1664
1661
|
onDestroy(textbus) {
|
1665
1662
|
this.subscription.unsubscribe();
|
@@ -1711,6 +1708,7 @@ class MultipleDocumentCollaborateModule {
|
|
1711
1708
|
setup(textbus) {
|
1712
1709
|
const messageBus = textbus.get(MessageBus, null);
|
1713
1710
|
const connector = textbus.get(SyncConnector);
|
1711
|
+
const collab = textbus.get(Collaborate);
|
1714
1712
|
if (messageBus) {
|
1715
1713
|
const selection = textbus.get(Selection);
|
1716
1714
|
connector.setLocalStateField('message', messageBus.get(textbus));
|
@@ -1722,7 +1720,10 @@ class MultipleDocumentCollaborateModule {
|
|
1722
1720
|
messageBus.consume(states, textbus);
|
1723
1721
|
}));
|
1724
1722
|
}
|
1725
|
-
return connector.onLoad.toPromise()
|
1723
|
+
return connector.onLoad.toPromise().then(() => {
|
1724
|
+
var _a, _b;
|
1725
|
+
return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
|
1726
|
+
});
|
1726
1727
|
}
|
1727
1728
|
onDestroy(textbus) {
|
1728
1729
|
this.subscription.unsubscribe();
|
package/bundles/index.js
CHANGED
@@ -948,7 +948,7 @@ exports.CollabHistory = class CollabHistory {
|
|
948
948
|
var _a;
|
949
949
|
return ((_a = this.manager) === null || _a === void 0 ? void 0 : _a.canRedo()) || false;
|
950
950
|
}
|
951
|
-
constructor(rootComponentRef, collaborate, scheduler,
|
951
|
+
constructor(rootComponentRef, collaborate, scheduler, stackSize, undoManagerConfig) {
|
952
952
|
Object.defineProperty(this, "rootComponentRef", {
|
953
953
|
enumerable: true,
|
954
954
|
configurable: true,
|
@@ -967,12 +967,6 @@ exports.CollabHistory = class CollabHistory {
|
|
967
967
|
writable: true,
|
968
968
|
value: scheduler
|
969
969
|
});
|
970
|
-
Object.defineProperty(this, "selection", {
|
971
|
-
enumerable: true,
|
972
|
-
configurable: true,
|
973
|
-
writable: true,
|
974
|
-
value: selection
|
975
|
-
});
|
976
970
|
Object.defineProperty(this, "stackSize", {
|
977
971
|
enumerable: true,
|
978
972
|
configurable: true,
|
@@ -1159,12 +1153,11 @@ exports.CollabHistory = class CollabHistory {
|
|
1159
1153
|
};
|
1160
1154
|
exports.CollabHistory = __decorate([
|
1161
1155
|
core$1.Injectable(),
|
1162
|
-
__param(
|
1163
|
-
__param(
|
1156
|
+
__param(3, core$1.Inject(core.HISTORY_STACK_SIZE)),
|
1157
|
+
__param(4, core$1.Optional()),
|
1164
1158
|
__metadata("design:paramtypes", [core.RootComponentRef,
|
1165
1159
|
exports.Collaborate,
|
1166
|
-
core.Scheduler,
|
1167
|
-
core.Selection, Number, CustomUndoManagerConfig])
|
1160
|
+
core.Scheduler, Number, CustomUndoManagerConfig])
|
1168
1161
|
], exports.CollabHistory);
|
1169
1162
|
|
1170
1163
|
/**
|
@@ -1650,6 +1643,7 @@ class CollaborateModule {
|
|
1650
1643
|
setup(textbus) {
|
1651
1644
|
const messageBus = textbus.get(MessageBus, null);
|
1652
1645
|
const connector = textbus.get(SyncConnector);
|
1646
|
+
const collab = textbus.get(exports.Collaborate);
|
1653
1647
|
if (messageBus) {
|
1654
1648
|
const selection = textbus.get(core.Selection);
|
1655
1649
|
connector.setLocalStateField('message', messageBus.get(textbus));
|
@@ -1661,7 +1655,10 @@ class CollaborateModule {
|
|
1661
1655
|
messageBus.consume(states, textbus);
|
1662
1656
|
}));
|
1663
1657
|
}
|
1664
|
-
return connector.onLoad.toPromise()
|
1658
|
+
return connector.onLoad.toPromise().then(() => {
|
1659
|
+
var _a, _b;
|
1660
|
+
return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
|
1661
|
+
});
|
1665
1662
|
}
|
1666
1663
|
onDestroy(textbus) {
|
1667
1664
|
this.subscription.unsubscribe();
|
@@ -1713,6 +1710,7 @@ class MultipleDocumentCollaborateModule {
|
|
1713
1710
|
setup(textbus) {
|
1714
1711
|
const messageBus = textbus.get(MessageBus, null);
|
1715
1712
|
const connector = textbus.get(SyncConnector);
|
1713
|
+
const collab = textbus.get(exports.Collaborate);
|
1716
1714
|
if (messageBus) {
|
1717
1715
|
const selection = textbus.get(core.Selection);
|
1718
1716
|
connector.setLocalStateField('message', messageBus.get(textbus));
|
@@ -1724,7 +1722,10 @@ class MultipleDocumentCollaborateModule {
|
|
1724
1722
|
messageBus.consume(states, textbus);
|
1725
1723
|
}));
|
1726
1724
|
}
|
1727
|
-
return connector.onLoad.toPromise()
|
1725
|
+
return connector.onLoad.toPromise().then(() => {
|
1726
|
+
var _a, _b;
|
1727
|
+
return (_b = (_a = this.config).beforeSync) === null || _b === void 0 ? void 0 : _b.call(_a, collab.yDoc);
|
1728
|
+
});
|
1728
1729
|
}
|
1729
1730
|
onDestroy(textbus) {
|
1730
1731
|
this.subscription.unsubscribe();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/collaborate",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.5.1",
|
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,16 +27,16 @@
|
|
27
27
|
"dependencies": {
|
28
28
|
"@hocuspocus/provider": "^2.15.2",
|
29
29
|
"@tanbo/stream": "^1.2.7",
|
30
|
-
"@textbus/core": "^4.
|
31
|
-
"@viewfly/core": "^1.2.
|
30
|
+
"@textbus/core": "^4.5.0",
|
31
|
+
"@viewfly/core": "^1.2.3",
|
32
32
|
"y-websocket": "^2.1.0",
|
33
33
|
"yjs": "^13.6.23"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
|
-
"@rollup/plugin-commonjs": "^
|
37
|
-
"@rollup/plugin-typescript": "^
|
36
|
+
"@rollup/plugin-commonjs": "^28.0.2",
|
37
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
38
38
|
"rimraf": "^3.0.2",
|
39
|
-
"rollup": "
|
39
|
+
"rollup": "4.22.4",
|
40
40
|
"tslib": "^2.4.1"
|
41
41
|
},
|
42
42
|
"author": {
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"bugs": {
|
51
51
|
"url": "https://github.com/textbus/textbus.git/issues"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "badc41649d7dbf25bc832bcbf37e02936ee5a847"
|
54
54
|
}
|