@ones-editor/editor 1.1.18-beta.16 → 1.1.18-beta.17
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/sharedb-doc/src/doc/auth-connection.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -2
- package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +20 -23
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34350,9 +34350,7 @@ ${codeText}
|
|
|
34350
34350
|
this.events.emit("writeConflictError", error2);
|
|
34351
34351
|
}
|
|
34352
34352
|
emitMaxUsersError() {
|
|
34353
|
-
|
|
34354
|
-
err.code = MaxUserError.err;
|
|
34355
|
-
this.events.emit("maxUsersError", err);
|
|
34353
|
+
this.events.emit("maxUsersError");
|
|
34356
34354
|
this.end(false);
|
|
34357
34355
|
}
|
|
34358
34356
|
handleMessage(message) {
|
|
@@ -34474,21 +34472,22 @@ ${codeText}
|
|
|
34474
34472
|
__publicField(this, "reauthFunc");
|
|
34475
34473
|
__publicField(this, "clientId", genId());
|
|
34476
34474
|
__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
|
+
});
|
|
34477
34483
|
assert(logger$2p, !this.doc, "This websocket has opened a doc.");
|
|
34478
34484
|
await this.connection.init(this.auth);
|
|
34479
34485
|
const doc2 = this.connection.get(this.auth.appId, this.auth.docId);
|
|
34480
34486
|
this.doc = doc2;
|
|
34487
|
+
await fetchDoc(doc2);
|
|
34488
|
+
logger$2p.debug(doc2);
|
|
34481
34489
|
return doc2;
|
|
34482
34490
|
});
|
|
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
|
-
}));
|
|
34492
34491
|
this.auth = auth;
|
|
34493
34492
|
const url = `${serverUrl}/${this.auth.appId}/${this.auth.docId}`;
|
|
34494
34493
|
types.register(json1__namespace.type);
|
|
@@ -35636,10 +35635,12 @@ ${codeText}
|
|
|
35636
35635
|
static async load(options) {
|
|
35637
35636
|
try {
|
|
35638
35637
|
const client = new ShareDBClient(options.auth, options.serverUrl, options.reauthFunc);
|
|
35638
|
+
client.onMaxUsersError(() => {
|
|
35639
|
+
var _a;
|
|
35640
|
+
return (_a = options.onMaxUsersError) == null ? void 0 : _a.call(options);
|
|
35641
|
+
});
|
|
35639
35642
|
const doc2 = await client.getDoc();
|
|
35640
35643
|
const shareDBDoc = new ShareDBDoc(client, doc2, options.disableLogout);
|
|
35641
|
-
shareDBDoc.initEvents();
|
|
35642
|
-
await client.fetchDoc(doc2);
|
|
35643
35644
|
if (doc2.type === null) {
|
|
35644
35645
|
if (options.autoCreateDoc === false) {
|
|
35645
35646
|
const error2 = new Error("doc not exists");
|
|
@@ -35650,6 +35651,7 @@ ${codeText}
|
|
|
35650
35651
|
}
|
|
35651
35652
|
await shareDBDoc.initPresence();
|
|
35652
35653
|
await shareDBDoc.subscribe();
|
|
35654
|
+
shareDBDoc.initEvents();
|
|
35653
35655
|
return shareDBDoc;
|
|
35654
35656
|
} catch (err) {
|
|
35655
35657
|
logger$2k.error(err);
|
|
@@ -35683,12 +35685,6 @@ ${codeText}
|
|
|
35683
35685
|
return (_a = cb.onAuthRecover) == null ? void 0 : _a.call(cb);
|
|
35684
35686
|
});
|
|
35685
35687
|
});
|
|
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
|
-
});
|
|
35692
35688
|
this.client.onWriteConflictError(this.handleWriteConflictError);
|
|
35693
35689
|
}
|
|
35694
35690
|
clearEvents() {
|
|
@@ -76994,7 +76990,8 @@ ${data.flowchartText}
|
|
|
76994
76990
|
},
|
|
76995
76991
|
serverUrl: options.serverUrl,
|
|
76996
76992
|
reauthFunc,
|
|
76997
|
-
disableLogout: options.disableLogout
|
|
76993
|
+
disableLogout: options.disableLogout,
|
|
76994
|
+
onMaxUsersError: options.onMaxUsersError
|
|
76998
76995
|
};
|
|
76999
76996
|
const doc2 = await ShareDBDoc.load(docOptions);
|
|
77000
76997
|
const editor = createEditor(root2, doc2, {
|
|
@@ -77130,7 +77127,7 @@ ${data.flowchartText}
|
|
|
77130
77127
|
}
|
|
77131
77128
|
}
|
|
77132
77129
|
});
|
|
77133
|
-
editor.version = "1.1.18-beta.
|
|
77130
|
+
editor.version = "1.1.18-beta.17";
|
|
77134
77131
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
77135
77132
|
window.setReauthFail = (fail) => {
|
|
77136
77133
|
window.isReauthError = fail;
|
|
@@ -77218,7 +77215,7 @@ ${data.flowchartText}
|
|
|
77218
77215
|
});
|
|
77219
77216
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
77220
77217
|
OnesEditorToolbar.register(editor);
|
|
77221
|
-
editor.version = "1.1.18-beta.
|
|
77218
|
+
editor.version = "1.1.18-beta.17";
|
|
77222
77219
|
return editor;
|
|
77223
77220
|
}
|
|
77224
77221
|
async function showDocVersions(editor, options, serverUrl) {
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export interface CreateOnesEditorOptions {
|
|
|
62
62
|
applyContentPlaceholder?: (editor: OnesEditor) => boolean;
|
|
63
63
|
};
|
|
64
64
|
onReauth?: (userId: string, docId: string, permission: OnesEditorUserPermission) => Promise<string>;
|
|
65
|
+
onMaxUsersError?: () => void;
|
|
65
66
|
user: {
|
|
66
67
|
userId: string;
|
|
67
68
|
displayName: string;
|