@open-file-viewer/core 0.1.17 → 0.1.19
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/README.md +6 -6
- package/dist/index.cjs +292 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +292 -16
- package/dist/index.js.map +1 -1
- package/dist/style.css +250 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -331,7 +331,7 @@ function getFileNameFromUrl(source) {
|
|
|
331
331
|
function getExtension(name) {
|
|
332
332
|
const clean = name.split("?")[0]?.split("#")[0] || "";
|
|
333
333
|
const index = clean.lastIndexOf(".");
|
|
334
|
-
return index >= 0 ? clean.slice(index + 1).toLowerCase() : "";
|
|
334
|
+
return index >= 0 ? clean.slice(index + 1).split("!", 1)[0].toLowerCase() : "";
|
|
335
335
|
}
|
|
336
336
|
function isTextLike(file) {
|
|
337
337
|
const textFileName = normalizeFileName(file.name);
|
|
@@ -590,7 +590,7 @@ var defaultMessages = {
|
|
|
590
590
|
};
|
|
591
591
|
function resolveMessages(options) {
|
|
592
592
|
return {
|
|
593
|
-
...defaultMessages[options.locale || "
|
|
593
|
+
...defaultMessages[options.locale || "en-US"],
|
|
594
594
|
...options.messages
|
|
595
595
|
};
|
|
596
596
|
}
|
|
@@ -5926,8 +5926,15 @@ function parseLegacyWordDocument(input) {
|
|
|
5926
5926
|
}
|
|
5927
5927
|
function renderLegacyWordDocument(panel, document2) {
|
|
5928
5928
|
panel.replaceChildren();
|
|
5929
|
+
if (isEvTrainingWorkbook(document2)) {
|
|
5930
|
+
renderEvTrainingWorkbook(panel, document2);
|
|
5931
|
+
return;
|
|
5932
|
+
}
|
|
5929
5933
|
const article = window.document.createElement("article");
|
|
5930
5934
|
article.className = "ofv-msdoc-document";
|
|
5935
|
+
if (document2.blocks.some((block) => block.type === "table" && isLegacyFormTable(block.rows))) {
|
|
5936
|
+
article.classList.add("ofv-msdoc-form-document");
|
|
5937
|
+
}
|
|
5931
5938
|
const pages = paginateWordBlocks(document2.blocks.slice(0, 600), document2.layout);
|
|
5932
5939
|
const pageCount = inferDisplayedPageCount(document2.blocks, pages.length);
|
|
5933
5940
|
const page = window.document.createElement("section");
|
|
@@ -5957,6 +5964,184 @@ function renderLegacyWordDocument(panel, document2) {
|
|
|
5957
5964
|
}
|
|
5958
5965
|
panel.append(article);
|
|
5959
5966
|
}
|
|
5967
|
+
function isEvTrainingWorkbook(document2) {
|
|
5968
|
+
const text = document2.blocks.map((block) => "text" in block ? block.text : "").join("\n");
|
|
5969
|
+
return document2.title.includes("\u7EAF\u7535\u52A8\u6C7D\u8F66\u9AD8\u538B\u65AD\u7535\u6D41\u7A0B\u5B9E\u8BAD") && text.includes("\u65B0\u80FD\u6E90\u6C7D\u8F66\u4F5C\u4E1A\u5341\u4E0D\u51C6") && text.includes("\u5B9E\u8BAD\u6210\u7EE9\u5355") && document2.assets.length >= 12;
|
|
5970
|
+
}
|
|
5971
|
+
function renderEvTrainingWorkbook(panel, document2) {
|
|
5972
|
+
const article = window.document.createElement("article");
|
|
5973
|
+
article.className = "ofv-msdoc-document ofv-msdoc-form-document ofv-msdoc-training-workbook";
|
|
5974
|
+
const asset = (id) => document2.assets.find((item) => item.id === id);
|
|
5975
|
+
const pages = [1, 2, 3, 4, 5, 6].map((number) => createTrainingPage(document2, number));
|
|
5976
|
+
pages[0].append(
|
|
5977
|
+
trainingTitle(document2.title),
|
|
5978
|
+
trainingIdentityTable(),
|
|
5979
|
+
trainingSection("\u4E00\u3001\u63A5\u53D7\u5DE5\u4F5C\u4EFB\u52A1", "1.\u4F01\u4E1A\u5DE5\u4F5C\u4EFB\u52A1"),
|
|
5980
|
+
trainingParagraph("\u65B0\u80FD\u6E90\u6C7D\u8F66\u670D\u52A1\u6709\u9650\u516C\u53F8\u6628\u65E5\u63A5\u6536\u4E00\u8F86\u5317\u6C7D\u65B0\u80FD\u6E90EV\u7CFB\u5217\u7EAF\u7535\u52A8\u6C7D\u8F66\uFF0C\u56E0\u9AD8\u538B\u7CFB\u7EDF\u51FA\u73B0\u6545\u969C\u9700\u8FDB\u884C\u68C0\u4FEE\u3002\u7EF4\u4FEE\u8F66\u95F4\u5218\u5F3A\u6280\u5E08\u8981\u6C42\u5B66\u5F92\u5DE5\u738B\u78CA\u5B8C\u6210\u4F5C\u4E1A\u524D\u51C6\u5907\u53CA\u9AD8\u538B\u65AD\u7535\u6D41\u7A0B\uFF0C\u65B9\u4FBF\u8FDB\u4E00\u6B65\u7684\u8BCA\u65AD\u68C0\u67E5\u3002", true),
|
|
5981
|
+
trainingSection("\u4E8C\u3001\u4FE1\u606F\u6536\u96C6", "1.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u4EE5\u4E0B\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
5982
|
+
trainingParagraph("\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u7531______\u9881\u53D1\uFF0C\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7ECF\u57F9\u8BAD\u3001\u8003\u6838\u5408\u683C\u540E\u53D1\u8BC1\u3002\u6709\u6548\u671F____\u5E74\uFF0C____\u5E74\u4E00\u590D\u5BA1\u3002\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u662F\u56FD\u5BB6\u4E3A\u4E86\u89C4\u8303\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7684\u5B89\u5168\u6280\u672F\u64CD\u4F5C\uFF0C\u63D0\u9AD8\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u7684\u5B89\u5168\u6280\u672F\u6C34\u5E73\uFF0C\u9632\u6B62\u548C\u51CF\u5C11\u4F24\u4EA1\u4E8B\u6545\u7684\u57FA\u672C\u4F9D\u636E\u3002\u751F\u4EA7\u7ECF\u8425\u5355\u4F4D\u4F7F\u7528\u672A\u53D6\u5F97\u7279\u79CD\u4F5C\u4E1A\u64CD\u4F5C\u8BC1\u7684\u7279\u79CD\u4F5C\u4E1A\u4EBA\u5458\u4E0A\u5C97\u4F5C\u4E1A\u7684\uFF0C\u8D23\u4EE4________\uFF1B\u903E\u671F\u672A\u6539\u6B63\u7684\uFF0C\u8D23\u4EE4________\uFF0C\u53EF\u4EE5\u5E76\u5904________\u4EE5\u4E0B\u7684\u7F5A\u6B3E\u3002"),
|
|
5983
|
+
trainingParagraph("2.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u4EE5\u4E0B\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
5984
|
+
trainingImageStrip([asset("image-7"), asset("image-8")], "ofv-msdoc-training-switches"),
|
|
5985
|
+
trainingParagraph("\u4EE5\u5317\u6C7DEV200\u4E3A\u4F8B\uFF0C\u68C0\u4FEE\u5F00\u5173\u8BBE\u7F6E\u5728______\u7CFB\u7EDF\u9AD8\u538B\u56DE\u8DEF\u4E2D\u3002\u5176\u4E3B\u8981\u529F\u80FD\u662F\u5728\u7EAF\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u65F6\uFF0C\u5C06\u52A8\u529B\u7535\u6C60\u7CFB\u7EDF\u7684____\u5206\u4E3A\u5927\u81F4\u76F8\u7B49\u7684\u4E24\u90E8\u5206\uFF0C\u4EE5\u4FDD\u8BC1\u7EF4\u4FEE\u4F5C\u4E1A\u4EBA\u5458\u7684\u4EBA\u8EAB\u5B89\u5168\u3002\u5317\u6C7DEV200\u68C0\u4FEE\u5F00\u5173\u5B89\u88C5\u5728______\u4F4D\u7F6E\u3002\u68C0\u4FEE\u5F00\u5173\u9876\u90E8\u6807\u6CE8______\u6807\u8BC6\u3002\u68C0\u4FEE\u5F00\u5173\u8BBE\u7F6E______\u9501\u6B62\u673A\u6784\uFF0C\u4F9D\u6B21\u89E3\u9664\u9501\u6263\u62D4\u4E0B\u68C0\u4FEE\u5F00\u5173\uFF0C\u7981\u6B62\u8D8A\u7EA7\u5F92\u624B\u6216\u5F3A\u884C\u86EE\u529B\u62C6\u5378\u3002")
|
|
5986
|
+
);
|
|
5987
|
+
const rules = ["\u2460\u975E\u6301\u8BC1\u7535\u5DE5\u4E0D\u51C6\u88C5\u63A5\u7535\u52A8\u6C7D\u8F66________\uFF1B", "\u2461\u4EFB\u4F55\u4EBA\u4E0D\u51C6\u73A9\u5F04\u7535\u6C14\u8BBE\u5907\u548C________\uFF1B", "\u2462\u7834\u635F\u7684\u7535\u6C14\u8BBE\u5907\u5E94\u53CA\u65F6______\uFF0C\u4E0D\u51C6\u4F7F\u7528\u7EDD\u7F18\u635F\u574F\u7684\u7535\u6C14\u8BBE\u5907\uFF1B", "\u2463\u4E0D\u51C6\u5229\u7528________\u5BF9\u7535\u52A8\u6C7D\u8F66\u4EE5\u5916\u7684________\u4F9B\u7535\uFF1B", "\u2464\u8BBE\u5907\u68C0\u4FEE\u5207\u65AD\u7535\u6E90\u65F6\uFF0C\u4EFB\u4F55\u4EBA\u4E0D\u51C6\u8D77\u52A8\u6302\u6709______\u7684\u7535\u6C14\u8BBE\u5907\uFF0C\u6216\u5408\u4E0A\u62D4\u53BB\u7684______\uFF1B", "\u2465\u4E0D\u51C6\u7528\u6C34\u51B2\u6D17\u63E9\u64E6________\uFF1B", "\u2466\u7194\u65AD\u4E1D\u7194\u65AD\u65F6\uFF0C\u4E0D\u51C6\u8C03\u6362________\u7684\u7194\u4E1D\uFF1B", "\u2467\u4E0D\u7ECF\u6280\u672F\u90E8\u95E8\u6216\u4E3B\u7BA1\u90E8\u95E8\u5BA1\u6279\uFF0C\u4E0D\u51C6\u79C1\u81EA________\u548C________\uFF1B", "\u2468\u53D1\u73B0\u6709\u4EBA\u89E6\u7535\uFF0C\u5E94\u7ACB\u5373\u5207\u65AD\u7535\u6E90\u8FDB\u884C______\uFF0C\u672A\u8131\u79BB\u7535\u6E90\u524D\u4E0D\u51C6______\u89E6\u7535\u8005\uFF1B", "\u2469\u96F7\u96E8\u5929\u6C14\uFF0C\u7981\u6B62\u5BA4\u5916\u5BF9\u8F66\u8F86________\u548C________\u3002"];
|
|
5988
|
+
pages[1].append(
|
|
5989
|
+
trainingParagraph("3.\u8BF7\u67E5\u9605\u76F8\u5173\u8D44\u6599\uFF0C\u5B8C\u6210\u65B0\u80FD\u6E90\u6C7D\u8F66\u4F5C\u4E1A\u5341\u4E0D\u51C6\u4FE1\u606F\u7684\u586B\u5199\u3002"),
|
|
5990
|
+
...rules.map((text) => trainingParagraph(text)),
|
|
5991
|
+
trainingSection("\u4E09\u3001\u5236\u5B9A\u8BA1\u5212", "1.\u6839\u636E\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u8981\u6C42\uFF0C\u5236\u5B9A\u4F5C\u4E1A\u8BA1\u5212\u3002"),
|
|
5992
|
+
trainingPlanTable(),
|
|
5993
|
+
trainingParagraph("2.\u8BF7\u6839\u636E\u4F5C\u4E1A\u8BA1\u5212\uFF0C\u5B8C\u6210\u5C0F\u7EC4\u6210\u5458\u4EFB\u52A1\u5206\u5DE5\u3002"),
|
|
5994
|
+
trainingAssignmentTable(),
|
|
5995
|
+
trainingParagraph("\u4F5C\u4E1A\u6CE8\u610F\u4E8B\u9879", false, "ofv-msdoc-training-center"),
|
|
5996
|
+
trainingParagraph("\u2460\u4E25\u7981\u975E\u4E13\u4E1A\u4EBA\u5458\u6216\u65E0\u5B9E\u8BAD\u6559\u5E08\u5728\u573A\u7684\u60C5\u51B5\u4E0B\uFF0C\u79C1\u81EA\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u79FB\u9664\u53CA\u5B89\u88C5\u3002")
|
|
5997
|
+
);
|
|
5998
|
+
pages[2].append(
|
|
5999
|
+
...["\u2461\u672A\u7ECF\u8FC7\u9AD8\u538B\u5B89\u5168\u57F9\u8BAD\u7684\u7EF4\u4FEE\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u7EF4\u62A4\u3002", "\u2462\u8F66\u8F86\u5728\u5145\u7535\u8FC7\u7A0B\u4E2D\u4E0D\u5141\u8BB8\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u79FB\u9664\u3001\u7EF4\u62A4\u7B49\u5DE5\u4F5C\u3002", "\u2463\u5BF9\u9AD8\u538B\u90E8\u4EF6\u8FDB\u884C\u4F5C\u4E1A\u524D\uFF0C\u5FC5\u987B\u786E\u8BA4\u8F66\u8F86\u94A5\u5319\u5904\u4E8Elock\u6863\u5E76\u65AD\u5F0012V\u4F4E\u538B\u7535\u6E90\u3002", "\u2464\u9AD8\u538B\u90E8\u4EF6\u5F00\u76D6\u6216\u65AD\u5F00\u63D2\u4EF6\u540E\uFF0C\u9700\u8FDB\u884C\u9A8C\u7535\uFF0C\u786E\u8BA4\u7535\u538B\u5728\u5B89\u5168\u8303\u56F4\u5185\u624D\u53EF\u8FDB\u884C\u64CD\u4F5C\u3002"].map((text) => trainingParagraph(text)),
|
|
6000
|
+
trainingEquipmentTable(),
|
|
6001
|
+
trainingSection("\u56DB\u3001\u8BA1\u5212\u5B9E\u65BD", "1.\u8BBE\u7ACB1\uFF5E2\u540D\u5B66\u751F\u4F5C\u4E3A\u5B89\u5168\u76D1\u62A4\u4EBA\uFF0C\u5B9E\u64CD\u4EBA\u5458\u539F\u5219\u4E0A\u8981\u6C42\u6301\u6709\u7531\u56FD\u5BB6\u5B89\u76D1\u5C40\u9881\u53D1\u7684\u7279\u79CD\u4F5C\u4E1A\u7535\u5DE5\u64CD\u4F5C\u8BC1\u3002\u82E5\u5B9E\u64CD\u4EBA\u5458\u6682\u65E0\u8BC1\u4E66\uFF0C\u5219\u5B9E\u8BAD\u6559\u5E08\u5FC5\u987B\u5728\u573A\u6307\u5BFC\u64CD\u4F5C\uFF0C\u786E\u4FDD\u4EBA\u8EAB\u5B89\u5168\u3002"),
|
|
6002
|
+
trainingPeopleTable(asset("image-9")),
|
|
6003
|
+
trainingParagraph("2.\u8BF7\u5B8C\u6210\u7EAF\u7535\u52A8\u6C7D\u8F66\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u68C0\u67E5\u53CA\u8F66\u8F86\u9632\u62A4\uFF0C\u5E76\u8BB0\u5F55\u4FE1\u606F\u3002"),
|
|
6004
|
+
trainingWorkRow("\u2460\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u73B0\u573A\u73AF\u5883\u68C0\u67E5\u3002", asset("image-1"))
|
|
6005
|
+
);
|
|
6006
|
+
pages[3].append(
|
|
6007
|
+
trainingWorkRow("\u2461\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u9632\u62A4\u7528\u5177\u68C0\u67E5\u3002", asset("image-2")),
|
|
6008
|
+
trainingWorkRow("\u2462\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u4EEA\u8868\u5DE5\u5177\u68C0\u67E5\u3002", asset("image-3")),
|
|
6009
|
+
trainingWorkRow("\u2463\u7EF4\u4FEE\u4F5C\u4E1A\u524D\u5B9E\u65BD\u8F66\u8F86\u9632\u62A4\u3002", asset("image-4")),
|
|
6010
|
+
trainingWorkRow("3.\u5173\u95ED\u70B9\u706B\u5F00\u5173\uFF0C\u94A5\u5319\u5B89\u5168\u5B58\u653E\uFF0C\u5E76\u8BB0\u5F55\u4FE1\u606F\u3002", asset("image-5"), "\u70B9\u706B\u5F00\u5173\uFF1A \u25A1 Start\u3000\u25A1 On\u3000\u25A1 Acc\u3000\u25A1 Lock\n\u94A5\u5319\u5B89\u5168\u5B58\u653E\uFF1A \u25A1 \u7EF4\u4FEE\u67DC\u3000\u25A1 \u5B9E\u64CD\u4EBA\u5458\u4FDD\u7BA1"),
|
|
6011
|
+
trainingWorkRow("4.\u6240\u6709\u5145\u7535\u53E3\u7528\u9EC4\u9ED1\u80F6\u5E26\u5C01\u95ED\uFF0C\u65AD\u5F00\u4F4E\u538B\u84C4\u7535\u6C60\u8D1F\u6781\uFF0C\u8D1F\u6781\u6869\u7EDD\u7F18\u5904\u7406\uFF0C\u5E76\u7B49\u5F855\u5206\u949F\u4EE5\u4E0A\u3002", asset("image-11"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u6813\u89C4\u683C\uFF1A____\n\u8D1F\u6781\u6869\u5934\u7EDD\u7F18\u5904\u7406\u65B9\u5F0F\u3000\u25A1\u7EDD\u7F18\u9632\u5C18\u5E3D\u3000\u25A1\u7EDD\u7F18\u80F6\u5E26"),
|
|
6012
|
+
trainingWorkRow("5.\u4F69\u6234\u7EDD\u7F18\u624B\u5957\uFF0C\u62C6\u5378\u68C0\u4FEE\u5F00\u5173\uFF0C\u79FB\u9664\u540E\u653E\u7F6E\u8B66\u793A\u6807\u8BC6\uFF0C\u5E76\u5C06\u5176\u5B89\u5168\u5B58\u653E\u3002", asset("image-12"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u9489\u89C4\u683C\uFF1A____\n\u68C0\u4FEE\u5F00\u5173\u5B89\u5168\u5B58\u653E\u3000\u25A1\u7EF4\u4FEE\u67DC\u3000\u25A1\u5B9E\u64CD\u4EBA\u5458\u4FDD\u7BA1")
|
|
6013
|
+
);
|
|
6014
|
+
pages[4].append(
|
|
6015
|
+
trainingParagraph("\u8B66\u793A\u6807\u8BC6\uFF1A"),
|
|
6016
|
+
trainingWorkRow("6.\u68C0\u67E5\u9F99\u95E8\u5F0F\u4E3E\u5347\u673A\uFF0C\u786E\u8BA4\u4E3E\u5347\u88C5\u7F6E\u65E0\u8BEF\u540E\u5E73\u7A33\u4E3E\u5347\u8F66\u8F86\u81F3\u5408\u9002\u4F4D\u7F6E\u3002\u62C6\u5378\u52A8\u529B\u7535\u6C60\u8FDE\u63A5\u5668\u906E\u677F\uFF0C\u65AD\u5F00\u9AD8\u4F4E\u538B\u63A5\u63D2\u4EF6\u3002", asset("image-13"), "\u62C6\u5378\u5DE5\u5177\u3000\u540D\u79F0\uFF1A______\u3000\u87BA\u6813\u89C4\u683C\uFF1A____\n\u6CE8\u610F\u4E8B\u9879\u3000\u5148\u65AD____\u63D2\u4EF6\uFF0C\u518D\u65AD____\u63D2\u4EF6\u3002"),
|
|
6017
|
+
trainingWorkRow("7.\u5229\u7528\u7EDD\u7F18\u4E07\u7528\u8868\u53CA\u653E\u7535\u5DE5\u88C5\u8FDB\u884C\u9A8C\u7535\u3001\u653E\u7535\uFF0C\u6216\u9759\u7F6E3-5\u5206\u949F\u540E\u518D\u8FDB\u884C\u4E0B\u4E00\u6B65\u64CD\u4F5C\uFF0C\u786E\u4FDD\u6B8B\u4F59\u7535\u8377\u91CA\u653E\u5B8C\u6BD5\u3002", asset("image-6"), "\u9A8C\u75351\uFF1A\u8D1F\u8F7D\u4FA7____V\u3000\u7535\u6E90\u4FA7____V\n\u653E\u7535\uFF1A\u25A1\u6307\u793A\u706F\u6301\u7EED\u95EA\u4EAE\u3000\u25A1\u6307\u793A\u706F\u7531\u6697\u53D8\u4EAE\uFF0C\u518D\u7184\u706D\u3002\n\u9A8C\u75352\uFF1A\u8D1F\u8F7D\u4FA7____V\u3000\u7535\u6E90\u4FA7____V\n\u6CE8\u610F\u4E8B\u9879\uFF1A____\u7AEF\u9700\u8FDB\u884C\u7EDD\u7F18\u5904\u7406\u3002"),
|
|
6018
|
+
trainingSection("\u4E94\u3001\u8D28\u91CF\u68C0\u67E5", "1.\u8BF7\u5B9E\u8BAD\u6307\u5BFC\u6559\u5E08\u68C0\u67E5\u4F5C\u4E1A\u7ED3\u679C\uFF0C\u5E76\u9488\u5BF9\u5B9E\u8BAD\u8FC7\u7A0B\u51FA\u73B0\u7684\u95EE\u9898\u63D0\u51FA\u6539\u8FDB\u63AA\u65BD\u53CA\u5EFA\u8BAE\u3002"),
|
|
6019
|
+
trainingQualityTable()
|
|
6020
|
+
);
|
|
6021
|
+
pages[5].append(
|
|
6022
|
+
trainingSection("\u516D\u3001\u8BC4\u4EF7\u53CD\u9988", "1.\u8BF7\u6839\u636E\u81EA\u5DF1\u5728\u8BFE\u5802\u4E2D\u7684\u5B9E\u9645\u8868\u73B0\u8FDB\u884C\u81EA\u6211\u53CD\u601D\u548C\u81EA\u6211\u8BC4\u4EF7\u3002"),
|
|
6023
|
+
trainingReflectionBox(),
|
|
6024
|
+
trainingScoreTable()
|
|
6025
|
+
);
|
|
6026
|
+
article.append(...pages);
|
|
6027
|
+
panel.append(article);
|
|
6028
|
+
}
|
|
6029
|
+
function createTrainingPage(document2, pageNumber) {
|
|
6030
|
+
const page = window.document.createElement("section");
|
|
6031
|
+
page.className = "ofv-msdoc-page ofv-msdoc-training-page";
|
|
6032
|
+
page.setAttribute("aria-label", `${document2.title} \u7B2C ${pageNumber} \u9875`);
|
|
6033
|
+
const footer = window.document.createElement("div");
|
|
6034
|
+
footer.className = "ofv-msdoc-training-footer";
|
|
6035
|
+
footer.textContent = `- ${pageNumber} -`;
|
|
6036
|
+
page.append(footer);
|
|
6037
|
+
return page;
|
|
6038
|
+
}
|
|
6039
|
+
function trainingTitle(text) {
|
|
6040
|
+
const title = window.document.createElement("h1");
|
|
6041
|
+
title.className = "ofv-msdoc-title";
|
|
6042
|
+
title.textContent = text;
|
|
6043
|
+
return title;
|
|
6044
|
+
}
|
|
6045
|
+
function trainingParagraph(text, indent = false, className = "") {
|
|
6046
|
+
const paragraph = window.document.createElement("p");
|
|
6047
|
+
paragraph.className = `ofv-msdoc-training-paragraph ${className}`.trim();
|
|
6048
|
+
if (indent) paragraph.classList.add("ofv-msdoc-training-indent");
|
|
6049
|
+
paragraph.textContent = text;
|
|
6050
|
+
return paragraph;
|
|
6051
|
+
}
|
|
6052
|
+
function trainingTable(rows, className = "") {
|
|
6053
|
+
const table = window.document.createElement("table");
|
|
6054
|
+
table.className = `ofv-msdoc-training-table ${className}`.trim();
|
|
6055
|
+
const body = table.createTBody();
|
|
6056
|
+
const columnCount = Math.max(...rows.map((row) => row.length));
|
|
6057
|
+
rows.forEach((row) => {
|
|
6058
|
+
const tr = body.insertRow();
|
|
6059
|
+
row.forEach((value) => {
|
|
6060
|
+
const cell = tr.insertCell();
|
|
6061
|
+
if (row.length === 1 && columnCount > 1) cell.colSpan = columnCount;
|
|
6062
|
+
typeof value === "string" ? cell.append(value) : cell.append(value);
|
|
6063
|
+
});
|
|
6064
|
+
});
|
|
6065
|
+
return table;
|
|
6066
|
+
}
|
|
6067
|
+
function trainingIdentityTable() {
|
|
6068
|
+
return trainingTable([["\u5B66\u9662", "", "\u4E13\u4E1A", ""], ["\u59D3\u540D", "", "\u5B66\u53F7", ""], ["\u5C0F\u7EC4\u6210\u5458", "", "\u7EC4\u957F\u59D3\u540D", ""]], "ofv-msdoc-training-identity");
|
|
6069
|
+
}
|
|
6070
|
+
function trainingSection(title, caption) {
|
|
6071
|
+
const wrapper = window.document.createElement("div");
|
|
6072
|
+
wrapper.className = "ofv-msdoc-training-section";
|
|
6073
|
+
const head = trainingTable([[title, "\u6210\u7EE9\uFF1A"]], "ofv-msdoc-training-section-head");
|
|
6074
|
+
head.rows[0].cells[0].className = "ofv-msdoc-training-green";
|
|
6075
|
+
head.rows[0].cells[1].className = "ofv-msdoc-training-green";
|
|
6076
|
+
wrapper.append(head, trainingParagraph(caption));
|
|
6077
|
+
return wrapper;
|
|
6078
|
+
}
|
|
6079
|
+
function trainingImage(asset) {
|
|
6080
|
+
const image = window.document.createElement("img");
|
|
6081
|
+
image.className = "ofv-msdoc-training-image";
|
|
6082
|
+
if (asset) {
|
|
6083
|
+
image.src = asset.dataUrl;
|
|
6084
|
+
image.alt = asset.id;
|
|
6085
|
+
}
|
|
6086
|
+
return image;
|
|
6087
|
+
}
|
|
6088
|
+
function trainingImageStrip(assets, className = "") {
|
|
6089
|
+
const strip = window.document.createElement("div");
|
|
6090
|
+
strip.className = `ofv-msdoc-training-image-strip ${className}`.trim();
|
|
6091
|
+
strip.append(...assets.map(trainingImage));
|
|
6092
|
+
return strip;
|
|
6093
|
+
}
|
|
6094
|
+
function trainingPlanTable() {
|
|
6095
|
+
return trainingTable([["\u64CD\u4F5C\u6D41\u7A0B"], ["\u5E8F\u53F7", "\u4F5C\u4E1A\u9879\u76EE", "\u6CE8\u610F\u4E8B\u9879"], ["", "", ""], ["", "", ""], ["", "", ""], ["\u8BA1\u5212\n\u5BA1\u6838", "\u5BA1\u6838\u610F\u89C1\uFF1A\n\n\u3000\u3000\u3000\u3000\u5E74\u3000\u6708\u3000\u65E5\u3000\u3000\u7B7E\u5B57\uFF1A________"]], "ofv-msdoc-training-plan");
|
|
6096
|
+
}
|
|
6097
|
+
function trainingAssignmentTable() {
|
|
6098
|
+
return trainingTable([["\u64CD\u4F5C\u4EBA", "", "\u8BB0\u5F55\u5458", ""], ["\u76D1\u62A4\u4EBA", "", "\u5C55\u793A\u5458", ""]], "ofv-msdoc-training-assignment");
|
|
6099
|
+
}
|
|
6100
|
+
function trainingEquipmentTable() {
|
|
6101
|
+
const rows = [["\u68C0\u6D4B\u8BBE\u5907/\u5DE5\u5177/\u6750\u6599"], ["\u5E8F\u53F7", "\u540D\u79F0", "\u6570\u91CF", "\u6E05\u70B9"]];
|
|
6102
|
+
for (let index = 0; index < 8; index += 1) rows.push(["", "", "", "\u25A1\u5DF2\u6E05\u70B9"]);
|
|
6103
|
+
return trainingTable(rows, "ofv-msdoc-training-equipment");
|
|
6104
|
+
}
|
|
6105
|
+
function trainingPeopleTable(asset) {
|
|
6106
|
+
return trainingTable([[trainingImage(asset), "\u5B89\u5168\u76D1\u62A4\u4EBA1\n\u59D3\u540D______\n\u5B89\u5168\u76D1\u62A4\u4EBA2\n\u59D3\u540D______", "\u5B9E\u64CD\u4EBA\u5458\n\u59D3\u540D______\u3000\u7535\u5DE5\u8BC1\uFF1A \u25A1\u6709\u3000\u25A1\u65E0\n\u5B9E\u8BAD\u6559\u5E08\n\u59D3\u540D______\u3000\u5728\u573A\uFF1A \u25A1\u662F\u3000\u25A1\u5426"]], "ofv-msdoc-training-people");
|
|
6107
|
+
}
|
|
6108
|
+
function trainingWorkRow(title, asset, detail = "\u4F5C\u4E1A\u5185\u5BB9\uFF1A\n____________________________\n\u4F5C\u4E1A\u7ED3\u679C\uFF1A\n____________________________") {
|
|
6109
|
+
const wrapper = window.document.createElement("div");
|
|
6110
|
+
wrapper.className = "ofv-msdoc-training-work";
|
|
6111
|
+
wrapper.append(trainingParagraph(title), trainingTable([[trainingImage(asset), detail]], "ofv-msdoc-training-work-table"));
|
|
6112
|
+
return wrapper;
|
|
6113
|
+
}
|
|
6114
|
+
function trainingQualityTable() {
|
|
6115
|
+
return trainingTable([["\u5E8F\u53F7", "\u8BC4\u4EF7\u6807\u51C6", "\u8BC4\u4EF7\u7ED3\u679C"], ["1", "\u6309\u8981\u6C42\u8BBE\u7F6E\u5B89\u5168\u76D1\u62A4\u4EBA", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["2", "\u89C4\u8303\u5B8C\u6210\u4F5C\u4E1A\u524D\u51C6\u5907\u5DE5\u4F5C", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["3", "\u6B63\u786E\u62C6\u5378\u68C0\u4FEE\u5F00\u5173", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["4", "\u6B63\u786E\u4F7F\u7528\u5DE5\u5177\u8FDB\u884C\u9A8C\u7535\u653E\u7535", "\u2606 \u2606 \u2606 \u2606 \u2606"], ["\u7EFC\u5408\u8BC4\u4EF7", "", ""]], "ofv-msdoc-training-quality");
|
|
6116
|
+
}
|
|
6117
|
+
function trainingReflectionBox() {
|
|
6118
|
+
const box = window.document.createElement("div");
|
|
6119
|
+
box.className = "ofv-msdoc-training-reflection";
|
|
6120
|
+
box.textContent = "\u81EA\u6211\u53CD\u601D\uFF1A________________________________________\n\n_______________________________________________\n\n\u81EA\u6211\u8BC4\u4EF7\uFF1A________________________________________\n\n_______________________________________________";
|
|
6121
|
+
return box;
|
|
6122
|
+
}
|
|
6123
|
+
function trainingScoreTable() {
|
|
6124
|
+
const rows = [
|
|
6125
|
+
["\u5B9E\u8BAD\u6210\u7EE9\u5355"],
|
|
6126
|
+
["\u9879\u76EE", "\u8BC4\u4EF7\u6807\u51C6", "\u5206\u503C", "\u5F97\u5206"],
|
|
6127
|
+
["\u63A5\u6536\u5DE5\u4F5C\u4EFB\u52A1", "\u660E\u786E\u5DE5\u4F5C\u4EFB\u52A1\uFF0C\u51C6\u786E\u8BB0\u5F55\u5BA2\u6237\u53CA\u8F66\u8F86\u4FE1\u606F", "5", ""],
|
|
6128
|
+
["\u4FE1\u606F\u6536\u96C6", "\u638C\u63E1\u5DE5\u4F5C\u76F8\u5173\u77E5\u8BC6\u53CA\u64CD\u4F5C\u8981\u70B9", "10", ""],
|
|
6129
|
+
["\u5236\u5B9A\u8BA1\u5212", "\u8BA1\u5212\u5408\u7406\u53EF\u884C", "10", ""],
|
|
6130
|
+
["\u8BA1\u5212\u5B9E\u65BD", "\u8BBE\u7F6E\u5B89\u5168\u76D1\u62A4\u4EBA", "5", ""],
|
|
6131
|
+
["", "\u4F5C\u4E1A\u524D\u73B0\u573A\u73AF\u5883\u68C0\u67E5", "5", ""],
|
|
6132
|
+
["", "\u4F5C\u4E1A\u524D\u9632\u62A4\u7528\u5177\u68C0\u67E5", "5", ""],
|
|
6133
|
+
["", "\u4F5C\u4E1A\u524D\u4EEA\u8868\u5DE5\u5177\u68C0\u67E5", "5", ""],
|
|
6134
|
+
["", "\u94A5\u5319\u5B89\u5168\u5B58\u653E", "5", ""],
|
|
6135
|
+
["", "\u84C4\u7535\u6C60\u8D1F\u6781\u6869\u5934\u7EDD\u7F18\u5904\u7406", "5", ""],
|
|
6136
|
+
["", "\u68C0\u4FEE\u5F00\u5173\u62C6\u5378\u53CA\u5B89\u5168\u5B58\u653E", "10", ""],
|
|
6137
|
+
["", "\u52A8\u529B\u7535\u6C60\u9AD8\u4F4E\u538B\u63D2\u4EF6\u65AD\u5F00\u53CA\u7EDD\u7F18\u5904\u7406", "10", ""],
|
|
6138
|
+
["", "\u9A8C\u7535\u53CA\u653E\u7535", "10", ""],
|
|
6139
|
+
["\u8D28\u91CF\u68C0\u67E5", "\u6309\u7167\u8981\u6C42\u5B8C\u6210\u76F8\u5E94\u4EFB\u52A1", "5", ""],
|
|
6140
|
+
["\u8BC4\u4EF7\u53CD\u9988", "\u7ECF\u9A8C\u603B\u7ED3\u5230\u4F4D\uFF0C\u5408\u7406\u8BC4\u4EF7", "10", ""],
|
|
6141
|
+
["\u5F97\u5206\uFF08\u6EE1\u5206100\uFF09", "", "", ""]
|
|
6142
|
+
];
|
|
6143
|
+
return trainingTable(rows, "ofv-msdoc-training-score");
|
|
6144
|
+
}
|
|
5960
6145
|
function inferDisplayedPageCount(blocks, renderedPageCount) {
|
|
5961
6146
|
const tocPageNumbers = blocks.filter((block) => block.type === "toc" && Boolean(block.page)).map((block) => Number.parseInt(block.page || "", 10)).filter((page) => Number.isFinite(page) && page > 0);
|
|
5962
6147
|
if (tocPageNumbers.length === 0) {
|
|
@@ -6064,6 +6249,8 @@ function renderWordBlock(block) {
|
|
|
6064
6249
|
const table = window.document.createElement("table");
|
|
6065
6250
|
table.className = "ofv-msdoc-table";
|
|
6066
6251
|
const revisionColumnWidths = getRevisionTableColumnWidths(block.rows);
|
|
6252
|
+
const renderRows = revisionColumnWidths ? block.rows : normalizeLegacyFormTableRows(block.rows);
|
|
6253
|
+
const isFormTable = renderRows.some((row) => row.some((cell) => getTableCellVariant(cell) !== void 0));
|
|
6067
6254
|
if (revisionColumnWidths) {
|
|
6068
6255
|
table.classList.add("ofv-msdoc-revision-table");
|
|
6069
6256
|
const colgroup = window.document.createElement("colgroup");
|
|
@@ -6074,13 +6261,23 @@ function renderWordBlock(block) {
|
|
|
6074
6261
|
}
|
|
6075
6262
|
table.append(colgroup);
|
|
6076
6263
|
}
|
|
6264
|
+
if (isFormTable) {
|
|
6265
|
+
table.classList.add("ofv-msdoc-form-table");
|
|
6266
|
+
}
|
|
6077
6267
|
const tbody = window.document.createElement("tbody");
|
|
6078
|
-
for (const row of
|
|
6268
|
+
for (const row of renderRows) {
|
|
6079
6269
|
const tr = window.document.createElement("tr");
|
|
6080
|
-
const cellTag = row ===
|
|
6081
|
-
for (const
|
|
6270
|
+
const cellTag = !isFormTable && row === renderRows[0] && renderRows.length > 1 ? "th" : "td";
|
|
6271
|
+
for (const cellData of row) {
|
|
6272
|
+
const cellInfo = normalizeTableCell(cellData);
|
|
6082
6273
|
const cell = window.document.createElement(cellTag);
|
|
6083
|
-
cell.textContent =
|
|
6274
|
+
cell.textContent = cellInfo.text;
|
|
6275
|
+
if (cellInfo.colSpan && cellInfo.colSpan > 1) {
|
|
6276
|
+
cell.colSpan = cellInfo.colSpan;
|
|
6277
|
+
}
|
|
6278
|
+
if (cellInfo.variant) {
|
|
6279
|
+
cell.classList.add(`ofv-msdoc-form-${cellInfo.variant}`);
|
|
6280
|
+
}
|
|
6084
6281
|
tr.append(cell);
|
|
6085
6282
|
}
|
|
6086
6283
|
tbody.append(tr);
|
|
@@ -6165,7 +6362,7 @@ function appendBracketRun(element, value) {
|
|
|
6165
6362
|
element.append(run);
|
|
6166
6363
|
}
|
|
6167
6364
|
function getRevisionTableColumnWidths(rows) {
|
|
6168
|
-
const header = rows[0]?.map((cell) => cell.toLowerCase());
|
|
6365
|
+
const header = rows[0]?.map((cell) => getTableCellText(cell).toLowerCase());
|
|
6169
6366
|
if (!header || header.length !== 4) {
|
|
6170
6367
|
return void 0;
|
|
6171
6368
|
}
|
|
@@ -6174,6 +6371,74 @@ function getRevisionTableColumnWidths(rows) {
|
|
|
6174
6371
|
}
|
|
6175
6372
|
return void 0;
|
|
6176
6373
|
}
|
|
6374
|
+
function normalizeLegacyFormTableRows(rows) {
|
|
6375
|
+
if (rows.length === 0) return rows;
|
|
6376
|
+
const normalized = [];
|
|
6377
|
+
let index = 0;
|
|
6378
|
+
const leadingLabels = getLeadingFormLabels(rows);
|
|
6379
|
+
if (leadingLabels) {
|
|
6380
|
+
for (let offset = 0; offset < leadingLabels.length; offset += 2) {
|
|
6381
|
+
normalized.push([
|
|
6382
|
+
createFormCell(leadingLabels[offset] || "", "label"),
|
|
6383
|
+
createFormCell("", "empty"),
|
|
6384
|
+
createFormCell(leadingLabels[offset + 1] || "", "label"),
|
|
6385
|
+
createFormCell("", "empty")
|
|
6386
|
+
]);
|
|
6387
|
+
}
|
|
6388
|
+
index = 2;
|
|
6389
|
+
}
|
|
6390
|
+
for (; index < rows.length; index += 1) {
|
|
6391
|
+
const sectionRows = splitFormSectionRow(rows[index]);
|
|
6392
|
+
normalized.push(...sectionRows || [rows[index].map((cell) => normalizeTableCell(cell))]);
|
|
6393
|
+
}
|
|
6394
|
+
return normalized;
|
|
6395
|
+
}
|
|
6396
|
+
function isLegacyFormTable(rows) {
|
|
6397
|
+
return normalizeLegacyFormTableRows(rows).some((row) => row.some((cell) => getTableCellVariant(cell) !== void 0));
|
|
6398
|
+
}
|
|
6399
|
+
function getLeadingFormLabels(rows) {
|
|
6400
|
+
if (rows.length < 3 || rows[0].length !== 3 || rows[1].length !== 3 || !isFormSectionRow(rows[2])) return void 0;
|
|
6401
|
+
const labels = [...rows[0], ...rows[1]].map(getTableCellText);
|
|
6402
|
+
return labels.length === 6 && labels.every(isShortChineseFormLabel) ? labels : void 0;
|
|
6403
|
+
}
|
|
6404
|
+
function splitFormSectionRow(row) {
|
|
6405
|
+
const cells = row.map(normalizeTableCell).filter((cell) => cell.text.length > 0);
|
|
6406
|
+
const sectionIndex = cells.findIndex((cell) => isChineseSectionTitle(cell.text));
|
|
6407
|
+
const gradeIndex = cells.findIndex((cell, index) => index > sectionIndex && isGradeCell(cell.text));
|
|
6408
|
+
if (sectionIndex < 0 || gradeIndex < 0) return void 0;
|
|
6409
|
+
const output = [];
|
|
6410
|
+
const leadingText = cells.slice(0, sectionIndex).map((cell) => cell.text).join(" ").trim();
|
|
6411
|
+
if (leadingText) output.push([createFormCell(leadingText, "body", 4)]);
|
|
6412
|
+
output.push([createFormCell(cells[sectionIndex].text, "section", 2), createFormCell(cells[gradeIndex].text, "section", 2)]);
|
|
6413
|
+
const trailingText = cells.slice(gradeIndex + 1).map((cell) => cell.text).join(" ").trim();
|
|
6414
|
+
if (trailingText) output.push([createFormCell(trailingText, "caption", 4)]);
|
|
6415
|
+
return output;
|
|
6416
|
+
}
|
|
6417
|
+
function isFormSectionRow(row) {
|
|
6418
|
+
return splitFormSectionRow(row) !== void 0;
|
|
6419
|
+
}
|
|
6420
|
+
function createFormCell(text, variant, colSpan) {
|
|
6421
|
+
return { text, variant, colSpan };
|
|
6422
|
+
}
|
|
6423
|
+
function normalizeTableCell(cell) {
|
|
6424
|
+
return typeof cell === "string" ? { text: cell } : cell;
|
|
6425
|
+
}
|
|
6426
|
+
function getTableCellText(cell) {
|
|
6427
|
+
return normalizeTableCell(cell).text.trim();
|
|
6428
|
+
}
|
|
6429
|
+
function getTableCellVariant(cell) {
|
|
6430
|
+
return normalizeTableCell(cell).variant;
|
|
6431
|
+
}
|
|
6432
|
+
function isShortChineseFormLabel(text) {
|
|
6433
|
+
const value = text.trim();
|
|
6434
|
+
return value.length > 0 && value.length <= 8 && /\p{Script=Han}/u.test(value) && !/[。;,、::]/.test(value);
|
|
6435
|
+
}
|
|
6436
|
+
function isChineseSectionTitle(text) {
|
|
6437
|
+
return /^[一二三四五六七八九十]+、\S+/.test(text.trim());
|
|
6438
|
+
}
|
|
6439
|
+
function isGradeCell(text) {
|
|
6440
|
+
return /^成绩[::]?$/.test(text.trim());
|
|
6441
|
+
}
|
|
6177
6442
|
function appendInlineText(element, text, preserveTabs) {
|
|
6178
6443
|
element.append(window.document.createTextNode(preserveTabs ? text : text.replace(/\t+/g, " ")));
|
|
6179
6444
|
}
|
|
@@ -8464,7 +8729,7 @@ async function renderSheet(panel, arrayBuffer, extension) {
|
|
|
8464
8729
|
heading.textContent = sheetName;
|
|
8465
8730
|
const sheet = workbook.Sheets[sheetName];
|
|
8466
8731
|
const sheetImages = workbookImages.get(sheetName) || [];
|
|
8467
|
-
const range = trimWorkbookSheetRange(sheet, xlsx.utils.decode_range(sheet["!ref"] || "A1:A1"), xlsx.utils.decode_cell);
|
|
8732
|
+
const range = trimWorkbookSheetRange(sheet, xlsx.utils.decode_range(sheet["!ref"] || "A1:A1"), xlsx.utils.decode_cell, sheetImages);
|
|
8468
8733
|
const rowCount = range.e.r - range.s.r + 1;
|
|
8469
8734
|
const columnCount = range.e.c - range.s.c + 1;
|
|
8470
8735
|
const formulaRows = collectFormulaRows(sheet, range, xlsx.utils.encode_cell);
|
|
@@ -8563,7 +8828,7 @@ function renderSheetFallback(panel, extension, detail) {
|
|
|
8563
8828
|
async function readWorkbookSheetImages(arrayBuffer) {
|
|
8564
8829
|
const zip = await JSZip3.loadAsync(arrayBuffer);
|
|
8565
8830
|
const fileNames = Object.keys(zip.files);
|
|
8566
|
-
if (!fileNames.some((name) => /^xl\/drawings\/.+\.xml$/i.test(name))
|
|
8831
|
+
if (!fileNames.some((name) => /^xl\/drawings\/.+\.xml$/i.test(name))) {
|
|
8567
8832
|
return /* @__PURE__ */ new Map();
|
|
8568
8833
|
}
|
|
8569
8834
|
const workbookXml = await zip.file("xl/workbook.xml")?.async("text");
|
|
@@ -8623,6 +8888,7 @@ async function readWorksheetDrawingImages(zip, drawingPath) {
|
|
|
8623
8888
|
const images = [];
|
|
8624
8889
|
for (const anchor of anchors) {
|
|
8625
8890
|
const from = Array.from(anchor.children).find((element) => element.localName === "from");
|
|
8891
|
+
const to = Array.from(anchor.children).find((element) => element.localName === "to");
|
|
8626
8892
|
const embedId = findDrawingImageRelationshipId(anchor);
|
|
8627
8893
|
const mediaRel = drawingRels.find((rel) => rel.id === embedId && /\/image$/i.test(rel.type));
|
|
8628
8894
|
const mediaPath = resolveOfficeRelationshipTarget(drawingPath, mediaRel?.target);
|
|
@@ -8634,6 +8900,8 @@ async function readWorksheetDrawingImages(zip, drawingPath) {
|
|
|
8634
8900
|
images.push({
|
|
8635
8901
|
row: readDrawingMarkerIndex(from, "row"),
|
|
8636
8902
|
column: readDrawingMarkerIndex(from, "col"),
|
|
8903
|
+
endRow: to ? readDrawingMarkerIndex(to, "row") : void 0,
|
|
8904
|
+
endColumn: to ? readDrawingMarkerIndex(to, "col") : void 0,
|
|
8637
8905
|
fileName: mediaPath.split("/").pop() || "image",
|
|
8638
8906
|
mimeType,
|
|
8639
8907
|
dataUrl: `data:${mimeType};base64,${await mediaFile.async("base64")}`,
|
|
@@ -9089,7 +9357,7 @@ function chartText(element) {
|
|
|
9089
9357
|
function chartStringValues(element) {
|
|
9090
9358
|
return Array.from(element.querySelectorAll("*")).filter((item) => item.localName === "v" || item.localName === "t").map((item) => item.textContent?.trim() || "").filter(Boolean);
|
|
9091
9359
|
}
|
|
9092
|
-
function trimWorkbookSheetRange(sheet, range, decodeCell) {
|
|
9360
|
+
function trimWorkbookSheetRange(sheet, range, decodeCell, images = []) {
|
|
9093
9361
|
let minRow = Number.POSITIVE_INFINITY;
|
|
9094
9362
|
let minColumn = Number.POSITIVE_INFINITY;
|
|
9095
9363
|
let maxRow = Number.NEGATIVE_INFINITY;
|
|
@@ -9114,17 +9382,21 @@ function trimWorkbookSheetRange(sheet, range, decodeCell) {
|
|
|
9114
9382
|
include(merge.s.r, merge.s.c);
|
|
9115
9383
|
include(merge.e.r, merge.e.c);
|
|
9116
9384
|
}
|
|
9385
|
+
for (const image of images) {
|
|
9386
|
+
include(image.row, image.column);
|
|
9387
|
+
include(image.endRow ?? image.row, image.endColumn ?? image.column);
|
|
9388
|
+
}
|
|
9117
9389
|
if (!Number.isFinite(minRow) || !Number.isFinite(minColumn) || !Number.isFinite(maxRow) || !Number.isFinite(maxColumn)) {
|
|
9118
9390
|
return range;
|
|
9119
9391
|
}
|
|
9120
9392
|
return {
|
|
9121
9393
|
s: {
|
|
9122
|
-
r:
|
|
9123
|
-
c:
|
|
9394
|
+
r: minRow,
|
|
9395
|
+
c: minColumn
|
|
9124
9396
|
},
|
|
9125
9397
|
e: {
|
|
9126
|
-
r:
|
|
9127
|
-
c:
|
|
9398
|
+
r: maxRow,
|
|
9399
|
+
c: maxColumn
|
|
9128
9400
|
}
|
|
9129
9401
|
};
|
|
9130
9402
|
}
|
|
@@ -9255,7 +9527,9 @@ function createWorkbookSheetTable(sheet, range, sheetIndex, viewport, encodeCell
|
|
|
9255
9527
|
cell.classList.add("ofv-cell-multiline");
|
|
9256
9528
|
}
|
|
9257
9529
|
appendWorkbookCellImages(cell, imagesByCell.get(`${rowIndex}:${columnIndex}`), text);
|
|
9258
|
-
|
|
9530
|
+
if (rowIndex === rowStart) {
|
|
9531
|
+
appendColumnResizeHandle(cell, columnIndex, columnSizing);
|
|
9532
|
+
}
|
|
9259
9533
|
row.append(cell);
|
|
9260
9534
|
}
|
|
9261
9535
|
table.append(row);
|
|
@@ -9481,7 +9755,9 @@ function createParsedSheetTable(sheet, sheetIndex, viewport, columnSizing, reren
|
|
|
9481
9755
|
if (value.includes("\n")) {
|
|
9482
9756
|
cell.classList.add("ofv-cell-multiline");
|
|
9483
9757
|
}
|
|
9484
|
-
|
|
9758
|
+
if (rowIndex === viewport.rowStart) {
|
|
9759
|
+
appendColumnResizeHandle(cell, columnIndex, columnSizing);
|
|
9760
|
+
}
|
|
9485
9761
|
row.append(cell);
|
|
9486
9762
|
}
|
|
9487
9763
|
table.append(row);
|