@a3s-lab/office 0.28.0 → 0.29.0
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 +27 -1
- package/dist/0~1403.js +1 -1
- package/dist/0~4980.js +1 -1
- package/dist/0~5093.js +64 -5
- package/dist/0~7043.js +241 -241
- package/dist/0~7048.js +1 -1
- package/dist/0~7614.js +1 -1
- package/dist/0~document-editor.js +433 -10
- package/dist/0~presentation-editor.js +1 -1
- package/dist/0~spreadsheet-editor.js +1 -2
- package/dist/0~work-docx-export.js +141 -3
- package/dist/0~work-docx-import.js +5 -3
- package/dist/0~work-office-diagnostics.js +46 -3
- package/dist/0~work-pptx-export.js +1 -1
- package/dist/0~work-pptx-import.js +1 -1
- package/dist/0~work-presentation-charts.js +1 -1
- package/dist/1544.js +1 -1
- package/dist/4104.js +2 -2
- package/dist/4121.js +1510 -0
- package/dist/6282.js +59 -684
- package/dist/8715.js +1 -1
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/features/work/editors/document-command-catalog.d.ts +9 -0
- package/dist/internal/features/work/editors/document-font-dialog-model.d.ts +5 -2
- package/dist/internal/features/work/editors/document-font-dialog-run-border-model.d.ts +24 -0
- package/dist/internal/features/work/editors/document-font-dialog-run-border-section.d.ts +10 -0
- package/dist/internal/features/work/work-document-character-formatting.d.ts +4 -0
- package/dist/internal/features/work/work-document-format-changes.d.ts +1 -0
- package/dist/internal/features/work/work-document-run-border.d.ts +11 -0
- package/dist/internal/features/work/work-document-word-line-metrics.d.ts +1 -0
- package/dist/internal/features/work/work-docx-run-border-diagnostics.d.ts +3 -0
- package/dist/internal/features/work/work-docx-run-border-export.d.ts +17 -0
- package/dist/internal/features/work/work-docx-run-border.d.ts +20 -0
- package/dist/internal/features/work/work-docx-run-formatting-import.d.ts +2 -0
- package/dist/office-kernel.wasm +0 -0
- package/dist/styles.css +31 -0
- package/docs/latest/en/browser-editor-architecture.md +22 -0
- package/package.json +4 -1
- package/dist/5184.js +0 -662
- package/dist/9424.js +0 -16
|
@@ -7,11 +7,10 @@ import { convertSpanToShareString, genarate, indexToColumnChar, update as core_u
|
|
|
7
7
|
import { freezeImportedSpreadsheetCell, withXlsxPatternFill, spreadsheetMatrixProfile, xlsxRichTextCellText, spreadsheetTextOrientationFromAngle, spreadsheetCellValueWithDiagonalBorder, xlsxSemanticColorMatchesValue, spreadsheetUnderlineCellValue, normalizeXlsxRichTextEditSource, attachSpreadsheetShownCommentCells, sameSpreadsheetHistoryValue, isSpreadsheetConditionalComparisonOperator, defaultSpreadsheetConditionalIconThresholds, normalizeXlsxRichTextCell, activeXlsxNativeFill, xlsxPatternFillTypes, normalizeSpreadsheetDateValidationBoundary, unlockedCellCount, editableRangeRequiresCredentials, spreadsheetTextOrientationChoiceFromCell, spreadsheetConditionalThresholdValue, withSheetProtection, defaultSpreadsheetColorScaleThresholds, protectedSheetCount, sameXlsxRichTextRunStyle, withSheetSelectionPermissions, spreadsheetTextOrientationFromCell, patchSpreadsheetRichTextFontRuns, readOfficeSpreadsheetCollaboration as readWorkOfficeSpreadsheetCollaboration, spreadsheetConditionalThresholdsEqual, spreadsheetVisibleTextRotationFromCell, spreadsheetTextOrientationFromChoice, normalizeXlsxSemanticColorOrigin, withoutEditableRange, isSpreadsheetTextOrientationId, normalizeSpreadsheetConditionalVisualOptions, withXlsxGradientFill, effectiveSpreadsheetPageSetup, normalizeXlsxPatternFill, normalizeXlsxRichTextColor, isHighSurrogate, xlsxNativeFillCellKeys, withEditableRange, createOfficeSpreadsheetCollaborationBinding as createWorkOfficeSpreadsheetCollaborationBinding, spreadsheetConditionalIconForValue, spreadsheetUnderlineStyle, sheetProtectionAuthority, normalizeXlsxGradientFill, xlsxGradientFillFallbackColor, editableRangeCellCount, registerDerivedSpreadsheetMatrix, deleteXlsxNativeFills, spreadsheetTextOrientationCellStyle, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, normalizeSheetProtectionAuthority, spreadsheetProtectionKey, SPREADSHEET_CONDITIONAL_COMPARISON_OPERATORS, normalizeXlsxRichTextRun, spreadsheetDiagonalBorderFromCellValue, SPREADSHEET_CONDITIONAL_ICON_SETS, isLowSurrogate, spreadsheetConditionalComparisonNeedsUpperValue, drawSpreadsheetConditionalIcon, coalesceXlsxRichTextRuns, replaceOfficeSpreadsheetCollaboration as replaceWorkOfficeSpreadsheetCollaboration, validXlsxRichText, isSpreadsheetUnderlineStyle } from "./1544.js";
|
|
8
8
|
import { workSpreadsheetChartSupportsGrouping, spreadsheetFormulaRangesForSelection, createSpreadsheetChartFromSelection, normalizeWorkSpreadsheetDataLabelPosition, normalizeSpreadsheetPrintTitleColumns, normalizeSpreadsheetPrintTitleRows, formulaHasStructuredReference, normalizeWorkSpreadsheetErrorBars, defaultPivotValueCaption, workSpreadsheetChartSupportsBarSpacing, normalizeWorkSpreadsheetChartGrouping, spreadsheetGridSize, normalizeWorkSpreadsheetChartAxisGroup, normalizeWorkSpreadsheetScatterStyle, cloneSparseMatrix, spreadsheetPivotAggregationLabel, workSpreadsheetChartAxisIsCategoryAxis, reconcileSpreadsheetChartPreviews, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetChartLegendPosition, spreadsheetChartCount, workSpreadsheetChartTypeLabel, sparseArrayEntries, normalizeWorkSpreadsheetTrendline, effectiveSpreadsheetCalculationSettings, spreadsheetPivotIntersects, normalizeWorkSpreadsheetDataLabels, spreadsheetPivotOutputContains, normalizeSpreadsheetPrintArea, spreadsheetCellAddress, formatSpreadsheetCellRanges, normalizeWorkSpreadsheetChartLayout, spreadsheetFormulaRangeForCell, workSpreadsheetChartAxisIsValueAxis, normalizeWorkSpreadsheetChartSmoothLines, spreadsheetPivotFilterValueKey, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetChartSeriesStyle, volatileSpreadsheetFormulaFunctions, sparseArrayIndexes, normalizeWorkSpreadsheetBubbleSizeRepresents, workSpreadsheetChartSupportsTrendlines, normalizeWorkSpreadsheetChartLegendOverlay, parseSpreadsheetChartReference, workSpreadsheetChartGroupingIsStacked, normalizeWorkSpreadsheetChartGapWidth, workSpreadsheetChartSupportsSmoothLines, refreshSpreadsheetPivotTables, createSpreadsheetPivotFromSelection, reconcileSpreadsheetPivots, spreadsheetPivotCount, sparseMatrixColumnCount, workSpreadsheetChartSupportsErrorBars, formulaHasExternalReference, isValidSpreadsheetDefinedName, spreadsheetPivotValidation, deleteSpreadsheetPivotTable, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartSupportsSeriesAnalysis, parseSpreadsheetCellRanges, spreadsheetPivotFilterItems, spreadsheetPivotFields, normalizeWorkSpreadsheetChartOverlap, spreadsheetFormulaRangeConflict, spreadsheetSheetsWithChartPreviews, workSpreadsheetChartUsesNumericXAxis, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartSupportsAxes, normalizeWorkSpreadsheetCombinationSeriesType, normalizeWorkSpreadsheetRadarStyle } from "./8715.js";
|
|
9
9
|
import { moveOfficeMenuFocus, stepOfficeZoom, useOfficeRemoteParticipants, Popover, officePresenceColor, useOfficePublishPresenceLocation, button_Button, icon_button_IconButton, moveOfficeGridMenuFocus, office_text_field_OfficeTextField, useDialogFocusScope, useOfficeEditorWheelZoom } from "./0~6090.js";
|
|
10
|
-
import { normalizeCssColor } from "./
|
|
10
|
+
import { isOfficeKernelSpreadsheetError, normalizeCssColor, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, createOfficeId as createWorkId } from "./4121.js";
|
|
11
11
|
import { useOfficeTaskPaneEscape, OfficeCheckbox, CommittedOfficeNumberField, useOfficeDialog, useOfficeTaskPaneModal, createOfficeKernelClient, officeFontFamilies, CollectionState, OfficeNumberField, handleOfficeTaskPaneKeyDown } from "./0~7048.js";
|
|
12
12
|
import { isOfficeShortcutBlocked, OfficeColorPicker } from "./0~3635.js";
|
|
13
13
|
import { createOfficeEditorExtension, useOfficeEditorRuntime, useOfficeEditorKeyboardShortcuts } from "./0~3557.js";
|
|
14
|
-
import { OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, createOfficeId as createWorkId, isOfficeKernelSpreadsheetError } from "./5184.js";
|
|
15
14
|
import { showToast } from "./6489.js";
|
|
16
15
|
import { unsupportedSpreadsheetFormulaFunctions } from "./0~work-spreadsheet-formula-support.js";
|
|
17
16
|
import { WorkspaceContextMenu, isWorkspaceContextMenuKeyboardEvent, WorkOfficeZoomControls, Tabs, WorkOfficeStatusBar, Dialog, WorkOfficeRibbon, workspaceContextMenuPosition, OfficeSelect, WorkOfficeRibbonGroup, WorkOfficeRibbonButton, WorkOfficePreviewBar } from "./0~4595.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import jszip from "jszip";
|
|
2
|
-
import { normalizeDocumentBookmarkName, normalizeDocumentEmphasisMark, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, applyDocumentImageIdentityToElement, documentEmphasisMarkFromElement, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, documentScriptFontSlotFromElement, normalizeDocumentColumns, createDocumentImageIdentityRegistry, serializeDocumentScriptFonts, documentCharacterSpacingTwipsFromElement, uniqueDocumentParagraphIdentity, documentCharacterPositionHalfPointsFromElement, normalizeDocumentTableVerticalAlign, documentTableColumnPercentagesFromElement, normalizeDocumentTextCase, documentTableCellMarginOverridesFromElement, applyDocumentTableRowIdentityToElement, normalizeDocumentBookmarksHtml, documentImageIdentityFromElement, documentTableGeometryFromElement, normalizeDocumentTableRowHeightRule, normalizeDocumentScriptFonts, documentNoteKey, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, normalizeDocumentHiddenText,
|
|
3
|
-
import { serializeUtf8Xml,
|
|
2
|
+
import { normalizeDocumentBookmarkName, normalizeDocumentEmphasisMark, DOCUMENT_STRIKE_STYLE_ATTRIBUTE, applyDocumentImageIdentityToElement, documentEmphasisMarkFromElement, DOCUMENT_PAGE_BORDER_EDGES, DOCUMENT_UNDERLINE_STYLE_ATTRIBUTE, documentScriptFontSlotFromElement, normalizeDocumentColumns, createDocumentImageIdentityRegistry, serializeDocumentScriptFonts, documentCharacterSpacingTwipsFromElement, uniqueDocumentParagraphIdentity, documentCharacterPositionHalfPointsFromElement, normalizeDocumentTableVerticalAlign, documentTableColumnPercentagesFromElement, normalizeDocumentTextCase, documentTableCellMarginOverridesFromElement, applyDocumentTableRowIdentityToElement, normalizeDocumentBookmarksHtml, documentImageIdentityFromElement, documentTableGeometryFromElement, normalizeDocumentTableRowHeightRule, normalizeDocumentScriptFonts, documentNoteKey, DOCUMENT_LEGACY_TEXT_EMBOSS_ATTRIBUTE, normalizeDocumentHiddenText, documentLegacyTextEffectsConflict, normalizeDocumentTableBorderWidth, normalizeDocumentCharacterSpacingTwips, normalizeDocumentParagraphId, documentStrikeFormattingFromElement, normalizeDocumentTableBorderStyle, normalizeDocumentBookmarkReferencesHtml, documentCitationInstruction, documentImageWrapContourFromElement, documentImagePositionFromElement, normalizeDocumentCharacterScalePercent, documentScriptFontsFromElement, normalizeDocumentUnderlineStyle, documentPageMarginsForLayout, normalizeDocumentPageChrome, normalizeDocumentImageLayer, documentFontNameFromCssFamily, documentKerningThresholdHalfPointsFromElement, documentImageCropFromElement, documentBookmarkReferenceInstruction, normalizeDocumentPageBorders, documentImageLayerFromElement, normalizeDocumentLegacyTextEffects, documentCaptionLabel, documentCaptionKind, applyDocumentParagraphIdentityToElement, DOCUMENT_LEGACY_TEXT_IMPRINT_ATTRIBUTE, isContourImageLayout, parseDocumentScriptFonts, normalizeDocumentStrikeStyle, normalizeDocumentImageIdentity, createDocumentParagraphIdentityRegistry, documentCitationTags, docxDocumentFieldKind, normalizeTableColor, documentTableBordersFromElement, documentSections, wrapsBesideImage, normalizeDocumentCharacterPositionHalfPoints, normalizeDocumentKerningThresholdHalfPoints, defaultDocumentImageWrapContour, normalizeDocumentParagraphIdentity, normalizeDocumentPaperSource, DOCUMENT_LEGACY_TEXT_OUTLINE_ATTRIBUTE, documentEquationFromElement, documentLegacyTextEffectsFromElement, parseDocumentCharacterFormatting, documentScriptFontFamily, documentParagraphIdentityFromElement, DOCUMENT_LEGACY_TEXT_SHADOW_ATTRIBUTE, normalizeDocumentEquation, documentUnderlineFormattingFromElement, normalizeDocumentBookmarkNativeId, parseDocumentParagraphShadingElement, DOCUMENT_PAGE_MARGIN_KEYS, uniqueDocumentImageIdentity, documentHiddenTextFromElement, parseDocumentParagraphFormatting, documentImageLayoutFromElement, documentScriptFontSlotFromHint, documentTableRowIdentityFromElement, documentPageHorizontalMarginTwips, collectDocumentNotes, documentPageGeometryForLayout, normalizeDocumentScriptFontSlot, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, documentCharacterScalePercentFromElement, normalizeDocumentPageMargins, normalizeDocumentLegacyTextEffect, documentNoteKind } from "./6282.js";
|
|
3
|
+
import { normalizeDocumentParagraphBorders, serializeUtf8Xml, DOCUMENT_PARAGRAPH_BORDER_EDGES, normalizeDocumentRunBorder, parseDocumentRunBorder, parseXml, decodeXmlBytes, parseDocxThemeReference, patchDocxThemeReferences, descendants, resolvePartTarget, attribute as work_ooxml_package_attribute, parseDocumentParagraphBordersElement, DOCUMENT_RUN_BORDER_ATTRIBUTE, directChildren, xmlNamespacePrefix, parseDocumentRunBorderElement, DocxThemePatchCollector, directChild } from "./4121.js";
|
|
4
4
|
import { assignDocxNoteIds, patchDocxPageColor, normalizeDocxCommentId, assignDocxCommentThreads } from "./0~4980.js";
|
|
5
5
|
import { paragraphTabStops, mergeDocxIgnorableExtensionsAtPairs, patchDocxBibliography, docxKerningThresholdValue, docxCharacterPositionValue, docxCharacterScaleValue, docxEmphasisMarkRunOptions, XMLNS_NAMESPACE as work_docx_settings_xml_XMLNS_NAMESPACE, paragraphAlignment, paragraphSpacingOptions, xmlNamespaceUri, hasNonWhitespaceXmlText, patchDocxExplicitZeroCharacterSpacing, cloneXmlElement, cssColorToHex, DocxParagraphDefaultCollapsedPatchCollector, assertXmlRoot, xmlDeclaredPrefix, paragraphIndent, domDirection, DOCX_WORDPROCESSING_NAMESPACES, paragraphBidirectional, XML_NAMESPACE as work_docx_settings_xml_XML_NAMESPACE, patchDocxParagraphDefaultCollapsed, xmlAttributeNamespace, dataBoolean, mergeDocxIgnorableExtensions, patchDocxExplicitZeroKerningThresholds, parseDocxColorSchemeMappingElement, paragraphPaginationOptions, DOCX_COLOR_SCHEME_MAPPING_ATTRIBUTES, xmlAttributeLocalName, cssFontSize, paragraphDirectionOptions, cssFontFamily, docxCharacterSpacingValue } from "./0~7043.js";
|
|
6
6
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
@@ -2513,9 +2513,29 @@ function appendFormattingProperties(document, properties, namespace, prefix, ser
|
|
|
2513
2513
|
appendFontSizeProperties(document, properties, namespace, prefix, byType.get('textStyle'));
|
|
2514
2514
|
appendHighlightProperty(document, properties, namespace, prefix, byType.get('highlight'));
|
|
2515
2515
|
appendUnderlineProperty(document, properties, namespace, prefix, byType.get('underline'));
|
|
2516
|
+
appendRunBorderProperty(document, properties, namespace, prefix, byType.get('textStyle'));
|
|
2516
2517
|
appendVerticalAlignProperty(document, properties, namespace, prefix, byType);
|
|
2517
2518
|
appendEmphasisMarkProperty(document, properties, namespace, prefix, byType.get('textStyle'));
|
|
2518
2519
|
}
|
|
2520
|
+
function appendRunBorderProperty(document, properties, namespace, prefix, mark) {
|
|
2521
|
+
const border = parseDocumentRunBorder(mark?.attrs?.runBorder);
|
|
2522
|
+
if (!border) return;
|
|
2523
|
+
const element = wordElement(document, namespace, prefix, 'bdr');
|
|
2524
|
+
work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'val', border.style);
|
|
2525
|
+
if (border.color) {
|
|
2526
|
+
work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'color', 'auto' === border.color.value ? 'auto' : border.color.value.slice(1).toUpperCase());
|
|
2527
|
+
if (border.color.theme) {
|
|
2528
|
+
work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeColor', border.color.theme.theme);
|
|
2529
|
+
if (border.color.theme.tint) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeTint', border.color.theme.tint);
|
|
2530
|
+
if (border.color.theme.shade) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'themeShade', border.color.theme.shade);
|
|
2531
|
+
}
|
|
2532
|
+
}
|
|
2533
|
+
if (void 0 !== border.size) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'sz', String(border.size));
|
|
2534
|
+
if (void 0 !== border.space) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'space', String(border.space));
|
|
2535
|
+
if (void 0 !== border.shadow) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'shadow', border.shadow ? '1' : '0');
|
|
2536
|
+
if (void 0 !== border.frame) work_docx_format_change_export_setWordAttribute(element, namespace, prefix, 'frame', border.frame ? '1' : '0');
|
|
2537
|
+
properties.append(element);
|
|
2538
|
+
}
|
|
2519
2539
|
function appendLegacyTextEffectsProperties(document, properties, namespace, prefix, mark) {
|
|
2520
2540
|
const effects = {};
|
|
2521
2541
|
const attributes = [
|
|
@@ -7828,6 +7848,110 @@ function setWordFontAttribute(element, name, value) {
|
|
|
7828
7848
|
const prefix = element.prefix || 'w';
|
|
7829
7849
|
element.setAttributeNS(namespace, `${prefix}:${name}`, value);
|
|
7830
7850
|
}
|
|
7851
|
+
const work_docx_run_border_export_WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
7852
|
+
class DocxRunBorderPatchCollector {
|
|
7853
|
+
patches = [];
|
|
7854
|
+
nextMarker = 1;
|
|
7855
|
+
usedColors;
|
|
7856
|
+
constructor(sourceHtml){
|
|
7857
|
+
this.usedColors = work_docx_run_border_export_sourceColors(sourceHtml);
|
|
7858
|
+
}
|
|
7859
|
+
marker(source) {
|
|
7860
|
+
const border = normalizeDocumentRunBorder(source);
|
|
7861
|
+
if (!border) return null;
|
|
7862
|
+
let marker = '';
|
|
7863
|
+
do {
|
|
7864
|
+
const value = 0xc00000 + this.nextMarker;
|
|
7865
|
+
if (value > 0xcfffff) throw new Error('DOCX character border marker space is exhausted.');
|
|
7866
|
+
marker = value.toString(16).padStart(6, '0').toUpperCase();
|
|
7867
|
+
this.nextMarker += 1;
|
|
7868
|
+
}while (this.usedColors.has(marker))
|
|
7869
|
+
this.usedColors.add(marker);
|
|
7870
|
+
this.patches.push({
|
|
7871
|
+
marker,
|
|
7872
|
+
border
|
|
7873
|
+
});
|
|
7874
|
+
return marker;
|
|
7875
|
+
}
|
|
7876
|
+
hasMarker(value) {
|
|
7877
|
+
const marker = value?.toUpperCase();
|
|
7878
|
+
return Boolean(marker && this.patches.some((patch)=>patch.marker === marker));
|
|
7879
|
+
}
|
|
7880
|
+
}
|
|
7881
|
+
function documentRunBorderDocxOptions(source, collector) {
|
|
7882
|
+
const marker = collector.marker(source);
|
|
7883
|
+
return marker ? {
|
|
7884
|
+
border: {
|
|
7885
|
+
style: 'single',
|
|
7886
|
+
color: marker,
|
|
7887
|
+
size: 2,
|
|
7888
|
+
space: 0
|
|
7889
|
+
}
|
|
7890
|
+
} : {};
|
|
7891
|
+
}
|
|
7892
|
+
async function patchDocxRunBorders(buffer, patches) {
|
|
7893
|
+
if (!patches.length) return buffer;
|
|
7894
|
+
const archive = await jszip.loadAsync(buffer);
|
|
7895
|
+
const byMarker = new Map(patches.map((patch)=>[
|
|
7896
|
+
patch.marker,
|
|
7897
|
+
patch
|
|
7898
|
+
]));
|
|
7899
|
+
const applied = new Set();
|
|
7900
|
+
for (const entry of Object.values(archive.files)){
|
|
7901
|
+
if (entry.dir || !/^word\/(?:document|header\d+|footer\d+|footnotes|endnotes|comments)\.xml$/i.test(entry.name)) continue;
|
|
7902
|
+
const document = parseXml(await entry.async('text'), entry.name);
|
|
7903
|
+
let changed = false;
|
|
7904
|
+
for (const element of Array.from(document.getElementsByTagName('*'))){
|
|
7905
|
+
if ('bdr' !== element.localName || element.namespaceURI !== work_docx_run_border_export_WORD_NAMESPACE || element.parentElement?.localName !== 'rPr') continue;
|
|
7906
|
+
const marker = work_docx_run_border_export_wordAttribute(element, 'color')?.toUpperCase();
|
|
7907
|
+
const patch = marker ? byMarker.get(marker) : void 0;
|
|
7908
|
+
if (marker && patch) {
|
|
7909
|
+
replaceRunBorderAttributes(document, element, patch.border);
|
|
7910
|
+
applied.add(marker);
|
|
7911
|
+
changed = true;
|
|
7912
|
+
}
|
|
7913
|
+
}
|
|
7914
|
+
if (changed) archive.file(entry.name, serializeUtf8Xml(document));
|
|
7915
|
+
}
|
|
7916
|
+
const missing = patches.filter((patch)=>!applied.has(patch.marker));
|
|
7917
|
+
if (missing.length) throw new Error(`Generated DOCX is missing ${missing.length} character border marker(s).`);
|
|
7918
|
+
return archive.generateAsync({
|
|
7919
|
+
type: 'arraybuffer'
|
|
7920
|
+
});
|
|
7921
|
+
}
|
|
7922
|
+
function setDocxRunBorderAttributes(document, element, border) {
|
|
7923
|
+
work_docx_run_border_export_setWordAttribute(document, element, 'val', border.style);
|
|
7924
|
+
const color = border.color;
|
|
7925
|
+
if (color) {
|
|
7926
|
+
work_docx_run_border_export_setWordAttribute(document, element, 'color', 'auto' === color.value ? 'auto' : color.value.slice(1).toUpperCase());
|
|
7927
|
+
if (color.theme) {
|
|
7928
|
+
work_docx_run_border_export_setWordAttribute(document, element, 'themeColor', color.theme.theme);
|
|
7929
|
+
if (color.theme.tint) work_docx_run_border_export_setWordAttribute(document, element, 'themeTint', color.theme.tint);
|
|
7930
|
+
if (color.theme.shade) work_docx_run_border_export_setWordAttribute(document, element, 'themeShade', color.theme.shade);
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
if (void 0 !== border.size) work_docx_run_border_export_setWordAttribute(document, element, 'sz', String(border.size));
|
|
7934
|
+
if (void 0 !== border.space) work_docx_run_border_export_setWordAttribute(document, element, 'space', String(border.space));
|
|
7935
|
+
if (void 0 !== border.shadow) work_docx_run_border_export_setWordAttribute(document, element, 'shadow', border.shadow ? '1' : '0');
|
|
7936
|
+
if (void 0 !== border.frame) work_docx_run_border_export_setWordAttribute(document, element, 'frame', border.frame ? '1' : '0');
|
|
7937
|
+
}
|
|
7938
|
+
function replaceRunBorderAttributes(document, element, border) {
|
|
7939
|
+
for (const attribute of Array.from(element.attributes))if ('xmlns' !== attribute.name && !attribute.name.startsWith('xmlns:')) element.removeAttributeNode(attribute);
|
|
7940
|
+
element.replaceChildren();
|
|
7941
|
+
setDocxRunBorderAttributes(document, element, border);
|
|
7942
|
+
}
|
|
7943
|
+
function work_docx_run_border_export_sourceColors(source) {
|
|
7944
|
+
const colors = new Set();
|
|
7945
|
+
for (const match of source.matchAll(/#([0-9a-f]{6})\b/gi))if (match[1]) colors.add(match[1].toUpperCase());
|
|
7946
|
+
return colors;
|
|
7947
|
+
}
|
|
7948
|
+
function work_docx_run_border_export_wordAttribute(element, name) {
|
|
7949
|
+
return element.getAttributeNS(work_docx_run_border_export_WORD_NAMESPACE, name) ?? element.getAttribute(`w:${name}`);
|
|
7950
|
+
}
|
|
7951
|
+
function work_docx_run_border_export_setWordAttribute(document, element, name, value) {
|
|
7952
|
+
const prefix = xmlNamespacePrefix(document.documentElement, work_docx_run_border_export_WORD_NAMESPACE) ?? 'w';
|
|
7953
|
+
element.setAttributeNS(work_docx_run_border_export_WORD_NAMESPACE, `${prefix}:${name}`, value);
|
|
7954
|
+
}
|
|
7831
7955
|
async function createDocxBlob(content, sourcePackage) {
|
|
7832
7956
|
const docx = await import("docx");
|
|
7833
7957
|
const normalizedContent = {
|
|
@@ -7865,6 +7989,8 @@ async function createDocxBlob(content, sourcePackage) {
|
|
|
7865
7989
|
runFontPatches: new DocxRunFontsPatchCollector(JSON.stringify(normalizedContent)),
|
|
7866
7990
|
hiddenTextPatches: new DocxHiddenTextPatchCollector(JSON.stringify(normalizedContent)),
|
|
7867
7991
|
legacyTextEffectsPatches: new DocxLegacyTextEffectsPatchCollector(JSON.stringify(normalizedContent)),
|
|
7992
|
+
runBorderPatches: new DocxRunBorderPatchCollector(JSON.stringify(normalizedContent)),
|
|
7993
|
+
usedRunBorderMarkers: new Set(),
|
|
7868
7994
|
usedNativeTextEffectMarkers: new Set(),
|
|
7869
7995
|
paragraphFormattingChangePatches: new DocxParagraphFormattingChangePatchCollector(),
|
|
7870
7996
|
hasExplicitZeroCharacterSpacing: false,
|
|
@@ -7920,7 +8046,8 @@ async function createDocxBlob(content, sourcePackage) {
|
|
|
7920
8046
|
const runFontsPatched = await patchDocxRunFonts(kerningPatched, noteContext.runFontPatches.patches);
|
|
7921
8047
|
const hiddenTextPatched = await patchDocxHiddenText(runFontsPatched, noteContext.hiddenTextPatches.patches.filter((patch)=>noteContext.usedNativeTextEffectMarkers.has(patch.marker)));
|
|
7922
8048
|
const legacyTextEffectsPatched = await patchDocxLegacyTextEffects(hiddenTextPatched, noteContext.legacyTextEffectsPatches.patches.filter((patch)=>noteContext.usedNativeTextEffectMarkers.has(patch.marker)));
|
|
7923
|
-
const
|
|
8049
|
+
const runBordersPatched = await patchDocxRunBorders(legacyTextEffectsPatched, noteContext.runBorderPatches.patches.filter((patch)=>noteContext.usedRunBorderMarkers.has(patch.marker)));
|
|
8050
|
+
const formattingChangesPatched = await patchDocxRunFormattingChanges(runBordersPatched, noteContext.formattingChangePatches.patches);
|
|
7924
8051
|
const noteImageRelationshipsPatched = await patchDocxNoteImageRelationships(formattingChangesPatched);
|
|
7925
8052
|
const commentMetadataPatched = await patchDocxCommentMetadata(noteImageRelationshipsPatched, commentThreads);
|
|
7926
8053
|
const numberingPatched = await patchDocxNumberingRestartRules(commentMetadataPatched, noteContext.numberingRestartRules);
|
|
@@ -8001,6 +8128,10 @@ function markDocxNativeTextEffectStyleUsed(style, context) {
|
|
|
8001
8128
|
break;
|
|
8002
8129
|
}
|
|
8003
8130
|
}
|
|
8131
|
+
function markDocxRunBorderUsed(border, context) {
|
|
8132
|
+
const marker = border?.color?.toUpperCase();
|
|
8133
|
+
if (context.runBorderPatches.hasMarker(marker)) context.usedRunBorderMarkers.add(marker);
|
|
8134
|
+
}
|
|
8004
8135
|
function work_docx_export_sectionProperties(layout, docx) {
|
|
8005
8136
|
const landscape = 'landscape' === layout.orientation;
|
|
8006
8137
|
const dimensions = documentPageGeometryForLayout(layout);
|
|
@@ -8171,6 +8302,7 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
|
|
|
8171
8302
|
if (node.nodeType === Node.TEXT_NODE) {
|
|
8172
8303
|
if (!node.textContent) return [];
|
|
8173
8304
|
markDocxNativeTextEffectStyleUsed(inherited.style, noteContext);
|
|
8305
|
+
markDocxRunBorderUsed(inherited.border, noteContext);
|
|
8174
8306
|
if (revision?.kind === 'insertion') return [
|
|
8175
8307
|
new docx.InsertedTextRun({
|
|
8176
8308
|
...inherited,
|
|
@@ -8250,6 +8382,9 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
|
|
|
8250
8382
|
const explicitLegacyTextEffects = hasExplicitLegacyTextEffects ? documentLegacyTextEffectsFromElement(node) : {};
|
|
8251
8383
|
if (hasExplicitLegacyTextEffects && !explicitLegacyTextEffects) throw new Error('Document contains invalid legacy text effects.');
|
|
8252
8384
|
const explicitCharacterPosition = documentCharacterPositionHalfPointsFromElement(node);
|
|
8385
|
+
const hasExplicitRunBorder = 'span' === tag && (node.hasAttribute(DOCUMENT_RUN_BORDER_ATTRIBUTE) || Boolean(node.style.borderStyle));
|
|
8386
|
+
const explicitRunBorder = hasExplicitRunBorder ? parseDocumentRunBorderElement(node) : null;
|
|
8387
|
+
if (hasExplicitRunBorder && !explicitRunBorder) throw new Error('Document contains an invalid character border.');
|
|
8253
8388
|
if (0 === explicitCharacterSpacing) noteContext.hasExplicitZeroCharacterSpacing = true;
|
|
8254
8389
|
if (0 === explicitKerningThreshold) noteContext.hasExplicitZeroKerningThreshold = true;
|
|
8255
8390
|
const characterSpacing = null === explicitCharacterSpacing ? inherited.characterSpacing : docxCharacterSpacingValue(explicitCharacterSpacing);
|
|
@@ -8274,6 +8409,7 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
|
|
|
8274
8409
|
const underline = docxUnderlineRunOptions(node, inherited.underline, noteContext.themePatches);
|
|
8275
8410
|
const strike = docxStrikeRunOptions(node, inherited);
|
|
8276
8411
|
const scriptFontMarker = noteContext.runFontPatches.marker(documentScriptFontsFromElement(node), documentScriptFontSlotFromElement(node), node.style.fontFamily);
|
|
8412
|
+
const runBorder = explicitRunBorder ? documentRunBorderDocxOptions(explicitRunBorder, noteContext.runBorderPatches).border : inherited.border;
|
|
8277
8413
|
const style = {
|
|
8278
8414
|
...inherited,
|
|
8279
8415
|
style: nativeTextEffectStyle,
|
|
@@ -8293,6 +8429,7 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
|
|
|
8293
8429
|
kern,
|
|
8294
8430
|
position,
|
|
8295
8431
|
emphasisMark,
|
|
8432
|
+
border: runBorder,
|
|
8296
8433
|
shading: themeFillMarker ? {
|
|
8297
8434
|
fill: themeFillMarker
|
|
8298
8435
|
} : resolvedShading,
|
|
@@ -8302,6 +8439,7 @@ async function work_docx_export_inlineRuns(root, docx, noteContext) {
|
|
|
8302
8439
|
};
|
|
8303
8440
|
if ('br' === tag) {
|
|
8304
8441
|
markDocxNativeTextEffectStyleUsed(style.style, noteContext);
|
|
8442
|
+
markDocxRunBorderUsed(style.border, noteContext);
|
|
8305
8443
|
return [
|
|
8306
8444
|
new docx.TextRun({
|
|
8307
8445
|
...style,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import jszip from "jszip";
|
|
2
|
-
import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, descendants, directChild, attribute as work_ooxml_package_attribute } from "./
|
|
3
|
-
import { normalizeDocumentBookmarkName, renderDocumentTableCellMarginOverrides, applyDocumentImageIdentityToElement, documentCharacterPositionDomAttributes, createDocumentImageIdentityRegistry, normalizeDocumentColumns, documentStrikeDomAttributes, normalizeDocumentImageWrapContour, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, normalizeDocumentBookmarksHtml, applyDocumentTableRowIdentityToElement, normalizeDocumentCaptionsHtml, documentCharacterSpacingDomAttributes, normalizeDocumentImageAlignment, normalizeDocumentParagraphId, applyDocumentImageLayerToElement, normalizeDocumentNotesHtml, normalizeDocumentBookmarkReferencesHtml, documentCitationTagsFromInstruction, applyDocumentImageWrapContourToElement, documentUnderlineDomAttributes, documentHiddenTextDomAttributes, normalizeDocumentPageChrome, normalizeDocumentImageLayoutOptions, applyDocumentImageCropToElement, documentPageMarginsForLayout, applyDocumentPageGeometry, createDocumentNoteElement, normalizeDocumentImageLayer, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, documentBookmarkReferenceInstruction, documentInitialSectionLayout, normalizeDocumentFieldsHtml, documentCaptionLabel, documentTableBordersFromElement, isContourImageLayout, normalizeDocumentCitationsHtml, normalizeDocumentImageIdentity, normalizeDocumentImageWrapSide, applyDocumentParagraphIdentityToElement, documentKerningDomAttributes, docxDocumentFieldKind,
|
|
4
|
-
import { markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, resolveDocxLegacyTextEffects, hasImportedDocxParagraphSpacingMarkers, docxTablePropertySources, parseDocxPageMargins, parseDirectDocxParagraphShading, markDocxPackageEquations, parseDocxPageGeometry, markDocxParagraphIndents, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers, applyImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphTabStopMarkers, docxCaptionSequenceKind, applyImportedDocxRunFormattingMarkers, markDocxParagraphAlignments, markDocxParagraphDirections, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphFormattingChangeMarkers, resolveDocxHiddenText, docxEquationHtml, docxFieldOccurrences, hasImportedDocxParagraphAlignmentMarkers, markDocxParagraphTabStops, applyImportedDocxParagraphIndentMarkers, resolveDocxTableStyleResolver, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphAlignmentMarkers, importedDocxUnderline, markDocxParagraphBorders, markDocxParagraphPagination, docxFieldOccurrenceIsInlineEditable, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphPaginationMarkers, docxRunPropertySources, markDocxParagraphFormattingChanges, markDocxParagraphShading, parseDocxPageBorders } from "./0~5093.js";
|
|
2
|
+
import { documentRunBorderDomAttributes, contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, documentParagraphBordersDomAttributes, descendants, directChild, attribute as work_ooxml_package_attribute, serializeDocxThemeReference } from "./4121.js";
|
|
3
|
+
import { normalizeDocumentBookmarkName, renderDocumentTableCellMarginOverrides, applyDocumentImageIdentityToElement, documentCharacterPositionDomAttributes, createDocumentImageIdentityRegistry, normalizeDocumentColumns, documentStrikeDomAttributes, normalizeDocumentImageWrapContour, DOCUMENT_TABLE_ROW_ID_ATTRIBUTE, normalizeDocumentBookmarksHtml, applyDocumentTableRowIdentityToElement, normalizeDocumentCaptionsHtml, documentCharacterSpacingDomAttributes, normalizeDocumentImageAlignment, normalizeDocumentParagraphId, applyDocumentImageLayerToElement, normalizeDocumentNotesHtml, normalizeDocumentBookmarkReferencesHtml, documentCitationTagsFromInstruction, applyDocumentImageWrapContourToElement, documentUnderlineDomAttributes, documentHiddenTextDomAttributes, normalizeDocumentPageChrome, normalizeDocumentImageLayoutOptions, applyDocumentImageCropToElement, documentPageMarginsForLayout, applyDocumentPageGeometry, createDocumentNoteElement, normalizeDocumentImageLayer, DOCUMENT_TABLE_ROW_TEXT_ID_ATTRIBUTE, documentBookmarkReferenceInstruction, documentInitialSectionLayout, normalizeDocumentFieldsHtml, documentCaptionLabel, documentTableBordersFromElement, isContourImageLayout, normalizeDocumentCitationsHtml, normalizeDocumentImageIdentity, normalizeDocumentImageWrapSide, applyDocumentParagraphIdentityToElement, documentKerningDomAttributes, docxDocumentFieldKind, renderDocumentTableBorders, docxBookmarkReferenceTarget, normalizeDocumentImagePosition, wrapsBesideImage, documentPageChromeLegacyFields, documentParagraphShadingDomAttributes, documentCharacterScaleDomAttributes, DEFAULT_DOCUMENT_TABLE_GEOMETRY, documentSectionDomAttributes, DEFAULT_DOCUMENT_TABLE_CELL_MARGINS, normalizeDocumentParagraphIdentity, documentPageMarginBody, documentLegacyTextEffectsDomAttributes, normalizeDocumentTableRowIdentity, normalizeDocumentBookmarkNativeId, uniqueDocumentImageIdentity, applyDocumentTableGeometryToElement, normalizeDocumentImageCrop, documentContentLayoutProperties, documentEmphasisMarkDomAttributes } from "./6282.js";
|
|
4
|
+
import { markDocxRunFormattingIntoState, applyImportedDocxParagraphSpacingMarkers, hasImportedDocxParagraphDirectionMarkers, hasImportedDocxParagraphIndentMarkers, resolveDocxParagraphBordersForParagraph, applyImportedDocxParagraphShadingMarkers, markDocxParagraphSpacing, docxCaptionBookmark, docxFieldResultText, createDocxParagraphStyleResolver, docxTableCellStyleLayers, createImportedDocxRunFormattingMarkerState, parseDocxPaperSource, resolveDocxLegacyTextEffects, hasImportedDocxParagraphSpacingMarkers, docxTablePropertySources, parseDocxPageMargins, parseDirectDocxParagraphShading, markDocxPackageEquations, parseDocxPageGeometry, markDocxParagraphIndents, resolveDocxRunBorder, docxCaptionReferenceTarget, applyImportedDocxEquationMarkers, hasImportedDocxParagraphPaginationMarkers, createDocxTableStyleResolver, hasImportedDocxParagraphShadingMarkers, isDocxEquationLikeRoot, importedDocxStrike, docxTableRunPropertySources, inspectDocxPageMarginSettings, hasImportedDocxRunFormattingMarkers, applyImportedDocxParagraphFormattingChangeMarkers, hasImportedDocxParagraphTabStopMarkers, docxCaptionSequenceKind, applyImportedDocxRunFormattingMarkers, markDocxParagraphAlignments, markDocxParagraphDirections, hasImportedDocxParagraphBorderMarkers, hasImportedDocxParagraphFormattingChangeMarkers, resolveDocxHiddenText, docxEquationHtml, docxFieldOccurrences, hasImportedDocxParagraphAlignmentMarkers, markDocxParagraphTabStops, applyImportedDocxParagraphIndentMarkers, resolveDocxTableStyleResolver, applyImportedDocxParagraphTabStopMarkers, applyImportedDocxParagraphDirectionMarkers, applyImportedDocxParagraphAlignmentMarkers, importedDocxUnderline, markDocxParagraphBorders, markDocxParagraphPagination, docxFieldOccurrenceIsInlineEditable, applyImportedDocxParagraphBorderMarkers, applyImportedDocxParagraphPaginationMarkers, docxRunPropertySources, markDocxParagraphFormattingChanges, markDocxParagraphShading, parseDocxPageBorders } from "./0~5093.js";
|
|
5
5
|
import { readDocxBibliography, XMLNS_NAMESPACE, docxCharacterScalePercentFromProperties, docxCharacterSpacingTwipsFromProperties, parseBoundedDocxInteger, xmlAttributeLocalName, resolveDocxEmphasisMark, createDocxThemeResolver, docxCharacterPositionHalfPointsFromProperties, docxThemeColor, parseDocxParagraphDefaultCollapsed, resolveDocxKerningThresholdHalfPoints, resolveDocxThemeResolver, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace } from "./0~7043.js";
|
|
6
6
|
import { importDocxPageColor, importedDocumentNoteId } from "./0~4980.js";
|
|
7
7
|
const WORD_NAMESPACE = 'http://schemas.openxmlformats.org/wordprocessingml/2006/main';
|
|
@@ -1826,6 +1826,8 @@ async function runHtml(run, field, context) {
|
|
|
1826
1826
|
if (void 0 !== hiddenText) content = `<span${htmlAttributes(documentHiddenTextDomAttributes(hiddenText))}>${content}</span>`;
|
|
1827
1827
|
const legacyTextEffects = resolveDocxLegacyTextEffects(propertySources);
|
|
1828
1828
|
if (legacyTextEffects) content = `<span${htmlAttributes(documentLegacyTextEffectsDomAttributes(legacyTextEffects))}>${content}</span>`;
|
|
1829
|
+
const runBorder = resolveDocxRunBorder(propertySources, context.theme).border;
|
|
1830
|
+
if (runBorder) content = `<span${htmlAttributes(documentRunBorderDomAttributes(runBorder))}>${content}</span>`;
|
|
1829
1831
|
const characterSpacing = docxCharacterSpacingTwipsFromProperties(properties ?? run);
|
|
1830
1832
|
if (void 0 !== characterSpacing) content = `<span${htmlAttributes(documentCharacterSpacingDomAttributes(characterSpacing))}>${content}</span>`;
|
|
1831
1833
|
const color = work_ooxml_package_attribute(directChild(properties ?? run, 'color') ?? run, 'val');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __webpack_require__ } from "./0~rslib-runtime.js";
|
|
2
|
-
import { contentTypeForPart, directChildren, OoxmlPackage, parseXml, firstDescendant, descendants, directChild, xmlContainsAnyElement, attribute } from "./
|
|
3
|
-
import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget,
|
|
4
|
-
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxLegacyTextEffects, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxRunFonts, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, inspectDocxHiddenText, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~5093.js";
|
|
2
|
+
import { contentTypeForPart, directChildren, OoxmlPackage, parseXml, firstDescendant, isDocumentParagraphArtBorderStyle, descendants, directChild, xmlContainsAnyElement, attribute, documentRunBorderIsVisible } from "./4121.js";
|
|
3
|
+
import { normalizeDocumentBookmarkName, docxBookmarkReferenceTarget, normalizeDocumentBookmarkNativeId, DOCUMENT_LEGACY_TEXT_EFFECT_NAMES, supportedDocxBookmarkReferenceInstruction, documentCitationTagsFromInstruction, docxDocumentFieldKind } from "./6282.js";
|
|
4
|
+
import { markDocxParagraphShading, inspectDocxPageSize, docxCaptionBookmark, hasInvalidDocxFieldStructure, inspectDocxLegacyTextEffects, inspectDocxPageMargins, inspectDocxPaperSource, createDocxParagraphStyleResolver, createDocxTableStyleResolver, docxFieldOccurrences, inspectDocxRunFonts, inspectDocxRunBorder, inspectDocxEquation, inspectDocxPageMarginSettings, markDocxParagraphBorders, isSupportedDocxParagraphFormattingChange, docxFieldOccurrenceIsInlineEditable, inspectDocxHiddenText, docxCaptionSequenceKind, inspectDocxPageBorders, isSupportedDocxRunFormattingChange, docxFieldInstructions, isSupportedDocxEquationPlacement } from "./0~5093.js";
|
|
5
5
|
import { normalizeDocumentHref } from "./0~work-document-links.js";
|
|
6
6
|
import { xmlAttributeLocalName, readDocxBibliography, inspectDocxEmphasisMark, createDocxThemeResolver, parseDocxParagraphDefaultCollapsed, DOCX_WORDPROCESSING_NAMESPACES, xmlAttributeNamespace, inspectDocxKerningThresholdHalfPoints } from "./0~7043.js";
|
|
7
7
|
import { updateSpreadsheetWorksheetCompatibilitySummary, inspectXlsxPivotTables, isSupportedXlsxChartLegend, isSupportedXlsxChartPlotLayout, xlsxChartNodeUsesStackedGrouping, isSupportedXlsxChartSeriesFormatting, readXlsxFormulaFeaturesFromPackage, inspectXlsxHeaderFooterText, emptySpreadsheetWorksheetCompatibilitySummary, isSupportedXlsxWorksheetImageContentType, MAX_XLSX_WORKSHEET_IMAGE_BYTES, xlsxChartSeriesFormattingShapeProperties, diagnoseXlsxProtection, isEditableXlsxPaperSizeCode, isSupportedXlsxCombinationChartNodes } from "./4104.js";
|
|
@@ -903,6 +903,48 @@ async function diagnoseDocxRunFonts(archive, document) {
|
|
|
903
903
|
});
|
|
904
904
|
return issues;
|
|
905
905
|
}
|
|
906
|
+
const RUN_BORDER_PART_PATTERN = /^word\/(?:document|styles|header\d*|footer\d*|footnotes|endnotes|comments)\.xml$/i;
|
|
907
|
+
async function diagnoseDocxRunBorders(archive, document) {
|
|
908
|
+
const themePath = archive.paths('word/theme/').find((path)=>/\/theme\d*\.xml$/i.test(path));
|
|
909
|
+
const themeDocument = themePath ? await archive.xml(themePath) : null;
|
|
910
|
+
const settingsDocument = archive.has('word/settings.xml') ? await archive.xml('word/settings.xml') : null;
|
|
911
|
+
const theme = createDocxThemeResolver(themeDocument, settingsDocument);
|
|
912
|
+
const parts = [
|
|
913
|
+
document
|
|
914
|
+
];
|
|
915
|
+
for (const path of archive.paths('word/'))if ('word/document.xml' !== path.toLowerCase() && RUN_BORDER_PART_PATTERN.test(path)) parts.push(await archive.xml(path));
|
|
916
|
+
let validCount = 0;
|
|
917
|
+
let resetCount = 0;
|
|
918
|
+
let invalidCount = 0;
|
|
919
|
+
for (const part of parts){
|
|
920
|
+
for (const properties of descendants(part, 'rPr').filter((element)=>DOCX_WORDPROCESSING_NAMESPACES.has(element.namespaceURI ?? ''))){
|
|
921
|
+
if (!directChildren(properties, 'bdr').length) continue;
|
|
922
|
+
const inspection = inspectDocxRunBorder(properties, theme);
|
|
923
|
+
if ('valid' === inspection.status) {
|
|
924
|
+
validCount += 1;
|
|
925
|
+
if (!documentRunBorderIsVisible(inspection.value)) resetCount += 1;
|
|
926
|
+
} else invalidCount += 1 + inspection.spoofedCount;
|
|
927
|
+
}
|
|
928
|
+
invalidCount += descendants(part, 'bdr').filter((element)=>{
|
|
929
|
+
const parent = element.parentElement;
|
|
930
|
+
return !parent || 'rPr' !== parent.localName || !DOCX_WORDPROCESSING_NAMESPACES.has(parent.namespaceURI ?? '');
|
|
931
|
+
}).length;
|
|
932
|
+
}
|
|
933
|
+
const issues = [];
|
|
934
|
+
if (validCount) issues.push({
|
|
935
|
+
code: 'docx.run-borders',
|
|
936
|
+
severity: 'info',
|
|
937
|
+
feature: 'Character borders',
|
|
938
|
+
message: `${validCount} native character border(s), including ${resetCount} explicit reset(s), were detected across document defaults, styles, body, page chrome, notes, comments, and formatting revisions. Writer preserves all 25 visible Word line styles plus nil and none, direct and theme colors, eighth-point widths, spacing, shadow, and frame semantics through editing, Format Painter, one-step Undo, and exact DOCX export. The browser and PDF paint is a bounded CSS approximation, and no non-standard shortcut is invented.`
|
|
939
|
+
});
|
|
940
|
+
if (invalidCount) issues.push({
|
|
941
|
+
code: 'docx.run-borders.invalid',
|
|
942
|
+
severity: 'warning',
|
|
943
|
+
feature: 'Character borders',
|
|
944
|
+
message: `${invalidCount} malformed, duplicated, misplaced, namespace-spoofed, text-bearing, child-bearing, extra-attribute, art-style, out-of-range, or unresolved-theme character border value(s) are normalized to explicit nil resets instead of enabling untrusted paint or inheriting stale formatting.`
|
|
945
|
+
});
|
|
946
|
+
return issues;
|
|
947
|
+
}
|
|
906
948
|
const SUPPORTED_CHART_ELEMENTS = new Set([
|
|
907
949
|
'barChart',
|
|
908
950
|
'lineChart',
|
|
@@ -1930,6 +1972,7 @@ async function analyzeDocxCompatibility(file, messages, sourcePackage) {
|
|
|
1930
1972
|
issues.push(...await diagnoseDocxEmphasisMarks(archive, document));
|
|
1931
1973
|
issues.push(...await diagnoseDocxHiddenText(archive, document));
|
|
1932
1974
|
issues.push(...await diagnoseDocxLegacyTextEffects(archive, document));
|
|
1975
|
+
issues.push(...await diagnoseDocxRunBorders(archive, document));
|
|
1933
1976
|
issues.push(...await diagnoseDocxRunFonts(archive, document));
|
|
1934
1977
|
}
|
|
1935
1978
|
issues.push(...await diagnoseDocxPageChrome(archive));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import jszip from "jszip";
|
|
2
2
|
import { normalizeRadarStyle, presentationChartShowsLegend, presentationChartAxes, presentationChartBubbleSizes, normalizePresentationBubbleScale, presentationChartUsesNumericXAxis, normalizePresentationBubbleSizeRepresents, normalizePresentationChartLegendPosition, presentationChartXValues, normalizeDoughnutHoleSize, presentationChartSupportsAxisTitles, normalizePresentationScatterStyle } from "./0~work-presentation-charts.js";
|
|
3
|
-
import { directChildren, xmlNamespacePrefix, parseXml, firstDescendant, directChild, descendants, childPath, attribute } from "./
|
|
3
|
+
import { directChildren, xmlNamespacePrefix, parseXml, firstDescendant, directChild, descendants, childPath, attribute } from "./4121.js";
|
|
4
4
|
import { workSpreadsheetChartAxisShowsMajorGridlinesByDefault, workSpreadsheetChartAxisDefaultLabelPosition, workSpreadsheetChartAxisIsCategoryAxis, workSpreadsheetChartAxisIsValueAxis } from "./8715.js";
|
|
5
5
|
import { presentationGroupPath, withPresentationDesign } from "./0~1403.js";
|
|
6
6
|
import { patchPptxChartLayoutAndSeriesStyles, patchPptxTransitions, patchPptxComments, patchPptxChartDataLabels, patchPptxChartSeriesAnalysis } from "./0~7614.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, descendants, directChild, childPath, attribute, createOfficeId as createWorkId } from "./
|
|
1
|
+
import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage, firstDescendant, descendants, directChild, childPath, attribute, createOfficeId as createWorkId } from "./4121.js";
|
|
2
2
|
import { normalizeRadarStyle, normalizePresentationChartLegendPosition, presentationChartUsesNumericXAxis, normalizePresentationBubbleScale, normalizePresentationBubbleSizeRepresents, withPresentationChartLayout, normalizeDoughnutHoleSize, normalizePresentationScatterStyle } from "./0~work-presentation-charts.js";
|
|
3
3
|
import { loadPptxCommentAuthors, readPptxSlideComments, readPptxChartLayoutAndSeriesStyles, readPptxTransition, readPptxChartSeriesAnalysis, readPptxChartDataLabels } from "./0~7614.js";
|
|
4
4
|
import { parseXlsxChartAxes } from "./4104.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { workSpreadsheetChartSupportsErrorBars, normalizeWorkSpreadsheetChartAxes, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetChartLayout, workSpreadsheetChartSupportsTrendlines, workSpreadsheetChartSupportsSeriesAnalysis, normalizeWorkSpreadsheetChartSeriesStyle, normalizeWorkSpreadsheetTrendline } from "./8715.js";
|
|
2
|
-
import { createOfficeId as createWorkId } from "./
|
|
2
|
+
import { createOfficeId as createWorkId } from "./4121.js";
|
|
3
3
|
function chartTypeWithAxes(type) {
|
|
4
4
|
return 'pie' === type || 'doughnut' === type ? 'column' : type;
|
|
5
5
|
}
|
package/dist/1544.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { workOfficeCollaborationJsonEqual, canonicalWorkOfficeCollaborationJson, isWorkOfficeCollaborationRecord, cloneWorkOfficeCollaborationJson } from "./4650.js";
|
|
2
2
|
import { initializeWorkOfficeCollaborationMetadata, assertWorkOfficeCollaborationEditable, OfficeCollaborationError as WorkOfficeCollaborationError, readOfficeCollaborationMetadata as readWorkOfficeCollaborationMetadata, registerWorkOfficeCollaborationInitializer, markWorkOfficeCollaborationInitialized, assertWorkOfficeCollaborationOrigin } from "./9787.js";
|
|
3
|
-
import { directChild, directChildren, descendants, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, attribute, firstDescendant } from "./
|
|
3
|
+
import { directChild, directChildren, descendants, OFFICE_KERNEL_SPREADSHEET_MAX_ROWS, attribute, firstDescendant } from "./4121.js";
|
|
4
4
|
import { sparseMatrixColumnCount, cloneSparseMatrix, sparseArrayEntries as spreadsheet_sparse_sparseArrayEntries, formatSpreadsheetCellRanges, isValidSpreadsheetDefinedName, parseSpreadsheetCellRanges as work_spreadsheet_ranges_parseSpreadsheetCellRanges, sparseArrayIndexes } from "./8715.js";
|
|
5
5
|
import { patchWorkOfficeCollaborationFlatJsonMap, readWorkOfficeCollaborationFlatJsonMap } from "./7060.js";
|
|
6
6
|
import * as __rspack_external_yjs from "yjs";
|
package/dist/4104.js
CHANGED
|
@@ -2,7 +2,7 @@ import jszip from "jszip";
|
|
|
2
2
|
import { MarkdownManager } from "@tiptap/markdown";
|
|
3
3
|
import { getSchema } from "@tiptap/core";
|
|
4
4
|
import { OFFICE_COLLABORATION_PROTOCOL as WORK_OFFICE_COLLABORATION_PROTOCOL, OfficeCollaborationError as WorkOfficeCollaborationError, assertWorkOfficeCollaborationOrigin } from "./9787.js";
|
|
5
|
-
import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage as work_ooxml_package_OoxmlPackage, parseXml, firstDescendant, xmlNamespacePrefix, descendants, directChild, createArtifact as createWorkArtifact, xmlContainsAnyElement, createOfficeId as createWorkId, attribute as work_ooxml_package_attribute } from "./
|
|
5
|
+
import { contentTypeForPart, directChildren, bytesToDataUrl, OoxmlPackage as work_ooxml_package_OoxmlPackage, parseXml, firstDescendant, xmlNamespacePrefix, descendants, directChild, createArtifact as createWorkArtifact, xmlContainsAnyElement, createOfficeId as createWorkId, attribute as work_ooxml_package_attribute } from "./4121.js";
|
|
6
6
|
import { mountWorkLiveDocumentCapture, materializeWorkDocumentContent as work_document_model_codec_materializeWorkDocumentContent, documentPageSurfaceGeometryForElement, createWorkDocumentModel, documentContentLayoutProperties, documentModelForContent, createWorkDocumentExtensions, positionWorkLiveDocumentCapture } from "./6282.js";
|
|
7
7
|
import { normalizeWorkSpreadsheetDataLabels, workSpreadsheetChartSupportsGrouping, normalizeSpreadsheetPrintArea, normalizeWorkSpreadsheetChartLegendPosition, formatSpreadsheetCellRanges, spreadsheetCellAddress, normalizeWorkSpreadsheetChartSmoothLines, spreadsheetFormulaRangeForCell, normalizeWorkSpreadsheetChartColor, readXlsxDrawingAnchor, sparseArrayEntries, qualifySpreadsheetRange, normalizeWorkSpreadsheetBubbleScale, normalizeWorkSpreadsheetChartSeriesStyle, normalizeSpreadsheetPrintTitleRows, normalizeSpreadsheetPrintTitleColumns, spreadsheetPivotFilterValueKey, normalizeWorkSpreadsheetErrorBars, normalizeWorkSpreadsheetBubbleSizeRepresents, workSpreadsheetChartSupportsTrendlines, stripSpreadsheetSheetQualifier, normalizeWorkSpreadsheetChartLegendOverlay, normalizeWorkSpreadsheetChartGapWidth, normalizeWorkSpreadsheetChartGrouping, workSpreadsheetChartSupportsBarSpacing, workSpreadsheetChartSupportsSmoothLines, workSpreadsheetChartGroupingIsStacked, xlsxDrawingAnchorToBounds, xlsxTwoCellAnchorMarkers, workSpreadsheetChartSupportsErrorBars, sparseMatrixColumnCount, refreshSpreadsheetPivotTables, normalizeWorkSpreadsheetChartAxisGroup, isValidSpreadsheetDefinedName, normalizeWorkSpreadsheetScatterStyle, workSpreadsheetChartAxisDefaultLabelPosition, spreadsheetPivotValidation, resolveSpreadsheetChart, parseSpreadsheetCellRanges, workSpreadsheetChartAxisIsCategoryAxis, spreadsheetPivotFields, normalizeWorkSpreadsheetDoughnutHoleSize, normalizeWorkSpreadsheetChartAxes, parseSpreadsheetPrintTitles, spreadsheetFormulaRangeConflict, spreadsheetFormulaForXlsx, editableSpreadsheetFormula, workSpreadsheetChartUsesNumericXAxis, normalizeWorkSpreadsheetChartOverlap, workSpreadsheetChartSupportsAxes, workSpreadsheetChartAxisShowsMajorGridlinesByDefault, normalizeWorkSpreadsheetCombinationSeriesType, effectiveSpreadsheetCalculationSettings, normalizeWorkSpreadsheetTrendline, normalizeWorkSpreadsheetRadarStyle } from "./8715.js";
|
|
8
8
|
import { freezeImportedSpreadsheetCell, readXlsxGradientFill, withXlsxPatternFill, xlsxCellStyleOriginSemanticColors, setXlsxToggleChild, work_xlsx_cell_style_values_xlsxBooleanAttribute, spreadsheetCellValueWithDiagonalBorder, xlsxRichTextCellText, xlsxColorElementMatchesOrigin, ensureXlsxStyleCollection, xlsxSemanticColorOriginKey, applyImportedXlsxRichText, hasXlsxDirectFontStyle, isSpreadsheetConditionalComparisonOperator, xlsxStyleCollectionIndex, spreadsheetExplicitTextOrientationFromCell, readXlsxSemanticColorOrigin, activeXlsxNativeFill, defaultSpreadsheetConditionalIconThresholds, DEFAULT_PROTECTION_HINT, sheetHasXlsxRichTextCells, normalizeSpreadsheetDateValidationBoundary, createXlsxColorResolver, resolveXlsxColor, setXlsxBorderLine, xlsxAlignmentMatches, xlsxBorderLineMatches, xlsxNativeFillKey, defaultXlsxBorder, editableRangeRequiresCredentials, spreadsheetDateValidationFormula, defaultSpreadsheetColorScaleThresholds, writeXlsxAlignment, xlsxGradientFillKey, applyXlsxSemanticColorOrigin, spreadsheetUnderlineCellValueFromXlsx, xlsxWorksheetCellEntries, defaultXlsxFill, spreadsheetConditionalThresholdsEqual, spreadsheetUnderlineCellValueFromSheetJs, xlsxColorMatches, withXlsxCellStyleOrigin, normalizeSpreadsheetPaperSize, normalizeSpreadsheetConditionalVisualOptions, xlsxRichTextStyleOrigins, withXlsxGradientFill, xlsxCellStyleOrigin, directXlsxAlignment, readXlsxPatternFill, spreadsheetTextOrientationFromXlsx, directXlsxFontStyle, registerImportedSpreadsheetMatrix, setXlsxUnderlineChild, readXlsxRichTextCells, xlsxGradientFillFallbackColor, setXlsxColorChild, createXlsxRichTextReadContext, spreadsheetTextOrientationCellStyle, normalizeSpreadsheetConditionalIconSetFormat, defaultSpreadsheetDataBarOptions, prepareXlsxSemanticPalette, normalizeSheetProtectionAuthority, importedSheetProtectionAuthority, spreadsheetDiagonalBorderFromCellValue, xlsxRgbColor, xlsxUnderlineStyle, sheetHasProtectionState, spreadsheetConditionalComparisonNeedsUpperValue, xlsxToggleEnabled, writeXlsxRichTextCells, activeXlsxSemanticColorOrigin, xlsxNativeFillSemanticColors, isSpreadsheetConditionalIconSetName, setXlsxValueChild, spreadsheetConditionalIconSetCount } from "./1544.js";
|
|
@@ -509,7 +509,7 @@ async function importWorkDocumentFile(file, extension, context) {
|
|
|
509
509
|
const importStartedAt = documentImportNow();
|
|
510
510
|
const arrayBuffer = context?.bytes ?? await file.arrayBuffer();
|
|
511
511
|
context?.controller.report('parsing', 0.1);
|
|
512
|
-
const { OoxmlPackage } = await import("./
|
|
512
|
+
const { OoxmlPackage } = await import("./4121.js");
|
|
513
513
|
const packageStartedAt = documentImportNow();
|
|
514
514
|
const sourcePackage = await OoxmlPackage.load(arrayBuffer).catch(()=>null);
|
|
515
515
|
recordDocumentImportMeasure('a3s-office.document.package', packageStartedAt, documentImportNow());
|