@ones-editor/editor 3.0.12-beta.2 → 3.0.12-beta.4
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/@ones-editor/core/src/core/doc/doc.d.ts +1 -1
- package/@ones-editor/core/src/core/editor-doc/editor-doc.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -0
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -1
- package/@ones-editor/drawio-embed/types/index.d.ts +1 -0
- package/@ones-editor/sharedb-doc/src/doc/auth-connection.d.ts +5 -0
- package/@ones-editor/sharedb-doc/src/doc/sharedb-doc.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/versions/src/history-doc/history-doc.d.ts +1 -1
- package/dist/error-handler/index.d.ts +2 -1
- package/dist/index.js +89 -22
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export default class HistoryDoc extends EventCallbacks<OnesEditorDocCallbacks> i
|
|
|
8
8
|
beginBatchUpdate(): number;
|
|
9
9
|
endBatchUpdate(): number;
|
|
10
10
|
toJSON(): DocObject;
|
|
11
|
-
|
|
11
|
+
applyingRemoteOps(): boolean;
|
|
12
12
|
getContainerBlocks(containerId: string): DocBlock[];
|
|
13
13
|
findContainerBlocks(containerId: string): DocBlock[];
|
|
14
14
|
getBlockData(containerId: string, blockIndex: number): DocBlock;
|
|
@@ -8,7 +8,8 @@ export default class DefaultErrorHandler implements ErrorHandler {
|
|
|
8
8
|
private _dirtyFlag;
|
|
9
9
|
private _connectionFlag;
|
|
10
10
|
private _offlineFlag;
|
|
11
|
-
private
|
|
11
|
+
private _pendingErrorMessage;
|
|
12
|
+
private _showErrorDebounced;
|
|
12
13
|
constructor();
|
|
13
14
|
destroy(): void;
|
|
14
15
|
private _handleOffline;
|
package/dist/index.js
CHANGED
|
@@ -29007,7 +29007,7 @@ var __publicField = (obj, key, value) => {
|
|
|
29007
29007
|
if (rangeInBlock(deletedBlock, range)) {
|
|
29008
29008
|
logger$3q.debug("adjust selection because remote deleted current block");
|
|
29009
29009
|
const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
|
|
29010
|
-
this.setRange(newRange, { noScroll: true });
|
|
29010
|
+
this.setRange(newRange, { noScroll: true, local: false });
|
|
29011
29011
|
}
|
|
29012
29012
|
});
|
|
29013
29013
|
this.editor = editor;
|
|
@@ -29083,7 +29083,13 @@ var __publicField = (obj, key, value) => {
|
|
|
29083
29083
|
}
|
|
29084
29084
|
const old = this._range;
|
|
29085
29085
|
this._range = newRange;
|
|
29086
|
-
|
|
29086
|
+
if ((options == null ? void 0 : options.local) === false) {
|
|
29087
|
+
setTimeout(() => {
|
|
29088
|
+
this.selectionChanged();
|
|
29089
|
+
});
|
|
29090
|
+
} else {
|
|
29091
|
+
this.selectionChanged();
|
|
29092
|
+
}
|
|
29087
29093
|
this.updateFocusedBlock(old);
|
|
29088
29094
|
if (hasClass(this.editor.rootContainer, "select-all")) {
|
|
29089
29095
|
if (!newRange.isSimple() || !allSelected(this.editor, newRange)) {
|
|
@@ -30798,9 +30804,9 @@ ${codeText}
|
|
|
30798
30804
|
endBatchUpdate() {
|
|
30799
30805
|
return this.externalDoc.endBatchUpdate();
|
|
30800
30806
|
}
|
|
30801
|
-
|
|
30807
|
+
applyingRemoteOps() {
|
|
30802
30808
|
var _a, _b;
|
|
30803
|
-
return ((_b = (_a = this.externalDoc).
|
|
30809
|
+
return ((_b = (_a = this.externalDoc).applyingRemoteOps) == null ? void 0 : _b.call(_a)) || false;
|
|
30804
30810
|
}
|
|
30805
30811
|
registerLocalEvents(events2) {
|
|
30806
30812
|
this.localEvents.push(events2);
|
|
@@ -32721,7 +32727,7 @@ ${codeText}
|
|
|
32721
32727
|
rawData() {
|
|
32722
32728
|
return this.doc;
|
|
32723
32729
|
}
|
|
32724
|
-
|
|
32730
|
+
applyingRemoteOps() {
|
|
32725
32731
|
return false;
|
|
32726
32732
|
}
|
|
32727
32733
|
getContainerBlocks(containerId) {
|
|
@@ -38382,6 +38388,8 @@ ${codeText}
|
|
|
38382
38388
|
__publicField(this, "closed", false);
|
|
38383
38389
|
__publicField(this, "connection");
|
|
38384
38390
|
__publicField(this, "ws");
|
|
38391
|
+
__publicField(this, "visibilityListenerRegistered", false);
|
|
38392
|
+
__publicField(this, "connectionDisconnected", false);
|
|
38385
38393
|
__publicField(this, "token", null);
|
|
38386
38394
|
__publicField(this, "resourceToken", null);
|
|
38387
38395
|
__publicField(this, "authMessage");
|
|
@@ -38435,8 +38443,20 @@ ${codeText}
|
|
|
38435
38443
|
this.emit("connectionError", err);
|
|
38436
38444
|
});
|
|
38437
38445
|
__publicField(this, "handleDisconnected", (reason) => {
|
|
38446
|
+
this.connectionDisconnected = true;
|
|
38438
38447
|
this.emit("disconnected", reason);
|
|
38439
38448
|
});
|
|
38449
|
+
__publicField(this, "handleVisibilityChange", () => {
|
|
38450
|
+
var _a, _b;
|
|
38451
|
+
const state = document.visibilityState || "unknown";
|
|
38452
|
+
if (state === "visible") {
|
|
38453
|
+
const readyState = (_a = this.ws) == null ? void 0 : _a.readyState;
|
|
38454
|
+
const wsActive = readyState === ReconnectingWebSocket__default.default.CONNECTING || readyState === ReconnectingWebSocket__default.default.OPEN;
|
|
38455
|
+
if (!wsActive || this.connectionDisconnected) {
|
|
38456
|
+
(_b = this.ws) == null ? void 0 : _b.reconnect();
|
|
38457
|
+
}
|
|
38458
|
+
}
|
|
38459
|
+
});
|
|
38440
38460
|
this.url = url;
|
|
38441
38461
|
this.renewTokenFunc = renewTokenFunc;
|
|
38442
38462
|
this.authMessage = authMessage;
|
|
@@ -38503,6 +38523,7 @@ ${codeText}
|
|
|
38503
38523
|
maxReconnectionDelay: 2500 * 5,
|
|
38504
38524
|
minReconnectionDelay: 1e3 * 5
|
|
38505
38525
|
});
|
|
38526
|
+
this.registerVisibilityListener();
|
|
38506
38527
|
this.connection = Object.create(Connection.prototype);
|
|
38507
38528
|
assert(logger$2$, this.connection, "no this.connection");
|
|
38508
38529
|
const thatWs = this.ws;
|
|
@@ -38549,6 +38570,7 @@ ${codeText}
|
|
|
38549
38570
|
if (!this.ready) {
|
|
38550
38571
|
this.emit("ready");
|
|
38551
38572
|
this.ready = true;
|
|
38573
|
+
this.connectionDisconnected = false;
|
|
38552
38574
|
}
|
|
38553
38575
|
}
|
|
38554
38576
|
try {
|
|
@@ -38638,12 +38660,27 @@ ${codeText}
|
|
|
38638
38660
|
if ((_d = this.connection) == null ? void 0 : _d._ping)
|
|
38639
38661
|
window.clearInterval(this.connection._ping);
|
|
38640
38662
|
this.connection = void 0;
|
|
38663
|
+
this.unregisterVisibilityListener();
|
|
38641
38664
|
(_e = this.ws) == null ? void 0 : _e.close();
|
|
38642
38665
|
this.ws = void 0;
|
|
38643
38666
|
if (logout) {
|
|
38644
38667
|
this.logout();
|
|
38645
38668
|
}
|
|
38646
38669
|
}
|
|
38670
|
+
registerVisibilityListener() {
|
|
38671
|
+
if (this.visibilityListenerRegistered) {
|
|
38672
|
+
return;
|
|
38673
|
+
}
|
|
38674
|
+
this.visibilityListenerRegistered = true;
|
|
38675
|
+
window.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
38676
|
+
}
|
|
38677
|
+
unregisterVisibilityListener() {
|
|
38678
|
+
if (!this.visibilityListenerRegistered) {
|
|
38679
|
+
return;
|
|
38680
|
+
}
|
|
38681
|
+
this.visibilityListenerRegistered = false;
|
|
38682
|
+
window.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
|
38683
|
+
}
|
|
38647
38684
|
}
|
|
38648
38685
|
getLogger("utils/file");
|
|
38649
38686
|
function fixMethodArrayBuffer() {
|
|
@@ -39706,7 +39743,7 @@ ${codeText}
|
|
|
39706
39743
|
__publicField(this, "disableLogout");
|
|
39707
39744
|
__publicField(this, "destroyed", false);
|
|
39708
39745
|
__publicField(this, "editStatus");
|
|
39709
|
-
__publicField(this, "
|
|
39746
|
+
__publicField(this, "_applyingRemoteOps", false);
|
|
39710
39747
|
__publicField(this, "handleNothingPending", () => {
|
|
39711
39748
|
this.setStatus("clean");
|
|
39712
39749
|
});
|
|
@@ -39891,14 +39928,16 @@ ${codeText}
|
|
|
39891
39928
|
return;
|
|
39892
39929
|
}
|
|
39893
39930
|
try {
|
|
39894
|
-
this._applyingOps = true;
|
|
39895
39931
|
const local = !!source;
|
|
39932
|
+
if (!local) {
|
|
39933
|
+
this._applyingRemoteOps = true;
|
|
39934
|
+
}
|
|
39896
39935
|
parseOps(ops, this, local);
|
|
39897
39936
|
} catch (err) {
|
|
39898
39937
|
logger$2U.error(err);
|
|
39899
39938
|
throw err;
|
|
39900
39939
|
} finally {
|
|
39901
|
-
this.
|
|
39940
|
+
this._applyingRemoteOps = false;
|
|
39902
39941
|
}
|
|
39903
39942
|
});
|
|
39904
39943
|
this.options = options;
|
|
@@ -39923,8 +39962,8 @@ ${codeText}
|
|
|
39923
39962
|
}
|
|
39924
39963
|
return this.batching;
|
|
39925
39964
|
}
|
|
39926
|
-
|
|
39927
|
-
return this.
|
|
39965
|
+
applyingRemoteOps() {
|
|
39966
|
+
return this._applyingRemoteOps;
|
|
39928
39967
|
}
|
|
39929
39968
|
static async load(options) {
|
|
39930
39969
|
try {
|
|
@@ -53541,7 +53580,7 @@ ${codeText}
|
|
|
53541
53580
|
handleDeleteBlock: (editor, block) => {
|
|
53542
53581
|
var _a, _b;
|
|
53543
53582
|
if (isListBlock(block)) {
|
|
53544
|
-
if ((_b = (_a = editor.doc).
|
|
53583
|
+
if ((_b = (_a = editor.doc).applyingRemoteOps) == null ? void 0 : _b.call(_a)) {
|
|
53545
53584
|
return;
|
|
53546
53585
|
}
|
|
53547
53586
|
const fixStart = new FixStartByWillDeletedList(editor, block);
|
|
@@ -82949,7 +82988,7 @@ ${docStr}
|
|
|
82949
82988
|
toJSON() {
|
|
82950
82989
|
return cloneDeep__default.default(this.docObject);
|
|
82951
82990
|
}
|
|
82952
|
-
|
|
82991
|
+
applyingRemoteOps() {
|
|
82953
82992
|
return false;
|
|
82954
82993
|
}
|
|
82955
82994
|
getContainerBlocks(containerId) {
|
|
@@ -88392,7 +88431,12 @@ ${data2.flowchartText}
|
|
|
88392
88431
|
function getBlockProperties$3(editor, block) {
|
|
88393
88432
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
88394
88433
|
handleExecuteCommand: (editor2, block2, item) => {
|
|
88434
|
+
var _a, _b;
|
|
88395
88435
|
if (item.id === "edit") {
|
|
88436
|
+
const drawioOptions = getDrawioOptions(editor2);
|
|
88437
|
+
if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
|
|
88438
|
+
return true;
|
|
88439
|
+
}
|
|
88396
88440
|
const data2 = editor2.getBlockData(block2).embedData;
|
|
88397
88441
|
editGraph(editor2, block2, data2, false);
|
|
88398
88442
|
return true;
|
|
@@ -88592,9 +88636,9 @@ ${data2.flowchartText}
|
|
|
88592
88636
|
root2.appendChild(suffixElem);
|
|
88593
88637
|
return root2;
|
|
88594
88638
|
} : void 0;
|
|
88595
|
-
|
|
88596
|
-
|
|
88597
|
-
insertEmbedCommandItems
|
|
88639
|
+
const insertEmbedCommandItems = [];
|
|
88640
|
+
if (drawioOptions.visible !== false) {
|
|
88641
|
+
insertEmbedCommandItems.push({
|
|
88598
88642
|
id: "insert-drawio",
|
|
88599
88643
|
name: i18n$1.t("drawio.title"),
|
|
88600
88644
|
icon: UmlIcon,
|
|
@@ -88603,7 +88647,11 @@ ${data2.flowchartText}
|
|
|
88603
88647
|
subText: getShortcutById("insert-drawio"),
|
|
88604
88648
|
element,
|
|
88605
88649
|
useDefaultClickHandler: true
|
|
88606
|
-
}
|
|
88650
|
+
});
|
|
88651
|
+
}
|
|
88652
|
+
return {
|
|
88653
|
+
name: "UML",
|
|
88654
|
+
insertEmbedCommandItems,
|
|
88607
88655
|
handleInsertEmptyEmbed: async (editor2, options) => {
|
|
88608
88656
|
var _a2, _b;
|
|
88609
88657
|
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
@@ -93654,7 +93702,19 @@ ${data2.plantumlText}
|
|
|
93654
93702
|
__publicField(this, "_dirtyFlag", false);
|
|
93655
93703
|
__publicField(this, "_connectionFlag", false);
|
|
93656
93704
|
__publicField(this, "_offlineFlag", false);
|
|
93657
|
-
__publicField(this, "
|
|
93705
|
+
__publicField(this, "_pendingErrorMessage", null);
|
|
93706
|
+
__publicField(this, "_showErrorDebounced", debounce__default.default(() => {
|
|
93707
|
+
if (!this._pendingErrorMessage) {
|
|
93708
|
+
return;
|
|
93709
|
+
}
|
|
93710
|
+
if (document.visibilityState === "hidden") {
|
|
93711
|
+
return;
|
|
93712
|
+
}
|
|
93713
|
+
if (this._editor) {
|
|
93714
|
+
this._editor.readonly = true;
|
|
93715
|
+
}
|
|
93716
|
+
this.bar.show(this._pendingErrorMessage, "error");
|
|
93717
|
+
}, 1e4));
|
|
93658
93718
|
__publicField(this, "_handleOffline", () => {
|
|
93659
93719
|
this._offlineFlag = true;
|
|
93660
93720
|
this.handleError(new Error("offline"));
|
|
@@ -93681,14 +93741,18 @@ ${data2.plantumlText}
|
|
|
93681
93741
|
this.autoHide();
|
|
93682
93742
|
});
|
|
93683
93743
|
__publicField(this, "onRenewingToken", (count) => {
|
|
93744
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewingToken ${count}`);
|
|
93684
93745
|
});
|
|
93685
93746
|
__publicField(this, "onRenewedToken", (auth) => {
|
|
93747
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewedToken`);
|
|
93686
93748
|
});
|
|
93687
93749
|
__publicField(this, "onRenewTokenError", (error2) => {
|
|
93750
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewTokenError`);
|
|
93688
93751
|
assert(logger$7, this._editor, "no editor");
|
|
93689
93752
|
this.handleError(error2);
|
|
93690
93753
|
});
|
|
93691
93754
|
__publicField(this, "onReauthing", () => {
|
|
93755
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onReauthing`);
|
|
93692
93756
|
});
|
|
93693
93757
|
__publicField(this, "onReauthError", (error2) => {
|
|
93694
93758
|
assert(logger$7, this._editor, "no editor");
|
|
@@ -93759,16 +93823,19 @@ ${data2.plantumlText}
|
|
|
93759
93823
|
handleError(error2, customMessage) {
|
|
93760
93824
|
console.error(`[${new Date().toLocaleString()}] wiz-editor error: ${error2}
|
|
93761
93825
|
${JSON.stringify(error2, null, 2)}`);
|
|
93762
|
-
if (
|
|
93763
|
-
|
|
93826
|
+
if (document.visibilityState === "hidden") {
|
|
93827
|
+
return;
|
|
93764
93828
|
}
|
|
93765
93829
|
const defaultMessage = this.hasPopup() ? i18n$1.t("error.networkPopup") : i18n$1.t("error.network");
|
|
93766
93830
|
const errorMessage = customMessage || defaultMessage;
|
|
93767
|
-
this.
|
|
93831
|
+
this._pendingErrorMessage = errorMessage;
|
|
93832
|
+
this._showErrorDebounced();
|
|
93768
93833
|
}
|
|
93769
93834
|
autoHide() {
|
|
93770
93835
|
var _a;
|
|
93771
93836
|
if (!this._dirtyFlag && !this._connectionFlag && !this._offlineFlag) {
|
|
93837
|
+
this._showErrorDebounced.cancel();
|
|
93838
|
+
this._pendingErrorMessage = null;
|
|
93772
93839
|
this.bar.hide();
|
|
93773
93840
|
if ((_a = this._editor) == null ? void 0 : _a.readonly) {
|
|
93774
93841
|
this._editor.readonly = false;
|
|
@@ -96850,7 +96917,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96850
96917
|
}
|
|
96851
96918
|
}
|
|
96852
96919
|
});
|
|
96853
|
-
editor.version = "3.0.12-beta.
|
|
96920
|
+
editor.version = "3.0.12-beta.4";
|
|
96854
96921
|
return editor;
|
|
96855
96922
|
}
|
|
96856
96923
|
function isDoc(doc2) {
|
|
@@ -96984,7 +97051,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96984
97051
|
OnesEditorDropTarget.register(editor);
|
|
96985
97052
|
OnesEditorTocProvider.register(editor);
|
|
96986
97053
|
OnesEditorExclusiveBlock.register(editor);
|
|
96987
|
-
editor.version = "3.0.12-beta.
|
|
97054
|
+
editor.version = "3.0.12-beta.4";
|
|
96988
97055
|
return editor;
|
|
96989
97056
|
}
|
|
96990
97057
|
async function showDocVersions(editor, options, serverUrl) {
|