@ones-editor/editor 2.2.16-beta.7 → 2.2.16-beta.8

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.
@@ -9,6 +9,5 @@ export type ToastOptions = {
9
9
  x: number;
10
10
  y: number;
11
11
  };
12
- onClick: (e: MouseEvent) => boolean;
13
12
  };
14
13
  export declare function showToast(text: string, options?: Partial<ToastOptions>): () => void;
package/dist/index.js CHANGED
@@ -40904,12 +40904,6 @@ ${codeText}
40904
40904
  toast2.remove();
40905
40905
  }, 500);
40906
40906
  };
40907
- toast2.onclick = (e2) => {
40908
- var _a2;
40909
- if ((_a2 = options == null ? void 0 : options.onClick) == null ? void 0 : _a2.call(options, e2)) {
40910
- exit();
40911
- }
40912
- };
40913
40907
  const autoClose = (_a = options == null ? void 0 : options.autoClose) != null ? _a : true;
40914
40908
  if (!autoClose) {
40915
40909
  const icon = createElement("span", ["close"], toast2);
@@ -82185,23 +82179,15 @@ ${content}
82185
82179
  </mxStylesheet>
82186
82180
  `;
82187
82181
  const toast = "";
82188
- const showWarnToast = (exit) => {
82189
- const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.errorTips")} <a>\u8FD4\u56DE\u9875\u9762</a></span>`;
82190
- const onClick = (e2) => {
82191
- if (e2.target instanceof HTMLAnchorElement) {
82192
- exit();
82193
- return true;
82194
- }
82195
- return false;
82196
- };
82182
+ const showWarnToast = () => {
82183
+ const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.warnTips")}</span>`;
82197
82184
  const hide = showToast(errorHTML, {
82198
- autoClose: false,
82185
+ autoClose: true,
82199
82186
  position: {
82200
82187
  y: 30,
82201
82188
  x: window.innerWidth / 2
82202
82189
  },
82203
82190
  html: true,
82204
- onClick,
82205
82191
  theme: "warn"
82206
82192
  });
82207
82193
  return hide;
@@ -82346,12 +82332,9 @@ ${content}
82346
82332
  }
82347
82333
  }
82348
82334
  function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
82349
- let hide = () => {
82350
- };
82351
82335
  const destroy = () => {
82352
82336
  window.removeEventListener("message", receive);
82353
82337
  exit();
82354
- hide();
82355
82338
  };
82356
82339
  const loadingHandler = new LoadingHandler();
82357
82340
  loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
@@ -82362,6 +82345,7 @@ ${content}
82362
82345
  if (evt.data.length > 0) {
82363
82346
  const msg = JSON.parse(evt.data);
82364
82347
  const xml = drawIoData.xmlSvg || drawIoData.xml;
82348
+ assert(logger$j, xml, "xml does not exist");
82365
82349
  switch (msg.event) {
82366
82350
  case "configure":
82367
82351
  iframe.contentWindow.postMessage(JSON.stringify({
@@ -82372,15 +82356,12 @@ ${content}
82372
82356
  }), "*");
82373
82357
  break;
82374
82358
  case "init":
82375
- if (xml == null) {
82376
- hide = showWarnToast(destroy);
82377
- }
82378
82359
  iframe.contentWindow.postMessage(JSON.stringify({
82379
82360
  action: "load",
82380
82361
  saveAndExit: 1,
82381
82362
  noSaveBtn: 1,
82382
82363
  noExitBtn: 0,
82383
- xml: xml || ""
82364
+ xml
82384
82365
  }), "*");
82385
82366
  loaded();
82386
82367
  loadingHandler.removeLoading();
@@ -82433,14 +82414,18 @@ ${content}
82433
82414
  if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
82434
82415
  callbacks.onBeginInitDrawIo(editor, block);
82435
82416
  }
82436
- const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
82437
- exclusiveBlock(editor, block);
82438
82417
  if (data2.src) {
82439
82418
  const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
82440
82419
  if (svg) {
82441
82420
  data2.xmlSvg = svg;
82442
82421
  }
82443
82422
  }
82423
+ if (!data2.xml && !data2.xmlSvg) {
82424
+ showWarnToast();
82425
+ return;
82426
+ }
82427
+ const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
82428
+ exclusiveBlock(editor, block);
82444
82429
  const loaded = () => {
82445
82430
  autoSaveInterval = setInterval(() => {
82446
82431
  if (!drawioIframe || !drawioIframe.contentWindow) {
@@ -82688,6 +82673,7 @@ ${content}
82688
82673
  abstract: "Flowchart/UML",
82689
82674
  errorTips: "Flowchart/UML loading failed",
82690
82675
  errorSubTips: "The network service is abnormal, you can",
82676
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82691
82677
  retry: "Try again",
82692
82678
  save: "Saving"
82693
82679
  }
@@ -82700,6 +82686,7 @@ ${content}
82700
82686
  abstract: "\u6D41\u7A0B\u56FE/UML",
82701
82687
  errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
82702
82688
  errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
82689
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82703
82690
  retry: "\u91CD\u8BD5",
82704
82691
  save: "\u4FDD\u5B58\u4E2D"
82705
82692
  }
@@ -82712,6 +82699,7 @@ ${content}
82712
82699
  abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
82713
82700
  errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
82714
82701
  errorSubTips: "\u304A\u4F7F\u3044\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u63A5\u7D9A\u306B\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u6B21\u306E\u64CD\u4F5C\u3092\u884C\u3063\u3066\u304F\u3060\u3055\u3044\u3002 ",
82702
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82715
82703
  retry: "\u518D\u8A66\u884C",
82716
82704
  save: "\u4FDD\u5B58\u4E2D"
82717
82705
  }
@@ -88483,7 +88471,7 @@ ${data2.flowchartText}
88483
88471
  }
88484
88472
  }
88485
88473
  });
88486
- editor.version = "2.2.16-beta.7";
88474
+ editor.version = "2.2.16-beta.8";
88487
88475
  return editor;
88488
88476
  }
88489
88477
  function isDoc(doc2) {
@@ -88578,7 +88566,7 @@ ${data2.flowchartText}
88578
88566
  });
88579
88567
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88580
88568
  OnesEditorToolbar.register(editor);
88581
- editor.version = "2.2.16-beta.7";
88569
+ editor.version = "2.2.16-beta.8";
88582
88570
  return editor;
88583
88571
  }
88584
88572
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.2.16-beta.7",
3
+ "version": "2.2.16-beta.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",