@ones-editor/editor 2.9.8-beta.37 → 2.9.8-beta.39

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.
@@ -3,7 +3,8 @@ import { HistoryUser } from '../types';
3
3
  export default class HistoryDoc extends EventCallbacks<OnesEditorDocCallbacks> implements OnesEditorDoc {
4
4
  private server;
5
5
  private docObject;
6
- constructor(server: OnesEditorDocServer, docObject: DocObject);
6
+ private editorOptions?;
7
+ constructor(server: OnesEditorDocServer, docObject: DocObject, editorOptions?: unknown);
7
8
  beginBatchUpdate(): number;
8
9
  endBatchUpdate(): number;
9
10
  toJSON(): DocObject;
@@ -2,6 +2,7 @@ import { OnesEditor, OnesEditorCustom, OnesEditorDocServer } from '../../../../@
2
2
  import type { OnesEditorVersionsProvider, VersionDialogOptions } from '../types';
3
3
  export declare class OnesEditorVersionsDialog implements OnesEditorCustom {
4
4
  private server;
5
+ private editorOptions?;
5
6
  private dialog;
6
7
  private oldViewer;
7
8
  private versionOptions?;
@@ -11,7 +12,7 @@ export declare class OnesEditorVersionsDialog implements OnesEditorCustom {
11
12
  private components;
12
13
  get versionHelper(): import("@ones-editor/core").OnesEditorDocVersionHelper;
13
14
  get editor(): OnesEditor | null;
14
- constructor(server: OnesEditorDocServer, provider: OnesEditorVersionsProvider);
15
+ constructor(server: OnesEditorDocServer, provider: OnesEditorVersionsProvider, editorOptions?: unknown);
15
16
  private handleRevert;
16
17
  private handleSelectVersion;
17
18
  private handleCompareWithVersion;
package/dist/index.js CHANGED
@@ -82013,10 +82013,11 @@ ${docStr}
82013
82013
  assert(logger$B, false, "no local actions for history doc");
82014
82014
  }
82015
82015
  class HistoryDoc extends EventCallbacks {
82016
- constructor(server, docObject) {
82016
+ constructor(server, docObject, editorOptions) {
82017
82017
  super();
82018
82018
  this.server = server;
82019
82019
  this.docObject = docObject;
82020
+ this.editorOptions = editorOptions;
82020
82021
  }
82021
82022
  beginBatchUpdate() {
82022
82023
  return 0;
@@ -82074,6 +82075,10 @@ ${docStr}
82074
82075
  return (_c = (_b = (_a = this.server).getServerMeta) == null ? void 0 : _b.call(_a)) != null ? _c : {};
82075
82076
  }
82076
82077
  buildResourceUrl(src) {
82078
+ var _a;
82079
+ if ((_a = this.editorOptions) == null ? void 0 : _a.buildResourceUrl) {
82080
+ return this.editorOptions.buildResourceUrl(this, src);
82081
+ }
82077
82082
  return this.server.buildResourceUrl(src);
82078
82083
  }
82079
82084
  request() {
@@ -82931,7 +82936,7 @@ ${docStr}
82931
82936
  }
82932
82937
  const logger$x = getLogger("version-dialog");
82933
82938
  class OnesEditorVersionsDialog {
82934
- constructor(server, provider) {
82939
+ constructor(server, provider, editorOptions) {
82935
82940
  __publicField(this, "dialog", null);
82936
82941
  __publicField(this, "oldViewer", null);
82937
82942
  __publicField(this, "versionOptions");
@@ -83000,7 +83005,7 @@ ${docStr}
83000
83005
  }
83001
83006
  const { editorContainer: editorElement } = this.components;
83002
83007
  editorElement.innerHTML = "";
83003
- const historyDoc = new HistoryDoc(this.server, docObject);
83008
+ const historyDoc = new HistoryDoc(this.server, docObject, this.editorOptions);
83004
83009
  const viewer = this.provider.createHistoryEditor(editorElement, historyDoc);
83005
83010
  viewer.editorBlockRenders.registerRender(new OnesEditorHistoryRender());
83006
83011
  viewer.editorBoxes.registerBoxClass(HistoryDeletedTextBox);
@@ -83023,6 +83028,7 @@ ${docStr}
83023
83028
  this.components.infoHeader.dropdown.setVersions(this.versions);
83024
83029
  });
83025
83030
  this.server = server;
83031
+ this.editorOptions = editorOptions;
83026
83032
  this.provider = provider;
83027
83033
  const root2 = createElement("div", ["version-dialog"], null);
83028
83034
  root2.style.setProperty("--history-mask-identifier", `"${HISTORY_MASK_IDENTIFIER}"`);
@@ -87664,6 +87670,9 @@ ${data2.flowchartText}
87664
87670
  if (!plantumlImgFile) {
87665
87671
  return await Promise.resolve(url);
87666
87672
  }
87673
+ if (plantumlImgFile.type === "text/html") {
87674
+ return await Promise.resolve(url);
87675
+ }
87667
87676
  const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile, { resourceType: "graph" });
87668
87677
  return uploadResourceResult.resourceId;
87669
87678
  } catch (error2) {
@@ -95563,7 +95572,7 @@ ${JSON.stringify(error2, null, 2)}`);
95563
95572
  }
95564
95573
  }
95565
95574
  });
95566
- editor.version = "2.9.8-beta.37";
95575
+ editor.version = "2.9.8-beta.39";
95567
95576
  return editor;
95568
95577
  }
95569
95578
  function isDoc(doc2) {
@@ -95695,7 +95704,7 @@ ${JSON.stringify(error2, null, 2)}`);
95695
95704
  OnesEditorDropTarget.register(editor);
95696
95705
  OnesEditorTocProvider.register(editor);
95697
95706
  OnesEditorExclusiveBlock.register(editor);
95698
- editor.version = "2.9.8-beta.37";
95707
+ editor.version = "2.9.8-beta.39";
95699
95708
  return editor;
95700
95709
  }
95701
95710
  async function showDocVersions(editor, options, serverUrl) {
@@ -95720,7 +95729,7 @@ ${JSON.stringify(error2, null, 2)}`);
95720
95729
  return dialog;
95721
95730
  }
95722
95731
  async function showDocVersions2(parent, options) {
95723
- var _a, _b;
95732
+ var _a;
95724
95733
  const { serverUrl, appId, docId, token, userId, displayName } = options;
95725
95734
  const auth = {
95726
95735
  appId,
@@ -95733,10 +95742,9 @@ ${JSON.stringify(error2, null, 2)}`);
95733
95742
  };
95734
95743
  const server = await ShareDBServer.load({
95735
95744
  auth,
95736
- serverUrl: options.serverUrl,
95737
- buildResourceUrl: (_a = options.editorOptions) == null ? void 0 : _a.buildResourceUrl
95745
+ serverUrl: options.serverUrl
95738
95746
  });
95739
- const versionHelper = (_b = server.getVersionHelper) == null ? void 0 : _b.call(server);
95747
+ const versionHelper = (_a = server.getVersionHelper) == null ? void 0 : _a.call(server);
95740
95748
  if (!versionHelper) {
95741
95749
  throw new Error("the editor does not support to show versions");
95742
95750
  }
@@ -95755,7 +95763,7 @@ ${JSON.stringify(error2, null, 2)}`);
95755
95763
  ...options == null ? void 0 : options.editorOptions
95756
95764
  };
95757
95765
  const versionsProvider = new ShareDBDocVersionsProvider(editorOptions);
95758
- const dialog = new OnesEditorVersionsDialog(server, versionsProvider);
95766
+ const dialog = new OnesEditorVersionsDialog(server, versionsProvider, editorOptions);
95759
95767
  const dialogOptions = options.options || {
95760
95768
  container: parent
95761
95769
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.9.8-beta.37",
3
+ "version": "2.9.8-beta.39",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {