@ones-editor/editor 2.8.2 → 2.8.5-beta.1

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
@@ -334,12 +334,12 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
334
334
  div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.hover .embed-hover-content {
335
335
  outline: 1px solid #0064ff;
336
336
  }
337
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected > div[data-type=block-content],
338
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content {
337
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) > div[data-type=block-content],
338
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) .embed-selected-content {
339
339
  position: relative;
340
340
  }
341
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected > div[data-type=block-content]::before,
342
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected .embed-selected-content::before {
341
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) > div[data-type=block-content]::before,
342
+ div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block].embed-block.selected:not(.no-mask) .embed-selected-content::before {
343
343
  content: " ";
344
344
  position: absolute;
345
345
  left: 0;
@@ -91012,7 +91012,7 @@ ${data2.plantumlText}
91012
91012
  updateMatrixByStripe(block, rows, cols, matrix);
91013
91013
  return matrix;
91014
91014
  }
91015
- async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth) {
91015
+ async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth, options) {
91016
91016
  async function convertBlock(block) {
91017
91017
  if (getDocByBlock2 && block.type !== "_exportVirtualBlock") {
91018
91018
  const embedDoc = await getDocByBlock2(appId, docId, block);
@@ -91041,8 +91041,12 @@ ${data2.plantumlText}
91041
91041
  const embedData = embedBlock.embedData;
91042
91042
  const embedType = embedBlock.embedType;
91043
91043
  if (embedTypeHasImage(embedType)) {
91044
- const blockObj = await getBlockObject(block, md5HexFunc, getTextsByBox);
91045
- await dbg.addImagesBlockObject(block, blockObj, maxWidth);
91044
+ try {
91045
+ const blockObj = await getBlockObject(block, md5HexFunc, getTextsByBox);
91046
+ await dbg.addImagesBlockObject(block, blockObj, maxWidth);
91047
+ } catch (err) {
91048
+ console.error(err.message);
91049
+ }
91046
91050
  } else if (block.embedType === "hr") {
91047
91051
  dbg.addSeparatorBlock();
91048
91052
  } else if (block.embedType === "video") {
@@ -91089,6 +91093,28 @@ ${data2.plantumlText}
91089
91093
  return [block];
91090
91094
  const finalizeBlocks = [];
91091
91095
  for (const { type: specType, data: specData } of exportSpec) {
91096
+ if (specType === "block-link" || specType === "page-link") {
91097
+ const buildLink = options == null ? void 0 : options.buildLink;
91098
+ if (buildLink) {
91099
+ const link2 = buildLink(block, specType);
91100
+ if (link2 && link2.link) {
91101
+ const url = link2.link;
91102
+ const title = link2.title || link2.link;
91103
+ const webpageBlock = {
91104
+ id: genId(),
91105
+ type: "text",
91106
+ text: [{
91107
+ insert: title,
91108
+ attributes: {
91109
+ link: url
91110
+ }
91111
+ }]
91112
+ };
91113
+ finalizeBlocks.push(webpageBlock);
91114
+ continue;
91115
+ }
91116
+ }
91117
+ }
91092
91118
  if (specType === "text") {
91093
91119
  const textBlock = {
91094
91120
  id: genId(),
@@ -91429,10 +91455,10 @@ ${data2.plantumlText}
91429
91455
  }
91430
91456
  }
91431
91457
  class ToDocX {
91432
- constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions) {
91458
+ constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions, options) {
91433
91459
  __publicField(this, "convertBlocks", async (parent, blocks, data2, appId, docId, state, maxWidth = 720) => {
91434
91460
  const dbg = new DocXBlocksGenerator(appId, docId, state, this.readImage, this.convertBlocks, this.defaultFontSize);
91435
- await convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, this.md5HexFunc, this.getDocByBlock, this.getTextsByBox, maxWidth || 720);
91461
+ await convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, this.md5HexFunc, this.getDocByBlock, this.getTextsByBox, maxWidth || 720, this.options);
91436
91462
  return dbg.paragraphs;
91437
91463
  });
91438
91464
  this.templateData = templateData;
@@ -91443,6 +91469,7 @@ ${data2.plantumlText}
91443
91469
  this.getDocByBlock = getDocByBlock2;
91444
91470
  this.getTextsByBox = getTextsByBox;
91445
91471
  this.backgroundImageOptions = backgroundImageOptions;
91472
+ this.options = options;
91446
91473
  }
91447
91474
  async convert(appId, docId) {
91448
91475
  return this.snapshot2docx(this.docData, appId, docId);
@@ -91555,7 +91582,7 @@ ${data2.plantumlText}
91555
91582
  const _readImage = (_appId, _docId, _src) => readImage(editor, _appId, _docId, _src);
91556
91583
  const _getDocByBlock = async (_appId, _docId, block) => getDocByBlock(editor, doc2, block);
91557
91584
  const _getTextByBox = async (boxText) => getTextByBox(editor, boxText);
91558
- const toDocx = new ToDocX(template, doc2, md5__default.default, _readImage, void 0, _getDocByBlock, _getTextByBox, backgroundImageOptions);
91585
+ const toDocx = new ToDocX(template, doc2, md5__default.default, _readImage, void 0, _getDocByBlock, _getTextByBox, backgroundImageOptions, options);
91559
91586
  const buffer = await toDocx.convert("_appId", "_docId");
91560
91587
  if (download) {
91561
91588
  const downloadUrl = URL.createObjectURL(buffer);
@@ -92546,7 +92573,7 @@ ${data2.plantumlText}
92546
92573
  }
92547
92574
  }
92548
92575
  });
92549
- editor.version = "2.8.2";
92576
+ editor.version = "2.8.5-beta.1";
92550
92577
  return editor;
92551
92578
  }
92552
92579
  function isDoc(doc2) {
@@ -92659,7 +92686,7 @@ ${data2.plantumlText}
92659
92686
  }
92660
92687
  });
92661
92688
  OnesEditorToolbar.register(editor);
92662
- editor.version = "2.8.2";
92689
+ editor.version = "2.8.5-beta.1";
92663
92690
  return editor;
92664
92691
  }
92665
92692
  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.8.2",
3
+ "version": "2.8.5-beta.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {