@ones-editor/editor 3.0.15-beta.1 → 3.0.16-beta.2

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
@@ -6481,6 +6481,10 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
6481
6481
  .version-dialog.loading .version-viewer .version-info-container {
6482
6482
  display: none;
6483
6483
  }
6484
+ .version-dialog.force-latest-compare .version-viewer .version-info-container,
6485
+ .version-dialog.force-latest-compare .version-list-root {
6486
+ display: none !important;
6487
+ }
6484
6488
  .version-dialog .version-loading {
6485
6489
  display: flex;
6486
6490
  height: 100%;
@@ -7798,38 +7802,6 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
7798
7802
  }
7799
7803
  div.editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=drawio] [data-src] {
7800
7804
  cursor: zoom-in;
7801
- }
7802
- .command-item.menu-item[data-id=insert-drawio] {
7803
- width: 100%;
7804
- }
7805
- .command-item.menu-item[data-id=insert-drawio] .uml-menu-item {
7806
- color: #2d2d2e;
7807
- user-select: none;
7808
- transition: background 20ms ease-in 0s;
7809
- width: 100%;
7810
- height: 32px;
7811
- padding: 6px 10px;
7812
- display: flex;
7813
- align-items: center;
7814
- box-sizing: border-box;
7815
- }
7816
- .command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-icon {
7817
- display: flex;
7818
- align-items: center;
7819
- justify-content: center;
7820
- height: 24px;
7821
- width: 24px;
7822
- margin-right: 5px;
7823
- margin-top: -2px;
7824
- display: flex;
7825
- flex-direction: column;
7826
- justify-content: center;
7827
- }
7828
- .command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-name {
7829
- white-space: nowrap;
7830
- flex-grow: 1;
7831
- display: flex;
7832
- align-items: center;
7833
7805
  }.embed-block[data-embed-type=mermaid],
7834
7806
  .embed-block[data-embed-type=flowchart],
7835
7807
  .embed-block[data-embed-type=plantuml] {
@@ -25244,20 +25216,20 @@ var __publicField = (obj, key, value) => {
25244
25216
  function textBlockToMarkdown(editor, blockData, doc2) {
25245
25217
  const richText2 = blockData.text || [];
25246
25218
  const text2 = textToMarkdownText(editor, richText2, doc2);
25247
- let markdown2 = text2;
25219
+ let markdown = text2;
25248
25220
  if (blockData.heading) {
25249
25221
  const heading = blockData.heading;
25250
25222
  const prefix = "#".repeat(heading);
25251
- markdown2 = `${prefix} ${markdown2}`;
25223
+ markdown = `${prefix} ${markdown}`;
25252
25224
  }
25253
25225
  if (blockData.quoted) {
25254
- markdown2 = `> ${markdown2}`;
25226
+ markdown = `> ${markdown}`;
25255
25227
  }
25256
25228
  if (blockData.type === "text") {
25257
- markdown2 = `${markdown2}
25229
+ markdown = `${markdown}
25258
25230
  `;
25259
25231
  }
25260
- return markdown2;
25232
+ return markdown;
25261
25233
  }
25262
25234
  function styleColorToColor$1(color) {
25263
25235
  switch (color) {
@@ -26922,8 +26894,8 @@ var __publicField = (obj, key, value) => {
26922
26894
  function docToMarkdown(editor, doc2) {
26923
26895
  const lines = doc2.blocks.root.map((b, index2) => blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
26924
26896
  lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
26925
- const markdown2 = lines.join("\n");
26926
- return markdown2;
26897
+ const markdown = lines.join("\n");
26898
+ return markdown;
26927
26899
  }
26928
26900
  const logger$3O = getLogger("get-text-position");
26929
26901
  function editorGetTextPosition(editor, insertPos) {
@@ -29926,13 +29898,13 @@ ${codeText}
29926
29898
  addMetaToDoc(editor, doc2);
29927
29899
  const htmlFragment = docToHtmlFragment(editor, doc2);
29928
29900
  injectDocToHtmlFragment(htmlFragment, doc2);
29929
- let markdown2 = "";
29901
+ let markdown = "";
29930
29902
  if (isSelectedCodeTextBlock(editor)) {
29931
29903
  const selectBlock = editor.selection.range.getSelectedBlocks()[0];
29932
29904
  const container = getParentContainer(selectBlock.block);
29933
29905
  const codeBlock2 = getParentBlock(container);
29934
29906
  if (codeBlock2) {
29935
- markdown2 = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
29907
+ markdown = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
29936
29908
  }
29937
29909
  } else {
29938
29910
  const lines = [];
@@ -29940,11 +29912,11 @@ ${codeText}
29940
29912
  lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
29941
29913
  });
29942
29914
  lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
29943
- markdown2 = lines.join("\n");
29915
+ markdown = lines.join("\n");
29944
29916
  }
29945
29917
  setClipboardData([{
29946
29918
  type: "text/plain",
29947
- data: new Blob([markdown2], { type: "text/plain" })
29919
+ data: new Blob([markdown], { type: "text/plain" })
29948
29920
  }]);
29949
29921
  return true;
29950
29922
  }
@@ -41832,9 +41804,7 @@ ${codeText}
41832
41804
  }
41833
41805
  }
41834
41806
  if (item.element) {
41835
- if (!item.useDefaultClickHandler) {
41836
- return;
41837
- }
41807
+ return;
41838
41808
  }
41839
41809
  this.emit("click", this, item, elem);
41840
41810
  if (item.clickToClose === false) {
@@ -42761,9 +42731,6 @@ ${codeText}
42761
42731
  function initMenuItem$1(item, elem) {
42762
42732
  var _a, _b;
42763
42733
  addClass(elem, "menu-item");
42764
- if (item.className) {
42765
- addClass(elem, ...item.className.split(" "));
42766
- }
42767
42734
  if (item.element) {
42768
42735
  return;
42769
42736
  }
@@ -42839,9 +42806,6 @@ ${codeText}
42839
42806
  });
42840
42807
  }
42841
42808
  function initToolbarItem(item, elem, options) {
42842
- if (item.className) {
42843
- addClass(elem, ...item.className.split(" "));
42844
- }
42845
42809
  elem.setAttribute("data-button-id", item.id);
42846
42810
  if (options.tooltipId && item.name && !item.disableTooltip) {
42847
42811
  elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
@@ -52469,22 +52433,7 @@ ${codeText}
52469
52433
  var _a, _b, _c;
52470
52434
  const list2 = blockData;
52471
52435
  if (type === "text") {
52472
- let text2 = ((_a = TextBlock.convertTo) == null ? void 0 : _a.call(TextBlock, editor, blockData, doc2, "text", path)) || "";
52473
- if (path.length === 1) {
52474
- if (list2.checkbox === "checked") {
52475
- text2 = `[x] ${text2}`;
52476
- } else if (list2.checkbox === "unchecked") {
52477
- text2 = `[ ] ${text2}`;
52478
- }
52479
- if (list2.ordered) {
52480
- text2 = `${list2.start}. ${text2}`;
52481
- } else {
52482
- text2 = `- ${text2}`;
52483
- }
52484
- const level = list2.level || 0;
52485
- const prefix = level > 0 ? " ".repeat(level - 1) : "";
52486
- text2 = prefix + text2;
52487
- }
52436
+ const text2 = ((_a = TextBlock.convertTo) == null ? void 0 : _a.call(TextBlock, editor, blockData, doc2, "text", path)) || "";
52488
52437
  return text2;
52489
52438
  }
52490
52439
  if (type === "markdown") {
@@ -67272,11 +67221,9 @@ ${codeText}
67272
67221
  });
67273
67222
  return true;
67274
67223
  }
67275
- function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
67276
- if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
67277
- if (matchHeading(editor, containerId, blockIndex, offset)) {
67278
- return true;
67279
- }
67224
+ function matchBlockStyle(editor, containerId, blockIndex, offset) {
67225
+ if (matchHeading(editor, containerId, blockIndex, offset)) {
67226
+ return true;
67280
67227
  }
67281
67228
  if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
67282
67229
  return true;
@@ -67381,9 +67328,6 @@ ${codeText}
67381
67328
  return false;
67382
67329
  }
67383
67330
  class MarkdownInputHandler {
67384
- constructor(options) {
67385
- this.options = options;
67386
- }
67387
67331
  handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
67388
67332
  const block = editor.getBlockByIndex(containerId, blockIndex);
67389
67333
  if (isTitleBlock$2(block)) {
@@ -67393,7 +67337,7 @@ ${codeText}
67393
67337
  if (converterIntercept(editor, containerId)) {
67394
67338
  return false;
67395
67339
  }
67396
- if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
67340
+ if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
67397
67341
  return true;
67398
67342
  }
67399
67343
  if (matchTextStyle(editor, containerId, blockIndex, offset)) {
@@ -69933,8 +69877,8 @@ ${codeText}
69933
69877
  return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
69934
69878
  }
69935
69879
  if (type === "markdown") {
69936
- const markdown2 = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
69937
- return `${markdown2}
69880
+ const markdown = images.map((image) => `![img](${editor.doc.buildResourceUrl(image.src, { withToken: true })})`).join("\n");
69881
+ return `${markdown}
69938
69882
  `;
69939
69883
  }
69940
69884
  return "";
@@ -75359,8 +75303,8 @@ ${codeText}
75359
75303
  }
75360
75304
  lines.push(rowText);
75361
75305
  }
75362
- const markdown2 = lines.join("\n");
75363
- return `${markdown2}
75306
+ const markdown = lines.join("\n");
75307
+ return `${markdown}
75364
75308
  `;
75365
75309
  }
75366
75310
  if (type === "html") {
@@ -76403,11 +76347,6 @@ ${codeText}
76403
76347
  }
76404
76348
  const logger$S = getLogger("custom-tag-to-text");
76405
76349
  function customTagToText(token, attributes, options) {
76406
- var _a;
76407
- const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
76408
- if (processed) {
76409
- return processed;
76410
- }
76411
76350
  const content = token.content;
76412
76351
  try {
76413
76352
  const base64 = content;
@@ -76620,7 +76559,7 @@ ${codeText}
76620
76559
  return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
76621
76560
  }
76622
76561
  if (token.type === "custom-tag") {
76623
- return customTagToText(token, attributes, options);
76562
+ return customTagToText(token, attributes);
76624
76563
  }
76625
76564
  if (token.type === "latex") {
76626
76565
  return [{
@@ -77083,9 +77022,9 @@ ${codeText}
77083
77022
  });
77084
77023
  marked.marked.use(extendedCustomTag());
77085
77024
  marked.marked.use(confluenceTextTag());
77086
- function markdownToDoc(markdown2, options) {
77025
+ function markdownToDoc(markdown, options) {
77087
77026
  const lexer = new marked.marked.Lexer();
77088
- const tokens = lexer.lex(markdown2);
77027
+ const tokens = lexer.lex(markdown);
77089
77028
  const doc2 = {
77090
77029
  blocks: {
77091
77030
  root: []
@@ -77100,8 +77039,7 @@ ${codeText}
77100
77039
  tokensToBlocks,
77101
77040
  tokensToTextWithChildren,
77102
77041
  htmlToDoc: options == null ? void 0 : options.htmlToDoc,
77103
- listLevel: 1,
77104
- customTagProcess: options == null ? void 0 : options.customTagProcess
77042
+ listLevel: 1
77105
77043
  };
77106
77044
  const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
77107
77045
  if (rootBlocks.length === 0) {
@@ -77114,13 +77052,6 @@ ${codeText}
77114
77052
  doc2.blocks.root.push(...rootBlocks);
77115
77053
  return doc2;
77116
77054
  }
77117
- const markdown = `
77118
- [[cursor]]
77119
- `;
77120
- setTimeout(() => {
77121
- const doc2 = markdownToDoc(markdown);
77122
- console.log(doc2);
77123
- }, 100);
77124
77055
  function extend(destination) {
77125
77056
  for (let i = 1; i < arguments.length; i++) {
77126
77057
  const source = arguments[i];
@@ -78686,9 +78617,9 @@ ${docStr}
78686
78617
  htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
78687
78618
  }
78688
78619
  }
78689
- const markdown2 = turndownService.turndown(htmlFragment);
78690
- logger$P.debug(`markdown: ${markdown2}`);
78691
- return markdownToDoc(markdown2, {
78620
+ const markdown = turndownService.turndown(htmlFragment);
78621
+ logger$P.debug(`markdown: ${markdown}`);
78622
+ return markdownToDoc(markdown, {
78692
78623
  htmlToDoc: (html2) => {
78693
78624
  const doc2 = htmlToDocByMarkdown(html2, options);
78694
78625
  return doc2;
@@ -83528,7 +83459,8 @@ ${docStr}
83528
83459
  this.dropdown.setLabels([]);
83529
83460
  if (compareWithVersion) {
83530
83461
  this.dropdown.setText(getVersionName(compareWithVersion));
83531
- if (compareWithVersion.version === -1 || compareWithVersion.created === this.versions[0].created) {
83462
+ const latestVersion = this.versions[0];
83463
+ if (compareWithVersion.version === -1 || latestVersion && compareWithVersion.created === latestVersion.created) {
83532
83464
  this.dropdown.setLabels([i18n$1.t("version.latest")]);
83533
83465
  }
83534
83466
  }
@@ -83934,6 +83866,7 @@ ${docStr}
83934
83866
  }
83935
83867
  }
83936
83868
  const logger$y = getLogger("version-dialog");
83869
+ const ForceLatestCompareClass = "force-latest-compare";
83937
83870
  class OnesEditorVersionsDialog {
83938
83871
  constructor(server, provider, editorOptions) {
83939
83872
  __publicField(this, "dialog", null);
@@ -83977,8 +83910,8 @@ ${docStr}
83977
83910
  (_b = (_a = this.versionOptions) == null ? void 0 : _a.onHelp) == null ? void 0 : _b.call(_a);
83978
83911
  });
83979
83912
  __publicField(this, "viewVersion", async (version, compareWithVersion, options) => {
83980
- var _a, _b, _c, _d, _e;
83981
- const isLatest = this.versions[0].created === version.created;
83913
+ var _a, _b, _c, _d, _e, _f, _g;
83914
+ const isLatest = !!this.versions[0] && this.versions[0].created === version.created;
83982
83915
  this.components.infoHeader.setVersion(version, compareWithVersion, isLatest);
83983
83916
  if (!compareWithVersion && (options == null ? void 0 : options.autoCompareWithLastVersion)) {
83984
83917
  compareWithVersion = (_a = this.components.infoHeader.dropdown.getLastVersion()) != null ? _a : void 0;
@@ -83990,20 +83923,21 @@ ${docStr}
83990
83923
  this.oldViewer.destroy();
83991
83924
  this.oldViewer = null;
83992
83925
  }
83993
- if (!this.versionList) {
83926
+ if (!this.versionList && !((_b = this.versionOptions) == null ? void 0 : _b.forceRequestVersionAsLatest)) {
83994
83927
  return;
83995
83928
  }
83996
- if (((_b = this.versionOptions) == null ? void 0 : _b.onWillChangeVersion) && !await this.versionOptions.onWillChangeVersion(this, version)) {
83929
+ if (((_c = this.versionOptions) == null ? void 0 : _c.onWillChangeVersion) && !await this.versionOptions.onWillChangeVersion(this, version)) {
83997
83930
  return;
83998
83931
  }
83999
83932
  this.renderEditorLoading();
84000
83933
  const from = compareWithVersion == null ? void 0 : compareWithVersion.version;
83934
+ const forceRequestVersionAsLatest = !!((_d = this.versionOptions) == null ? void 0 : _d.forceRequestVersionAsLatest);
84001
83935
  let docObject;
84002
83936
  let historyData;
84003
83937
  if (from) {
84004
- const start = Math.min(version.version, from);
84005
- const end = Math.max(version.version, from);
84006
- const ret = await this.versionHelper.getHistoryData(end, start);
83938
+ const requestVersion = forceRequestVersionAsLatest ? -1 : Math.max(version.version, from);
83939
+ const requestFrom = forceRequestVersionAsLatest ? from : Math.min(version.version, from);
83940
+ const ret = await this.versionHelper.getHistoryData(requestVersion, requestFrom);
84007
83941
  docObject = ret.doc;
84008
83942
  historyData = ret.historyData;
84009
83943
  } else {
@@ -84016,7 +83950,7 @@ ${docStr}
84016
83950
  const viewer = this.provider.createHistoryEditor(editorElement, historyDoc);
84017
83951
  viewer.editorBlockRenders.registerRender(new OnesEditorHistoryRender());
84018
83952
  viewer.editorBoxes.registerBoxClass(HistoryDeletedTextBox);
84019
- (_d = (_c = this.versionOptions) == null ? void 0 : _c.textRenders) == null ? void 0 : _d.forEach((render) => viewer.editorBlockRenders.registerRender(render));
83953
+ (_f = (_e = this.versionOptions) == null ? void 0 : _e.textRenders) == null ? void 0 : _f.forEach((render) => viewer.editorBlockRenders.registerRender(render));
84020
83954
  OnesEditorHistoryTooltip.register(viewer);
84021
83955
  addClass(viewer.rootElement, HistoryClass.HISTORY);
84022
83956
  try {
@@ -84024,7 +83958,7 @@ ${docStr}
84024
83958
  } finally {
84025
83959
  this.oldViewer = viewer;
84026
83960
  }
84027
- if ((_e = this.versionOptions) == null ? void 0 : _e.onVersionChanged) {
83961
+ if ((_g = this.versionOptions) == null ? void 0 : _g.onVersionChanged) {
84028
83962
  this.versionOptions.onVersionChanged(this, viewer, version);
84029
83963
  }
84030
83964
  });
@@ -84062,6 +83996,26 @@ ${docStr}
84062
83996
  get editor() {
84063
83997
  return this.oldViewer;
84064
83998
  }
83999
+ createVersionFromNum(versionNum) {
84000
+ if (versionNum === void 0 || versionNum === null) {
84001
+ return void 0;
84002
+ }
84003
+ let parsed;
84004
+ if (typeof versionNum === "string" && versionNum.startsWith("v")) {
84005
+ parsed = Number.parseInt(versionNum.substring(1), 10);
84006
+ } else {
84007
+ parsed = Number(versionNum);
84008
+ }
84009
+ if (Number.isNaN(parsed)) {
84010
+ return void 0;
84011
+ }
84012
+ return {
84013
+ version: parsed,
84014
+ created: parsed,
84015
+ versionIndex: 0,
84016
+ tagId: ""
84017
+ };
84018
+ }
84065
84019
  renderContent(versions) {
84066
84020
  var _a, _b, _c, _d, _e, _f;
84067
84021
  const { listContainer: versionsListContainer } = this.components;
@@ -84090,9 +84044,17 @@ ${docStr}
84090
84044
  this.versionList = versionList2;
84091
84045
  }
84092
84046
  initViewVersion() {
84093
- var _a, _b, _c;
84047
+ var _a, _b, _c, _d, _e, _f;
84048
+ if ((_a = this.versionOptions) == null ? void 0 : _a.forceRequestVersionAsLatest) {
84049
+ const initVersion = this.createVersionFromNum((_b = this.versionOptions) == null ? void 0 : _b.initSelectedVersion);
84050
+ if (initVersion) {
84051
+ const compareWithVersion2 = this.createVersionFromNum((_c = this.versionOptions) == null ? void 0 : _c.compareWith);
84052
+ this.viewVersion(initVersion, compareWithVersion2);
84053
+ }
84054
+ return;
84055
+ }
84094
84056
  let compareWithVersion;
84095
- if ((_a = this.versionOptions) == null ? void 0 : _a.compareWith) {
84057
+ if ((_d = this.versionOptions) == null ? void 0 : _d.compareWith) {
84096
84058
  compareWithVersion = this.versions.find((v) => {
84097
84059
  var _a2, _b2;
84098
84060
  if (v.version === ((_a2 = this.versionOptions) == null ? void 0 : _a2.compareWith)) {
@@ -84104,9 +84066,9 @@ ${docStr}
84104
84066
  return false;
84105
84067
  });
84106
84068
  }
84107
- const autoCompareWithLastVersion = (_b = this.versionOptions) == null ? void 0 : _b.autoCompareWithLastVersion;
84069
+ const autoCompareWithLastVersion = (_e = this.versionOptions) == null ? void 0 : _e.autoCompareWithLastVersion;
84108
84070
  assert(logger$y, this.versionList, "no versionList");
84109
- if ((_c = this.versionOptions) == null ? void 0 : _c.initSelectedVersion) {
84071
+ if ((_f = this.versionOptions) == null ? void 0 : _f.initSelectedVersion) {
84110
84072
  const { initSelectedVersion: versionNumber } = this.versionOptions;
84111
84073
  const version2 = this.versionList.selectVersionByVersionNum(versionNumber);
84112
84074
  if (version2) {
@@ -84141,11 +84103,17 @@ ${docStr}
84141
84103
  versionsListContainer.append(versionsListHeader, listLoading);
84142
84104
  }
84143
84105
  async show(options) {
84106
+ var _a, _b, _c, _d, _e;
84144
84107
  this.versionOptions = {
84145
84108
  ...this.versionOptions,
84146
84109
  ...options
84147
84110
  };
84148
84111
  const { root: root2 } = this.components;
84112
+ if ((_a = this.versionOptions) == null ? void 0 : _a.forceRequestVersionAsLatest) {
84113
+ addClass(root2, ForceLatestCompareClass);
84114
+ } else {
84115
+ removeClass(root2, ForceLatestCompareClass);
84116
+ }
84149
84117
  addClass(root2, "loading");
84150
84118
  this.renderListLoading();
84151
84119
  this.renderEditorLoading();
@@ -84153,6 +84121,20 @@ ${docStr}
84153
84121
  this.dialog = new Dialog$1(root2);
84154
84122
  }
84155
84123
  this.dialog.show(options.container);
84124
+ const skipVersionsFetch = !!((_b = this.versionOptions) == null ? void 0 : _b.forceRequestVersionAsLatest) && ((_c = this.versionOptions) == null ? void 0 : _c.initSelectedVersion) !== void 0 && ((_d = this.versionOptions) == null ? void 0 : _d.compareWith) !== void 0;
84125
+ if (skipVersionsFetch) {
84126
+ this.versions = [];
84127
+ (_e = this.versionList) == null ? void 0 : _e.destroy();
84128
+ this.versionList = null;
84129
+ this.components.listContainer.innerHTML = "";
84130
+ this.components.infoHeader.dropdown.setVersions([]);
84131
+ removeClass(this.components.root, "loading");
84132
+ if (this.versionOptions.onVersionsLoaded) {
84133
+ this.versionOptions.onVersionsLoaded(this, this.versions);
84134
+ }
84135
+ this.initViewVersion();
84136
+ return;
84137
+ }
84156
84138
  this.versions = await this.versionHelper.getVersions(options.showPublishedVersions);
84157
84139
  removeClass(this.components.root, "loading");
84158
84140
  if (this.versionOptions.onVersionsLoaded) {
@@ -88470,12 +88452,7 @@ ${data2.flowchartText}
88470
88452
  function getBlockProperties$3(editor, block) {
88471
88453
  const properties = getStandardEmbedBlockProperties(editor, block, {
88472
88454
  handleExecuteCommand: (editor2, block2, item) => {
88473
- var _a, _b;
88474
88455
  if (item.id === "edit") {
88475
- const drawioOptions = getDrawioOptions(editor2);
88476
- if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
88477
- return true;
88478
- }
88479
88456
  const data2 = editor2.getBlockData(block2).embedData;
88480
88457
  editGraph(editor2, block2, data2, false);
88481
88458
  return true;
@@ -88663,51 +88640,30 @@ ${data2.flowchartText}
88663
88640
  update(editor, embed, data2);
88664
88641
  return true;
88665
88642
  }
88666
- function getOptions$3(editor) {
88667
- var _a;
88668
- const drawioOptions = getDrawioOptions(editor);
88669
- const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
88670
- const element = suffixElem ? () => {
88671
- const root2 = createElement("div", ["uml-menu-item"], null);
88672
- const iconElem = createElement("div", ["menu-item-icon"], root2);
88673
- iconElem.innerHTML = UmlIcon;
88674
- createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
88675
- root2.appendChild(suffixElem);
88676
- return root2;
88677
- } : void 0;
88678
- const insertEmbedCommandItems = [];
88679
- if (drawioOptions.visible !== false) {
88680
- insertEmbedCommandItems.push({
88643
+ function getOptions$3() {
88644
+ return {
88645
+ name: "UML",
88646
+ insertEmbedCommandItems: [{
88681
88647
  id: "insert-drawio",
88682
88648
  name: i18n$1.t("drawio.title"),
88683
88649
  icon: UmlIcon,
88684
88650
  group: "common",
88685
88651
  order: 600,
88686
- subText: getShortcutById("insert-drawio"),
88687
- element,
88688
- useDefaultClickHandler: true
88689
- });
88690
- }
88691
- return {
88692
- name: "UML",
88693
- insertEmbedCommandItems,
88694
- handleInsertEmptyEmbed: async (editor2, options) => {
88695
- var _a2, _b;
88696
- if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
88697
- return null;
88698
- }
88652
+ subText: getShortcutById("insert-drawio")
88653
+ }],
88654
+ handleInsertEmptyEmbed: async (editor, options) => {
88699
88655
  const embedData = {
88700
88656
  src: "",
88701
88657
  xml: "",
88702
88658
  xmlSvg: ""
88703
88659
  };
88704
- const block = editor2.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
88660
+ const block = editor.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
88705
88661
  setTimeout(() => {
88706
88662
  const blockContent = getBlockContent(block);
88707
88663
  const embed = blockContent.querySelector(":scope > .editor-drawio-content");
88708
88664
  assert(logger$i, embed, "embed should not be null");
88709
- const blockData = editor2.getBlockData(block);
88710
- editDrawIO(editor2, block, embed, blockData.embedData);
88665
+ const blockData = editor.getBlockData(block);
88666
+ editDrawIO(editor, block, embed, blockData.embedData);
88711
88667
  }, 100);
88712
88668
  return block;
88713
88669
  }
@@ -96416,8 +96372,9 @@ ${JSON.stringify(error2, null, 2)}`);
96416
96372
  }
96417
96373
  const elem = node;
96418
96374
  const refId = elem.getAttribute("data-ref-id");
96375
+ const refType = elem.getAttribute("data-ref-type");
96419
96376
  const uuid = elem.getAttribute("data-uuid");
96420
- return Boolean(refId && uuid);
96377
+ return Boolean(refType === "task" && refId && uuid);
96421
96378
  },
96422
96379
  replacement: (content, node) => {
96423
96380
  const refType = node.getAttribute("data-ref-type");
@@ -96955,7 +96912,7 @@ ${JSON.stringify(error2, null, 2)}`);
96955
96912
  }
96956
96913
  }
96957
96914
  });
96958
- editor.version = "3.0.15-beta.1";
96915
+ editor.version = "3.0.16-beta.2";
96959
96916
  return editor;
96960
96917
  }
96961
96918
  function isDoc(doc2) {
@@ -97089,7 +97046,7 @@ ${JSON.stringify(error2, null, 2)}`);
97089
97046
  OnesEditorDropTarget.register(editor);
97090
97047
  OnesEditorTocProvider.register(editor);
97091
97048
  OnesEditorExclusiveBlock.register(editor);
97092
- editor.version = "3.0.15-beta.1";
97049
+ editor.version = "3.0.16-beta.2";
97093
97050
  return editor;
97094
97051
  }
97095
97052
  async function showDocVersions(editor, options, serverUrl) {
@@ -97156,77 +97113,6 @@ ${JSON.stringify(error2, null, 2)}`);
97156
97113
  dialog.show(dialogOptions);
97157
97114
  return dialog;
97158
97115
  }
97159
- async function createSimpleInput(root2, docData, options) {
97160
- var _a, _b, _c, _d, _e, _f, _g, _h;
97161
- assert(logger, root2, "app does not exists");
97162
- const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
97163
- serverUrl: options.serverUrl || ""
97164
- });
97165
- if (options.lang) {
97166
- i18n$1.setLang(options.lang);
97167
- }
97168
- Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
97169
- const editor = createEditor(root2, doc2, {
97170
- id: options.id,
97171
- scrollContainer: options == null ? void 0 : options.scrollContainer,
97172
- enableResolveComments: false,
97173
- enableComments: false,
97174
- dateTimeFormatter: options.dateTimeFormatter,
97175
- components: {
97176
- blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
97177
- commandProviders: [],
97178
- decorators: [],
97179
- embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
97180
- boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
97181
- insertions: [],
97182
- blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
97183
- textRenders: [
97184
- ...((_g = options.components) == null ? void 0 : _g.textRenders) || []
97185
- ].filter(Boolean),
97186
- options: { ...options.componentsOptions }
97187
- },
97188
- shortcuts: [TextStyleShortcuts, DefaultShortcuts]
97189
- });
97190
- if (options.compact) {
97191
- addClass(editor.rootElement, "compact");
97192
- if (options.headingButton === false)
97193
- addClass(editor.rootElement, "no-heading-collapse");
97194
- if (options.blockMenuButton === false)
97195
- addClass(editor.rootElement, "no-block-menu");
97196
- }
97197
- editor.input.addHandler(new MarkdownInputHandler({
97198
- disableHeadingShortcuts: true
97199
- }));
97200
- editor.input.addHandler(new OnesEditorPasteHandler(editor));
97201
- editor.input.addHandler(new ListPasteHandler());
97202
- editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
97203
- if (!clientType.isMobile) {
97204
- editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
97205
- }
97206
- editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
97207
- if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
97208
- const mentionOptions = options.componentsOptions.mention;
97209
- editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
97210
- }
97211
- if (options.autoNewLine) {
97212
- editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
97213
- }
97214
- editor.addListener("clickLink", (editor2, event, link2) => {
97215
- var _a2;
97216
- if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
97217
- options.events.onClickLink(editor2, event, link2);
97218
- return;
97219
- }
97220
- const href = link2.getAttribute("link") || link2.getAttribute("href");
97221
- if (href) {
97222
- if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
97223
- window.open(href, "_blank");
97224
- }
97225
- }
97226
- });
97227
- editor.version = "3.0.15-beta.1";
97228
- return editor;
97229
- }
97230
97116
  const emojis$1 = {
97231
97117
  smileysAndPeople: [
97232
97118
  "\u{1F600}",
@@ -143130,7 +143016,6 @@ ${JSON.stringify(error2, null, 2)}`);
143130
143016
  exports2.MathMenuIcon = MathMenuIcon;
143131
143017
  exports2.MaxUserError = MaxUserError;
143132
143018
  exports2.Mention2Icon = Mention2Icon;
143133
- exports2.MentionBox = MentionBox;
143134
143019
  exports2.MentionIcon = MentionIcon;
143135
143020
  exports2.MergeCellIcon = MergeCellIcon;
143136
143021
  exports2.Mindmap = Mindmap;
@@ -143143,14 +143028,12 @@ ${JSON.stringify(error2, null, 2)}`);
143143
143028
  exports2.MoreItem = MoreItem;
143144
143029
  exports2.NextIcon = NextIcon;
143145
143030
  exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
143146
- exports2.OnesEditorBlockMention = OnesEditorBlockMention;
143147
143031
  exports2.OnesEditorComments = OnesEditorComments;
143148
143032
  exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
143149
143033
  exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
143150
143034
  exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
143151
143035
  exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
143152
143036
  exports2.OnesEditorIcons = index$f;
143153
- exports2.OnesEditorMention = OnesEditorMention;
143154
143037
  exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
143155
143038
  exports2.OnesEditorToc = OnesEditorToc;
143156
143039
  exports2.OnesEditorTocProvider = OnesEditorTocProvider;
@@ -143348,7 +143231,6 @@ ${JSON.stringify(error2, null, 2)}`);
143348
143231
  exports2.createSeparator = createSeparator;
143349
143232
  exports2.createSimpleBlockPosition = createSimpleBlockPosition;
143350
143233
  exports2.createSimpleDocPos = createSimpleDocPos;
143351
- exports2.createSimpleInput = createSimpleInput;
143352
143234
  exports2.createTextBlockData = createTextBlockData;
143353
143235
  exports2.createTextButton = createTextButton;
143354
143236
  exports2.createTextOp = createTextOp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "3.0.15-beta.1",
3
+ "version": "3.0.16-beta.2",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {
@@ -1,3 +0,0 @@
1
- export interface MarkdownInputHandlerOptions {
2
- disableHeadingShortcuts?: boolean;
3
- }