@ones-editor/editor 2.8.6 → 2.8.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
@@ -53814,7 +53814,13 @@ ${codeText}
53814
53814
  this._lastClickTime = Date.now();
53815
53815
  });
53816
53816
  __publicField(this, "handleClose", () => {
53817
+ var _a;
53817
53818
  if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
53819
+ const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
53820
+ if (activeElement && isInBlockTools(activeElement)) {
53821
+ logger$1X.debug("focus is in block tools, ignore focus");
53822
+ return;
53823
+ }
53818
53824
  this.editor.focus({
53819
53825
  preventScroll: true
53820
53826
  });
@@ -84348,8 +84354,8 @@ ${docStr}
84348
84354
  command: {
84349
84355
  name: "\u30C0\u30A4\u30A2\u30B0\u30E9\u30E0",
84350
84356
  bothShow: "\u30B3\u30FC\u30C9\u3068\u30C0\u30A4\u30A2\u30B0\u30E9\u30E0\u3092\u8868\u793A",
84351
- codeShow: "\u30C0\u30A4\u30A2\u30B0\u30E9\u30E0\u306E\u307F\u8868\u793A",
84352
- drawShow: "\u30B3\u30FC\u30C9\u306E\u307F\u8868\u793A"
84357
+ codeShow: "\u30B3\u30FC\u30C9\u306E\u307F\u8868\u793A",
84358
+ drawShow: "\u30C0\u30A4\u30A2\u30B0\u30E9\u30E0\u306E\u307F\u8868\u793A"
84353
84359
  }
84354
84360
  }
84355
84361
  };
@@ -91012,7 +91018,7 @@ ${data2.plantumlText}
91012
91018
  updateMatrixByStripe(block, rows, cols, matrix);
91013
91019
  return matrix;
91014
91020
  }
91015
- async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth) {
91021
+ async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth, options) {
91016
91022
  async function convertBlock(block) {
91017
91023
  if (getDocByBlock2 && block.type !== "_exportVirtualBlock") {
91018
91024
  const embedDoc = await getDocByBlock2(appId, docId, block);
@@ -91093,6 +91099,28 @@ ${data2.plantumlText}
91093
91099
  return [block];
91094
91100
  const finalizeBlocks = [];
91095
91101
  for (const { type: specType, data: specData } of exportSpec) {
91102
+ if (specType === "block-link" || specType === "page-link") {
91103
+ const buildLink = options == null ? void 0 : options.buildLink;
91104
+ if (buildLink) {
91105
+ const link2 = buildLink(block, specType);
91106
+ if (link2 && link2.link) {
91107
+ const url = link2.link;
91108
+ const title = link2.title || link2.link;
91109
+ const webpageBlock = {
91110
+ id: genId(),
91111
+ type: "text",
91112
+ text: [{
91113
+ insert: title,
91114
+ attributes: {
91115
+ link: url
91116
+ }
91117
+ }]
91118
+ };
91119
+ finalizeBlocks.push(webpageBlock);
91120
+ continue;
91121
+ }
91122
+ }
91123
+ }
91096
91124
  if (specType === "text") {
91097
91125
  const textBlock = {
91098
91126
  id: genId(),
@@ -91433,10 +91461,10 @@ ${data2.plantumlText}
91433
91461
  }
91434
91462
  }
91435
91463
  class ToDocX {
91436
- constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions) {
91464
+ constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions, options) {
91437
91465
  __publicField(this, "convertBlocks", async (parent, blocks, data2, appId, docId, state, maxWidth = 720) => {
91438
91466
  const dbg = new DocXBlocksGenerator(appId, docId, state, this.readImage, this.convertBlocks, this.defaultFontSize);
91439
- await convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, this.md5HexFunc, this.getDocByBlock, this.getTextsByBox, maxWidth || 720);
91467
+ await convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, this.md5HexFunc, this.getDocByBlock, this.getTextsByBox, maxWidth || 720, this.options);
91440
91468
  return dbg.paragraphs;
91441
91469
  });
91442
91470
  this.templateData = templateData;
@@ -91447,6 +91475,7 @@ ${data2.plantumlText}
91447
91475
  this.getDocByBlock = getDocByBlock2;
91448
91476
  this.getTextsByBox = getTextsByBox;
91449
91477
  this.backgroundImageOptions = backgroundImageOptions;
91478
+ this.options = options;
91450
91479
  }
91451
91480
  async convert(appId, docId) {
91452
91481
  return this.snapshot2docx(this.docData, appId, docId);
@@ -91559,7 +91588,7 @@ ${data2.plantumlText}
91559
91588
  const _readImage = (_appId, _docId, _src) => readImage(editor, _appId, _docId, _src);
91560
91589
  const _getDocByBlock = async (_appId, _docId, block) => getDocByBlock(editor, doc2, block);
91561
91590
  const _getTextByBox = async (boxText) => getTextByBox(editor, boxText);
91562
- const toDocx = new ToDocX(template, doc2, md5__default.default, _readImage, void 0, _getDocByBlock, _getTextByBox, backgroundImageOptions);
91591
+ const toDocx = new ToDocX(template, doc2, md5__default.default, _readImage, void 0, _getDocByBlock, _getTextByBox, backgroundImageOptions, options);
91563
91592
  const buffer = await toDocx.convert("_appId", "_docId");
91564
91593
  if (download) {
91565
91594
  const downloadUrl = URL.createObjectURL(buffer);
@@ -92550,7 +92579,7 @@ ${data2.plantumlText}
92550
92579
  }
92551
92580
  }
92552
92581
  });
92553
- editor.version = "2.8.6";
92582
+ editor.version = "2.8.8";
92554
92583
  return editor;
92555
92584
  }
92556
92585
  function isDoc(doc2) {
@@ -92663,7 +92692,7 @@ ${data2.plantumlText}
92663
92692
  }
92664
92693
  });
92665
92694
  OnesEditorToolbar.register(editor);
92666
- editor.version = "2.8.6";
92695
+ editor.version = "2.8.8";
92667
92696
  return editor;
92668
92697
  }
92669
92698
  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.6",
3
+ "version": "2.8.8",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "dependencies": {