@ones-editor/editor 1.1.18-beta.6 → 1.1.18-beta.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
@@ -28276,12 +28276,13 @@ ${codeText}
28276
28276
  const defaultRange = { anchor: defaultPos, focus: defaultPos };
28277
28277
  return editorInsertBlock(this, containerId, blockIndex, blockData, newRange != null ? newRange : defaultRange, options);
28278
28278
  }
28279
- insertEmbed(containerId, blockIndex, embedType, embedData, newRange) {
28279
+ insertEmbed(containerId, blockIndex, embedType, embedData, newRange, attributes) {
28280
28280
  const blockData = {
28281
28281
  id: genId(),
28282
28282
  type: "embed",
28283
28283
  embedType,
28284
- embedData
28284
+ embedData,
28285
+ ...attributes
28285
28286
  };
28286
28287
  return this.insertBlock(containerId, blockIndex, blockData, newRange);
28287
28288
  }
@@ -28359,8 +28360,8 @@ ${codeText}
28359
28360
  clearSelectedContents() {
28360
28361
  editorClearSelectedContents(this);
28361
28362
  }
28362
- insertTextBlock(text2, containerId, blockIndex, options) {
28363
- const blockData = createTextBlockData(text2 != null ? text2 : "");
28363
+ insertTextBlock(text2, containerId, blockIndex, options, attributes) {
28364
+ const blockData = createTextBlockData(text2 != null ? text2 : "", attributes);
28364
28365
  return editorAutoInsertBlock(this, blockData, containerId, blockIndex, options == null ? void 0 : options.newRange, options == null ? void 0 : options.insertBlockOptions);
28365
28366
  }
28366
28367
  updateCompositionText(text2, end) {
@@ -41282,6 +41283,10 @@ ${codeText}
41282
41283
  }
41283
41284
  }
41284
41285
  }
41286
+ function getContainerTextContent(container) {
41287
+ var _a;
41288
+ return (_a = container.textContent) != null ? _a : "";
41289
+ }
41285
41290
  async function updateTableChart(editor, block) {
41286
41291
  if (!editor.contains(block)) {
41287
41292
  return;
@@ -41298,21 +41303,22 @@ ${codeText}
41298
41303
  const datasets = [];
41299
41304
  const grid = TableGrid.fromBlock(block);
41300
41305
  const chartTypes = ["line", "bar", "pie", "radar"];
41301
- let type = grid.getCell({ row: 0, col: 0 }).container.innerText.trim().toLowerCase();
41306
+ const typeContainer = grid.getCell({ row: 0, col: 0 }).container;
41307
+ let type = getContainerTextContent(typeContainer).trim().toLowerCase();
41302
41308
  if (!new Set(chartTypes).has(type)) {
41303
41309
  type = chartTypes[0];
41304
41310
  }
41305
41311
  const labels = [];
41306
41312
  for (let col = 1; col < grid.colCount; col++) {
41307
- labels.push(grid.getCell({ row: 0, col }).container.innerText);
41313
+ labels.push(getContainerTextContent(grid.getCell({ row: 0, col }).container));
41308
41314
  }
41309
41315
  for (let row = 1; row < grid.rowCount; row++) {
41310
41316
  const firstCellData = grid.getCell({ row, col: 0 });
41311
41317
  const firstContainer = firstCellData.container;
41312
- const label = firstContainer.innerText;
41318
+ const label = getContainerTextContent(firstContainer);
41313
41319
  const data = [];
41314
41320
  for (let col = 1; col < grid.colCount; col++) {
41315
- const text2 = grid.getCell({ row, col }).container.innerText;
41321
+ const text2 = getContainerTextContent(grid.getCell({ row, col }).container);
41316
41322
  const number = Number.parseFloat(text2) || 0;
41317
41323
  data.push(number);
41318
41324
  }
@@ -68758,6 +68764,11 @@ ${codeText}
68758
68764
  const containerId = getContainerId(container);
68759
68765
  const blockIndex = getBlockIndex(block) + 1;
68760
68766
  const boxData = editor.getBoxData(box);
68767
+ const blockData = editor.getBlockData(block);
68768
+ const existComments = blockData.comments;
68769
+ const blockAttributes = Array.isArray(existComments) && existComments.length > 0 ? {
68770
+ comments: existComments
68771
+ } : {};
68761
68772
  const offset = getChildOffset(block, box);
68762
68773
  editor.undoManager.runInGroup(() => {
68763
68774
  const embedData = {
@@ -68770,21 +68781,21 @@ ${codeText}
68770
68781
  if (offset.start === 0) {
68771
68782
  if (getBlockTextLength$4(editor, block) === 1) {
68772
68783
  editor.deleteBlock(block);
68773
- editor.insertEmbed(containerId, blockIndex - 1, "office", embedData);
68784
+ editor.insertEmbed(containerId, blockIndex - 1, "office", embedData, void 0, blockAttributes);
68774
68785
  } else {
68775
68786
  editor.deleteTextFromBlock(block, offset.start, 1);
68776
- editor.insertEmbed(containerId, blockIndex - 1, "office", embedData);
68787
+ editor.insertEmbed(containerId, blockIndex - 1, "office", embedData, void 0, blockAttributes);
68777
68788
  }
68778
68789
  } else {
68779
68790
  if (offset.start === getBlockTextLength$4(editor, block) - 1) {
68780
68791
  editor.deleteTextFromBlock(block, offset.start, 1);
68781
- editor.insertEmbed(containerId, blockIndex, "office", embedData);
68792
+ editor.insertEmbed(containerId, blockIndex, "office", embedData, void 0, blockAttributes);
68782
68793
  } else {
68783
68794
  editor.deleteTextFromBlock(block, offset.start, 1);
68784
68795
  editorBreakTextBlock(editor, block, offset.start, {
68785
68796
  forceInsertAfter: true
68786
68797
  });
68787
- editor.insertEmbed(containerId, blockIndex, "office", embedData);
68798
+ editor.insertEmbed(containerId, blockIndex, "office", embedData, void 0, blockAttributes);
68788
68799
  }
68789
68800
  }
68790
68801
  });
@@ -69049,10 +69060,14 @@ ${codeText}
69049
69060
  fileSize: fileData.fileSize,
69050
69061
  fileType: fileData.fileType
69051
69062
  };
69063
+ const existComments = blockData.comments;
69064
+ const blockAttributes = Array.isArray(existComments) && existComments.length > 0 ? {
69065
+ comments: existComments
69066
+ } : {};
69052
69067
  editor.undoManager.runInGroup(() => {
69053
69068
  editor.deleteBlock(block);
69054
69069
  const newBlockText = [createBoxOp(boxData)];
69055
- editor.insertTextBlock(newBlockText, containerId, blockIndex);
69070
+ editor.insertTextBlock(newBlockText, containerId, blockIndex, void 0, blockAttributes);
69056
69071
  });
69057
69072
  } else if (item.id === "download") {
69058
69073
  downloadFile(editor, block);
@@ -77124,7 +77139,7 @@ ${data.flowchartText}
77124
77139
  }
77125
77140
  }
77126
77141
  });
77127
- editor.version = "1.1.18-beta.6";
77142
+ editor.version = "1.1.18-beta.7";
77128
77143
  if (Logger$2.level === LogLevel.DEBUG) {
77129
77144
  window.setReauthFail = (fail) => {
77130
77145
  window.isReauthError = fail;
@@ -77212,7 +77227,7 @@ ${data.flowchartText}
77212
77227
  });
77213
77228
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
77214
77229
  OnesEditorToolbar.register(editor);
77215
- editor.version = "1.1.18-beta.6";
77230
+ editor.version = "1.1.18-beta.7";
77216
77231
  return editor;
77217
77232
  }
77218
77233
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.18-beta.6",
3
+ "version": "1.1.18-beta.7",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",