@ones-editor/editor 2.6.4 → 2.6.6

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
@@ -27182,6 +27182,7 @@ var __publicField = (obj, key, value) => {
27182
27182
  }
27183
27183
  const logger$3z = getLogger("insert-doc");
27184
27184
  function editorInsertDoc(editor, block, offset, insertedDoc, cloneDocResult) {
27185
+ var _a;
27185
27186
  if (isComplexKindBlock(editor, block)) {
27186
27187
  logger$3z.warn("failed to insert doc into a complex block");
27187
27188
  return;
@@ -27190,9 +27191,13 @@ var __publicField = (obj, key, value) => {
27190
27191
  const container = getParentContainer(block);
27191
27192
  const blockIndex = getBlockIndex(block);
27192
27193
  const containerId = getContainerId(container);
27194
+ if (doc2.blocks.root.length === 1 && isTextKindBlockType(editor, doc2.blocks.root[0].type)) {
27195
+ editor.insertTextToBlock(block, offset, (_a = doc2.blocks.root[0].text) != null ? _a : []);
27196
+ return;
27197
+ }
27193
27198
  editor.doc.beginBatchUpdate();
27194
27199
  editor.undoManager.runInGroup(() => {
27195
- var _a, _b, _c;
27200
+ var _a2, _b, _c;
27196
27201
  const childContainers = [];
27197
27202
  Object.entries(doc2.blocks).forEach(([containerId2, blocks2]) => {
27198
27203
  if (containerId2 === "root")
@@ -27257,7 +27262,7 @@ var __publicField = (obj, key, value) => {
27257
27262
  if (blocks.length === 1) {
27258
27263
  const newBlock2 = blocks[0];
27259
27264
  if (isTextKindBlockType(editor, newBlock2.type)) {
27260
- editor.insertTextToBlock(block, offset, (_a = newBlock2.text) != null ? _a : []);
27265
+ editor.insertTextToBlock(block, offset, (_a2 = newBlock2.text) != null ? _a2 : []);
27261
27266
  return;
27262
27267
  }
27263
27268
  editor.breakTextBlock(block, offset);
@@ -85495,6 +85500,9 @@ ${data2.flowchartText}
85495
85500
  async function plantumlUrlToResourceId(editor, url) {
85496
85501
  try {
85497
85502
  const plantumlImgFile = await downloadObjectToFile(editor, url);
85503
+ if (!plantumlImgFile) {
85504
+ return await Promise.resolve(url);
85505
+ }
85498
85506
  const uploadResourceResult = await editor.doc.uploadResource(plantumlImgFile);
85499
85507
  return uploadResourceResult.resourceId;
85500
85508
  } catch (error2) {
@@ -90803,9 +90811,6 @@ ${data2.plantumlText}
90803
90811
  return void 0;
90804
90812
  }
90805
90813
  function hasBorder(block) {
90806
- if (block.type === "embed" && block.embedType && embedTypeHasImage(block.embedType) && block.embedData && block.embedData.src) {
90807
- return true;
90808
- }
90809
90814
  return false;
90810
90815
  }
90811
90816
  async function getBlockObject(block, md5Func, textsByBox) {
@@ -90818,7 +90823,7 @@ ${data2.plantumlText}
90818
90823
  texts: await getBlockTextObjects(block, textsByBox),
90819
90824
  list: getBlockListObject(block),
90820
90825
  images: getBlockImageObject(block, md5Func),
90821
- border: hasBorder(block)
90826
+ border: hasBorder()
90822
90827
  };
90823
90828
  }
90824
90829
  async function getCodeObject(block, data2, md5Func, textsByBox) {
@@ -92473,7 +92478,7 @@ ${data2.plantumlText}
92473
92478
  }
92474
92479
  }
92475
92480
  });
92476
- editor.version = "2.6.4";
92481
+ editor.version = "2.6.6";
92477
92482
  return editor;
92478
92483
  }
92479
92484
  function isDoc(doc2) {
@@ -92586,7 +92591,7 @@ ${data2.plantumlText}
92586
92591
  }
92587
92592
  });
92588
92593
  OnesEditorToolbar.register(editor);
92589
- editor.version = "2.6.4";
92594
+ editor.version = "2.6.6";
92590
92595
  return editor;
92591
92596
  }
92592
92597
  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.6.4",
3
+ "version": "2.6.6",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {