@ones-editor/editor 1.0.7 → 1.0.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.
package/dist/index.js CHANGED
@@ -10035,6 +10035,14 @@ var __publicField = (obj, key, value) => {
10035
10035
  }
10036
10036
  return void 0;
10037
10037
  }
10038
+ function getResources$2(editor, data) {
10039
+ const embedType = data.embedType;
10040
+ const embedClass = editor.editorEmbeds.getEmbedClass(embedType);
10041
+ if (embedClass.getResources) {
10042
+ return embedClass.getResources(editor, data);
10043
+ }
10044
+ return [];
10045
+ }
10038
10046
  const EmbedBlock = {
10039
10047
  blockType: "embed",
10040
10048
  blockKind: "embed",
@@ -10053,7 +10061,8 @@ var __publicField = (obj, key, value) => {
10053
10061
  handleUpdateBlock: handleUpdateBlock$6,
10054
10062
  handleDropOver: handleDropOver$1,
10055
10063
  handleDrop: handleDrop$1,
10056
- toStandardDoc: toStandardDoc$1
10064
+ toStandardDoc: toStandardDoc$1,
10065
+ getResources: getResources$2
10057
10066
  };
10058
10067
  const logger$3N = getLogger("complex-block-helper");
10059
10068
  function complexBlockGetAllChildContainers(editor, block, options) {
@@ -25704,7 +25713,7 @@ var __publicField = (obj, key, value) => {
25704
25713
  });
25705
25714
  return true;
25706
25715
  }
25707
- function defaultGetResourceFromBlock(doc2, block, resources) {
25716
+ function defaultGetResourceFromBlock(editor, doc2, block, resources) {
25708
25717
  if (block.type === "embed") {
25709
25718
  const embedData = block.embedData;
25710
25719
  const src = embedData.src;
@@ -25720,7 +25729,18 @@ var __publicField = (obj, key, value) => {
25720
25729
  text2.forEach((op) => {
25721
25730
  if (op.attributes) {
25722
25731
  if (op.attributes.src && typeof op.attributes.src === "string") {
25723
- resources.add(op.attributes.src);
25732
+ if (isBoxOp(op)) {
25733
+ const boxClass = editor.editorBoxes.getBoxClass(op.attributes.type);
25734
+ if (boxClass.getResources) {
25735
+ boxClass.getResources(editor, op.attributes).forEach((resource) => {
25736
+ resources.add(resource);
25737
+ });
25738
+ } else {
25739
+ resources.add(op.attributes.src);
25740
+ }
25741
+ } else {
25742
+ resources.add(op.attributes.src);
25743
+ }
25724
25744
  }
25725
25745
  }
25726
25746
  });
@@ -25730,7 +25750,7 @@ var __publicField = (obj, key, value) => {
25730
25750
  children.forEach((childContainerId) => {
25731
25751
  const blocks = doc2.blocks[childContainerId];
25732
25752
  blocks.forEach((b) => {
25733
- defaultGetResourceFromBlock(doc2, b, resources);
25753
+ defaultGetResourceFromBlock(editor, doc2, b, resources);
25734
25754
  });
25735
25755
  });
25736
25756
  }
@@ -25741,11 +25761,11 @@ var __publicField = (obj, key, value) => {
25741
25761
  blocks.forEach((block) => {
25742
25762
  const blockClass = editor.editorBlocks.getBlockClass(block.type);
25743
25763
  if (blockClass.getResources) {
25744
- blockClass.getResources(block).forEach((resource) => {
25764
+ blockClass.getResources(editor, block).forEach((resource) => {
25745
25765
  resources.add(resource);
25746
25766
  });
25747
25767
  } else {
25748
- defaultGetResourceFromBlock(doc2, block, resources);
25768
+ defaultGetResourceFromBlock(editor, doc2, block, resources);
25749
25769
  }
25750
25770
  });
25751
25771
  return Array.from(resources);
@@ -61473,13 +61493,17 @@ ${codeText}
61473
61493
  }
61474
61494
  }];
61475
61495
  }
61496
+ function getResources$1() {
61497
+ return [];
61498
+ }
61476
61499
  const FileBox = {
61477
61500
  boxType: "file",
61478
61501
  updateBoxContent: updateBoxContent$2,
61479
61502
  handleClickBox: handleClickBox$1,
61480
61503
  getBoxProperties: getBoxProperties$1,
61481
61504
  convertTo: convertTo$a,
61482
- toStandardText
61505
+ toStandardText,
61506
+ getResources: getResources$1
61483
61507
  };
61484
61508
  const DwgFileIcon = '<svg width="48" height="48" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M12 1C13.5 2.5 14 3 16 5V15.6087C16 15.7914 15.9638 15.9723 15.8934 16.1411C15.8231 16.3099 15.7199 16.4633 15.5899 16.5925C15.4599 16.7217 15.3056 16.8242 15.1358 16.8941C14.9659 16.964 14.7838 17 14.6 17H3.4C3.21615 17 3.0341 16.964 2.86424 16.8941C2.69439 16.8242 2.54005 16.7217 2.41005 16.5925C2.28005 16.4633 2.17693 16.3099 2.10657 16.1411C2.03621 15.9723 2 15.7914 2 15.6087V2.3913C2 2.2086 2.03621 2.02768 2.10657 1.85888C2.17693 1.69007 2.28005 1.5367 2.41005 1.4075C2.54005 1.27831 2.69439 1.17583 2.86424 1.10591C3.0341 1.03599 3.21615 1 3.4 1H12Z" fill="#FFBE5A"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 7.5V11.1H8.7C9.69411 11.1 10.5 10.2941 10.5 9.3C10.5 8.30589 9.69411 7.5 8.7 7.5H7.5ZM7 6C6.44772 6 6 6.44771 6 7V11.6C6 12.1523 6.44772 12.6 7 12.6H8.7C10.5225 12.6 12 11.1225 12 9.3C12 7.47746 10.5225 6 8.7 6H7Z" fill="white"/>\n<path d="M12 1L14 3L16 5H13.3333C12.9797 5 12.6406 4.84675 12.3905 4.57397C12.1405 4.30119 12 3.93122 12 3.54546V1Z" fill="#FFD89C"/>\n</svg>';
61485
61509
  const RvtFileIcon = '<svg width="48" height="48" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M12 1C13.5 2.5 14 3 16 5V15.6087C16 15.7914 15.9638 15.9723 15.8934 16.1411C15.8231 16.3099 15.7199 16.4633 15.5899 16.5925C15.4599 16.7217 15.3056 16.8242 15.1358 16.8941C14.9659 16.964 14.7838 17 14.6 17H3.4C3.21615 17 3.0341 16.964 2.86424 16.8941C2.69439 16.8242 2.54005 16.7217 2.41005 16.5925C2.28005 16.4633 2.17693 16.3099 2.10657 16.1411C2.03621 15.9723 2 15.7914 2 15.6087V2.3913C2 2.2086 2.03621 2.02768 2.10657 1.85888C2.17693 1.69007 2.28005 1.5367 2.41005 1.4075C2.54005 1.27831 2.69439 1.17583 2.86424 1.10591C3.0341 1.03599 3.21615 1 3.4 1H12Z" fill="#6B77F3"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M7.5 6.90039V8.70039H9.6C10.0971 8.70039 10.5 8.29745 10.5 7.80039C10.5 7.30333 10.0971 6.90039 9.6 6.90039H7.5ZM7 5.40039C6.44772 5.40039 6 5.84811 6 6.40039V7.0504V9.20039V12.1504C6 12.3989 6.20147 12.6004 6.45 12.6004C6.69853 12.6004 6.9 12.3989 6.9 12.1504V10.1955C6.93289 10.1987 6.96625 10.2004 7 10.2004H9.6C9.6944 10.2004 9.78753 10.1949 9.87909 10.1843L11.1521 12.3892C11.2764 12.6045 11.5516 12.6782 11.7668 12.554C11.982 12.4297 12.0558 12.1545 11.9315 11.9392L10.7564 9.90392C11.4977 9.4955 12 8.7066 12 7.80039C12 6.47491 10.9255 5.40039 9.6 5.40039H7Z" fill="white"/>\n<path d="M12 1L14 3L16 5H13.3333C12.9797 5 12.6406 4.84675 12.3905 4.57397C12.1405 4.30119 12 3.93122 12 3.54546V1Z" fill="#B5BBF9"/>\n</svg>';
@@ -61737,12 +61761,16 @@ ${codeText}
61737
61761
  comments: {}
61738
61762
  };
61739
61763
  }
61764
+ function getResources() {
61765
+ return [];
61766
+ }
61740
61767
  const FileEmbed = {
61741
61768
  embedType: "office",
61742
61769
  createEmbedContent: createEmbedContent$7,
61743
61770
  getBlockProperties: getBlockProperties$6,
61744
61771
  convertTo: convertTo$9,
61745
- toStandardDoc
61772
+ toStandardDoc,
61773
+ getResources
61746
61774
  };
61747
61775
  const zhCN$b = {
61748
61776
  file: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",