@textbus/collaborate 4.3.6 → 4.3.8
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.
@@ -3,6 +3,8 @@ import { WebsocketProvider } from 'y-websocket';
|
|
3
3
|
import { SyncConnector } from '../base/sync-connector';
|
4
4
|
export declare class YWebsocketConnector extends SyncConnector {
|
5
5
|
provide: WebsocketProvider;
|
6
|
+
private onSync;
|
7
|
+
private onUpdate;
|
6
8
|
constructor(url: string, roomName: string, yDoc: YDoc);
|
7
9
|
setLocalStateField(key: string, data: Record<string, any>): void;
|
8
10
|
onDestroy(): void;
|
package/bundles/index.esm.js
CHANGED
@@ -1115,11 +1115,16 @@ let CollabHistory = class CollabHistory {
|
|
1115
1115
|
this.changeEvent.next();
|
1116
1116
|
}
|
1117
1117
|
destroy() {
|
1118
|
-
var _a;
|
1119
1118
|
this.index = 0;
|
1120
1119
|
this.historyItems = [];
|
1121
1120
|
this.subscriptions.forEach(i => i.unsubscribe());
|
1122
|
-
(
|
1121
|
+
if (this.manager) {
|
1122
|
+
this.manager.destroy();
|
1123
|
+
this.manager.captureTransaction = () => true;
|
1124
|
+
this.manager.deleteFilter = () => true;
|
1125
|
+
this.manager.trackedOrigins = new Set([null]);
|
1126
|
+
}
|
1127
|
+
this.manager = null;
|
1123
1128
|
}
|
1124
1129
|
};
|
1125
1130
|
CollabHistory = __decorate([
|
@@ -1534,30 +1539,44 @@ class YWebsocketConnector extends SyncConnector {
|
|
1534
1539
|
writable: true,
|
1535
1540
|
value: void 0
|
1536
1541
|
});
|
1537
|
-
this
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1542
|
+
Object.defineProperty(this, "onSync", {
|
1543
|
+
enumerable: true,
|
1544
|
+
configurable: true,
|
1545
|
+
writable: true,
|
1546
|
+
value: (is) => {
|
1547
|
+
if (is) {
|
1548
|
+
this.loadEvent.next();
|
1549
|
+
}
|
1543
1550
|
}
|
1544
1551
|
});
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1552
|
+
Object.defineProperty(this, "onUpdate", {
|
1553
|
+
enumerable: true,
|
1554
|
+
configurable: true,
|
1555
|
+
writable: true,
|
1556
|
+
value: () => {
|
1557
|
+
const syncStates = [];
|
1558
|
+
this.provide.awareness.getStates().forEach((state, id) => {
|
1559
|
+
syncStates.push({
|
1560
|
+
clientId: id,
|
1561
|
+
message: state.message,
|
1562
|
+
});
|
1551
1563
|
});
|
1552
|
-
|
1553
|
-
|
1564
|
+
this.stateChangeEvent.next(syncStates);
|
1565
|
+
}
|
1554
1566
|
});
|
1567
|
+
this.onLoad = this.loadEvent.asObservable();
|
1568
|
+
this.onStateChange = this.stateChangeEvent.asObservable();
|
1569
|
+
this.provide = new WebsocketProvider(url, roomName, yDoc);
|
1570
|
+
this.provide.once('sync', this.onSync);
|
1571
|
+
this.provide.awareness.on('update', this.onUpdate);
|
1555
1572
|
}
|
1556
1573
|
setLocalStateField(key, data) {
|
1557
1574
|
this.provide.awareness.setLocalStateField(key, data);
|
1558
1575
|
}
|
1559
1576
|
onDestroy() {
|
1577
|
+
this.provide.awareness.off('update', this.onUpdate);
|
1560
1578
|
this.provide.disconnect();
|
1579
|
+
this.provide.destroy();
|
1561
1580
|
}
|
1562
1581
|
}
|
1563
1582
|
|
package/bundles/index.js
CHANGED
@@ -1117,11 +1117,16 @@ exports.CollabHistory = class CollabHistory {
|
|
1117
1117
|
this.changeEvent.next();
|
1118
1118
|
}
|
1119
1119
|
destroy() {
|
1120
|
-
var _a;
|
1121
1120
|
this.index = 0;
|
1122
1121
|
this.historyItems = [];
|
1123
1122
|
this.subscriptions.forEach(i => i.unsubscribe());
|
1124
|
-
(
|
1123
|
+
if (this.manager) {
|
1124
|
+
this.manager.destroy();
|
1125
|
+
this.manager.captureTransaction = () => true;
|
1126
|
+
this.manager.deleteFilter = () => true;
|
1127
|
+
this.manager.trackedOrigins = new Set([null]);
|
1128
|
+
}
|
1129
|
+
this.manager = null;
|
1125
1130
|
}
|
1126
1131
|
};
|
1127
1132
|
exports.CollabHistory = __decorate([
|
@@ -1536,30 +1541,44 @@ class YWebsocketConnector extends SyncConnector {
|
|
1536
1541
|
writable: true,
|
1537
1542
|
value: void 0
|
1538
1543
|
});
|
1539
|
-
this
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
|
1544
|
+
Object.defineProperty(this, "onSync", {
|
1545
|
+
enumerable: true,
|
1546
|
+
configurable: true,
|
1547
|
+
writable: true,
|
1548
|
+
value: (is) => {
|
1549
|
+
if (is) {
|
1550
|
+
this.loadEvent.next();
|
1551
|
+
}
|
1545
1552
|
}
|
1546
1553
|
});
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1554
|
+
Object.defineProperty(this, "onUpdate", {
|
1555
|
+
enumerable: true,
|
1556
|
+
configurable: true,
|
1557
|
+
writable: true,
|
1558
|
+
value: () => {
|
1559
|
+
const syncStates = [];
|
1560
|
+
this.provide.awareness.getStates().forEach((state, id) => {
|
1561
|
+
syncStates.push({
|
1562
|
+
clientId: id,
|
1563
|
+
message: state.message,
|
1564
|
+
});
|
1553
1565
|
});
|
1554
|
-
|
1555
|
-
|
1566
|
+
this.stateChangeEvent.next(syncStates);
|
1567
|
+
}
|
1556
1568
|
});
|
1569
|
+
this.onLoad = this.loadEvent.asObservable();
|
1570
|
+
this.onStateChange = this.stateChangeEvent.asObservable();
|
1571
|
+
this.provide = new yWebsocket.WebsocketProvider(url, roomName, yDoc);
|
1572
|
+
this.provide.once('sync', this.onSync);
|
1573
|
+
this.provide.awareness.on('update', this.onUpdate);
|
1557
1574
|
}
|
1558
1575
|
setLocalStateField(key, data) {
|
1559
1576
|
this.provide.awareness.setLocalStateField(key, data);
|
1560
1577
|
}
|
1561
1578
|
onDestroy() {
|
1579
|
+
this.provide.awareness.off('update', this.onUpdate);
|
1562
1580
|
this.provide.disconnect();
|
1581
|
+
this.provide.destroy();
|
1563
1582
|
}
|
1564
1583
|
}
|
1565
1584
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@textbus/collaborate",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.8",
|
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
|
"@hocuspocus/provider": "^2.13.6",
|
29
29
|
"@tanbo/stream": "^1.2.6",
|
30
|
-
"@textbus/core": "^4.3.
|
30
|
+
"@textbus/core": "^4.3.8",
|
31
31
|
"@viewfly/core": "^1.1.10",
|
32
32
|
"y-websocket": "^1.4.3",
|
33
33
|
"yjs": "^13.6.14"
|
@@ -50,5 +50,5 @@
|
|
50
50
|
"bugs": {
|
51
51
|
"url": "https://github.com/textbus/textbus.git/issues"
|
52
52
|
},
|
53
|
-
"gitHead": "
|
53
|
+
"gitHead": "a2eb21a78bc8f1fc18cb0a75c4d1093de539eebf"
|
54
54
|
}
|