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

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
@@ -88,6 +88,8 @@ div.editor-root div.editor-content .editor-input {
88
88
  width: 16px;
89
89
  height: 20px;
90
90
  font-size: 16px;
91
+ white-space: nowrap;
92
+ overflow: hidden;
91
93
  }
92
94
  div.editor-root div.editor-content div[data-type=editor-container] {
93
95
  position: relative;
@@ -40904,12 +40906,6 @@ ${codeText}
40904
40906
  toast2.remove();
40905
40907
  }, 500);
40906
40908
  };
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
40909
  const autoClose = (_a = options == null ? void 0 : options.autoClose) != null ? _a : true;
40914
40910
  if (!autoClose) {
40915
40911
  const icon = createElement("span", ["close"], toast2);
@@ -50308,6 +50304,9 @@ ${codeText}
50308
50304
  this.editor = editor;
50309
50305
  }
50310
50306
  handleBeforeKeyDown(editor, event) {
50307
+ if (!editor.isWritable()) {
50308
+ return false;
50309
+ }
50311
50310
  const selectBlocks = editor.selection.range.getSelectedBlocks();
50312
50311
  if (selectBlocks.length === 0) {
50313
50312
  return false;
@@ -82185,23 +82184,15 @@ ${content}
82185
82184
  </mxStylesheet>
82186
82185
  `;
82187
82186
  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
- };
82187
+ const showWarnToast = () => {
82188
+ const errorHTML = `<span class="toast-message">${WarningFilledIcon}${i18n$1.t("drawio.warnTips")}</span>`;
82197
82189
  const hide = showToast(errorHTML, {
82198
- autoClose: false,
82190
+ autoClose: true,
82199
82191
  position: {
82200
82192
  y: 30,
82201
82193
  x: window.innerWidth / 2
82202
82194
  },
82203
82195
  html: true,
82204
- onClick,
82205
82196
  theme: "warn"
82206
82197
  });
82207
82198
  return hide;
@@ -82346,12 +82337,9 @@ ${content}
82346
82337
  }
82347
82338
  }
82348
82339
  function contactWithIframe(editor, block, drawIoData, iframe, loaded, exit, isInitializationCompleted2) {
82349
- let hide = () => {
82350
- };
82351
82340
  const destroy = () => {
82352
82341
  window.removeEventListener("message", receive);
82353
82342
  exit();
82354
- hide();
82355
82343
  };
82356
82344
  const loadingHandler = new LoadingHandler();
82357
82345
  loadingHandler.setLoading(iframe, i18n$1.t("drawio.loading"));
@@ -82362,6 +82350,7 @@ ${content}
82362
82350
  if (evt.data.length > 0) {
82363
82351
  const msg = JSON.parse(evt.data);
82364
82352
  const xml = drawIoData.xmlSvg || drawIoData.xml;
82353
+ assert(logger$j, xml, "xml does not exist");
82365
82354
  switch (msg.event) {
82366
82355
  case "configure":
82367
82356
  iframe.contentWindow.postMessage(JSON.stringify({
@@ -82372,15 +82361,12 @@ ${content}
82372
82361
  }), "*");
82373
82362
  break;
82374
82363
  case "init":
82375
- if (xml == null) {
82376
- hide = showWarnToast(destroy);
82377
- }
82378
82364
  iframe.contentWindow.postMessage(JSON.stringify({
82379
82365
  action: "load",
82380
82366
  saveAndExit: 1,
82381
82367
  noSaveBtn: 1,
82382
82368
  noExitBtn: 0,
82383
- xml: xml || ""
82369
+ xml
82384
82370
  }), "*");
82385
82371
  loaded();
82386
82372
  loadingHandler.removeLoading();
@@ -82433,14 +82419,18 @@ ${content}
82433
82419
  if (callbacks && (callbacks == null ? void 0 : callbacks.onBeginInitDrawIo)) {
82434
82420
  callbacks.onBeginInitDrawIo(editor, block);
82435
82421
  }
82436
- const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
82437
- exclusiveBlock(editor, block);
82438
82422
  if (data2.src) {
82439
82423
  const svg = await downloadSvgToString(editor, editor.doc.buildResourceUrl(data2.src));
82440
82424
  if (svg) {
82441
82425
  data2.xmlSvg = svg;
82442
82426
  }
82443
82427
  }
82428
+ if (!data2.xml && !data2.xmlSvg) {
82429
+ showWarnToast();
82430
+ return;
82431
+ }
82432
+ const { drawioIframe, exit: exitIframe } = await initializeDrawioIframe(editor, block);
82433
+ exclusiveBlock(editor, block);
82444
82434
  const loaded = () => {
82445
82435
  autoSaveInterval = setInterval(() => {
82446
82436
  if (!drawioIframe || !drawioIframe.contentWindow) {
@@ -82688,6 +82678,7 @@ ${content}
82688
82678
  abstract: "Flowchart/UML",
82689
82679
  errorTips: "Flowchart/UML loading failed",
82690
82680
  errorSubTips: "The network service is abnormal, you can",
82681
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82691
82682
  retry: "Try again",
82692
82683
  save: "Saving"
82693
82684
  }
@@ -82700,6 +82691,7 @@ ${content}
82700
82691
  abstract: "\u6D41\u7A0B\u56FE/UML",
82701
82692
  errorTips: "\u6D41\u7A0B\u56FE/UML\u52A0\u8F7D\u5931\u8D25",
82702
82693
  errorSubTips: "\u7F51\u7EDC\u670D\u52A1\u5F02\u5E38\uFF0C\u4F60\u53EF\u4EE5",
82694
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82703
82695
  retry: "\u91CD\u8BD5",
82704
82696
  save: "\u4FDD\u5B58\u4E2D"
82705
82697
  }
@@ -82712,6 +82704,7 @@ ${content}
82712
82704
  abstract: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML",
82713
82705
  errorTips: "\u30D5\u30ED\u30FC\u30C1\u30E3\u30FC\u30C8/UML \u306E\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",
82714
82706
  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 ",
82707
+ warnTips: "\u6D41\u7A0B\u56FE/UML \u8D44\u6E90\u83B7\u53D6\u5931\u8D25\uFF0C\u65E0\u6CD5\u8FDB\u884C\u7F16\u8F91\u3002",
82715
82708
  retry: "\u518D\u8A66\u884C",
82716
82709
  save: "\u4FDD\u5B58\u4E2D"
82717
82710
  }
@@ -88483,7 +88476,7 @@ ${data2.flowchartText}
88483
88476
  }
88484
88477
  }
88485
88478
  });
88486
- editor.version = "2.2.16-beta.7";
88479
+ editor.version = "2.2.16-beta.9";
88487
88480
  return editor;
88488
88481
  }
88489
88482
  function isDoc(doc2) {
@@ -88578,7 +88571,7 @@ ${data2.flowchartText}
88578
88571
  });
88579
88572
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
88580
88573
  OnesEditorToolbar.register(editor);
88581
- editor.version = "2.2.16-beta.7";
88574
+ editor.version = "2.2.16-beta.9";
88582
88575
  return editor;
88583
88576
  }
88584
88577
  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.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",