@ones-editor/editor 1.1.18-beta.14 → 1.1.18-beta.16
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/dist/index.js
CHANGED
|
@@ -34350,7 +34350,9 @@ ${codeText}
|
|
|
34350
34350
|
this.events.emit("writeConflictError", error2);
|
|
34351
34351
|
}
|
|
34352
34352
|
emitMaxUsersError() {
|
|
34353
|
-
|
|
34353
|
+
const err = new Error(MaxUserError.msg);
|
|
34354
|
+
err.code = MaxUserError.err;
|
|
34355
|
+
this.events.emit("maxUsersError", err);
|
|
34354
34356
|
this.end(false);
|
|
34355
34357
|
}
|
|
34356
34358
|
handleMessage(message) {
|
|
@@ -34472,22 +34474,21 @@ ${codeText}
|
|
|
34472
34474
|
__publicField(this, "reauthFunc");
|
|
34473
34475
|
__publicField(this, "clientId", genId());
|
|
34474
34476
|
__publicField(this, "getDoc", async () => {
|
|
34475
|
-
const fetchDoc = (doc22) => new Promise((resolve, reject) => {
|
|
34476
|
-
doc22.fetch((err) => {
|
|
34477
|
-
if (err)
|
|
34478
|
-
reject(err);
|
|
34479
|
-
else
|
|
34480
|
-
resolve();
|
|
34481
|
-
});
|
|
34482
|
-
});
|
|
34483
34477
|
assert(logger$2p, !this.doc, "This websocket has opened a doc.");
|
|
34484
34478
|
await this.connection.init(this.auth);
|
|
34485
34479
|
const doc2 = this.connection.get(this.auth.appId, this.auth.docId);
|
|
34486
34480
|
this.doc = doc2;
|
|
34487
|
-
await fetchDoc(doc2);
|
|
34488
|
-
logger$2p.debug(doc2);
|
|
34489
34481
|
return doc2;
|
|
34490
34482
|
});
|
|
34483
|
+
__publicField(this, "fetchDoc", (doc2) => new Promise((resolve, reject) => {
|
|
34484
|
+
doc2.fetch((err) => {
|
|
34485
|
+
if (err)
|
|
34486
|
+
reject(err);
|
|
34487
|
+
else
|
|
34488
|
+
resolve();
|
|
34489
|
+
});
|
|
34490
|
+
logger$2p.debug(doc2);
|
|
34491
|
+
}));
|
|
34491
34492
|
this.auth = auth;
|
|
34492
34493
|
const url = `${serverUrl}/${this.auth.appId}/${this.auth.docId}`;
|
|
34493
34494
|
types.register(json1__namespace.type);
|
|
@@ -35637,6 +35638,8 @@ ${codeText}
|
|
|
35637
35638
|
const client = new ShareDBClient(options.auth, options.serverUrl, options.reauthFunc);
|
|
35638
35639
|
const doc2 = await client.getDoc();
|
|
35639
35640
|
const shareDBDoc = new ShareDBDoc(client, doc2, options.disableLogout);
|
|
35641
|
+
shareDBDoc.initEvents();
|
|
35642
|
+
await client.fetchDoc(doc2);
|
|
35640
35643
|
if (doc2.type === null) {
|
|
35641
35644
|
if (options.autoCreateDoc === false) {
|
|
35642
35645
|
const error2 = new Error("doc not exists");
|
|
@@ -35647,7 +35650,6 @@ ${codeText}
|
|
|
35647
35650
|
}
|
|
35648
35651
|
await shareDBDoc.initPresence();
|
|
35649
35652
|
await shareDBDoc.subscribe();
|
|
35650
|
-
shareDBDoc.initEvents();
|
|
35651
35653
|
return shareDBDoc;
|
|
35652
35654
|
} catch (err) {
|
|
35653
35655
|
logger$2k.error(err);
|
|
@@ -35681,6 +35683,12 @@ ${codeText}
|
|
|
35681
35683
|
return (_a = cb.onAuthRecover) == null ? void 0 : _a.call(cb);
|
|
35682
35684
|
});
|
|
35683
35685
|
});
|
|
35686
|
+
this.client.onMaxUsersError((err) => {
|
|
35687
|
+
this.callbacks.forEach((cb) => {
|
|
35688
|
+
var _a;
|
|
35689
|
+
return (_a = cb.onError) == null ? void 0 : _a.call(cb, err);
|
|
35690
|
+
});
|
|
35691
|
+
});
|
|
35684
35692
|
this.client.onWriteConflictError(this.handleWriteConflictError);
|
|
35685
35693
|
}
|
|
35686
35694
|
clearEvents() {
|
|
@@ -77122,7 +77130,7 @@ ${data.flowchartText}
|
|
|
77122
77130
|
}
|
|
77123
77131
|
}
|
|
77124
77132
|
});
|
|
77125
|
-
editor.version = "1.1.18-beta.
|
|
77133
|
+
editor.version = "1.1.18-beta.16";
|
|
77126
77134
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
77127
77135
|
window.setReauthFail = (fail) => {
|
|
77128
77136
|
window.isReauthError = fail;
|
|
@@ -77210,7 +77218,7 @@ ${data.flowchartText}
|
|
|
77210
77218
|
});
|
|
77211
77219
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
77212
77220
|
OnesEditorToolbar.register(editor);
|
|
77213
|
-
editor.version = "1.1.18-beta.
|
|
77221
|
+
editor.version = "1.1.18-beta.16";
|
|
77214
77222
|
return editor;
|
|
77215
77223
|
}
|
|
77216
77224
|
async function showDocVersions(editor, options, serverUrl) {
|