@ones-editor/editor 2.1.6 → 2.1.7
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
|
@@ -36726,6 +36726,7 @@ ${codeText}
|
|
|
36726
36726
|
__publicField(this, "status", "clean");
|
|
36727
36727
|
__publicField(this, "disableLogout");
|
|
36728
36728
|
__publicField(this, "destroyed", false);
|
|
36729
|
+
__publicField(this, "options", null);
|
|
36729
36730
|
__publicField(this, "handleNothingPending", () => {
|
|
36730
36731
|
this.setStatus("clean");
|
|
36731
36732
|
});
|
|
@@ -36936,6 +36937,7 @@ ${codeText}
|
|
|
36936
36937
|
});
|
|
36937
36938
|
const doc2 = await client.getDoc();
|
|
36938
36939
|
const shareDBDoc = new ShareDBDoc(client, doc2, options.disableLogout);
|
|
36940
|
+
shareDBDoc.options = options;
|
|
36939
36941
|
if (doc2.type === null) {
|
|
36940
36942
|
if (options.autoCreateDoc === false) {
|
|
36941
36943
|
const error2 = new Error("doc not exists");
|
|
@@ -37215,14 +37217,28 @@ ${codeText}
|
|
|
37215
37217
|
return ret;
|
|
37216
37218
|
}
|
|
37217
37219
|
async uploadResource(file2, options) {
|
|
37218
|
-
var _a;
|
|
37219
|
-
|
|
37220
|
+
var _a, _b;
|
|
37221
|
+
if ((_a = this.options) == null ? void 0 : _a.uploadResource) {
|
|
37222
|
+
try {
|
|
37223
|
+
const ret2 = await this.options.uploadResource(file2, options);
|
|
37224
|
+
return ret2;
|
|
37225
|
+
} catch (err) {
|
|
37226
|
+
}
|
|
37227
|
+
}
|
|
37228
|
+
const ret = await this.client.uploadResource(file2, (_b = options == null ? void 0 : options.onProgress) != null ? _b : () => {
|
|
37220
37229
|
});
|
|
37221
37230
|
return {
|
|
37222
37231
|
resourceId: ret
|
|
37223
37232
|
};
|
|
37224
37233
|
}
|
|
37225
37234
|
buildResourceUrl(resourceId, options) {
|
|
37235
|
+
var _a;
|
|
37236
|
+
if ((_a = this.options) == null ? void 0 : _a.buildResourceUrl) {
|
|
37237
|
+
const ret = this.options.buildResourceUrl(resourceId, options);
|
|
37238
|
+
if (ret) {
|
|
37239
|
+
return ret;
|
|
37240
|
+
}
|
|
37241
|
+
}
|
|
37226
37242
|
return this.client.buildResourceUrl(resourceId, options);
|
|
37227
37243
|
}
|
|
37228
37244
|
request(url, options) {
|
|
@@ -82938,7 +82954,9 @@ ${data2.flowchartText}
|
|
|
82938
82954
|
serverUrl: options.serverUrl,
|
|
82939
82955
|
reauthFunc,
|
|
82940
82956
|
disableLogout: options.disableLogout,
|
|
82941
|
-
onMaxUsersError: options.onMaxUsersError
|
|
82957
|
+
onMaxUsersError: options.onMaxUsersError,
|
|
82958
|
+
uploadResource: options.uploadResource,
|
|
82959
|
+
buildResourceUrl: options.buildResourceUrl
|
|
82942
82960
|
};
|
|
82943
82961
|
const doc2 = await ShareDBDoc.load(docOptions);
|
|
82944
82962
|
const enableComments = options == null ? void 0 : options.enableComments;
|
|
@@ -83086,7 +83104,7 @@ ${data2.flowchartText}
|
|
|
83086
83104
|
}
|
|
83087
83105
|
}
|
|
83088
83106
|
});
|
|
83089
|
-
editor.version = "2.1.
|
|
83107
|
+
editor.version = "2.1.7";
|
|
83090
83108
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
83091
83109
|
window.setReauthFail = (fail) => {
|
|
83092
83110
|
window.isReauthError = fail;
|
|
@@ -83181,7 +83199,7 @@ ${data2.flowchartText}
|
|
|
83181
83199
|
if (!clientType.isMobile) {
|
|
83182
83200
|
OnesEditorToolbar.register(editor);
|
|
83183
83201
|
}
|
|
83184
|
-
editor.version = "2.1.
|
|
83202
|
+
editor.version = "2.1.7";
|
|
83185
83203
|
return editor;
|
|
83186
83204
|
}
|
|
83187
83205
|
async function showDocVersions(editor, options, serverUrl) {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Embed, Box, i18n, OnesEditor, OnesEditorUser, OnesEditorUserPermission, OnesEditorBlockHook, OnesEditorCommandProvider, LogLevel, Block, ShortcutRecords, OnesEditorBlockRenderer } from '../@ones-editor/core';
|
|
1
|
+
import { Embed, Box, i18n, OnesEditor, OnesEditorUser, OnesEditorUserPermission, OnesEditorBlockHook, OnesEditorCommandProvider, LogLevel, Block, ShortcutRecords, OnesEditorBlockRenderer, BuildResourceUrlOptions, UploadResourceOptions, UploadResourceResult } from '../@ones-editor/core';
|
|
2
2
|
import { DrawIoOptions } from '../@ones-editor/drawio-embed';
|
|
3
3
|
import { FlowCharEmbedOptions, MermaidEmbedOptions, PlantumlEmbedOptions } from '../@ones-editor/graph-embed';
|
|
4
4
|
import { ImageOptions } from '../@ones-editor/image-embed';
|
|
@@ -82,6 +82,8 @@ export interface CreateOnesEditorOptions {
|
|
|
82
82
|
events?: EditorEvents;
|
|
83
83
|
shortcuts?: ShortcutRecords[];
|
|
84
84
|
componentsOptions?: EditorComponentOptions;
|
|
85
|
+
buildResourceUrl?: (resourceId: string, options?: BuildResourceUrlOptions) => string;
|
|
86
|
+
uploadResource?: (file: File, options?: UploadResourceOptions) => Promise<UploadResourceResult>;
|
|
85
87
|
}
|
|
86
88
|
export interface CreateLocalEditorOptions {
|
|
87
89
|
id?: string;
|