@ones-editor/editor 3.0.12-beta.2 → 3.0.13
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 -1
- package/@ones-editor/core/src/local-doc/index.d.ts +1 -1
- package/@ones-editor/drawio-embed/types/index.d.ts +0 -2
- package/@ones-editor/main-toolbar/src/items/text-color.d.ts +0 -1
- 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 +83 -76
- 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
|
@@ -7798,38 +7798,6 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
7798
7798
|
}
|
|
7799
7799
|
div.editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=drawio] [data-src] {
|
|
7800
7800
|
cursor: zoom-in;
|
|
7801
|
-
}
|
|
7802
|
-
.command-item.menu-item[data-id=insert-drawio] {
|
|
7803
|
-
width: 100%;
|
|
7804
|
-
}
|
|
7805
|
-
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item {
|
|
7806
|
-
color: #2d2d2e;
|
|
7807
|
-
user-select: none;
|
|
7808
|
-
transition: background 20ms ease-in 0s;
|
|
7809
|
-
width: 100%;
|
|
7810
|
-
height: 32px;
|
|
7811
|
-
padding: 6px 10px;
|
|
7812
|
-
display: flex;
|
|
7813
|
-
align-items: center;
|
|
7814
|
-
box-sizing: border-box;
|
|
7815
|
-
}
|
|
7816
|
-
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-icon {
|
|
7817
|
-
display: flex;
|
|
7818
|
-
align-items: center;
|
|
7819
|
-
justify-content: center;
|
|
7820
|
-
height: 24px;
|
|
7821
|
-
width: 24px;
|
|
7822
|
-
margin-right: 5px;
|
|
7823
|
-
margin-top: -2px;
|
|
7824
|
-
display: flex;
|
|
7825
|
-
flex-direction: column;
|
|
7826
|
-
justify-content: center;
|
|
7827
|
-
}
|
|
7828
|
-
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-name {
|
|
7829
|
-
white-space: nowrap;
|
|
7830
|
-
flex-grow: 1;
|
|
7831
|
-
display: flex;
|
|
7832
|
-
align-items: center;
|
|
7833
7801
|
}.embed-block[data-embed-type=mermaid],
|
|
7834
7802
|
.embed-block[data-embed-type=flowchart],
|
|
7835
7803
|
.embed-block[data-embed-type=plantuml] {
|
|
@@ -29007,7 +28975,7 @@ var __publicField = (obj, key, value) => {
|
|
|
29007
28975
|
if (rangeInBlock(deletedBlock, range)) {
|
|
29008
28976
|
logger$3q.debug("adjust selection because remote deleted current block");
|
|
29009
28977
|
const newRange = moveSelectionBeforeDeleteBlock(editor, deletedBlock);
|
|
29010
|
-
this.setRange(newRange, { noScroll: true });
|
|
28978
|
+
this.setRange(newRange, { noScroll: true, local: false });
|
|
29011
28979
|
}
|
|
29012
28980
|
});
|
|
29013
28981
|
this.editor = editor;
|
|
@@ -29083,7 +29051,13 @@ var __publicField = (obj, key, value) => {
|
|
|
29083
29051
|
}
|
|
29084
29052
|
const old = this._range;
|
|
29085
29053
|
this._range = newRange;
|
|
29086
|
-
|
|
29054
|
+
if ((options == null ? void 0 : options.local) === false) {
|
|
29055
|
+
setTimeout(() => {
|
|
29056
|
+
this.selectionChanged();
|
|
29057
|
+
});
|
|
29058
|
+
} else {
|
|
29059
|
+
this.selectionChanged();
|
|
29060
|
+
}
|
|
29087
29061
|
this.updateFocusedBlock(old);
|
|
29088
29062
|
if (hasClass(this.editor.rootContainer, "select-all")) {
|
|
29089
29063
|
if (!newRange.isSimple() || !allSelected(this.editor, newRange)) {
|
|
@@ -30798,9 +30772,9 @@ ${codeText}
|
|
|
30798
30772
|
endBatchUpdate() {
|
|
30799
30773
|
return this.externalDoc.endBatchUpdate();
|
|
30800
30774
|
}
|
|
30801
|
-
|
|
30775
|
+
applyingRemoteOps() {
|
|
30802
30776
|
var _a, _b;
|
|
30803
|
-
return ((_b = (_a = this.externalDoc).
|
|
30777
|
+
return ((_b = (_a = this.externalDoc).applyingRemoteOps) == null ? void 0 : _b.call(_a)) || false;
|
|
30804
30778
|
}
|
|
30805
30779
|
registerLocalEvents(events2) {
|
|
30806
30780
|
this.localEvents.push(events2);
|
|
@@ -32721,7 +32695,7 @@ ${codeText}
|
|
|
32721
32695
|
rawData() {
|
|
32722
32696
|
return this.doc;
|
|
32723
32697
|
}
|
|
32724
|
-
|
|
32698
|
+
applyingRemoteOps() {
|
|
32725
32699
|
return false;
|
|
32726
32700
|
}
|
|
32727
32701
|
getContainerBlocks(containerId) {
|
|
@@ -38382,6 +38356,8 @@ ${codeText}
|
|
|
38382
38356
|
__publicField(this, "closed", false);
|
|
38383
38357
|
__publicField(this, "connection");
|
|
38384
38358
|
__publicField(this, "ws");
|
|
38359
|
+
__publicField(this, "visibilityListenerRegistered", false);
|
|
38360
|
+
__publicField(this, "connectionDisconnected", false);
|
|
38385
38361
|
__publicField(this, "token", null);
|
|
38386
38362
|
__publicField(this, "resourceToken", null);
|
|
38387
38363
|
__publicField(this, "authMessage");
|
|
@@ -38435,8 +38411,20 @@ ${codeText}
|
|
|
38435
38411
|
this.emit("connectionError", err);
|
|
38436
38412
|
});
|
|
38437
38413
|
__publicField(this, "handleDisconnected", (reason) => {
|
|
38414
|
+
this.connectionDisconnected = true;
|
|
38438
38415
|
this.emit("disconnected", reason);
|
|
38439
38416
|
});
|
|
38417
|
+
__publicField(this, "handleVisibilityChange", () => {
|
|
38418
|
+
var _a, _b;
|
|
38419
|
+
const state = document.visibilityState || "unknown";
|
|
38420
|
+
if (state === "visible") {
|
|
38421
|
+
const readyState = (_a = this.ws) == null ? void 0 : _a.readyState;
|
|
38422
|
+
const wsActive = readyState === ReconnectingWebSocket__default.default.CONNECTING || readyState === ReconnectingWebSocket__default.default.OPEN;
|
|
38423
|
+
if (!wsActive || this.connectionDisconnected) {
|
|
38424
|
+
(_b = this.ws) == null ? void 0 : _b.reconnect();
|
|
38425
|
+
}
|
|
38426
|
+
}
|
|
38427
|
+
});
|
|
38440
38428
|
this.url = url;
|
|
38441
38429
|
this.renewTokenFunc = renewTokenFunc;
|
|
38442
38430
|
this.authMessage = authMessage;
|
|
@@ -38503,6 +38491,7 @@ ${codeText}
|
|
|
38503
38491
|
maxReconnectionDelay: 2500 * 5,
|
|
38504
38492
|
minReconnectionDelay: 1e3 * 5
|
|
38505
38493
|
});
|
|
38494
|
+
this.registerVisibilityListener();
|
|
38506
38495
|
this.connection = Object.create(Connection.prototype);
|
|
38507
38496
|
assert(logger$2$, this.connection, "no this.connection");
|
|
38508
38497
|
const thatWs = this.ws;
|
|
@@ -38549,6 +38538,7 @@ ${codeText}
|
|
|
38549
38538
|
if (!this.ready) {
|
|
38550
38539
|
this.emit("ready");
|
|
38551
38540
|
this.ready = true;
|
|
38541
|
+
this.connectionDisconnected = false;
|
|
38552
38542
|
}
|
|
38553
38543
|
}
|
|
38554
38544
|
try {
|
|
@@ -38638,12 +38628,27 @@ ${codeText}
|
|
|
38638
38628
|
if ((_d = this.connection) == null ? void 0 : _d._ping)
|
|
38639
38629
|
window.clearInterval(this.connection._ping);
|
|
38640
38630
|
this.connection = void 0;
|
|
38631
|
+
this.unregisterVisibilityListener();
|
|
38641
38632
|
(_e = this.ws) == null ? void 0 : _e.close();
|
|
38642
38633
|
this.ws = void 0;
|
|
38643
38634
|
if (logout) {
|
|
38644
38635
|
this.logout();
|
|
38645
38636
|
}
|
|
38646
38637
|
}
|
|
38638
|
+
registerVisibilityListener() {
|
|
38639
|
+
if (this.visibilityListenerRegistered) {
|
|
38640
|
+
return;
|
|
38641
|
+
}
|
|
38642
|
+
this.visibilityListenerRegistered = true;
|
|
38643
|
+
window.addEventListener("visibilitychange", this.handleVisibilityChange);
|
|
38644
|
+
}
|
|
38645
|
+
unregisterVisibilityListener() {
|
|
38646
|
+
if (!this.visibilityListenerRegistered) {
|
|
38647
|
+
return;
|
|
38648
|
+
}
|
|
38649
|
+
this.visibilityListenerRegistered = false;
|
|
38650
|
+
window.removeEventListener("visibilitychange", this.handleVisibilityChange);
|
|
38651
|
+
}
|
|
38647
38652
|
}
|
|
38648
38653
|
getLogger("utils/file");
|
|
38649
38654
|
function fixMethodArrayBuffer() {
|
|
@@ -39706,7 +39711,7 @@ ${codeText}
|
|
|
39706
39711
|
__publicField(this, "disableLogout");
|
|
39707
39712
|
__publicField(this, "destroyed", false);
|
|
39708
39713
|
__publicField(this, "editStatus");
|
|
39709
|
-
__publicField(this, "
|
|
39714
|
+
__publicField(this, "_applyingRemoteOps", false);
|
|
39710
39715
|
__publicField(this, "handleNothingPending", () => {
|
|
39711
39716
|
this.setStatus("clean");
|
|
39712
39717
|
});
|
|
@@ -39891,14 +39896,16 @@ ${codeText}
|
|
|
39891
39896
|
return;
|
|
39892
39897
|
}
|
|
39893
39898
|
try {
|
|
39894
|
-
this._applyingOps = true;
|
|
39895
39899
|
const local = !!source;
|
|
39900
|
+
if (!local) {
|
|
39901
|
+
this._applyingRemoteOps = true;
|
|
39902
|
+
}
|
|
39896
39903
|
parseOps(ops, this, local);
|
|
39897
39904
|
} catch (err) {
|
|
39898
39905
|
logger$2U.error(err);
|
|
39899
39906
|
throw err;
|
|
39900
39907
|
} finally {
|
|
39901
|
-
this.
|
|
39908
|
+
this._applyingRemoteOps = false;
|
|
39902
39909
|
}
|
|
39903
39910
|
});
|
|
39904
39911
|
this.options = options;
|
|
@@ -39923,8 +39930,8 @@ ${codeText}
|
|
|
39923
39930
|
}
|
|
39924
39931
|
return this.batching;
|
|
39925
39932
|
}
|
|
39926
|
-
|
|
39927
|
-
return this.
|
|
39933
|
+
applyingRemoteOps() {
|
|
39934
|
+
return this._applyingRemoteOps;
|
|
39928
39935
|
}
|
|
39929
39936
|
static async load(options) {
|
|
39930
39937
|
try {
|
|
@@ -41793,9 +41800,7 @@ ${codeText}
|
|
|
41793
41800
|
}
|
|
41794
41801
|
}
|
|
41795
41802
|
if (item.element) {
|
|
41796
|
-
|
|
41797
|
-
return;
|
|
41798
|
-
}
|
|
41803
|
+
return;
|
|
41799
41804
|
}
|
|
41800
41805
|
this.emit("click", this, item, elem);
|
|
41801
41806
|
if (item.clickToClose === false) {
|
|
@@ -53541,7 +53546,7 @@ ${codeText}
|
|
|
53541
53546
|
handleDeleteBlock: (editor, block) => {
|
|
53542
53547
|
var _a, _b;
|
|
53543
53548
|
if (isListBlock(block)) {
|
|
53544
|
-
if ((_b = (_a = editor.doc).
|
|
53549
|
+
if ((_b = (_a = editor.doc).applyingRemoteOps) == null ? void 0 : _b.call(_a)) {
|
|
53545
53550
|
return;
|
|
53546
53551
|
}
|
|
53547
53552
|
const fixStart = new FixStartByWillDeletedList(editor, block);
|
|
@@ -82949,7 +82954,7 @@ ${docStr}
|
|
|
82949
82954
|
toJSON() {
|
|
82950
82955
|
return cloneDeep__default.default(this.docObject);
|
|
82951
82956
|
}
|
|
82952
|
-
|
|
82957
|
+
applyingRemoteOps() {
|
|
82953
82958
|
return false;
|
|
82954
82959
|
}
|
|
82955
82960
|
getContainerBlocks(containerId) {
|
|
@@ -88580,18 +88585,7 @@ ${data2.flowchartText}
|
|
|
88580
88585
|
update(editor, embed, data2);
|
|
88581
88586
|
return true;
|
|
88582
88587
|
}
|
|
88583
|
-
function getOptions$3(
|
|
88584
|
-
var _a;
|
|
88585
|
-
const drawioOptions = getDrawioOptions(editor);
|
|
88586
|
-
const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
|
|
88587
|
-
const element = suffixElem ? () => {
|
|
88588
|
-
const root2 = createElement("div", ["uml-menu-item"], null);
|
|
88589
|
-
const iconElem = createElement("div", ["menu-item-icon"], root2);
|
|
88590
|
-
iconElem.innerHTML = UmlIcon;
|
|
88591
|
-
createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
|
|
88592
|
-
root2.appendChild(suffixElem);
|
|
88593
|
-
return root2;
|
|
88594
|
-
} : void 0;
|
|
88588
|
+
function getOptions$3() {
|
|
88595
88589
|
return {
|
|
88596
88590
|
name: "UML",
|
|
88597
88591
|
insertEmbedCommandItems: [{
|
|
@@ -88600,27 +88594,21 @@ ${data2.flowchartText}
|
|
|
88600
88594
|
icon: UmlIcon,
|
|
88601
88595
|
group: "common",
|
|
88602
88596
|
order: 600,
|
|
88603
|
-
subText: getShortcutById("insert-drawio")
|
|
88604
|
-
element,
|
|
88605
|
-
useDefaultClickHandler: true
|
|
88597
|
+
subText: getShortcutById("insert-drawio")
|
|
88606
88598
|
}],
|
|
88607
|
-
handleInsertEmptyEmbed: async (
|
|
88608
|
-
var _a2, _b;
|
|
88609
|
-
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
88610
|
-
return null;
|
|
88611
|
-
}
|
|
88599
|
+
handleInsertEmptyEmbed: async (editor, options) => {
|
|
88612
88600
|
const embedData = {
|
|
88613
88601
|
src: "",
|
|
88614
88602
|
xml: "",
|
|
88615
88603
|
xmlSvg: ""
|
|
88616
88604
|
};
|
|
88617
|
-
const block =
|
|
88605
|
+
const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
88618
88606
|
setTimeout(() => {
|
|
88619
88607
|
const blockContent = getBlockContent(block);
|
|
88620
88608
|
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
88621
88609
|
assert(logger$i, embed, "embed should not be null");
|
|
88622
|
-
const blockData =
|
|
88623
|
-
editDrawIO(
|
|
88610
|
+
const blockData = editor.getBlockData(block);
|
|
88611
|
+
editDrawIO(editor, block, embed, blockData.embedData);
|
|
88624
88612
|
}, 100);
|
|
88625
88613
|
return block;
|
|
88626
88614
|
}
|
|
@@ -93654,7 +93642,19 @@ ${data2.plantumlText}
|
|
|
93654
93642
|
__publicField(this, "_dirtyFlag", false);
|
|
93655
93643
|
__publicField(this, "_connectionFlag", false);
|
|
93656
93644
|
__publicField(this, "_offlineFlag", false);
|
|
93657
|
-
__publicField(this, "
|
|
93645
|
+
__publicField(this, "_pendingErrorMessage", null);
|
|
93646
|
+
__publicField(this, "_showErrorDebounced", debounce__default.default(() => {
|
|
93647
|
+
if (!this._pendingErrorMessage) {
|
|
93648
|
+
return;
|
|
93649
|
+
}
|
|
93650
|
+
if (document.visibilityState === "hidden") {
|
|
93651
|
+
return;
|
|
93652
|
+
}
|
|
93653
|
+
if (this._editor) {
|
|
93654
|
+
this._editor.readonly = true;
|
|
93655
|
+
}
|
|
93656
|
+
this.bar.show(this._pendingErrorMessage, "error");
|
|
93657
|
+
}, 1e4));
|
|
93658
93658
|
__publicField(this, "_handleOffline", () => {
|
|
93659
93659
|
this._offlineFlag = true;
|
|
93660
93660
|
this.handleError(new Error("offline"));
|
|
@@ -93681,14 +93681,18 @@ ${data2.plantumlText}
|
|
|
93681
93681
|
this.autoHide();
|
|
93682
93682
|
});
|
|
93683
93683
|
__publicField(this, "onRenewingToken", (count) => {
|
|
93684
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewingToken ${count}`);
|
|
93684
93685
|
});
|
|
93685
93686
|
__publicField(this, "onRenewedToken", (auth) => {
|
|
93687
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewedToken`);
|
|
93686
93688
|
});
|
|
93687
93689
|
__publicField(this, "onRenewTokenError", (error2) => {
|
|
93690
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onRenewTokenError`);
|
|
93688
93691
|
assert(logger$7, this._editor, "no editor");
|
|
93689
93692
|
this.handleError(error2);
|
|
93690
93693
|
});
|
|
93691
93694
|
__publicField(this, "onReauthing", () => {
|
|
93695
|
+
console.log(`[${new Date().toLocaleString()}] wiz-editor onReauthing`);
|
|
93692
93696
|
});
|
|
93693
93697
|
__publicField(this, "onReauthError", (error2) => {
|
|
93694
93698
|
assert(logger$7, this._editor, "no editor");
|
|
@@ -93759,16 +93763,19 @@ ${data2.plantumlText}
|
|
|
93759
93763
|
handleError(error2, customMessage) {
|
|
93760
93764
|
console.error(`[${new Date().toLocaleString()}] wiz-editor error: ${error2}
|
|
93761
93765
|
${JSON.stringify(error2, null, 2)}`);
|
|
93762
|
-
if (
|
|
93763
|
-
|
|
93766
|
+
if (document.visibilityState === "hidden") {
|
|
93767
|
+
return;
|
|
93764
93768
|
}
|
|
93765
93769
|
const defaultMessage = this.hasPopup() ? i18n$1.t("error.networkPopup") : i18n$1.t("error.network");
|
|
93766
93770
|
const errorMessage = customMessage || defaultMessage;
|
|
93767
|
-
this.
|
|
93771
|
+
this._pendingErrorMessage = errorMessage;
|
|
93772
|
+
this._showErrorDebounced();
|
|
93768
93773
|
}
|
|
93769
93774
|
autoHide() {
|
|
93770
93775
|
var _a;
|
|
93771
93776
|
if (!this._dirtyFlag && !this._connectionFlag && !this._offlineFlag) {
|
|
93777
|
+
this._showErrorDebounced.cancel();
|
|
93778
|
+
this._pendingErrorMessage = null;
|
|
93772
93779
|
this.bar.hide();
|
|
93773
93780
|
if ((_a = this._editor) == null ? void 0 : _a.readonly) {
|
|
93774
93781
|
this._editor.readonly = false;
|
|
@@ -96850,7 +96857,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96850
96857
|
}
|
|
96851
96858
|
}
|
|
96852
96859
|
});
|
|
96853
|
-
editor.version = "3.0.
|
|
96860
|
+
editor.version = "3.0.13";
|
|
96854
96861
|
return editor;
|
|
96855
96862
|
}
|
|
96856
96863
|
function isDoc(doc2) {
|
|
@@ -96984,7 +96991,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96984
96991
|
OnesEditorDropTarget.register(editor);
|
|
96985
96992
|
OnesEditorTocProvider.register(editor);
|
|
96986
96993
|
OnesEditorExclusiveBlock.register(editor);
|
|
96987
|
-
editor.version = "3.0.
|
|
96994
|
+
editor.version = "3.0.13";
|
|
96988
96995
|
return editor;
|
|
96989
96996
|
}
|
|
96990
96997
|
async function showDocVersions(editor, options, serverUrl) {
|