@ones-editor/editor 2.8.6 → 2.8.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/@ones-editor/to-docx/src/doc2other/core.d.ts +3 -1
- package/@ones-editor/to-docx/src/index.d.ts +2 -6
- package/@ones-editor/to-docx/src/to-docx.d.ts +3 -1
- package/@ones-editor/to-docx/src/types.d.ts +11 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +29 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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);
|
|
@@ -91093,6 +91093,28 @@ ${data2.plantumlText}
|
|
|
91093
91093
|
return [block];
|
|
91094
91094
|
const finalizeBlocks = [];
|
|
91095
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
|
+
}
|
|
91096
91118
|
if (specType === "text") {
|
|
91097
91119
|
const textBlock = {
|
|
91098
91120
|
id: genId(),
|
|
@@ -91433,10 +91455,10 @@ ${data2.plantumlText}
|
|
|
91433
91455
|
}
|
|
91434
91456
|
}
|
|
91435
91457
|
class ToDocX {
|
|
91436
|
-
constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions) {
|
|
91458
|
+
constructor(templateData, docData, md5HexFunc, readImage2, defaultFontSize, getDocByBlock2, getTextsByBox, backgroundImageOptions, options) {
|
|
91437
91459
|
__publicField(this, "convertBlocks", async (parent, blocks, data2, appId, docId, state, maxWidth = 720) => {
|
|
91438
91460
|
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);
|
|
91461
|
+
await convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, this.md5HexFunc, this.getDocByBlock, this.getTextsByBox, maxWidth || 720, this.options);
|
|
91440
91462
|
return dbg.paragraphs;
|
|
91441
91463
|
});
|
|
91442
91464
|
this.templateData = templateData;
|
|
@@ -91447,6 +91469,7 @@ ${data2.plantumlText}
|
|
|
91447
91469
|
this.getDocByBlock = getDocByBlock2;
|
|
91448
91470
|
this.getTextsByBox = getTextsByBox;
|
|
91449
91471
|
this.backgroundImageOptions = backgroundImageOptions;
|
|
91472
|
+
this.options = options;
|
|
91450
91473
|
}
|
|
91451
91474
|
async convert(appId, docId) {
|
|
91452
91475
|
return this.snapshot2docx(this.docData, appId, docId);
|
|
@@ -91559,7 +91582,7 @@ ${data2.plantumlText}
|
|
|
91559
91582
|
const _readImage = (_appId, _docId, _src) => readImage(editor, _appId, _docId, _src);
|
|
91560
91583
|
const _getDocByBlock = async (_appId, _docId, block) => getDocByBlock(editor, doc2, block);
|
|
91561
91584
|
const _getTextByBox = async (boxText) => getTextByBox(editor, boxText);
|
|
91562
|
-
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);
|
|
91563
91586
|
const buffer = await toDocx.convert("_appId", "_docId");
|
|
91564
91587
|
if (download) {
|
|
91565
91588
|
const downloadUrl = URL.createObjectURL(buffer);
|
|
@@ -92550,7 +92573,7 @@ ${data2.plantumlText}
|
|
|
92550
92573
|
}
|
|
92551
92574
|
}
|
|
92552
92575
|
});
|
|
92553
|
-
editor.version = "2.8.
|
|
92576
|
+
editor.version = "2.8.7";
|
|
92554
92577
|
return editor;
|
|
92555
92578
|
}
|
|
92556
92579
|
function isDoc(doc2) {
|
|
@@ -92663,7 +92686,7 @@ ${data2.plantumlText}
|
|
|
92663
92686
|
}
|
|
92664
92687
|
});
|
|
92665
92688
|
OnesEditorToolbar.register(editor);
|
|
92666
|
-
editor.version = "2.8.
|
|
92689
|
+
editor.version = "2.8.7";
|
|
92667
92690
|
return editor;
|
|
92668
92691
|
}
|
|
92669
92692
|
async function showDocVersions(editor, options, serverUrl) {
|