oasis-editor 0.0.134 → 0.0.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{OasisEditorApp-B2f15Gpe.js → OasisEditorApp-DPrjPRTW.js} +772 -1033
- package/dist/app/controllers/EditorCommandsController.d.ts +2 -0
- package/dist/app/controllers/documentIO/DocumentImporter.d.ts +3 -1
- package/dist/app/controllers/documentIO/importProgress.d.ts +1 -1
- package/dist/app/controllers/useEditorDocumentIO.d.ts +3 -1
- package/dist/assets/{importDocxWorker-CCwhxVSR.js → importDocxWorker-B0cSSI12.js} +1 -1
- package/dist/core/commands/builtinCommands.d.ts +1 -1
- package/dist/core/commands/image.d.ts +15 -1
- package/dist/core/commands/publicCommandTypes.d.ts +4 -0
- package/dist/core/commands/table/tableCellStyleCommands.d.ts +7 -0
- package/dist/core/lineDash.d.ts +16 -0
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/types/primitives.d.ts +19 -0
- package/dist/core/smallCaps.d.ts +7 -0
- package/dist/core/tableStyleResolver.d.ts +5 -0
- package/dist/export/docx/docxTypes.d.ts +2 -1
- package/dist/export/docx/text/drawingContainerXml.d.ts +7 -1
- package/dist/export/pdf/draw/drawImageObject.d.ts +14 -0
- package/dist/export/pdf/fonts/PdfFontRegistry.d.ts +1 -0
- package/dist/export/pdf/fonts/officeFontAssets.d.ts +2 -0
- package/dist/export/pdf/writer/pdfTypes.d.ts +2 -0
- package/dist/i18n/locales/en.d.ts +19 -2
- package/dist/i18n/locales/pt-BR.d.ts +19 -2
- package/dist/{index-ogn0S9F3.js → index-Cbwb1bgI.js} +3771 -1616
- package/dist/oasis-editor.css +1 -1
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- package/dist/plugins/internal/essentialsCapabilities.d.ts +19 -1
- package/dist/text/fonts/FontMetricsProvider.d.ts +1 -1
- package/dist/text/fonts/core/types.d.ts +1 -1
- package/dist/text/fonts/decoders/WoffDecoder.d.ts +8 -0
- package/dist/text/fonts/preciseFontMetrics.d.ts +9 -0
- package/dist/text/fonts/remoteWebFonts.d.ts +16 -0
- package/dist/ui/OasisEditorAppProps.d.ts +4 -0
- package/dist/ui/OasisEditorEditorProps.d.ts +1 -0
- package/dist/ui/app/buildEditorViewProps.d.ts +1 -0
- package/dist/ui/app/createAppCommandsController.d.ts +2 -0
- package/dist/ui/app/createEditorCommandRuntime.d.ts +1 -0
- package/dist/ui/app/documentFontPreparation.d.ts +23 -0
- package/dist/ui/canvas/canvasFontResolution.d.ts +2 -2
- package/dist/ui/canvas/paragraph/canvasInlineImage.d.ts +1 -1
- package/dist/ui/canvas/paragraph/canvasTextEffects.d.ts +1 -0
- package/dist/ui/components/Toolbar/TableBordersMenu.d.ts +6 -0
- package/dist/ui/components/Toolbar/TableStyleGallery.d.ts +9 -0
- package/dist/ui/components/Toolbar/TableStyleOptions.d.ts +6 -0
- package/dist/ui/components/Toolbar/pictureBorderPresets.d.ts +19 -0
- package/dist/ui/components/Toolbar/presets/defaultToolbar/buttonSpecs.d.ts +1 -0
- package/dist/ui/components/Toolbar/primitives/ColorGrids.d.ts +20 -0
- package/dist/ui/components/Toolbar/primitives/PictureBorderPicker.d.ts +37 -0
- package/dist/ui/components/Toolbar/primitives/WideMenuButton.d.ts +27 -0
- package/dist/ui/components/Toolbar/schema/items.d.ts +23 -1
- package/dist/ui/editorUiTypes.d.ts +1 -0
- package/dist/ui/textMeasurement/fontMetrics.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as
|
|
4
|
+
import { E as EMPTY_PROJECTION_CONTEXT, d as domTextMeasurer, g as getProjectedParagraphBlockHeight, e as estimateTableBlockHeight, p as projectParagraphLayout, a as getPageBodyBottom, b as getPageBodyTop, c as getPageContentWidth, F as FOOTNOTE_MARKER_GUTTER_PX, f as getParagraphText, h as getBlockParagraphs, i as getRunFootnoteReference, l as listReferencedEndnotes, j as getFootnoteDisplayMarker, k as createProjectionContext, m as getDocumentSections, n as getRunField, o as projectBlocksLayout, v as visitRun, q as assertNever, r as createSignal, s as createEditorStateFromDocument, t as createInitialEditorState, S as STANDARD_FONT_SIZES_PT, u as fontSizePxToPt, w as probeLocalFontFamilies, x as createEditorParagraphFromRuns, y as isInlineObjectRun, z as createEditorStyledRun, A as getParagraphLength, B as getActiveZone, C as getActiveSectionIndex, D as getParagraphs, G as normalizeSelection, H as positionToParagraphOffset, I as paragraphOffsetToPosition, J as clampPosition, K as findParagraphIndex, L as createCollapsedSelection, M as isSelectionCollapsed, N as parseFontSizePtToPx, O as formatFontSizePt, P as createEditorParagraph, Q as resolveDefaultParagraphStyleId, R as findParagraphTableLocation, T as buildTableCellLayout, U as PT_PER_PX, V as createEditorTableCell, W as createEditorTableRow, X as createEditorTable, Y as PX_PER_POINT, Z as underlineStyleToCssDecorationStyle, _ as resolveImageSrc, $ as listKindForTag, a0 as isParagraphTag, a1 as collectInlineRuns, a2 as parseParagraphStyle, a3 as getRunImage, a4 as InlineShell, a5 as BalloonShell, a6 as DocumentShell, a7 as createMemo, a8 as getCaretRectFromSnapshot, a9 as getParagraphRectFromSnapshot, aa as createComponent, ab as CaretOverlay, ac as Show, ad as createRenderEffect, ae as style, af as setStyleProperty, ag as setAttribute, ah as memo, ai as template, aj as Button, ak as useI18n, al as createEffect, am as TextField, an as Dialog, ao as insert, ap as className, aq as Grid, ar as SelectField, as as StatusText, at as ColorField, au as UNDERLINE_STYLE_OPTIONS, av as Stack, aw as For, ax as ToggleChip, ay as FormField, az as Checkbox, aA as FieldGroup, aB as Tabs, aC as NumberField, aD as parseNumber, aE as createStore, aF as reconcile, aG as RadioGroup, aH as Radio$1, aI as TextAreaField, aJ as Text, aK as SurfaceButton, aL as delegateEvents, aM as onMount, aN as onCleanup, aO as CheckIcon, aP as use, aQ as PluginUiHost, aR as OasisEditorEditor, aS as OasisBrandMark, aT as setPreciseFontPreference, aU as setWelcomeSeen, aV as enablePreciseFontMode, aW as TWIPS_PER_POINT, aX as PX_PER_INCH, aY as TWIPS_PER_INCH, aZ as normalizeHex6, a_ as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, a$ as TABLE_BORDER_EDGE_KEYS, b0 as resolveEffectiveParagraphStyle, b1 as resolveEffectiveTextStyleForParagraph, b2 as EMU_PER_PT, b3 as OOXML_ROTATION_UNITS, b4 as OOXML_PERCENT_DENOMINATOR, b5 as parseHexColorToRgb255, b6 as EMU_PER_PX, b7 as getRunEndnoteReference, b8 as iterateFootnoteReferenceRuns, b9 as iterateEndnoteReferenceRuns, ba as imageContentTypeDefaults, bb as getRunFieldChar, bc as getRunFieldInstruction, bd as createEditorRun, be as JSZip, bf as imageExtensionFromMime, bg as pxToPt$1, bh as resolveFloatingObjectRect, bi as getTextBoxFloatingGeometry, bj as getPresetPathSegments, bk as buildListLabels, bl as lineDashPatternPt, bm as DEFAULT_FONT_SIZE_PX, bn as resolveGradientAxis, bo as isDoubleUnderlineStyle, bp as isWavyUnderlineStyle, bq as underlineStyleLineWidthPx, br as WAVY_UNDERLINE_WAVELENGTH_PX, bs as WAVY_UNDERLINE_AMPLITUDE_PX, bt as DOUBLE_UNDERLINE_OFFSET_PX, bu as underlineStyleDashArray, bv as EMPHASIS_GLYPH, bw as rgb255ToHex, bx as getImageFloatingGeometry, by as textStyleToFontSizePt, bz as resolveTextAlignmentBaselineOffset, bA as TEXT_BASELINE_RATIO, bB as resolveRenderedTextChar, bC as resolveOpenTypeFeatureTags, bD as isLowercaseSmallCapsChar, bE as resolveDecorationLineY, bF as DOUBLE_STRIKE_OFFSET_PX, bG as resolveListLabel, bH as getListLabelInset, bI as getAlignedListLabelInset, bJ as getParagraphBorderInsets, bK as buildSegmentTable, bL as buildCanvasTableLayout, bM as resolveCanvasTableWidth, bN as resolveFloatingTableRect, bO as paragraphBetweenBorderMatches, bP as normalizeFamily, bQ as ROBOTO_FONT_FILES, bR as loadFontAsset, bS as getRemotePdfFontFaces, bT as OFFICE_COMPAT_FONT_FAMILIES, bU as BinaryReader, bV as buildSfnt, bW as defaultFontDecoderRegistry, bX as SfntFontProgram, bY as zlibSync, bZ as collectPdfFontFamilies, b_ as outlineFrom, b$ as getPageHeaderZoneTop, c0 as getPageColumnRects, c1 as findFootnoteReference, c2 as resolveImporterForFile, c3 as roundTo, c4 as getDocumentSectionsCanonical, c5 as getDocumentParagraphsCanonical, c6 as getDocumentParagraphs, c7 as PX_PER_CM, c8 as getDocumentPageSettings, c9 as getTableCellContentWidthForParagraph, ca as layoutMetricsEpoch, cb as bumpLayoutMetricsEpoch, cc as createCanvasLayoutSnapshotProvider, cd as on, ce as debounce, cf as unwrap, cg as perfTimer, ch as prepareDocumentFonts, ci as getRunTextBox, cj as createEditorDocument, ck as resolveResizedDimensions, cl as axisSignForDirection, cm as clamp$1, cn as MIN_RESIZE_SIZE_PX, co as resolveTextBoxRenderHeight, cp as getToolbarStyleState, cq as VERTICAL_HIT_WEIGHT, cr as getCachedCanvasImage, cs as measureParagraphMinContentWidthPx, ct as getEditableBlocksForZone, cu as findParagraphLocation, cv as createSectionBoundaryParagraph, cw as normalizePageSettings, cx as DEFAULT_EDITOR_PAGE_SETTINGS, cy as markStart, cz as markEnd, cA as getParagraphEntries, cB as getParagraphById, cC as createEditorFootnote, cD as createFootnoteReferenceRun, cE as renumberFootnotes, cF as preciseFontModeVersion, cG as isPreciseFontModeEnabled, cH as getHeadingLevel, cI as togglePreciseFontMode, cJ as nextFontSizePt, cK as previousFontSizePt, cL as fontSizePtToPx, cM as resolveNamedTextStyle, cN as resolveNamedTableStyle, cO as createDefaultToolbarPreset, cP as MenuRegistry, cQ as createToolbarRegistry, cR as Editor, cS as resolveCommandRef, cT as commandRefName, cU as createOasisEditorClient, cV as createEditorZoom, cW as startLongTaskObserver, cX as installGlobalReport, cY as applyStoredPreciseFontPreference, cZ as getWelcomeSeen, c_ as isLocalFontAccessSupported, c$ as EDITOR_SCROLL_PADDING_PX, d0 as Toolbar, d1 as OasisEditorLoading, d2 as I18nProvider, d3 as createTranslator, d4 as registerDomStatsSurface, d5 as createEditorLogger } from "./index-Cbwb1bgI.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -13,7 +13,7 @@ function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
|
13
13
|
defaultTabStop
|
|
14
14
|
} = context;
|
|
15
15
|
return blocks.map((block, index) => {
|
|
16
|
-
var
|
|
16
|
+
var _a, _b;
|
|
17
17
|
if (block.type === "paragraph") {
|
|
18
18
|
const layout = deps.projectParagraphLayout(
|
|
19
19
|
block,
|
|
@@ -47,8 +47,8 @@ function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
|
47
47
|
sourceBlockId: block.id,
|
|
48
48
|
blockType: block.type,
|
|
49
49
|
globalIndex: index,
|
|
50
|
-
estimatedHeight: ((
|
|
51
|
-
floatingTableHeight: ((
|
|
50
|
+
estimatedHeight: ((_a = block.style) == null ? void 0 : _a.floating) ? 0 : tableHeight,
|
|
51
|
+
floatingTableHeight: ((_b = block.style) == null ? void 0 : _b.floating) ? tableHeight : void 0,
|
|
52
52
|
sourceBlock: block
|
|
53
53
|
};
|
|
54
54
|
});
|
|
@@ -87,7 +87,7 @@ function getProjectedBlocksHeight$1(blocks) {
|
|
|
87
87
|
return blocks.reduce((sum, block) => sum + block.estimatedHeight, 0);
|
|
88
88
|
}
|
|
89
89
|
function collectFootnoteReferencesFromBlock(block) {
|
|
90
|
-
var
|
|
90
|
+
var _a, _b;
|
|
91
91
|
const result = [];
|
|
92
92
|
const appendFromParagraph = (paragraph, startOffset, endOffset) => {
|
|
93
93
|
let runStart = 0;
|
|
@@ -103,8 +103,8 @@ function collectFootnoteReferencesFromBlock(block) {
|
|
|
103
103
|
if (block.sourceBlock.type === "paragraph") {
|
|
104
104
|
appendFromParagraph(
|
|
105
105
|
block.sourceBlock,
|
|
106
|
-
((
|
|
107
|
-
((
|
|
106
|
+
((_a = block.layout) == null ? void 0 : _a.startOffset) ?? 0,
|
|
107
|
+
((_b = block.layout) == null ? void 0 : _b.endOffset) ?? getParagraphText(block.sourceBlock).length
|
|
108
108
|
);
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
@@ -126,14 +126,14 @@ function collectPageFootnoteReferenceIds(page) {
|
|
|
126
126
|
return ids;
|
|
127
127
|
}
|
|
128
128
|
function projectFootnoteBlocksForPage(document2, footnoteReferenceIds, page, totalPages, measuredHeights, measuredParagraphLayouts, measurer, projectBlocks) {
|
|
129
|
-
var
|
|
129
|
+
var _a, _b, _c;
|
|
130
130
|
const contentWidth = Math.max(
|
|
131
131
|
24,
|
|
132
132
|
getPageContentWidth(page.pageSettings) - FOOTNOTE_MARKER_GUTTER_PX
|
|
133
133
|
);
|
|
134
134
|
const blocks = [];
|
|
135
135
|
for (const footnoteId of footnoteReferenceIds) {
|
|
136
|
-
const footnote = (
|
|
136
|
+
const footnote = (_b = (_a = document2.footnotes) == null ? void 0 : _a.items) == null ? void 0 : _b[footnoteId];
|
|
137
137
|
if (!footnote) continue;
|
|
138
138
|
const projected = projectBlocks(footnote.blocks, {
|
|
139
139
|
pageIndex: page.index,
|
|
@@ -485,13 +485,13 @@ function spacerParagraph() {
|
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
487
|
function buildEndnoteFlowBlocks(document2) {
|
|
488
|
-
var
|
|
488
|
+
var _a, _b, _c;
|
|
489
489
|
const referenced = listReferencedEndnotes(document2);
|
|
490
|
-
const items = (
|
|
490
|
+
const items = (_a = document2.endnotes) == null ? void 0 : _a.items;
|
|
491
491
|
if (!items || referenced.length === 0) {
|
|
492
492
|
return [];
|
|
493
493
|
}
|
|
494
|
-
const format = ((_c = (
|
|
494
|
+
const format = ((_c = (_b = document2.endnotes) == null ? void 0 : _b.settings) == null ? void 0 : _c.numberFormat) ?? "decimal";
|
|
495
495
|
const out = [spacerParagraph()];
|
|
496
496
|
for (const ref of referenced) {
|
|
497
497
|
const endnote = items[ref.endnoteId];
|
|
@@ -534,8 +534,8 @@ function blockContainsNumPagesField(block) {
|
|
|
534
534
|
if (block.type === "paragraph") {
|
|
535
535
|
return block.runs.some(
|
|
536
536
|
(run) => {
|
|
537
|
-
var
|
|
538
|
-
return ((
|
|
537
|
+
var _a;
|
|
538
|
+
return ((_a = getRunField(run)) == null ? void 0 : _a.type) === "NUMPAGES";
|
|
539
539
|
}
|
|
540
540
|
);
|
|
541
541
|
}
|
|
@@ -559,10 +559,10 @@ function documentContainsNumPagesField(document2) {
|
|
|
559
559
|
);
|
|
560
560
|
}
|
|
561
561
|
function projectDocumentLayout(document2, maxPageHeightOverride, measuredHeights, measuredParagraphLayouts, options = {}) {
|
|
562
|
-
var
|
|
562
|
+
var _a, _b;
|
|
563
563
|
const measurer = options.measurer ?? domTextMeasurer;
|
|
564
564
|
const projectionContext = createProjectionContext(
|
|
565
|
-
((
|
|
565
|
+
((_a = document2.settings) == null ? void 0 : _a.autoHyphenation) ? {
|
|
566
566
|
enabled: true,
|
|
567
567
|
zone: document2.settings.hyphenationZone,
|
|
568
568
|
consecutiveLimit: document2.settings.consecutiveHyphenLimit,
|
|
@@ -579,7 +579,7 @@ function projectDocumentLayout(document2, maxPageHeightOverride, measuredHeights
|
|
|
579
579
|
measuredHeights,
|
|
580
580
|
measuredParagraphLayouts,
|
|
581
581
|
measurer,
|
|
582
|
-
defaultTabStop: (
|
|
582
|
+
defaultTabStop: (_b = document2.settings) == null ? void 0 : _b.defaultTabStop,
|
|
583
583
|
needsTotalPages,
|
|
584
584
|
projectBlocks: projectBlocksLayout,
|
|
585
585
|
projectHeaderFooterBlocks,
|
|
@@ -857,12 +857,12 @@ function cloneBlock(block) {
|
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
859
|
function cloneSection(section) {
|
|
860
|
-
var
|
|
860
|
+
var _a, _b, _c, _d, _e, _f;
|
|
861
861
|
return {
|
|
862
862
|
...section,
|
|
863
863
|
blocks: section.blocks.map(cloneBlock),
|
|
864
|
-
header: (
|
|
865
|
-
firstPageHeader: (
|
|
864
|
+
header: (_a = section.header) == null ? void 0 : _a.map(cloneBlock),
|
|
865
|
+
firstPageHeader: (_b = section.firstPageHeader) == null ? void 0 : _b.map(cloneBlock),
|
|
866
866
|
evenPageHeader: (_c = section.evenPageHeader) == null ? void 0 : _c.map(cloneBlock),
|
|
867
867
|
footer: (_d = section.footer) == null ? void 0 : _d.map(cloneBlock),
|
|
868
868
|
firstPageFooter: (_e = section.firstPageFooter) == null ? void 0 : _e.map(cloneBlock),
|
|
@@ -876,7 +876,7 @@ function cloneFootnote(footnote) {
|
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
878
|
function cloneFootnotes(footnotes) {
|
|
879
|
-
var
|
|
879
|
+
var _a, _b;
|
|
880
880
|
if (!footnotes) return void 0;
|
|
881
881
|
const nextItems = {};
|
|
882
882
|
for (const [id, footnote] of Object.entries(footnotes.items)) {
|
|
@@ -885,8 +885,8 @@ function cloneFootnotes(footnotes) {
|
|
|
885
885
|
return {
|
|
886
886
|
items: nextItems,
|
|
887
887
|
settings: footnotes.settings ? { ...footnotes.settings } : void 0,
|
|
888
|
-
separator: (
|
|
889
|
-
continuationSeparator: (
|
|
888
|
+
separator: (_a = footnotes.separator) == null ? void 0 : _a.map(cloneBlock),
|
|
889
|
+
continuationSeparator: (_b = footnotes.continuationSeparator) == null ? void 0 : _b.map(cloneBlock)
|
|
890
890
|
};
|
|
891
891
|
}
|
|
892
892
|
function cloneEndnote(endnote) {
|
|
@@ -896,7 +896,7 @@ function cloneEndnote(endnote) {
|
|
|
896
896
|
};
|
|
897
897
|
}
|
|
898
898
|
function cloneEndnotes(endnotes) {
|
|
899
|
-
var
|
|
899
|
+
var _a, _b;
|
|
900
900
|
if (!endnotes) return void 0;
|
|
901
901
|
const nextItems = {};
|
|
902
902
|
for (const [id, endnote] of Object.entries(endnotes.items)) {
|
|
@@ -905,17 +905,17 @@ function cloneEndnotes(endnotes) {
|
|
|
905
905
|
return {
|
|
906
906
|
items: nextItems,
|
|
907
907
|
settings: endnotes.settings ? { ...endnotes.settings } : void 0,
|
|
908
|
-
separator: (
|
|
909
|
-
continuationSeparator: (
|
|
908
|
+
separator: (_a = endnotes.separator) == null ? void 0 : _a.map(cloneBlock),
|
|
909
|
+
continuationSeparator: (_b = endnotes.continuationSeparator) == null ? void 0 : _b.map(cloneBlock)
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
912
|
function cloneEditorState(source) {
|
|
913
|
-
var
|
|
913
|
+
var _a;
|
|
914
914
|
return {
|
|
915
915
|
...source,
|
|
916
916
|
document: {
|
|
917
917
|
...source.document,
|
|
918
|
-
sections: (
|
|
918
|
+
sections: (_a = source.document.sections) == null ? void 0 : _a.map(cloneSection),
|
|
919
919
|
footnotes: cloneFootnotes(source.document.footnotes),
|
|
920
920
|
endnotes: cloneEndnotes(source.document.endnotes)
|
|
921
921
|
},
|
|
@@ -1037,7 +1037,7 @@ const getClassNames = (attrs) => {
|
|
|
1037
1037
|
return "";
|
|
1038
1038
|
};
|
|
1039
1039
|
const replaceElement = (element, { nameAttr, icons: icons2, attrs }) => {
|
|
1040
|
-
var
|
|
1040
|
+
var _a;
|
|
1041
1041
|
const iconName = element.getAttribute(nameAttr);
|
|
1042
1042
|
if (iconName == null) return;
|
|
1043
1043
|
const ComponentName = toPascalCase(iconName);
|
|
@@ -1070,7 +1070,7 @@ const replaceElement = (element, { nameAttr, icons: icons2, attrs }) => {
|
|
|
1070
1070
|
});
|
|
1071
1071
|
}
|
|
1072
1072
|
const svgElement = createElement(iconNode, iconAttrs);
|
|
1073
|
-
return (
|
|
1073
|
+
return (_a = element.parentNode) == null ? void 0 : _a.replaceChild(svgElement, element);
|
|
1074
1074
|
};
|
|
1075
1075
|
/**
|
|
1076
1076
|
* @license lucide v1.11.0 - ISC
|
|
@@ -26998,9 +26998,9 @@ function cloneLayoutSnapshot(snapshot) {
|
|
|
26998
26998
|
};
|
|
26999
26999
|
}
|
|
27000
27000
|
function isCanvasDebugEnabled() {
|
|
27001
|
-
var
|
|
27001
|
+
var _a;
|
|
27002
27002
|
const viteEnv = __vite_import_meta_env__ ?? {};
|
|
27003
|
-
const processEnv = ((
|
|
27003
|
+
const processEnv = ((_a = globalThis.process) == null ? void 0 : _a.env) ?? {};
|
|
27004
27004
|
return viteEnv.DEV === true || viteEnv.MODE === "test" || processEnv.NODE_ENV === "test" || viteEnv.VITE_OASIS_CANVAS_DEBUG === "1";
|
|
27005
27005
|
}
|
|
27006
27006
|
function buildApi() {
|
|
@@ -27409,12 +27409,12 @@ function addFontFamily(target, seen, value) {
|
|
|
27409
27409
|
target.push(family);
|
|
27410
27410
|
}
|
|
27411
27411
|
function computeFontFamilyOptions(document2, toolbarStyleState, localFontFamilies = []) {
|
|
27412
|
-
var
|
|
27412
|
+
var _a;
|
|
27413
27413
|
const seen = /* @__PURE__ */ new Set();
|
|
27414
27414
|
const documentFonts = [];
|
|
27415
27415
|
const fallbackFonts = [];
|
|
27416
27416
|
for (const style2 of Object.values((document2 == null ? void 0 : document2.styles) ?? {})) {
|
|
27417
|
-
addFontFamily(documentFonts, seen, (
|
|
27417
|
+
addFontFamily(documentFonts, seen, (_a = style2.textStyle) == null ? void 0 : _a.fontFamily);
|
|
27418
27418
|
}
|
|
27419
27419
|
addFontFamily(documentFonts, seen, toolbarStyleState.fontFamily);
|
|
27420
27420
|
for (const family of localFontFamilies) {
|
|
@@ -27429,10 +27429,10 @@ function computeFontFamilyOptions(document2, toolbarStyleState, localFontFamilie
|
|
|
27429
27429
|
];
|
|
27430
27430
|
}
|
|
27431
27431
|
function computeFontSizeOptions(document2, toolbarStyleState) {
|
|
27432
|
-
var
|
|
27432
|
+
var _a;
|
|
27433
27433
|
const values = new Set(STANDARD_FONT_SIZES_PT);
|
|
27434
27434
|
for (const style2 of Object.values((document2 == null ? void 0 : document2.styles) ?? {})) {
|
|
27435
|
-
const fontSize = (
|
|
27435
|
+
const fontSize = (_a = style2.textStyle) == null ? void 0 : _a.fontSize;
|
|
27436
27436
|
if (typeof fontSize === "number" && Number.isFinite(fontSize)) {
|
|
27437
27437
|
values.add(fontSizePxToPt(fontSize));
|
|
27438
27438
|
}
|
|
@@ -27559,7 +27559,7 @@ function clearParagraphList(paragraph) {
|
|
|
27559
27559
|
return nextParagraph;
|
|
27560
27560
|
}
|
|
27561
27561
|
function getStyleAtOffset(paragraph, offset) {
|
|
27562
|
-
var
|
|
27562
|
+
var _a;
|
|
27563
27563
|
if (paragraph.runs.length === 0) {
|
|
27564
27564
|
return void 0;
|
|
27565
27565
|
}
|
|
@@ -27579,7 +27579,7 @@ function getStyleAtOffset(paragraph, offset) {
|
|
|
27579
27579
|
}
|
|
27580
27580
|
consumed = nextConsumed;
|
|
27581
27581
|
}
|
|
27582
|
-
return cloneStyle((
|
|
27582
|
+
return cloneStyle((_a = paragraph.runs[paragraph.runs.length - 1]) == null ? void 0 : _a.styles);
|
|
27583
27583
|
}
|
|
27584
27584
|
function getRunAtOffset(paragraph, offset) {
|
|
27585
27585
|
let consumed = 0;
|
|
@@ -27609,9 +27609,9 @@ function getRunAtOffset(paragraph, offset) {
|
|
|
27609
27609
|
return null;
|
|
27610
27610
|
}
|
|
27611
27611
|
function expandLinkRangeInParagraph(paragraph, offset) {
|
|
27612
|
-
var
|
|
27612
|
+
var _a, _b, _c;
|
|
27613
27613
|
const resolved = getRunAtOffset(paragraph, offset);
|
|
27614
|
-
const href = (
|
|
27614
|
+
const href = (_a = resolved == null ? void 0 : resolved.run.styles) == null ? void 0 : _a.link;
|
|
27615
27615
|
if (!resolved || !href || resolved.run.kind === "image") {
|
|
27616
27616
|
return null;
|
|
27617
27617
|
}
|
|
@@ -27630,7 +27630,7 @@ function expandLinkRangeInParagraph(paragraph, offset) {
|
|
|
27630
27630
|
endOffset = consumed + resolved.run.text.length;
|
|
27631
27631
|
for (let index = runIndex - 1; index >= 0; index -= 1) {
|
|
27632
27632
|
const run = runs[index];
|
|
27633
|
-
if (run.kind === "image" || ((
|
|
27633
|
+
if (run.kind === "image" || ((_b = run.styles) == null ? void 0 : _b.link) !== href) {
|
|
27634
27634
|
break;
|
|
27635
27635
|
}
|
|
27636
27636
|
startOffset -= run.text.length;
|
|
@@ -27985,8 +27985,8 @@ function deleteSelectionRange(state) {
|
|
|
27985
27985
|
const startOffset2 = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
|
|
27986
27986
|
const endOffset2 = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
|
|
27987
27987
|
return mapRunsInRange(paragraph, startOffset2, endOffset2, (run) => {
|
|
27988
|
-
var
|
|
27989
|
-
if (((
|
|
27988
|
+
var _a;
|
|
27989
|
+
if (((_a = run.revision) == null ? void 0 : _a.type) === "insert") {
|
|
27990
27990
|
return { ...run, text: "" };
|
|
27991
27991
|
}
|
|
27992
27992
|
return {
|
|
@@ -28312,7 +28312,7 @@ function insertPlainTextAtSelection(state, text, styleOverride) {
|
|
|
28312
28312
|
);
|
|
28313
28313
|
}
|
|
28314
28314
|
function deleteBackward(state) {
|
|
28315
|
-
var
|
|
28315
|
+
var _a;
|
|
28316
28316
|
if (!isSelectionCollapsed(state.selection)) {
|
|
28317
28317
|
return deleteSelectionRange(state);
|
|
28318
28318
|
}
|
|
@@ -28335,7 +28335,7 @@ function deleteBackward(state) {
|
|
|
28335
28335
|
}
|
|
28336
28336
|
if (targetRunIndex !== -1) {
|
|
28337
28337
|
const targetRun = runs[targetRunIndex];
|
|
28338
|
-
if (((
|
|
28338
|
+
if (((_a = targetRun.revision) == null ? void 0 : _a.type) === "insert") {
|
|
28339
28339
|
const nextRuns2 = [
|
|
28340
28340
|
...sliceRuns(paragraph, 0, offset - 1),
|
|
28341
28341
|
...sliceRuns(paragraph, offset, getParagraphLength(paragraph))
|
|
@@ -28421,7 +28421,7 @@ function deleteBackward(state) {
|
|
|
28421
28421
|
);
|
|
28422
28422
|
}
|
|
28423
28423
|
function deleteForward(state) {
|
|
28424
|
-
var
|
|
28424
|
+
var _a;
|
|
28425
28425
|
if (!isSelectionCollapsed(state.selection)) {
|
|
28426
28426
|
return deleteSelectionRange(state);
|
|
28427
28427
|
}
|
|
@@ -28444,7 +28444,7 @@ function deleteForward(state) {
|
|
|
28444
28444
|
}
|
|
28445
28445
|
if (targetRunIndex !== -1) {
|
|
28446
28446
|
const targetRun = runs[targetRunIndex];
|
|
28447
|
-
if (((
|
|
28447
|
+
if (((_a = targetRun.revision) == null ? void 0 : _a.type) === "insert") {
|
|
28448
28448
|
const nextRuns2 = [
|
|
28449
28449
|
...sliceRuns(paragraph, 0, offset),
|
|
28450
28450
|
...sliceRuns(paragraph, offset + 1, getParagraphLength(paragraph))
|
|
@@ -28545,8 +28545,8 @@ function toggleTextStyle(state, key) {
|
|
|
28545
28545
|
}
|
|
28546
28546
|
const shouldEnable = !touchedRuns.every(
|
|
28547
28547
|
(run) => {
|
|
28548
|
-
var
|
|
28549
|
-
return Boolean((
|
|
28548
|
+
var _a;
|
|
28549
|
+
return Boolean((_a = run.styles) == null ? void 0 : _a[key]);
|
|
28550
28550
|
}
|
|
28551
28551
|
);
|
|
28552
28552
|
const nextParagraphs = paragraphs.map(
|
|
@@ -28582,8 +28582,8 @@ function clearSelectedTextFormatting(state) {
|
|
|
28582
28582
|
const startOffset = paragraphIndex === normalized.startIndex ? normalized.startParagraphOffset : 0;
|
|
28583
28583
|
const endOffset = paragraphIndex === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
|
|
28584
28584
|
return mapRunsInRange(paragraph, startOffset, endOffset, (run) => {
|
|
28585
|
-
var
|
|
28586
|
-
const link = (
|
|
28585
|
+
var _a;
|
|
28586
|
+
const link = (_a = run.styles) == null ? void 0 : _a.link;
|
|
28587
28587
|
const styles = link != null && link !== "" ? { link } : {};
|
|
28588
28588
|
return { ...run, styles };
|
|
28589
28589
|
});
|
|
@@ -28894,7 +28894,7 @@ function createFontDialogBridge(deps) {
|
|
|
28894
28894
|
};
|
|
28895
28895
|
}
|
|
28896
28896
|
function moveBlockToPosition(state, blockId, targetPosition) {
|
|
28897
|
-
var
|
|
28897
|
+
var _a;
|
|
28898
28898
|
let movedBlock;
|
|
28899
28899
|
const removeFromBlocks = (blocks) => {
|
|
28900
28900
|
const idx = blocks.findIndex((b) => b.id === blockId);
|
|
@@ -28944,7 +28944,7 @@ function moveBlockToPosition(state, blockId, targetPosition) {
|
|
|
28944
28944
|
};
|
|
28945
28945
|
const activeIdx = getActiveSectionIndex(state);
|
|
28946
28946
|
const zone = getActiveZone(state);
|
|
28947
|
-
const activeSection = (
|
|
28947
|
+
const activeSection = (_a = nextDocument.sections) == null ? void 0 : _a[activeIdx];
|
|
28948
28948
|
const section = { ...activeSection };
|
|
28949
28949
|
let found = false;
|
|
28950
28950
|
if (zone === "header") {
|
|
@@ -29132,7 +29132,7 @@ function insertSectionBreakAtSelection(state, breakType) {
|
|
|
29132
29132
|
};
|
|
29133
29133
|
}
|
|
29134
29134
|
function updateSectionSettings(state, sectionIndex, settings) {
|
|
29135
|
-
var
|
|
29135
|
+
var _a;
|
|
29136
29136
|
const sections = getDocumentSections(state.document);
|
|
29137
29137
|
if (sectionIndex < 0 || sectionIndex >= sections.length) {
|
|
29138
29138
|
return state;
|
|
@@ -29146,7 +29146,7 @@ function updateSectionSettings(state, sectionIndex, settings) {
|
|
|
29146
29146
|
...settings.pageSettings ?? {},
|
|
29147
29147
|
margins: {
|
|
29148
29148
|
...nextSections[sectionIndex].pageSettings.margins,
|
|
29149
|
-
...((
|
|
29149
|
+
...((_a = settings.pageSettings) == null ? void 0 : _a.margins) ?? {}
|
|
29150
29150
|
}
|
|
29151
29151
|
}
|
|
29152
29152
|
};
|
|
@@ -29508,6 +29508,11 @@ function updateActiveTableBlocks(state, updateTable) {
|
|
|
29508
29508
|
}
|
|
29509
29509
|
};
|
|
29510
29510
|
}
|
|
29511
|
+
const DEFAULT_TABLE_BORDER = {
|
|
29512
|
+
width: 0.5,
|
|
29513
|
+
type: "solid",
|
|
29514
|
+
color: "#000000"
|
|
29515
|
+
};
|
|
29511
29516
|
function collectTableSelectedParagraphIds(state) {
|
|
29512
29517
|
const selectedParagraphIds = /* @__PURE__ */ new Set();
|
|
29513
29518
|
const activeSectionIndex = getActiveSectionIndex(state);
|
|
@@ -29635,6 +29640,39 @@ function setTableCellBorders(state, border) {
|
|
|
29635
29640
|
nextState = setTableCellStyleValue(nextState, "borderLeft", border);
|
|
29636
29641
|
return nextState;
|
|
29637
29642
|
}
|
|
29643
|
+
function applyTableBorderPreset(state, preset, border = DEFAULT_TABLE_BORDER) {
|
|
29644
|
+
const apply = (current, keys, value) => keys.reduce(
|
|
29645
|
+
(next, key) => setTableCellStyleValue(next, key, value),
|
|
29646
|
+
current
|
|
29647
|
+
);
|
|
29648
|
+
const edges = ["borderTop", "borderRight", "borderBottom", "borderLeft"];
|
|
29649
|
+
switch (preset) {
|
|
29650
|
+
case "none":
|
|
29651
|
+
return apply(
|
|
29652
|
+
state,
|
|
29653
|
+
[...edges, "borderTopLeftToBottomRight", "borderTopRightToBottomLeft"],
|
|
29654
|
+
null
|
|
29655
|
+
);
|
|
29656
|
+
case "bottom":
|
|
29657
|
+
return apply(state, ["borderBottom"], border);
|
|
29658
|
+
case "top":
|
|
29659
|
+
return apply(state, ["borderTop"], border);
|
|
29660
|
+
case "left":
|
|
29661
|
+
return apply(state, ["borderLeft"], border);
|
|
29662
|
+
case "right":
|
|
29663
|
+
return apply(state, ["borderRight"], border);
|
|
29664
|
+
case "diagonalDown":
|
|
29665
|
+
return apply(state, ["borderTopLeftToBottomRight"], border);
|
|
29666
|
+
case "diagonalUp":
|
|
29667
|
+
return apply(state, ["borderTopRightToBottomLeft"], border);
|
|
29668
|
+
case "all":
|
|
29669
|
+
case "outside":
|
|
29670
|
+
case "inside":
|
|
29671
|
+
case "insideHorizontal":
|
|
29672
|
+
case "insideVertical":
|
|
29673
|
+
return apply(state, edges, border);
|
|
29674
|
+
}
|
|
29675
|
+
}
|
|
29638
29676
|
function collectLinearSelectedParagraphIds(state) {
|
|
29639
29677
|
const normalized = normalizeSelection(state);
|
|
29640
29678
|
const paragraphs = getParagraphs(state);
|
|
@@ -29788,10 +29826,10 @@ function setTableRowHeight(state, tableId, rowIndex, height) {
|
|
|
29788
29826
|
const DEFAULT_DISTRIBUTED_ROW_PX = 24;
|
|
29789
29827
|
function distributeSelectedTableRows(state) {
|
|
29790
29828
|
return updateActiveTableBlocks(state, (table) => {
|
|
29791
|
-
var
|
|
29829
|
+
var _a;
|
|
29792
29830
|
let target = 0;
|
|
29793
29831
|
for (const row of table.rows) {
|
|
29794
|
-
const height = (
|
|
29832
|
+
const height = (_a = row.style) == null ? void 0 : _a.height;
|
|
29795
29833
|
const px = typeof height === "number" ? height : typeof height === "string" ? Number.parseFloat(height) : 0;
|
|
29796
29834
|
if (Number.isFinite(px) && px > target) target = px;
|
|
29797
29835
|
}
|
|
@@ -29837,7 +29875,7 @@ function parseUnitToPt(value) {
|
|
|
29837
29875
|
const DEFAULT_DISTRIBUTED_COLUMN_PT = 120;
|
|
29838
29876
|
function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableIndentLeft) {
|
|
29839
29877
|
const updateTable = (table) => {
|
|
29840
|
-
var
|
|
29878
|
+
var _a;
|
|
29841
29879
|
if (table.id !== tableId) return table;
|
|
29842
29880
|
const tableLayout = buildTableCellLayout(table);
|
|
29843
29881
|
const visualColumnCount = Math.max(
|
|
@@ -29856,7 +29894,7 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
29856
29894
|
hasGridOverride = true;
|
|
29857
29895
|
continue;
|
|
29858
29896
|
}
|
|
29859
|
-
const existing = (
|
|
29897
|
+
const existing = (_a = table.gridCols) == null ? void 0 : _a[columnIndex];
|
|
29860
29898
|
if (typeof existing === "number" && Number.isFinite(existing) && existing > 0) {
|
|
29861
29899
|
nextGridCols[columnIndex] = existing;
|
|
29862
29900
|
continue;
|
|
@@ -29867,7 +29905,7 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
29867
29905
|
const nextRows = table.rows.map((row, rowIndex) => {
|
|
29868
29906
|
const nextCells = row.cells.map(
|
|
29869
29907
|
(cell, cellIndex) => {
|
|
29870
|
-
var
|
|
29908
|
+
var _a2, _b;
|
|
29871
29909
|
const entry = tableLayout.find(
|
|
29872
29910
|
(item) => item.rowIndex === rowIndex && item.cellIndex === cellIndex
|
|
29873
29911
|
);
|
|
@@ -29875,11 +29913,11 @@ function setTableColumnWidths(state, tableId, columnWidths, tableWidth, tableInd
|
|
|
29875
29913
|
const rightVisualColumnIndex = entry.visualColumnIndex + entry.colSpan - 1;
|
|
29876
29914
|
const newWidth = columnWidths[rightVisualColumnIndex];
|
|
29877
29915
|
if (newWidth !== void 0 && entry.colSpan === 1) {
|
|
29878
|
-
const propertyRevision = state.trackChangesEnabled && !((
|
|
29916
|
+
const propertyRevision = state.trackChangesEnabled && !((_a2 = cell.style) == null ? void 0 : _a2.propertyRevision) ? {
|
|
29879
29917
|
...createTableRevisionMetadata(),
|
|
29880
29918
|
type: "property",
|
|
29881
29919
|
previous: { ...cell.style ?? {} }
|
|
29882
|
-
} : (
|
|
29920
|
+
} : (_b = cell.style) == null ? void 0 : _b.propertyRevision;
|
|
29883
29921
|
return {
|
|
29884
29922
|
...cell,
|
|
29885
29923
|
style: {
|
|
@@ -30147,17 +30185,17 @@ function isVisibleBorder(border) {
|
|
|
30147
30185
|
return !!border && border.type !== "none" && border.width > 0;
|
|
30148
30186
|
}
|
|
30149
30187
|
function buildFloatingSummary(table) {
|
|
30150
|
-
var
|
|
30151
|
-
const floating = (
|
|
30188
|
+
var _a;
|
|
30189
|
+
const floating = (_a = table.style) == null ? void 0 : _a.floating;
|
|
30152
30190
|
if (!floating || Object.keys(floating).length === 0) return "";
|
|
30153
30191
|
return Object.entries(floating).map(([key, value]) => `${key}=${value}`).join(", ");
|
|
30154
30192
|
}
|
|
30155
30193
|
function buildInitialValues(ctx, activeTab = "table") {
|
|
30156
|
-
var
|
|
30157
|
-
const tableWidth = serializeWidth((
|
|
30194
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
30195
|
+
const tableWidth = serializeWidth((_a = ctx.table.style) == null ? void 0 : _a.width);
|
|
30158
30196
|
const row = ctx.table.rows[ctx.rowIndex];
|
|
30159
30197
|
const cell = row == null ? void 0 : row.cells[ctx.cellIndex];
|
|
30160
|
-
const rowHeight = serializeWidth((
|
|
30198
|
+
const rowHeight = serializeWidth((_b = row == null ? void 0 : row.style) == null ? void 0 : _b.height);
|
|
30161
30199
|
const cellWidth = serializeWidth((_c = cell == null ? void 0 : cell.style) == null ? void 0 : _c.width);
|
|
30162
30200
|
const gridWidth = (_d = ctx.table.gridCols) == null ? void 0 : _d[ctx.visualColumnIndex];
|
|
30163
30201
|
const columnWidth = serializeWidth(gridWidth);
|
|
@@ -30581,14 +30619,14 @@ function textLanguageToHtmlAttributes(language) {
|
|
|
30581
30619
|
return attrs.length > 0 ? ` ${attrs.join(" ")}` : "";
|
|
30582
30620
|
}
|
|
30583
30621
|
function serializeImageRunToHtml(run, document2) {
|
|
30584
|
-
var
|
|
30622
|
+
var _a;
|
|
30585
30623
|
if (run.kind !== "image") {
|
|
30586
30624
|
return "";
|
|
30587
30625
|
}
|
|
30588
30626
|
const resolvedSrc = resolveImageSrc(document2, run.image.src);
|
|
30589
30627
|
const altAttr = run.image.alt !== void 0 ? ` alt="${escapeHtml(run.image.alt)}"` : "";
|
|
30590
30628
|
const img = `<img src="${escapeHtml(resolvedSrc)}" width="${Math.max(1, Math.round(run.image.width))}" height="${Math.max(1, Math.round(run.image.height))}"${altAttr}>`;
|
|
30591
|
-
if ((
|
|
30629
|
+
if ((_a = run.styles) == null ? void 0 : _a.link) {
|
|
30592
30630
|
return `<a href="${escapeHtml(run.styles.link)}">${img}</a>`;
|
|
30593
30631
|
}
|
|
30594
30632
|
return img;
|
|
@@ -30632,7 +30670,7 @@ function serializeParagraphRunsToHtml(runs, document2) {
|
|
|
30632
30670
|
return runs.map((run) => serializeTextRunToHtml(run, document2)).join("") || "<br>";
|
|
30633
30671
|
}
|
|
30634
30672
|
function serializeEditorSelectionToHtml(state) {
|
|
30635
|
-
var
|
|
30673
|
+
var _a;
|
|
30636
30674
|
const normalized = normalizeSelection(state);
|
|
30637
30675
|
if (normalized.isCollapsed) {
|
|
30638
30676
|
return "";
|
|
@@ -30657,7 +30695,7 @@ function serializeEditorSelectionToHtml(state) {
|
|
|
30657
30695
|
const css = paragraphStyleToCssText(paragraph.style);
|
|
30658
30696
|
const attrs = css.length > 0 ? ` style="${css}"` : "";
|
|
30659
30697
|
const paragraphHtml = serializeParagraphRunsToHtml(runs, state.document);
|
|
30660
|
-
if ((
|
|
30698
|
+
if ((_a = paragraph.list) == null ? void 0 : _a.kind) {
|
|
30661
30699
|
const wrapperTag = paragraph.list.kind === "bullet" ? "ul" : "ol";
|
|
30662
30700
|
if (activeListKind !== paragraph.list.kind) {
|
|
30663
30701
|
closeList();
|
|
@@ -31023,13 +31061,13 @@ function createEditorContextMenuClipboard(deps) {
|
|
|
31023
31061
|
function createEditorContextMenuClipboardImpl(deps) {
|
|
31024
31062
|
const t = deps.t;
|
|
31025
31063
|
const programmaticCopy = async () => {
|
|
31026
|
-
var
|
|
31064
|
+
var _a;
|
|
31027
31065
|
const state = deps.state();
|
|
31028
31066
|
const text = getSelectedText(state);
|
|
31029
31067
|
if (!text) return;
|
|
31030
31068
|
const html = serializeEditorSelectionToHtml(state);
|
|
31031
31069
|
try {
|
|
31032
|
-
if (typeof ClipboardItem !== "undefined" && ((
|
|
31070
|
+
if (typeof ClipboardItem !== "undefined" && ((_a = navigator.clipboard) == null ? void 0 : _a.write)) {
|
|
31033
31071
|
await navigator.clipboard.write([
|
|
31034
31072
|
new ClipboardItem({
|
|
31035
31073
|
"text/plain": new Blob([text], { type: "text/plain" }),
|
|
@@ -31063,12 +31101,12 @@ function createEditorContextMenuClipboardImpl(deps) {
|
|
|
31063
31101
|
deps.focusInput();
|
|
31064
31102
|
};
|
|
31065
31103
|
const programmaticPaste = async () => {
|
|
31066
|
-
var
|
|
31104
|
+
var _a, _b;
|
|
31067
31105
|
if (deps.isReadOnly()) return;
|
|
31068
31106
|
let html = "";
|
|
31069
31107
|
let text = "";
|
|
31070
31108
|
try {
|
|
31071
|
-
if ((
|
|
31109
|
+
if ((_a = navigator.clipboard) == null ? void 0 : _a.read) {
|
|
31072
31110
|
const items = await navigator.clipboard.read();
|
|
31073
31111
|
for (const item of items) {
|
|
31074
31112
|
if (item.types.includes("text/html")) {
|
|
@@ -31080,7 +31118,7 @@ function createEditorContextMenuClipboardImpl(deps) {
|
|
|
31080
31118
|
text = await blob.text();
|
|
31081
31119
|
}
|
|
31082
31120
|
}
|
|
31083
|
-
} else if ((
|
|
31121
|
+
} else if ((_b = navigator.clipboard) == null ? void 0 : _b.readText) {
|
|
31084
31122
|
text = await navigator.clipboard.readText();
|
|
31085
31123
|
}
|
|
31086
31124
|
} catch (err) {
|
|
@@ -31425,19 +31463,19 @@ function createEditorUiOptions(ctx) {
|
|
|
31425
31463
|
showToolbar: () => ui().showToolbar ?? true,
|
|
31426
31464
|
showOutline: () => ui().showOutline ?? true,
|
|
31427
31465
|
toolbarView: () => {
|
|
31428
|
-
var
|
|
31429
|
-
return ((
|
|
31466
|
+
var _a;
|
|
31467
|
+
return ((_a = ui().toolbar) == null ? void 0 : _a.view) ?? "ribbon";
|
|
31430
31468
|
},
|
|
31431
31469
|
toolbarLayout: () => {
|
|
31432
|
-
var
|
|
31433
|
-
return ((
|
|
31470
|
+
var _a;
|
|
31471
|
+
return ((_a = ui().toolbar) == null ? void 0 : _a.layout) ?? "overflow";
|
|
31434
31472
|
},
|
|
31435
31473
|
isReadOnly: () => documentOptions().readOnly ?? false,
|
|
31436
31474
|
useComposedShell: () => ui().uiVariant === "docs" || (ui().shell ?? "document") !== "document",
|
|
31437
31475
|
loadingOptions,
|
|
31438
31476
|
loadingLabel: () => {
|
|
31439
|
-
var
|
|
31440
|
-
return ((
|
|
31477
|
+
var _a;
|
|
31478
|
+
return ((_a = loadingOptions()) == null ? void 0 : _a.label) ?? "Loading oasis-editor...";
|
|
31441
31479
|
},
|
|
31442
31480
|
shellComponent: () => {
|
|
31443
31481
|
const s = ui().shell ?? "document";
|
|
@@ -31467,7 +31505,7 @@ function computeShouldShowCaret(state, caretBox) {
|
|
|
31467
31505
|
}
|
|
31468
31506
|
function DropCaret(props) {
|
|
31469
31507
|
const layout = createMemo(() => {
|
|
31470
|
-
var
|
|
31508
|
+
var _a, _b, _c;
|
|
31471
31509
|
const pos = props.targetPos();
|
|
31472
31510
|
const surfaceRef = props.surfaceRef;
|
|
31473
31511
|
if (!surfaceRef) return null;
|
|
@@ -31475,7 +31513,7 @@ function DropCaret(props) {
|
|
|
31475
31513
|
surface: surfaceRef,
|
|
31476
31514
|
state: props.state,
|
|
31477
31515
|
documentLayout: props.documentLayout(),
|
|
31478
|
-
zoomFactor: (
|
|
31516
|
+
zoomFactor: (_a = props.zoomFactor) == null ? void 0 : _a.call(props)
|
|
31479
31517
|
});
|
|
31480
31518
|
let viewportLeft = 0;
|
|
31481
31519
|
let viewportTop = 0;
|
|
@@ -31500,7 +31538,7 @@ function DropCaret(props) {
|
|
|
31500
31538
|
};
|
|
31501
31539
|
}
|
|
31502
31540
|
}
|
|
31503
|
-
const caret = ((
|
|
31541
|
+
const caret = ((_b = props.caretViewport) == null ? void 0 : _b.call(props)) ?? null;
|
|
31504
31542
|
if (caret) {
|
|
31505
31543
|
viewportLeft = caret.left;
|
|
31506
31544
|
viewportTop = caret.top;
|
|
@@ -31781,12 +31819,12 @@ function TextInputDialog(props) {
|
|
|
31781
31819
|
return props.confirmLabel;
|
|
31782
31820
|
},
|
|
31783
31821
|
get cancelTestId() {
|
|
31784
|
-
var
|
|
31785
|
-
return (
|
|
31822
|
+
var _a;
|
|
31823
|
+
return (_a = props.testIds) == null ? void 0 : _a.cancel;
|
|
31786
31824
|
},
|
|
31787
31825
|
get confirmTestId() {
|
|
31788
|
-
var
|
|
31789
|
-
return (
|
|
31826
|
+
var _a;
|
|
31827
|
+
return (_a = props.testIds) == null ? void 0 : _a.confirm;
|
|
31790
31828
|
}
|
|
31791
31829
|
});
|
|
31792
31830
|
},
|
|
@@ -31808,8 +31846,8 @@ function TextInputDialog(props) {
|
|
|
31808
31846
|
return props.placeholder;
|
|
31809
31847
|
},
|
|
31810
31848
|
get ["data-testid"]() {
|
|
31811
|
-
var
|
|
31812
|
-
return (
|
|
31849
|
+
var _a;
|
|
31850
|
+
return (_a = props.testIds) == null ? void 0 : _a.input;
|
|
31813
31851
|
}
|
|
31814
31852
|
});
|
|
31815
31853
|
}
|
|
@@ -33517,8 +33555,8 @@ function useParagraphDialogController(props) {
|
|
|
33517
33555
|
props.onClose();
|
|
33518
33556
|
};
|
|
33519
33557
|
const handleSetDefault = () => {
|
|
33520
|
-
var
|
|
33521
|
-
(
|
|
33558
|
+
var _a;
|
|
33559
|
+
(_a = props.onSetDefault) == null ? void 0 : _a.call(props, collectValues());
|
|
33522
33560
|
props.onClose();
|
|
33523
33561
|
};
|
|
33524
33562
|
return {
|
|
@@ -35704,9 +35742,9 @@ function ContextMenu(props) {
|
|
|
35704
35742
|
get children() {
|
|
35705
35743
|
var _el$2 = _tmpl$4(), _el$4 = _el$2.firstChild;
|
|
35706
35744
|
_el$2.$$click = () => {
|
|
35707
|
-
var
|
|
35745
|
+
var _a;
|
|
35708
35746
|
if (item.disabled) return;
|
|
35709
|
-
(
|
|
35747
|
+
(_a = item.onSelect) == null ? void 0 : _a.call(item);
|
|
35710
35748
|
props.onClose();
|
|
35711
35749
|
};
|
|
35712
35750
|
insert(_el$2, createComponent(Show, {
|
|
@@ -35920,6 +35958,7 @@ function buildEditorViewProps(ctx) {
|
|
|
35920
35958
|
} = ctx;
|
|
35921
35959
|
const layout = {
|
|
35922
35960
|
documentLayout: layoutInput.documentLayout,
|
|
35961
|
+
remoteWebFonts: layoutInput.remoteWebFonts,
|
|
35923
35962
|
viewportHeight: layoutInput.viewportHeight,
|
|
35924
35963
|
class: layoutInput.className,
|
|
35925
35964
|
style: layoutInput.style,
|
|
@@ -35961,12 +36000,12 @@ function buildEditorViewProps(ctx) {
|
|
|
35961
36000
|
};
|
|
35962
36001
|
const fileHandlers = {
|
|
35963
36002
|
onImportInputChange: (e) => {
|
|
35964
|
-
var
|
|
35965
|
-
return files.handleImportFile(((
|
|
36003
|
+
var _a;
|
|
36004
|
+
return files.handleImportFile(((_a = e.currentTarget.files) == null ? void 0 : _a[0]) ?? null);
|
|
35966
36005
|
},
|
|
35967
36006
|
onImageInputChange: (e) => {
|
|
35968
|
-
var
|
|
35969
|
-
return files.handleInsertImage(((
|
|
36007
|
+
var _a;
|
|
36008
|
+
return files.handleInsertImage(((_a = e.currentTarget.files) == null ? void 0 : _a[0]) ?? null);
|
|
35970
36009
|
}
|
|
35971
36010
|
};
|
|
35972
36011
|
const surfaceHandlers = {
|
|
@@ -36499,10 +36538,10 @@ function serializeBorder(border) {
|
|
|
36499
36538
|
return serializeDocxBorderAttrs(resolved, DEFAULT_TABLE_BORDER_COLOR);
|
|
36500
36539
|
}
|
|
36501
36540
|
function serializeTableCellBorders(cell) {
|
|
36502
|
-
var
|
|
36541
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
36503
36542
|
const borders = [
|
|
36504
|
-
`<w:top ${serializeBorder((
|
|
36505
|
-
`<w:left ${serializeBorder((
|
|
36543
|
+
`<w:top ${serializeBorder((_a = cell.style) == null ? void 0 : _a.borderTop)}`,
|
|
36544
|
+
`<w:left ${serializeBorder((_b = cell.style) == null ? void 0 : _b.borderLeft)}`,
|
|
36506
36545
|
`<w:bottom ${serializeBorder((_c = cell.style) == null ? void 0 : _c.borderBottom)}`,
|
|
36507
36546
|
`<w:right ${serializeBorder((_d = cell.style) == null ? void 0 : _d.borderRight)}`
|
|
36508
36547
|
];
|
|
@@ -36560,12 +36599,12 @@ function serializeTableDefaultCellMargins(margins) {
|
|
|
36560
36599
|
return parts.length > 0 ? `<w:tblCellMar>${parts.join("")}</w:tblCellMar>` : "";
|
|
36561
36600
|
}
|
|
36562
36601
|
function serializeTableCellProperties(cell, fallbackWidthPt) {
|
|
36563
|
-
var
|
|
36602
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
36564
36603
|
const colSpan = Math.max(1, Math.floor(cell.colSpan ?? 1));
|
|
36565
36604
|
const parts = [];
|
|
36566
36605
|
const conditional = serializeConditionalFlags(cell.conditionalStyle);
|
|
36567
36606
|
if (conditional) parts.push(conditional);
|
|
36568
|
-
const widthXml = serializeCellWidth(((
|
|
36607
|
+
const widthXml = serializeCellWidth(((_a = cell.style) == null ? void 0 : _a.width) ?? fallbackWidthPt);
|
|
36569
36608
|
if (widthXml) {
|
|
36570
36609
|
parts.push(widthXml);
|
|
36571
36610
|
}
|
|
@@ -36577,7 +36616,7 @@ function serializeTableCellProperties(cell, fallbackWidthPt) {
|
|
|
36577
36616
|
} else if (cell.vMerge === "continue") {
|
|
36578
36617
|
parts.push("<w:vMerge/>");
|
|
36579
36618
|
}
|
|
36580
|
-
if ((
|
|
36619
|
+
if ((_b = cell.style) == null ? void 0 : _b.shading) {
|
|
36581
36620
|
parts.push(serializeShading(cell.style.shading));
|
|
36582
36621
|
}
|
|
36583
36622
|
const noWrap = serializeOnOffElement("noWrap", (_c = cell.style) == null ? void 0 : _c.noWrap);
|
|
@@ -36652,10 +36691,10 @@ function serializeTableRowHeightFromStyle(heightValue, heightRule) {
|
|
|
36652
36691
|
return `<w:trHeight ${attrs.join(" ")}/>`;
|
|
36653
36692
|
}
|
|
36654
36693
|
function serializeTableRowHeight(row) {
|
|
36655
|
-
var
|
|
36694
|
+
var _a, _b;
|
|
36656
36695
|
return serializeTableRowHeightFromStyle(
|
|
36657
|
-
(
|
|
36658
|
-
(
|
|
36696
|
+
(_a = row.style) == null ? void 0 : _a.height,
|
|
36697
|
+
(_b = row.style) == null ? void 0 : _b.heightRule
|
|
36659
36698
|
);
|
|
36660
36699
|
}
|
|
36661
36700
|
function serializeTableRowStyleXml(style2) {
|
|
@@ -36689,13 +36728,13 @@ function serializeTableRowStyleXml(style2) {
|
|
|
36689
36728
|
return parts.length > 0 ? `<w:trPr>${parts.join("")}</w:trPr>` : "";
|
|
36690
36729
|
}
|
|
36691
36730
|
function serializeTableRowProperties(row) {
|
|
36692
|
-
var
|
|
36731
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
36693
36732
|
const parts = [];
|
|
36694
36733
|
const conditional = serializeConditionalFlags(row.conditionalStyle);
|
|
36695
36734
|
if (conditional) parts.push(conditional);
|
|
36696
|
-
const gridBefore = serializeGridSkip("gridBefore", (
|
|
36735
|
+
const gridBefore = serializeGridSkip("gridBefore", (_a = row.style) == null ? void 0 : _a.gridBefore);
|
|
36697
36736
|
if (gridBefore) parts.push(gridBefore);
|
|
36698
|
-
const gridAfter = serializeGridSkip("gridAfter", (
|
|
36737
|
+
const gridAfter = serializeGridSkip("gridAfter", (_b = row.style) == null ? void 0 : _b.gridAfter);
|
|
36699
36738
|
if (gridAfter) parts.push(gridAfter);
|
|
36700
36739
|
const widthBefore = serializeDocxWidthElement(
|
|
36701
36740
|
"wBefore",
|
|
@@ -36764,12 +36803,12 @@ function serializeTableBorders(style2) {
|
|
|
36764
36803
|
return xml ? `<w:tblBorders>${xml}</w:tblBorders>` : "";
|
|
36765
36804
|
}
|
|
36766
36805
|
function serializeTableProperties(table) {
|
|
36767
|
-
var
|
|
36806
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
36768
36807
|
const parts = [];
|
|
36769
|
-
if ((
|
|
36808
|
+
if ((_a = table.style) == null ? void 0 : _a.styleId) {
|
|
36770
36809
|
parts.push(`<w:tblStyle w:val="${escapeXml(table.style.styleId)}"/>`);
|
|
36771
36810
|
}
|
|
36772
|
-
if ((
|
|
36811
|
+
if ((_b = table.style) == null ? void 0 : _b.tblLook) {
|
|
36773
36812
|
const l = table.style.tblLook;
|
|
36774
36813
|
parts.push(
|
|
36775
36814
|
`<w:tblLook w:firstRow="${l.firstRow ? "1" : "0"}" w:lastRow="${l.lastRow ? "1" : "0"}" w:firstColumn="${l.firstCol ? "1" : "0"}" w:lastColumn="${l.lastCol ? "1" : "0"}" w:noHBand="${l.noHBand ? "1" : "0"}" w:noVBand="${l.noVBand ? "1" : "0"}"/>`
|
|
@@ -36957,7 +36996,7 @@ function materializeParagraphStyle(paragraph, styles) {
|
|
|
36957
36996
|
};
|
|
36958
36997
|
}
|
|
36959
36998
|
function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
36960
|
-
var
|
|
36999
|
+
var _a;
|
|
36961
37000
|
const effective = resolveEffectiveTextStyleForParagraph(
|
|
36962
37001
|
run.styles,
|
|
36963
37002
|
paragraphStyleId,
|
|
@@ -37013,7 +37052,7 @@ function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
|
37013
37052
|
shading: effective.shading,
|
|
37014
37053
|
language: effective.language
|
|
37015
37054
|
};
|
|
37016
|
-
if ((
|
|
37055
|
+
if ((_a = run.styles) == null ? void 0 : _a.link) {
|
|
37017
37056
|
materialized.link = run.styles.link;
|
|
37018
37057
|
}
|
|
37019
37058
|
return materialized;
|
|
@@ -37155,11 +37194,11 @@ function serializeParagraphStyleXml(style2) {
|
|
|
37155
37194
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
37156
37195
|
}
|
|
37157
37196
|
function serializeParagraphProperties(paragraph, numberingInfo, styles, overrides) {
|
|
37158
|
-
var
|
|
37197
|
+
var _a, _b;
|
|
37159
37198
|
const parts = [];
|
|
37160
37199
|
const style2 = materializeParagraphStyle(paragraph, styles);
|
|
37161
|
-
const align = ((
|
|
37162
|
-
if ((
|
|
37200
|
+
const align = ((_a = paragraph.style) == null ? void 0 : _a.align) ?? (overrides == null ? void 0 : overrides.align) ?? style2.align;
|
|
37201
|
+
if ((_b = paragraph.style) == null ? void 0 : _b.styleId) {
|
|
37163
37202
|
parts.push(`<w:pStyle w:val="${escapeXml(paragraph.style.styleId)}"/>`);
|
|
37164
37203
|
}
|
|
37165
37204
|
if (align) {
|
|
@@ -37604,6 +37643,15 @@ function buildSrcRect(crop) {
|
|
|
37604
37643
|
}
|
|
37605
37644
|
return `<a:srcRect l="${l}" t="${t}" r="${r}" b="${b}"/>`;
|
|
37606
37645
|
}
|
|
37646
|
+
function buildImageLnXml(border) {
|
|
37647
|
+
if (!border) {
|
|
37648
|
+
return "";
|
|
37649
|
+
}
|
|
37650
|
+
const widthAttr = border.widthPt !== void 0 ? ` w="${Math.round(border.widthPt * EMU_PER_PT)}"` : "";
|
|
37651
|
+
const fill = `<a:solidFill><a:srgbClr val="${escapeXml(border.color.replace(/^#/, ""))}"/></a:solidFill>`;
|
|
37652
|
+
const dash = border.dash ? `<a:prstDash val="${border.dash}"/>` : "";
|
|
37653
|
+
return `<a:ln${widthAttr}>${fill}${dash}</a:ln>`;
|
|
37654
|
+
}
|
|
37607
37655
|
function buildAnchorBool(value, fallback) {
|
|
37608
37656
|
return value ?? fallback ? "1" : "0";
|
|
37609
37657
|
}
|
|
@@ -37696,9 +37744,10 @@ function serializeImageRun(runId, rId, context, rPrXml) {
|
|
|
37696
37744
|
const altAttr = img.alt !== void 0 ? ` descr="${escapeXml(img.alt)}" title="${escapeXml(img.alt)}"` : "";
|
|
37697
37745
|
const xfrmAttrs = buildXfrmAttrs(img);
|
|
37698
37746
|
const srcRect = buildSrcRect(img.crop);
|
|
37747
|
+
const lnXml = buildImageLnXml(img.border);
|
|
37699
37748
|
const fill = img.fillMode === "tile" ? "<a:tile/>" : "<a:stretch><a:fillRect/></a:stretch>";
|
|
37700
37749
|
const blipRelAttr = img.kind === "linked" ? `r:link="${rId}"` : `r:embed="${rId}"`;
|
|
37701
|
-
const picXml = `<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${altAttr}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${blipRelAttr} xmlns:r="${OFFICE_REL_NS}"/>${srcRect}${fill}</pic:blipFill><pic:spPr><a:xfrm${xfrmAttrs}><a:off x="0" y="0"/><a:ext cx="${img.cx}" cy="${img.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom
|
|
37750
|
+
const picXml = `<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:pic xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><pic:nvPicPr><pic:cNvPr id="0" name="Picture"${altAttr}/><pic:cNvPicPr/></pic:nvPicPr><pic:blipFill><a:blip ${blipRelAttr} xmlns:r="${OFFICE_REL_NS}"/>${srcRect}${fill}</pic:blipFill><pic:spPr><a:xfrm${xfrmAttrs}><a:off x="0" y="0"/><a:ext cx="${img.cx}" cy="${img.cy}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom>${lnXml}</pic:spPr></pic:pic></a:graphicData></a:graphic>`;
|
|
37702
37751
|
const drawing = buildDrawingXml(img, docPrId, altAttr, picXml);
|
|
37703
37752
|
return `<w:r>${rPrXml}${drawing}</w:r>`;
|
|
37704
37753
|
}
|
|
@@ -37880,7 +37929,7 @@ function serializeRun(run, context, paragraphStyleId, styles, serializeBlocksXml
|
|
|
37880
37929
|
});
|
|
37881
37930
|
}
|
|
37882
37931
|
function serializeRunWithRelationships(run, context, paragraphStyleId, styles, serializeBlocksXml2) {
|
|
37883
|
-
var
|
|
37932
|
+
var _a;
|
|
37884
37933
|
const runXml = serializeRun(
|
|
37885
37934
|
run,
|
|
37886
37935
|
context,
|
|
@@ -37888,7 +37937,7 @@ function serializeRunWithRelationships(run, context, paragraphStyleId, styles, s
|
|
|
37888
37937
|
styles,
|
|
37889
37938
|
serializeBlocksXml2
|
|
37890
37939
|
);
|
|
37891
|
-
const href = (
|
|
37940
|
+
const href = (_a = run.styles) == null ? void 0 : _a.link;
|
|
37892
37941
|
if (!href) {
|
|
37893
37942
|
return runXml;
|
|
37894
37943
|
}
|
|
@@ -37967,18 +38016,18 @@ function serializeRunsWithBoundaries(runs, tokens, context, paragraphStyleId, st
|
|
|
37967
38016
|
return out;
|
|
37968
38017
|
}
|
|
37969
38018
|
function serializeSingleBlockXml(block, context, styles) {
|
|
37970
|
-
var
|
|
38019
|
+
var _a;
|
|
37971
38020
|
switch (block.type) {
|
|
37972
38021
|
case "paragraph":
|
|
37973
38022
|
return serializeParagraphXml(block, context, styles);
|
|
37974
38023
|
case "table": {
|
|
37975
|
-
const pageBreakXml = ((
|
|
38024
|
+
const pageBreakXml = ((_a = block.style) == null ? void 0 : _a.pageBreakBefore) ? '<w:p><w:r><w:br w:type="page"/></w:r></w:p>' : "";
|
|
37976
38025
|
return pageBreakXml + serializeTableXml(
|
|
37977
38026
|
block,
|
|
37978
38027
|
(paragraph, cell) => {
|
|
37979
|
-
var
|
|
38028
|
+
var _a2;
|
|
37980
38029
|
return serializeParagraphXml(paragraph, context, styles, {
|
|
37981
|
-
align: (
|
|
38030
|
+
align: (_a2 = cell.style) == null ? void 0 : _a2.horizontalAlign
|
|
37982
38031
|
});
|
|
37983
38032
|
}
|
|
37984
38033
|
);
|
|
@@ -37988,12 +38037,12 @@ function serializeSingleBlockXml(block, context, styles) {
|
|
|
37988
38037
|
}
|
|
37989
38038
|
}
|
|
37990
38039
|
function serializeBlocksXml(blocks, context, styles) {
|
|
37991
|
-
var
|
|
38040
|
+
var _a, _b, _c;
|
|
37992
38041
|
let out = "";
|
|
37993
38042
|
let i = 0;
|
|
37994
38043
|
while (i < blocks.length) {
|
|
37995
38044
|
const block = blocks[i];
|
|
37996
|
-
const wrapper = (
|
|
38045
|
+
const wrapper = (_a = block.sdtWrappers) == null ? void 0 : _a[0];
|
|
37997
38046
|
if (!wrapper) {
|
|
37998
38047
|
out += serializeSingleBlockXml(block, context, styles);
|
|
37999
38048
|
i += 1;
|
|
@@ -38001,7 +38050,7 @@ function serializeBlocksXml(blocks, context, styles) {
|
|
|
38001
38050
|
}
|
|
38002
38051
|
const group = [];
|
|
38003
38052
|
let j = i;
|
|
38004
|
-
while (j < blocks.length && ((_c = (
|
|
38053
|
+
while (j < blocks.length && ((_c = (_b = blocks[j].sdtWrappers) == null ? void 0 : _b[0]) == null ? void 0 : _c.groupId) === wrapper.groupId) {
|
|
38005
38054
|
const rest = blocks[j].sdtWrappers.slice(1);
|
|
38006
38055
|
group.push({
|
|
38007
38056
|
...blocks[j],
|
|
@@ -38016,11 +38065,11 @@ function serializeBlocksXml(blocks, context, styles) {
|
|
|
38016
38065
|
return out;
|
|
38017
38066
|
}
|
|
38018
38067
|
function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
38019
|
-
var
|
|
38068
|
+
var _a, _b, _c;
|
|
38020
38069
|
const runs = paragraph.runs.length > 0 ? paragraph.runs : [{ id: "", text: "", kind: "text" }];
|
|
38021
38070
|
const dropCapFrame = paragraph.dropCap ? serializeDropCapFrameParagraph(paragraph.dropCap) : "";
|
|
38022
|
-
const bookmarkEvents = (
|
|
38023
|
-
const commentEvents = (
|
|
38071
|
+
const bookmarkEvents = (_a = context.bookmarkEventsByParagraph) == null ? void 0 : _a.get(paragraph.id);
|
|
38072
|
+
const commentEvents = (_b = context.commentEventsByParagraph) == null ? void 0 : _b.get(paragraph.id);
|
|
38024
38073
|
const boundaryTokens = [
|
|
38025
38074
|
...(bookmarkEvents ?? []).map(
|
|
38026
38075
|
(e) => ({
|
|
@@ -38045,11 +38094,11 @@ function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
|
38045
38094
|
styles
|
|
38046
38095
|
) : runs.map(
|
|
38047
38096
|
(run) => {
|
|
38048
|
-
var
|
|
38097
|
+
var _a2;
|
|
38049
38098
|
return serializeRunWithRelationships(
|
|
38050
38099
|
run,
|
|
38051
38100
|
context,
|
|
38052
|
-
(
|
|
38101
|
+
(_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
|
|
38053
38102
|
styles,
|
|
38054
38103
|
serializeBlocksXml
|
|
38055
38104
|
);
|
|
@@ -38064,8 +38113,8 @@ function serializeParagraphXml(paragraph, context, styles, overrides) {
|
|
|
38064
38113
|
}
|
|
38065
38114
|
const FIRST_FOOTNOTE_DOCX_ID = 1;
|
|
38066
38115
|
function collectReferencedFootnotesForExport(document2) {
|
|
38067
|
-
var
|
|
38068
|
-
const items = (
|
|
38116
|
+
var _a;
|
|
38117
|
+
const items = (_a = document2.footnotes) == null ? void 0 : _a.items;
|
|
38069
38118
|
if (!items) return [];
|
|
38070
38119
|
const seen = /* @__PURE__ */ new Map();
|
|
38071
38120
|
let nextDocxId = FIRST_FOOTNOTE_DOCX_ID;
|
|
@@ -38113,11 +38162,11 @@ function createEmptyFootnoteBodyParagraph(withMarker = true) {
|
|
|
38113
38162
|
};
|
|
38114
38163
|
}
|
|
38115
38164
|
function prependFootnoteRefMarker(paragraph) {
|
|
38116
|
-
var
|
|
38165
|
+
var _a;
|
|
38117
38166
|
return {
|
|
38118
38167
|
...paragraph,
|
|
38119
38168
|
runs: [makeFootnoteRefMarkerRun(), ...paragraph.runs],
|
|
38120
|
-
style: ((
|
|
38169
|
+
style: ((_a = paragraph.style) == null ? void 0 : _a.styleId) ? paragraph.style : { ...paragraph.style ?? {}, styleId: "FootnoteText" }
|
|
38121
38170
|
};
|
|
38122
38171
|
}
|
|
38123
38172
|
function makeFootnoteRefMarkerRun() {
|
|
@@ -38146,9 +38195,9 @@ function buildFootnotesXml(document2, referenced, numberingContext, state, build
|
|
|
38146
38195
|
return serializeTableXml(
|
|
38147
38196
|
block,
|
|
38148
38197
|
(paragraph, cell) => {
|
|
38149
|
-
var
|
|
38198
|
+
var _a;
|
|
38150
38199
|
return serializeParagraphXml(paragraph, partContext, styles, {
|
|
38151
|
-
align: (
|
|
38200
|
+
align: (_a = cell.style) == null ? void 0 : _a.horizontalAlign
|
|
38152
38201
|
});
|
|
38153
38202
|
}
|
|
38154
38203
|
);
|
|
@@ -38160,8 +38209,8 @@ function buildFootnotesXml(document2, referenced, numberingContext, state, build
|
|
|
38160
38209
|
}
|
|
38161
38210
|
const FIRST_ENDNOTE_DOCX_ID = 1;
|
|
38162
38211
|
function collectReferencedEndnotesForExport(document2) {
|
|
38163
|
-
var
|
|
38164
|
-
const items = (
|
|
38212
|
+
var _a;
|
|
38213
|
+
const items = (_a = document2.endnotes) == null ? void 0 : _a.items;
|
|
38165
38214
|
if (!items) return [];
|
|
38166
38215
|
const seen = /* @__PURE__ */ new Map();
|
|
38167
38216
|
let nextDocxId = FIRST_ENDNOTE_DOCX_ID;
|
|
@@ -38209,11 +38258,11 @@ function createEmptyEndnoteBodyParagraph(withMarker = true) {
|
|
|
38209
38258
|
};
|
|
38210
38259
|
}
|
|
38211
38260
|
function prependEndnoteRefMarker(paragraph) {
|
|
38212
|
-
var
|
|
38261
|
+
var _a;
|
|
38213
38262
|
return {
|
|
38214
38263
|
...paragraph,
|
|
38215
38264
|
runs: [makeEndnoteRefMarkerRun(), ...paragraph.runs],
|
|
38216
|
-
style: ((
|
|
38265
|
+
style: ((_a = paragraph.style) == null ? void 0 : _a.styleId) ? paragraph.style : { ...paragraph.style ?? {}, styleId: "EndnoteText" }
|
|
38217
38266
|
};
|
|
38218
38267
|
}
|
|
38219
38268
|
function makeEndnoteRefMarkerRun() {
|
|
@@ -38241,9 +38290,9 @@ function buildEndnotesXml(_document, referenced, _numberingContext, _state, buil
|
|
|
38241
38290
|
return serializeTableXml(
|
|
38242
38291
|
block,
|
|
38243
38292
|
(paragraph, cell) => {
|
|
38244
|
-
var
|
|
38293
|
+
var _a;
|
|
38245
38294
|
return serializeParagraphXml(paragraph, partContext, styles, {
|
|
38246
|
-
align: (
|
|
38295
|
+
align: (_a = cell.style) == null ? void 0 : _a.horizontalAlign
|
|
38247
38296
|
});
|
|
38248
38297
|
}
|
|
38249
38298
|
);
|
|
@@ -38672,14 +38721,14 @@ function buildNumberingXml(definitions) {
|
|
|
38672
38721
|
}
|
|
38673
38722
|
const DOCUMENT_XMLNS = `xmlns:w="${WORD_NS$1}" xmlns:w14="${WORD14_NS}" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:r="${OFFICE_REL_NS}"`;
|
|
38674
38723
|
function serializeSectionPropertiesWithReferences(pageSettings, references, section, nextBreakType) {
|
|
38675
|
-
var
|
|
38724
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
38676
38725
|
const width = pxToTwips(pageSettings.width, 12240);
|
|
38677
38726
|
const height = pxToTwips(pageSettings.height, 15840);
|
|
38678
38727
|
const margins = pageSettings.margins;
|
|
38679
38728
|
const orientationAttr = pageSettings.orientation === "landscape" ? ' w:orient="landscape"' : "";
|
|
38680
38729
|
const referencesXml = [
|
|
38681
|
-
((
|
|
38682
|
-
((
|
|
38730
|
+
((_a = references == null ? void 0 : references.header) == null ? void 0 : _a.first) ? `<w:headerReference w:type="first" r:id="${references.header.first.relId}"/>` : "",
|
|
38731
|
+
((_b = references == null ? void 0 : references.header) == null ? void 0 : _b.even) ? `<w:headerReference w:type="even" r:id="${references.header.even.relId}"/>` : "",
|
|
38683
38732
|
((_c = references == null ? void 0 : references.header) == null ? void 0 : _c.default) ? `<w:headerReference w:type="default" r:id="${references.header.default.relId}"/>` : "",
|
|
38684
38733
|
((_d = references == null ? void 0 : references.footer) == null ? void 0 : _d.first) ? `<w:footerReference w:type="first" r:id="${references.footer.first.relId}"/>` : "",
|
|
38685
38734
|
((_e = references == null ? void 0 : references.footer) == null ? void 0 : _e.even) ? `<w:footerReference w:type="even" r:id="${references.footer.even.relId}"/>` : "",
|
|
@@ -38722,7 +38771,7 @@ function serializeSectionPropertiesWithReferences(pageSettings, references, sect
|
|
|
38722
38771
|
function buildDocumentXml(document2, context, sectionReferences) {
|
|
38723
38772
|
const sections = getDocumentSections(document2);
|
|
38724
38773
|
const sectionsXml = sections.map((section, sectionIndex) => {
|
|
38725
|
-
var
|
|
38774
|
+
var _a;
|
|
38726
38775
|
const blocksXml = serializeBlocksXml(
|
|
38727
38776
|
section.blocks,
|
|
38728
38777
|
context,
|
|
@@ -38732,7 +38781,7 @@ function buildDocumentXml(document2, context, sectionReferences) {
|
|
|
38732
38781
|
section.pageSettings,
|
|
38733
38782
|
sectionReferences[sectionIndex],
|
|
38734
38783
|
section,
|
|
38735
|
-
(
|
|
38784
|
+
(_a = sections[sectionIndex + 1]) == null ? void 0 : _a.breakType
|
|
38736
38785
|
);
|
|
38737
38786
|
return blocksXml + sectionPr;
|
|
38738
38787
|
}).join("");
|
|
@@ -38780,11 +38829,11 @@ function createImageCaptionParagraph(captionText, label, sequenceNumber) {
|
|
|
38780
38829
|
return paragraph;
|
|
38781
38830
|
}
|
|
38782
38831
|
function isImageCaptionParagraph(paragraph) {
|
|
38783
|
-
var
|
|
38832
|
+
var _a, _b;
|
|
38784
38833
|
if (!paragraph) {
|
|
38785
38834
|
return false;
|
|
38786
38835
|
}
|
|
38787
|
-
const styleId = (
|
|
38836
|
+
const styleId = (_b = (_a = paragraph.style) == null ? void 0 : _a.styleId) == null ? void 0 : _b.toLowerCase();
|
|
38788
38837
|
if (styleId !== "caption") {
|
|
38789
38838
|
return false;
|
|
38790
38839
|
}
|
|
@@ -38796,7 +38845,7 @@ function isImageCaptionParagraph(paragraph) {
|
|
|
38796
38845
|
});
|
|
38797
38846
|
}
|
|
38798
38847
|
function getImageCaptionText(paragraph) {
|
|
38799
|
-
var
|
|
38848
|
+
var _a;
|
|
38800
38849
|
if (!isImageCaptionParagraph(paragraph)) {
|
|
38801
38850
|
return "";
|
|
38802
38851
|
}
|
|
@@ -38807,15 +38856,15 @@ function getImageCaptionText(paragraph) {
|
|
|
38807
38856
|
value += run.text;
|
|
38808
38857
|
continue;
|
|
38809
38858
|
}
|
|
38810
|
-
if (((
|
|
38859
|
+
if (((_a = getRunFieldChar(run)) == null ? void 0 : _a.kind) === "end") {
|
|
38811
38860
|
afterField = true;
|
|
38812
38861
|
}
|
|
38813
38862
|
}
|
|
38814
38863
|
return value.replace(/^[:\-\s]+/, "");
|
|
38815
38864
|
}
|
|
38816
38865
|
function updateImageCaptionParagraph(paragraph, captionText, label) {
|
|
38817
|
-
var
|
|
38818
|
-
const currentNumber = ((
|
|
38866
|
+
var _a;
|
|
38867
|
+
const currentNumber = ((_a = paragraph.runs.find((run) => /^\d+$/.test(run.text))) == null ? void 0 : _a.text) ?? "1";
|
|
38819
38868
|
const next = createImageCaptionParagraph(
|
|
38820
38869
|
captionText,
|
|
38821
38870
|
label,
|
|
@@ -38914,9 +38963,9 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
38914
38963
|
const hyperlinks = [];
|
|
38915
38964
|
const hyperlinkMap = /* @__PURE__ */ new Map();
|
|
38916
38965
|
visitBlocks(blocks, (paragraph) => {
|
|
38917
|
-
var
|
|
38966
|
+
var _a;
|
|
38918
38967
|
for (const run of paragraph.runs) {
|
|
38919
|
-
const link = (
|
|
38968
|
+
const link = (_a = run.styles) == null ? void 0 : _a.link;
|
|
38920
38969
|
if (link && !link.startsWith("#") && !hyperlinkMap.has(link)) {
|
|
38921
38970
|
const rId2 = `rIdLink${hyperlinks.length + 1}`;
|
|
38922
38971
|
hyperlinkMap.set(link, rId2);
|
|
@@ -38939,6 +38988,7 @@ function buildPartContext(blocks, numberingContext, state, document2) {
|
|
|
38939
38988
|
alt: run.image.alt,
|
|
38940
38989
|
crop: run.image.crop,
|
|
38941
38990
|
fillMode: run.image.fillMode,
|
|
38991
|
+
border: run.image.border,
|
|
38942
38992
|
rotation: run.image.rotation,
|
|
38943
38993
|
flipH: run.image.flipH,
|
|
38944
38994
|
flipV: run.image.flipV,
|
|
@@ -39000,7 +39050,7 @@ function writeNotePart(zip, partName, part) {
|
|
|
39000
39050
|
}
|
|
39001
39051
|
}
|
|
39002
39052
|
async function exportEditorDocumentToDocx(document2) {
|
|
39003
|
-
var
|
|
39053
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
39004
39054
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
39005
39055
|
const zip = new JSZip();
|
|
39006
39056
|
const numberingContext = buildNumberingContext(document2);
|
|
@@ -39042,7 +39092,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
39042
39092
|
let nextFooterIndex = 1;
|
|
39043
39093
|
sections.forEach((section, sectionIndex) => {
|
|
39044
39094
|
const addPart = (kind, type, blocks) => {
|
|
39045
|
-
var
|
|
39095
|
+
var _a2;
|
|
39046
39096
|
if (!blocks || blocks.length === 0) {
|
|
39047
39097
|
return;
|
|
39048
39098
|
}
|
|
@@ -39062,7 +39112,7 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
39062
39112
|
context
|
|
39063
39113
|
});
|
|
39064
39114
|
const referenceKey = kind === "header" ? "header" : "footer";
|
|
39065
|
-
((
|
|
39115
|
+
((_a2 = sectionReferences[sectionIndex])[referenceKey] ?? (_a2[referenceKey] = {}))[type] = { relId };
|
|
39066
39116
|
if (kind === "header") {
|
|
39067
39117
|
nextHeaderIndex += 1;
|
|
39068
39118
|
} else {
|
|
@@ -39079,11 +39129,11 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
39079
39129
|
const hasNumbering = numberingContext.definitions.length > 0;
|
|
39080
39130
|
const hasEvenAndOddHeaders = sections.some(
|
|
39081
39131
|
(section) => {
|
|
39082
|
-
var
|
|
39083
|
-
return (((
|
|
39132
|
+
var _a2, _b2;
|
|
39133
|
+
return (((_a2 = section.evenPageHeader) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b2 = section.evenPageFooter) == null ? void 0 : _b2.length) ?? 0) > 0;
|
|
39084
39134
|
}
|
|
39085
39135
|
);
|
|
39086
|
-
const hasDocumentSettings = hasEvenAndOddHeaders || ((
|
|
39136
|
+
const hasDocumentSettings = hasEvenAndOddHeaders || ((_a = document2.settings) == null ? void 0 : _a.defaultTabStop) !== void 0 || ((_b = document2.settings) == null ? void 0 : _b.allowSpaceOfSameStyleInTable) !== void 0 || ((_c = document2.settings) == null ? void 0 : _c.autoHyphenation) !== void 0 || ((_d = document2.settings) == null ? void 0 : _d.consecutiveHyphenLimit) !== void 0 || ((_e = document2.settings) == null ? void 0 : _e.hyphenationZone) !== void 0 || ((_f = document2.settings) == null ? void 0 : _f.doNotHyphenateCaps) !== void 0 || ((_g = document2.footnotes) == null ? void 0 : _g.settings) !== void 0 || ((_h = document2.endnotes) == null ? void 0 : _h.settings) !== void 0;
|
|
39087
39137
|
const allImages = [
|
|
39088
39138
|
...bodyContext.images,
|
|
39089
39139
|
...parts.flatMap((part) => part.context.images)
|
|
@@ -39114,8 +39164,8 @@ async function exportEditorDocumentToDocx(document2) {
|
|
|
39114
39164
|
}
|
|
39115
39165
|
const imageExtensions = allImages.filter((img) => img.kind === "embedded").map(
|
|
39116
39166
|
(img) => {
|
|
39117
|
-
var
|
|
39118
|
-
return (
|
|
39167
|
+
var _a2;
|
|
39168
|
+
return (_a2 = img.target.split(".").pop()) == null ? void 0 : _a2.toLowerCase();
|
|
39119
39169
|
}
|
|
39120
39170
|
).filter((ext) => Boolean(ext));
|
|
39121
39171
|
const hasStyles = document2.styles != null && Object.keys(document2.styles).length > 0;
|
|
@@ -39236,24 +39286,24 @@ function borderDashArray(type) {
|
|
|
39236
39286
|
}
|
|
39237
39287
|
}
|
|
39238
39288
|
function getPadding(textBox) {
|
|
39239
|
-
var
|
|
39289
|
+
var _a, _b, _c, _d;
|
|
39240
39290
|
return {
|
|
39241
|
-
left: ((
|
|
39242
|
-
top: ((
|
|
39291
|
+
left: ((_a = textBox.body) == null ? void 0 : _a.paddingLeft) ?? 0,
|
|
39292
|
+
top: ((_b = textBox.body) == null ? void 0 : _b.paddingTop) ?? 0,
|
|
39243
39293
|
right: ((_c = textBox.body) == null ? void 0 : _c.paddingRight) ?? 0,
|
|
39244
39294
|
bottom: ((_d = textBox.body) == null ? void 0 : _d.paddingBottom) ?? 0
|
|
39245
39295
|
};
|
|
39246
39296
|
}
|
|
39247
39297
|
function drawShapeGeometry(writer, pageIndex, textBox, xPx, yPx, widthPx, heightPx) {
|
|
39248
|
-
var
|
|
39298
|
+
var _a, _b, _c, _d;
|
|
39249
39299
|
const segments = getPresetPathSegments(
|
|
39250
|
-
(
|
|
39300
|
+
(_a = textBox.shape) == null ? void 0 : _a.preset,
|
|
39251
39301
|
pxToPt$1(xPx),
|
|
39252
39302
|
pxToPt$1(yPx),
|
|
39253
39303
|
pxToPt$1(widthPx),
|
|
39254
39304
|
pxToPt$1(heightPx)
|
|
39255
39305
|
);
|
|
39256
|
-
const fill = (
|
|
39306
|
+
const fill = (_b = textBox.shape) == null ? void 0 : _b.fill;
|
|
39257
39307
|
const borderColor = (_c = textBox.shape) == null ? void 0 : _c.borderColor;
|
|
39258
39308
|
const borderWidthPt = ((_d = textBox.shape) == null ? void 0 : _d.borderWidthPt) ?? (borderColor ? 0.75 : 0);
|
|
39259
39309
|
writer.drawPath(pageIndex, {
|
|
@@ -39264,7 +39314,7 @@ function drawShapeGeometry(writer, pageIndex, textBox, xPx, yPx, widthPx, height
|
|
|
39264
39314
|
});
|
|
39265
39315
|
}
|
|
39266
39316
|
async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heightPx, drawers) {
|
|
39267
|
-
var
|
|
39317
|
+
var _a;
|
|
39268
39318
|
if (textBox.blocks.length === 0) {
|
|
39269
39319
|
return;
|
|
39270
39320
|
}
|
|
@@ -39293,7 +39343,7 @@ async function drawTextBoxContent(writer, textBox, ctx, xPx, yPx, widthPx, heigh
|
|
|
39293
39343
|
styles: ctx.document.styles,
|
|
39294
39344
|
pageOffset: ctx.pageIndex
|
|
39295
39345
|
});
|
|
39296
|
-
const blocks = ((
|
|
39346
|
+
const blocks = ((_a = pages[0]) == null ? void 0 : _a.blocks) ?? [];
|
|
39297
39347
|
if (blocks.length === 0) {
|
|
39298
39348
|
return;
|
|
39299
39349
|
}
|
|
@@ -39562,6 +39612,43 @@ async function registerPdfImageRun(writer, document2, image) {
|
|
|
39562
39612
|
perWriter.set(resolvedSrc, preparedPromise);
|
|
39563
39613
|
return preparedPromise;
|
|
39564
39614
|
}
|
|
39615
|
+
async function drawImageObject(writer, pageIndex, document2, image, x, y, width, height) {
|
|
39616
|
+
const resourceName = await registerPdfImageRun(writer, document2, image);
|
|
39617
|
+
if (!resourceName) {
|
|
39618
|
+
return;
|
|
39619
|
+
}
|
|
39620
|
+
writer.drawImage(pageIndex, {
|
|
39621
|
+
resourceName,
|
|
39622
|
+
x,
|
|
39623
|
+
y,
|
|
39624
|
+
width,
|
|
39625
|
+
height,
|
|
39626
|
+
rotation: image.rotation,
|
|
39627
|
+
crop: image.crop
|
|
39628
|
+
});
|
|
39629
|
+
const border = image.border;
|
|
39630
|
+
if (!border) {
|
|
39631
|
+
return;
|
|
39632
|
+
}
|
|
39633
|
+
const rotation = image.rotation;
|
|
39634
|
+
if (rotation) {
|
|
39635
|
+
writer.saveGraphicsState(pageIndex);
|
|
39636
|
+
writer.rotateAbout(pageIndex, x + width / 2, y + height / 2, rotation);
|
|
39637
|
+
}
|
|
39638
|
+
const dashArray = lineDashPatternPt(border.dash);
|
|
39639
|
+
writer.drawRect(pageIndex, {
|
|
39640
|
+
x,
|
|
39641
|
+
y,
|
|
39642
|
+
width,
|
|
39643
|
+
height,
|
|
39644
|
+
stroke: border.color,
|
|
39645
|
+
lineWidth: border.widthPt ?? 1,
|
|
39646
|
+
...dashArray.length > 0 ? { dashArray } : {}
|
|
39647
|
+
});
|
|
39648
|
+
if (rotation) {
|
|
39649
|
+
writer.restoreGraphicsState(pageIndex);
|
|
39650
|
+
}
|
|
39651
|
+
}
|
|
39565
39652
|
function resolveFragmentSlots(line, fragment) {
|
|
39566
39653
|
const slotByOffset = new Map(
|
|
39567
39654
|
line.slots.map(
|
|
@@ -39732,7 +39819,7 @@ function drawFragmentEmphasis(writer, pageIndex, line, fragment, originX, origin
|
|
|
39732
39819
|
}
|
|
39733
39820
|
}
|
|
39734
39821
|
function drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2, originX, baselineY, color) {
|
|
39735
|
-
var
|
|
39822
|
+
var _a;
|
|
39736
39823
|
const slotByOffset = new Map(
|
|
39737
39824
|
line.slots.map(
|
|
39738
39825
|
(slot) => [slot.offset, slot]
|
|
@@ -39748,7 +39835,7 @@ function drawTabLeaders(writer, pageIndex, paragraph, line, fragment, document2,
|
|
|
39748
39835
|
const slot = slotByOffset.get(char.paragraphOffset);
|
|
39749
39836
|
const nextSlot = slotByOffset.get(char.paragraphOffset + 1);
|
|
39750
39837
|
if (!slot || !nextSlot) continue;
|
|
39751
|
-
const lineStart = ((
|
|
39838
|
+
const lineStart = ((_a = line.slots[0]) == null ? void 0 : _a.left) ?? 0;
|
|
39752
39839
|
const relativeLeft = slot.left - lineStart;
|
|
39753
39840
|
const stop = tabs.filter((tab) => tab.type !== "clear").map((tab) => ({ ...tab, positionPx: tab.position * PX_PER_POINT })).filter((tab) => tab.positionPx > relativeLeft + 0.01).sort((a, b) => a.positionPx - b.positionPx)[0];
|
|
39754
39841
|
const leader = (stop == null ? void 0 : stop.leader) && stop.leader !== "none" ? stop.leader : void 0;
|
|
@@ -39918,21 +40005,16 @@ async function drawFloatingImagesForParagraph(options) {
|
|
|
39918
40005
|
lineTop: options.paragraphTop + line.top,
|
|
39919
40006
|
anchorLeft: options.contentLeft + ((slot == null ? void 0 : slot.left) ?? 0)
|
|
39920
40007
|
});
|
|
39921
|
-
|
|
40008
|
+
await drawImageObject(
|
|
39922
40009
|
options.writer,
|
|
40010
|
+
options.pageIndex,
|
|
39923
40011
|
options.document,
|
|
39924
|
-
image
|
|
40012
|
+
image,
|
|
40013
|
+
pxToPt$1(rect.x),
|
|
40014
|
+
pxToPt$1(rect.y),
|
|
40015
|
+
pxToPt$1(rect.width),
|
|
40016
|
+
pxToPt$1(rect.height)
|
|
39925
40017
|
);
|
|
39926
|
-
if (!resourceName) continue;
|
|
39927
|
-
options.writer.drawImage(options.pageIndex, {
|
|
39928
|
-
resourceName,
|
|
39929
|
-
x: pxToPt$1(rect.x),
|
|
39930
|
-
y: pxToPt$1(rect.y),
|
|
39931
|
-
width: pxToPt$1(rect.width),
|
|
39932
|
-
height: pxToPt$1(rect.height),
|
|
39933
|
-
rotation: image.rotation,
|
|
39934
|
-
crop: image.crop
|
|
39935
|
-
});
|
|
39936
40018
|
}
|
|
39937
40019
|
}
|
|
39938
40020
|
}
|
|
@@ -40007,9 +40089,37 @@ function drawLinkAnnotation(writer, pageIndex, line, fragment, originX, originY,
|
|
|
40007
40089
|
function emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, paragraphAlign) {
|
|
40008
40090
|
const chunks = paragraphAlign === "justify" ? groupSlotChunksByWhitespace(chars) : groupSlotChunksByOffsetGaps(chars);
|
|
40009
40091
|
for (const chunk of chunks) {
|
|
40010
|
-
|
|
40011
|
-
|
|
40012
|
-
|
|
40092
|
+
let segment = [];
|
|
40093
|
+
let segmentReduced = false;
|
|
40094
|
+
const flush = () => {
|
|
40095
|
+
if (segment.length === 0) return;
|
|
40096
|
+
const text = segment.map((char) => resolveRenderedTextChar(char.char, styles)).join("");
|
|
40097
|
+
if (text.length > 0) {
|
|
40098
|
+
const fontSizePt = segmentReduced ? chunkCtx.fontSizePt * 0.8 : chunkCtx.fontSizePt;
|
|
40099
|
+
emitTextChunk(
|
|
40100
|
+
{
|
|
40101
|
+
...chunkCtx,
|
|
40102
|
+
fontSizePt,
|
|
40103
|
+
baseTextOptions: {
|
|
40104
|
+
...chunkCtx.baseTextOptions,
|
|
40105
|
+
fontSize: fontSizePt
|
|
40106
|
+
}
|
|
40107
|
+
},
|
|
40108
|
+
originX + segment[0].left,
|
|
40109
|
+
text
|
|
40110
|
+
);
|
|
40111
|
+
}
|
|
40112
|
+
segment = [];
|
|
40113
|
+
};
|
|
40114
|
+
for (const char of chunk) {
|
|
40115
|
+
const reduced = Boolean(
|
|
40116
|
+
styles.smallCaps && isLowercaseSmallCapsChar(char.char)
|
|
40117
|
+
);
|
|
40118
|
+
if (segment.length > 0 && reduced !== segmentReduced) flush();
|
|
40119
|
+
segmentReduced = reduced;
|
|
40120
|
+
segment.push(char);
|
|
40121
|
+
}
|
|
40122
|
+
flush();
|
|
40013
40123
|
}
|
|
40014
40124
|
if (line.trailingHyphen && fragment.endOffset >= line.endOffset) {
|
|
40015
40125
|
const endSlot = line.slots.find((slot) => slot.offset === line.endOffset) ?? line.slots[line.slots.length - 1];
|
|
@@ -40017,26 +40127,21 @@ function emitFragmentGlyphs(chunkCtx, chars, originX, styles, line, fragment, pa
|
|
|
40017
40127
|
}
|
|
40018
40128
|
}
|
|
40019
40129
|
async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, document2, originX, originY, fontRegistry, drawers) {
|
|
40020
|
-
var
|
|
40130
|
+
var _a, _b, _c;
|
|
40021
40131
|
if (fragment.image) {
|
|
40022
40132
|
if (fragment.image.floating) return;
|
|
40023
40133
|
const slot = line.slots.find((c) => c.offset === fragment.startOffset) ?? line.slots.find((c) => c.offset >= fragment.startOffset);
|
|
40024
40134
|
if (!slot) return;
|
|
40025
|
-
|
|
40135
|
+
await drawImageObject(
|
|
40026
40136
|
writer,
|
|
40137
|
+
pageIndex,
|
|
40027
40138
|
document2,
|
|
40028
|
-
fragment.image
|
|
40029
|
-
|
|
40030
|
-
|
|
40031
|
-
|
|
40032
|
-
|
|
40033
|
-
|
|
40034
|
-
y: pxToPt$1(originY + line.top + line.height - fragment.image.height),
|
|
40035
|
-
width: pxToPt$1(fragment.image.width),
|
|
40036
|
-
height: pxToPt$1(fragment.image.height),
|
|
40037
|
-
rotation: fragment.image.rotation,
|
|
40038
|
-
crop: fragment.image.crop
|
|
40039
|
-
});
|
|
40139
|
+
fragment.image,
|
|
40140
|
+
pxToPt$1(originX + slot.left),
|
|
40141
|
+
pxToPt$1(originY + line.top + line.height - fragment.image.height),
|
|
40142
|
+
pxToPt$1(fragment.image.width),
|
|
40143
|
+
pxToPt$1(fragment.image.height)
|
|
40144
|
+
);
|
|
40040
40145
|
return;
|
|
40041
40146
|
}
|
|
40042
40147
|
if (fragment.textBox) {
|
|
@@ -40057,7 +40162,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
40057
40162
|
}
|
|
40058
40163
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
40059
40164
|
fragment.styles,
|
|
40060
|
-
(
|
|
40165
|
+
(_a = paragraph.style) == null ? void 0 : _a.styleId,
|
|
40061
40166
|
document2.styles
|
|
40062
40167
|
);
|
|
40063
40168
|
if (styles.hidden) return;
|
|
@@ -40066,7 +40171,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
40066
40171
|
bold: styles.bold,
|
|
40067
40172
|
italic: styles.italic
|
|
40068
40173
|
});
|
|
40069
|
-
const fontSizePt =
|
|
40174
|
+
const fontSizePt = textStyleToFontSizePt(styles);
|
|
40070
40175
|
const baselineShiftPx = (styles.baselineShift ?? 0) * PX_PER_POINT;
|
|
40071
40176
|
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
40072
40177
|
paragraph.style,
|
|
@@ -40079,9 +40184,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
40079
40184
|
);
|
|
40080
40185
|
const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO - baselineShiftPx + textAlignOffset;
|
|
40081
40186
|
const chars = resolveFragmentSlots(line, fragment);
|
|
40082
|
-
const text = chars.map(
|
|
40083
|
-
(char) => styles.allCaps ? char.char.toUpperCase() : char.char
|
|
40084
|
-
).join("");
|
|
40187
|
+
const text = chars.map((char) => resolveRenderedTextChar(char.char, styles)).join("");
|
|
40085
40188
|
const firstChar = chars[0];
|
|
40086
40189
|
if (!firstChar || text.length === 0) return;
|
|
40087
40190
|
drawLinkAnnotation(
|
|
@@ -40145,7 +40248,7 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
40145
40248
|
horizontalScale: styles.characterScale ?? 100,
|
|
40146
40249
|
fontFeatures
|
|
40147
40250
|
};
|
|
40148
|
-
const mainColor = ((
|
|
40251
|
+
const mainColor = ((_b = styles.textFill) == null ? void 0 : _b.type) === "solid" ? styles.textFill.color : ((_c = styles.textFill) == null ? void 0 : _c.type) === "gradient" && styles.textFill.stops[0] ? styles.textFill.stops[0].color : styles.color ?? "#000000";
|
|
40149
40252
|
const gradientShadingName = resolveGradientShadingName(
|
|
40150
40253
|
writer,
|
|
40151
40254
|
pageIndex,
|
|
@@ -40226,7 +40329,7 @@ function getListOrdinals(document2) {
|
|
|
40226
40329
|
return buildListLabels(document2);
|
|
40227
40330
|
}
|
|
40228
40331
|
function drawListPrefix(writer, pageIndex, paragraph, line, document2, originX, originY, fontRegistry, listOrdinals) {
|
|
40229
|
-
var
|
|
40332
|
+
var _a;
|
|
40230
40333
|
if (line.index !== 0) {
|
|
40231
40334
|
return;
|
|
40232
40335
|
}
|
|
@@ -40240,7 +40343,7 @@ function drawListPrefix(writer, pageIndex, paragraph, line, document2, originX,
|
|
|
40240
40343
|
}
|
|
40241
40344
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
40242
40345
|
void 0,
|
|
40243
|
-
(
|
|
40346
|
+
(_a = paragraph.style) == null ? void 0 : _a.styleId,
|
|
40244
40347
|
document2.styles
|
|
40245
40348
|
);
|
|
40246
40349
|
const fontFace = fontRegistry.resolveFontFace({
|
|
@@ -40483,7 +40586,7 @@ async function drawTableBlock(writer, pageIndex, block, document2, originX, orig
|
|
|
40483
40586
|
}
|
|
40484
40587
|
const blockDrawers = { drawParagraph, drawTableBlock };
|
|
40485
40588
|
async function drawBlockList(writer, pageIndex, blocks, document2, originX, originY, contentWidth, fontRegistry, listOrdinals, pageSettings, onParagraphDrawn) {
|
|
40486
|
-
var
|
|
40589
|
+
var _a;
|
|
40487
40590
|
if (!blocks || blocks.length === 0) {
|
|
40488
40591
|
return;
|
|
40489
40592
|
}
|
|
@@ -40584,7 +40687,7 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
40584
40687
|
break;
|
|
40585
40688
|
}
|
|
40586
40689
|
case "table":
|
|
40587
|
-
if (((
|
|
40690
|
+
if (((_a = block.sourceBlock.style) == null ? void 0 : _a.floating) && pageSettings) {
|
|
40588
40691
|
const width = resolveCanvasTableWidth(
|
|
40589
40692
|
block.sourceBlock,
|
|
40590
40693
|
contentWidth
|
|
@@ -40788,6 +40891,29 @@ class PdfFontRegistry {
|
|
|
40788
40891
|
this.fallbackFamily = "Roboto";
|
|
40789
40892
|
}
|
|
40790
40893
|
}
|
|
40894
|
+
async loadRemoteWebFontFaces(options = {}) {
|
|
40895
|
+
if (!options.families) return;
|
|
40896
|
+
const faces = await getRemotePdfFontFaces(options.families);
|
|
40897
|
+
for (const face of faces) {
|
|
40898
|
+
const resourceName = `Remote${pdfResourceNamePrefix(
|
|
40899
|
+
face.postscriptName || face.family
|
|
40900
|
+
)}`;
|
|
40901
|
+
this.registerFontFace({
|
|
40902
|
+
key: faceKey(face.family, face.bold, face.italic),
|
|
40903
|
+
family: face.family,
|
|
40904
|
+
bold: face.bold,
|
|
40905
|
+
italic: face.italic,
|
|
40906
|
+
writerResourceName: resourceName,
|
|
40907
|
+
pdfResource: {
|
|
40908
|
+
kind: "unicode",
|
|
40909
|
+
resourceName,
|
|
40910
|
+
family: face.family,
|
|
40911
|
+
fontData: face.fontData,
|
|
40912
|
+
postscriptName: face.postscriptName
|
|
40913
|
+
}
|
|
40914
|
+
});
|
|
40915
|
+
}
|
|
40916
|
+
}
|
|
40791
40917
|
async registerOfficeCompatibleFaces(requestedFamilies) {
|
|
40792
40918
|
const matchedFamilies = /* @__PURE__ */ new Set();
|
|
40793
40919
|
for (const familyDefinition of OFFICE_COMPAT_FONT_FAMILIES) {
|
|
@@ -41029,6 +41155,12 @@ function textMarkerComment(value) {
|
|
|
41029
41155
|
);
|
|
41030
41156
|
return `% OasisText ${encodePdfUtf16Hex(codePoints)}`;
|
|
41031
41157
|
}
|
|
41158
|
+
function buildDashCommand(dashArray) {
|
|
41159
|
+
if (!dashArray || dashArray.length === 0) {
|
|
41160
|
+
return null;
|
|
41161
|
+
}
|
|
41162
|
+
return `[${dashArray.map((value) => formatNumber(value)).join(" ")}] 0 d`;
|
|
41163
|
+
}
|
|
41032
41164
|
class PdfContentStream {
|
|
41033
41165
|
constructor(page, fonts, images, shadings) {
|
|
41034
41166
|
this.page = page;
|
|
@@ -41064,6 +41196,10 @@ class PdfContentStream {
|
|
|
41064
41196
|
if (options.stroke) {
|
|
41065
41197
|
commands.push(colorCommand(options.stroke, "RG", [0, 0, 0]));
|
|
41066
41198
|
commands.push(`${formatNumber(options.lineWidth ?? 1)} w`);
|
|
41199
|
+
const dashCommand = buildDashCommand(options.dashArray);
|
|
41200
|
+
if (dashCommand) {
|
|
41201
|
+
commands.push(dashCommand);
|
|
41202
|
+
}
|
|
41067
41203
|
}
|
|
41068
41204
|
commands.push(
|
|
41069
41205
|
[
|
|
@@ -41086,7 +41222,7 @@ class PdfContentStream {
|
|
|
41086
41222
|
}
|
|
41087
41223
|
drawLine(options) {
|
|
41088
41224
|
const page = this.page;
|
|
41089
|
-
const dashCommand = options.dashArray
|
|
41225
|
+
const dashCommand = buildDashCommand(options.dashArray);
|
|
41090
41226
|
const commands = [
|
|
41091
41227
|
"q",
|
|
41092
41228
|
colorCommand(options.stroke, "RG", [0, 0, 0])
|
|
@@ -42283,7 +42419,7 @@ class SimpleTextLayouter {
|
|
|
42283
42419
|
function view(bytes) {
|
|
42284
42420
|
return new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
42285
42421
|
}
|
|
42286
|
-
function u16
|
|
42422
|
+
function u16(bytes, offset) {
|
|
42287
42423
|
return view(bytes).getUint16(offset);
|
|
42288
42424
|
}
|
|
42289
42425
|
function i16(bytes, offset) {
|
|
@@ -42338,8 +42474,8 @@ function collectCompositeGlyphs(glyph, addGlyph) {
|
|
|
42338
42474
|
let flags = 0;
|
|
42339
42475
|
do {
|
|
42340
42476
|
if (offset + 4 > glyph.byteLength) return;
|
|
42341
|
-
flags = u16
|
|
42342
|
-
addGlyph(u16
|
|
42477
|
+
flags = u16(glyph, offset);
|
|
42478
|
+
addGlyph(u16(glyph, offset + 2));
|
|
42343
42479
|
offset += 4;
|
|
42344
42480
|
offset += flags & 1 ? 4 : 2;
|
|
42345
42481
|
if (flags & 8) offset += 2;
|
|
@@ -42356,7 +42492,7 @@ function subsetClosure(font, initialGlyphs) {
|
|
|
42356
42492
|
(a, b) => a - b
|
|
42357
42493
|
);
|
|
42358
42494
|
}
|
|
42359
|
-
const offsets = readLoca(loca, u16
|
|
42495
|
+
const offsets = readLoca(loca, u16(head, 50));
|
|
42360
42496
|
const used = /* @__PURE__ */ new Set([0, ...initialGlyphs]);
|
|
42361
42497
|
const stack = Array.from(used);
|
|
42362
42498
|
while (stack.length > 0) {
|
|
@@ -42400,7 +42536,7 @@ function buildSubsetTables(font, glyphIds) {
|
|
|
42400
42536
|
}
|
|
42401
42537
|
const maxGlyphId = Math.max(0, ...glyphIds);
|
|
42402
42538
|
const used = new Set(glyphIds);
|
|
42403
|
-
const sourceOffsets = readLoca(loca, u16
|
|
42539
|
+
const sourceOffsets = readLoca(loca, u16(head, 50));
|
|
42404
42540
|
const locaOffsets = [];
|
|
42405
42541
|
const glyfChunks = [];
|
|
42406
42542
|
let glyfOffset = 0;
|
|
@@ -42801,524 +42937,6 @@ function buildFunctionObject(stops) {
|
|
|
42801
42937
|
">>"
|
|
42802
42938
|
].join("\n");
|
|
42803
42939
|
}
|
|
42804
|
-
var u8 = Uint8Array, u16 = Uint16Array, i32 = Int32Array;
|
|
42805
|
-
var fleb = new u8([
|
|
42806
|
-
0,
|
|
42807
|
-
0,
|
|
42808
|
-
0,
|
|
42809
|
-
0,
|
|
42810
|
-
0,
|
|
42811
|
-
0,
|
|
42812
|
-
0,
|
|
42813
|
-
0,
|
|
42814
|
-
1,
|
|
42815
|
-
1,
|
|
42816
|
-
1,
|
|
42817
|
-
1,
|
|
42818
|
-
2,
|
|
42819
|
-
2,
|
|
42820
|
-
2,
|
|
42821
|
-
2,
|
|
42822
|
-
3,
|
|
42823
|
-
3,
|
|
42824
|
-
3,
|
|
42825
|
-
3,
|
|
42826
|
-
4,
|
|
42827
|
-
4,
|
|
42828
|
-
4,
|
|
42829
|
-
4,
|
|
42830
|
-
5,
|
|
42831
|
-
5,
|
|
42832
|
-
5,
|
|
42833
|
-
5,
|
|
42834
|
-
0,
|
|
42835
|
-
/* unused */
|
|
42836
|
-
0,
|
|
42837
|
-
0,
|
|
42838
|
-
/* impossible */
|
|
42839
|
-
0
|
|
42840
|
-
]);
|
|
42841
|
-
var fdeb = new u8([
|
|
42842
|
-
0,
|
|
42843
|
-
0,
|
|
42844
|
-
0,
|
|
42845
|
-
0,
|
|
42846
|
-
1,
|
|
42847
|
-
1,
|
|
42848
|
-
2,
|
|
42849
|
-
2,
|
|
42850
|
-
3,
|
|
42851
|
-
3,
|
|
42852
|
-
4,
|
|
42853
|
-
4,
|
|
42854
|
-
5,
|
|
42855
|
-
5,
|
|
42856
|
-
6,
|
|
42857
|
-
6,
|
|
42858
|
-
7,
|
|
42859
|
-
7,
|
|
42860
|
-
8,
|
|
42861
|
-
8,
|
|
42862
|
-
9,
|
|
42863
|
-
9,
|
|
42864
|
-
10,
|
|
42865
|
-
10,
|
|
42866
|
-
11,
|
|
42867
|
-
11,
|
|
42868
|
-
12,
|
|
42869
|
-
12,
|
|
42870
|
-
13,
|
|
42871
|
-
13,
|
|
42872
|
-
/* unused */
|
|
42873
|
-
0,
|
|
42874
|
-
0
|
|
42875
|
-
]);
|
|
42876
|
-
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
42877
|
-
var freb = function(eb, start) {
|
|
42878
|
-
var b = new u16(31);
|
|
42879
|
-
for (var i = 0; i < 31; ++i) {
|
|
42880
|
-
b[i] = start += 1 << eb[i - 1];
|
|
42881
|
-
}
|
|
42882
|
-
var r = new i32(b[30]);
|
|
42883
|
-
for (var i = 1; i < 30; ++i) {
|
|
42884
|
-
for (var j = b[i]; j < b[i + 1]; ++j) {
|
|
42885
|
-
r[j] = j - b[i] << 5 | i;
|
|
42886
|
-
}
|
|
42887
|
-
}
|
|
42888
|
-
return { b, r };
|
|
42889
|
-
};
|
|
42890
|
-
var _a = freb(fleb, 2), fl = _a.b, revfl = _a.r;
|
|
42891
|
-
fl[28] = 258, revfl[258] = 28;
|
|
42892
|
-
var _b = freb(fdeb, 0), revfd = _b.r;
|
|
42893
|
-
var rev = new u16(32768);
|
|
42894
|
-
for (var i = 0; i < 32768; ++i) {
|
|
42895
|
-
var x = (i & 43690) >> 1 | (i & 21845) << 1;
|
|
42896
|
-
x = (x & 52428) >> 2 | (x & 13107) << 2;
|
|
42897
|
-
x = (x & 61680) >> 4 | (x & 3855) << 4;
|
|
42898
|
-
rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
|
|
42899
|
-
}
|
|
42900
|
-
var hMap = function(cd, mb, r) {
|
|
42901
|
-
var s = cd.length;
|
|
42902
|
-
var i = 0;
|
|
42903
|
-
var l = new u16(mb);
|
|
42904
|
-
for (; i < s; ++i) {
|
|
42905
|
-
if (cd[i])
|
|
42906
|
-
++l[cd[i] - 1];
|
|
42907
|
-
}
|
|
42908
|
-
var le = new u16(mb);
|
|
42909
|
-
for (i = 1; i < mb; ++i) {
|
|
42910
|
-
le[i] = le[i - 1] + l[i - 1] << 1;
|
|
42911
|
-
}
|
|
42912
|
-
var co;
|
|
42913
|
-
if (r) {
|
|
42914
|
-
co = new u16(1 << mb);
|
|
42915
|
-
var rvb = 15 - mb;
|
|
42916
|
-
for (i = 0; i < s; ++i) {
|
|
42917
|
-
if (cd[i]) {
|
|
42918
|
-
var sv = i << 4 | cd[i];
|
|
42919
|
-
var r_1 = mb - cd[i];
|
|
42920
|
-
var v = le[cd[i] - 1]++ << r_1;
|
|
42921
|
-
for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
|
|
42922
|
-
co[rev[v] >> rvb] = sv;
|
|
42923
|
-
}
|
|
42924
|
-
}
|
|
42925
|
-
}
|
|
42926
|
-
} else {
|
|
42927
|
-
co = new u16(s);
|
|
42928
|
-
for (i = 0; i < s; ++i) {
|
|
42929
|
-
if (cd[i]) {
|
|
42930
|
-
co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
|
|
42931
|
-
}
|
|
42932
|
-
}
|
|
42933
|
-
}
|
|
42934
|
-
return co;
|
|
42935
|
-
};
|
|
42936
|
-
var flt = new u8(288);
|
|
42937
|
-
for (var i = 0; i < 144; ++i)
|
|
42938
|
-
flt[i] = 8;
|
|
42939
|
-
for (var i = 144; i < 256; ++i)
|
|
42940
|
-
flt[i] = 9;
|
|
42941
|
-
for (var i = 256; i < 280; ++i)
|
|
42942
|
-
flt[i] = 7;
|
|
42943
|
-
for (var i = 280; i < 288; ++i)
|
|
42944
|
-
flt[i] = 8;
|
|
42945
|
-
var fdt = new u8(32);
|
|
42946
|
-
for (var i = 0; i < 32; ++i)
|
|
42947
|
-
fdt[i] = 5;
|
|
42948
|
-
var flm = /* @__PURE__ */ hMap(flt, 9, 0);
|
|
42949
|
-
var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
|
|
42950
|
-
var shft = function(p) {
|
|
42951
|
-
return (p + 7) / 8 | 0;
|
|
42952
|
-
};
|
|
42953
|
-
var slc = function(v, s, e) {
|
|
42954
|
-
if (e == null || e > v.length)
|
|
42955
|
-
e = v.length;
|
|
42956
|
-
return new u8(v.subarray(s, e));
|
|
42957
|
-
};
|
|
42958
|
-
var wbits = function(d, p, v) {
|
|
42959
|
-
v <<= p & 7;
|
|
42960
|
-
var o = p / 8 | 0;
|
|
42961
|
-
d[o] |= v;
|
|
42962
|
-
d[o + 1] |= v >> 8;
|
|
42963
|
-
};
|
|
42964
|
-
var wbits16 = function(d, p, v) {
|
|
42965
|
-
v <<= p & 7;
|
|
42966
|
-
var o = p / 8 | 0;
|
|
42967
|
-
d[o] |= v;
|
|
42968
|
-
d[o + 1] |= v >> 8;
|
|
42969
|
-
d[o + 2] |= v >> 16;
|
|
42970
|
-
};
|
|
42971
|
-
var hTree = function(d, mb) {
|
|
42972
|
-
var t = [];
|
|
42973
|
-
for (var i = 0; i < d.length; ++i) {
|
|
42974
|
-
if (d[i])
|
|
42975
|
-
t.push({ s: i, f: d[i] });
|
|
42976
|
-
}
|
|
42977
|
-
var s = t.length;
|
|
42978
|
-
var t2 = t.slice();
|
|
42979
|
-
if (!s)
|
|
42980
|
-
return { t: et, l: 0 };
|
|
42981
|
-
if (s == 1) {
|
|
42982
|
-
var v = new u8(t[0].s + 1);
|
|
42983
|
-
v[t[0].s] = 1;
|
|
42984
|
-
return { t: v, l: 1 };
|
|
42985
|
-
}
|
|
42986
|
-
t.sort(function(a, b) {
|
|
42987
|
-
return a.f - b.f;
|
|
42988
|
-
});
|
|
42989
|
-
t.push({ s: -1, f: 25001 });
|
|
42990
|
-
var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
|
|
42991
|
-
t[0] = { s: -1, f: l.f + r.f, l, r };
|
|
42992
|
-
while (i1 != s - 1) {
|
|
42993
|
-
l = t[t[i0].f < t[i2].f ? i0++ : i2++];
|
|
42994
|
-
r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
|
|
42995
|
-
t[i1++] = { s: -1, f: l.f + r.f, l, r };
|
|
42996
|
-
}
|
|
42997
|
-
var maxSym = t2[0].s;
|
|
42998
|
-
for (var i = 1; i < s; ++i) {
|
|
42999
|
-
if (t2[i].s > maxSym)
|
|
43000
|
-
maxSym = t2[i].s;
|
|
43001
|
-
}
|
|
43002
|
-
var tr = new u16(maxSym + 1);
|
|
43003
|
-
var mbt = ln(t[i1 - 1], tr, 0);
|
|
43004
|
-
if (mbt > mb) {
|
|
43005
|
-
var i = 0, dt = 0;
|
|
43006
|
-
var lft = mbt - mb, cst = 1 << lft;
|
|
43007
|
-
t2.sort(function(a, b) {
|
|
43008
|
-
return tr[b.s] - tr[a.s] || a.f - b.f;
|
|
43009
|
-
});
|
|
43010
|
-
for (; i < s; ++i) {
|
|
43011
|
-
var i2_1 = t2[i].s;
|
|
43012
|
-
if (tr[i2_1] > mb) {
|
|
43013
|
-
dt += cst - (1 << mbt - tr[i2_1]);
|
|
43014
|
-
tr[i2_1] = mb;
|
|
43015
|
-
} else
|
|
43016
|
-
break;
|
|
43017
|
-
}
|
|
43018
|
-
dt >>= lft;
|
|
43019
|
-
while (dt > 0) {
|
|
43020
|
-
var i2_2 = t2[i].s;
|
|
43021
|
-
if (tr[i2_2] < mb)
|
|
43022
|
-
dt -= 1 << mb - tr[i2_2]++ - 1;
|
|
43023
|
-
else
|
|
43024
|
-
++i;
|
|
43025
|
-
}
|
|
43026
|
-
for (; i >= 0 && dt; --i) {
|
|
43027
|
-
var i2_3 = t2[i].s;
|
|
43028
|
-
if (tr[i2_3] == mb) {
|
|
43029
|
-
--tr[i2_3];
|
|
43030
|
-
++dt;
|
|
43031
|
-
}
|
|
43032
|
-
}
|
|
43033
|
-
mbt = mb;
|
|
43034
|
-
}
|
|
43035
|
-
return { t: new u8(tr), l: mbt };
|
|
43036
|
-
};
|
|
43037
|
-
var ln = function(n, l, d) {
|
|
43038
|
-
return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
|
|
43039
|
-
};
|
|
43040
|
-
var lc = function(c) {
|
|
43041
|
-
var s = c.length;
|
|
43042
|
-
while (s && !c[--s])
|
|
43043
|
-
;
|
|
43044
|
-
var cl = new u16(++s);
|
|
43045
|
-
var cli = 0, cln = c[0], cls = 1;
|
|
43046
|
-
var w = function(v) {
|
|
43047
|
-
cl[cli++] = v;
|
|
43048
|
-
};
|
|
43049
|
-
for (var i = 1; i <= s; ++i) {
|
|
43050
|
-
if (c[i] == cln && i != s)
|
|
43051
|
-
++cls;
|
|
43052
|
-
else {
|
|
43053
|
-
if (!cln && cls > 2) {
|
|
43054
|
-
for (; cls > 138; cls -= 138)
|
|
43055
|
-
w(32754);
|
|
43056
|
-
if (cls > 2) {
|
|
43057
|
-
w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
|
|
43058
|
-
cls = 0;
|
|
43059
|
-
}
|
|
43060
|
-
} else if (cls > 3) {
|
|
43061
|
-
w(cln), --cls;
|
|
43062
|
-
for (; cls > 6; cls -= 6)
|
|
43063
|
-
w(8304);
|
|
43064
|
-
if (cls > 2)
|
|
43065
|
-
w(cls - 3 << 5 | 8208), cls = 0;
|
|
43066
|
-
}
|
|
43067
|
-
while (cls--)
|
|
43068
|
-
w(cln);
|
|
43069
|
-
cls = 1;
|
|
43070
|
-
cln = c[i];
|
|
43071
|
-
}
|
|
43072
|
-
}
|
|
43073
|
-
return { c: cl.subarray(0, cli), n: s };
|
|
43074
|
-
};
|
|
43075
|
-
var clen = function(cf, cl) {
|
|
43076
|
-
var l = 0;
|
|
43077
|
-
for (var i = 0; i < cl.length; ++i)
|
|
43078
|
-
l += cf[i] * cl[i];
|
|
43079
|
-
return l;
|
|
43080
|
-
};
|
|
43081
|
-
var wfblk = function(out, pos, dat) {
|
|
43082
|
-
var s = dat.length;
|
|
43083
|
-
var o = shft(pos + 2);
|
|
43084
|
-
out[o] = s & 255;
|
|
43085
|
-
out[o + 1] = s >> 8;
|
|
43086
|
-
out[o + 2] = out[o] ^ 255;
|
|
43087
|
-
out[o + 3] = out[o + 1] ^ 255;
|
|
43088
|
-
for (var i = 0; i < s; ++i)
|
|
43089
|
-
out[o + i + 4] = dat[i];
|
|
43090
|
-
return (o + 4 + s) * 8;
|
|
43091
|
-
};
|
|
43092
|
-
var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
|
|
43093
|
-
wbits(out, p++, final);
|
|
43094
|
-
++lf[256];
|
|
43095
|
-
var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
|
|
43096
|
-
var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
|
|
43097
|
-
var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
|
|
43098
|
-
var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
|
|
43099
|
-
var lcfreq = new u16(19);
|
|
43100
|
-
for (var i = 0; i < lclt.length; ++i)
|
|
43101
|
-
++lcfreq[lclt[i] & 31];
|
|
43102
|
-
for (var i = 0; i < lcdt.length; ++i)
|
|
43103
|
-
++lcfreq[lcdt[i] & 31];
|
|
43104
|
-
var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
|
|
43105
|
-
var nlcc = 19;
|
|
43106
|
-
for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
|
|
43107
|
-
;
|
|
43108
|
-
var flen = bl + 5 << 3;
|
|
43109
|
-
var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
|
|
43110
|
-
var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
|
|
43111
|
-
if (bs >= 0 && flen <= ftlen && flen <= dtlen)
|
|
43112
|
-
return wfblk(out, p, dat.subarray(bs, bs + bl));
|
|
43113
|
-
var lm, ll, dm, dl;
|
|
43114
|
-
wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
|
|
43115
|
-
if (dtlen < ftlen) {
|
|
43116
|
-
lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
|
|
43117
|
-
var llm = hMap(lct, mlcb, 0);
|
|
43118
|
-
wbits(out, p, nlc - 257);
|
|
43119
|
-
wbits(out, p + 5, ndc - 1);
|
|
43120
|
-
wbits(out, p + 10, nlcc - 4);
|
|
43121
|
-
p += 14;
|
|
43122
|
-
for (var i = 0; i < nlcc; ++i)
|
|
43123
|
-
wbits(out, p + 3 * i, lct[clim[i]]);
|
|
43124
|
-
p += 3 * nlcc;
|
|
43125
|
-
var lcts = [lclt, lcdt];
|
|
43126
|
-
for (var it = 0; it < 2; ++it) {
|
|
43127
|
-
var clct = lcts[it];
|
|
43128
|
-
for (var i = 0; i < clct.length; ++i) {
|
|
43129
|
-
var len = clct[i] & 31;
|
|
43130
|
-
wbits(out, p, llm[len]), p += lct[len];
|
|
43131
|
-
if (len > 15)
|
|
43132
|
-
wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
|
|
43133
|
-
}
|
|
43134
|
-
}
|
|
43135
|
-
} else {
|
|
43136
|
-
lm = flm, ll = flt, dm = fdm, dl = fdt;
|
|
43137
|
-
}
|
|
43138
|
-
for (var i = 0; i < li; ++i) {
|
|
43139
|
-
var sym = syms[i];
|
|
43140
|
-
if (sym > 255) {
|
|
43141
|
-
var len = sym >> 18 & 31;
|
|
43142
|
-
wbits16(out, p, lm[len + 257]), p += ll[len + 257];
|
|
43143
|
-
if (len > 7)
|
|
43144
|
-
wbits(out, p, sym >> 23 & 31), p += fleb[len];
|
|
43145
|
-
var dst = sym & 31;
|
|
43146
|
-
wbits16(out, p, dm[dst]), p += dl[dst];
|
|
43147
|
-
if (dst > 3)
|
|
43148
|
-
wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
|
|
43149
|
-
} else {
|
|
43150
|
-
wbits16(out, p, lm[sym]), p += ll[sym];
|
|
43151
|
-
}
|
|
43152
|
-
}
|
|
43153
|
-
wbits16(out, p, lm[256]);
|
|
43154
|
-
return p + ll[256];
|
|
43155
|
-
};
|
|
43156
|
-
var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
|
|
43157
|
-
var et = /* @__PURE__ */ new u8(0);
|
|
43158
|
-
var dflt = function(dat, lvl, plvl, pre, post, st) {
|
|
43159
|
-
var s = st.z || dat.length;
|
|
43160
|
-
var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
|
|
43161
|
-
var w = o.subarray(pre, o.length - post);
|
|
43162
|
-
var lst = st.l;
|
|
43163
|
-
var pos = (st.r || 0) & 7;
|
|
43164
|
-
if (lvl) {
|
|
43165
|
-
if (pos)
|
|
43166
|
-
w[0] = st.r >> 3;
|
|
43167
|
-
var opt = deo[lvl - 1];
|
|
43168
|
-
var n = opt >> 13, c = opt & 8191;
|
|
43169
|
-
var msk_1 = (1 << plvl) - 1;
|
|
43170
|
-
var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
|
|
43171
|
-
var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
|
|
43172
|
-
var hsh = function(i2) {
|
|
43173
|
-
return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1;
|
|
43174
|
-
};
|
|
43175
|
-
var syms = new i32(25e3);
|
|
43176
|
-
var lf = new u16(288), df = new u16(32);
|
|
43177
|
-
var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
|
|
43178
|
-
for (; i + 2 < s; ++i) {
|
|
43179
|
-
var hv = hsh(i);
|
|
43180
|
-
var imod = i & 32767, pimod = head[hv];
|
|
43181
|
-
prev[imod] = pimod;
|
|
43182
|
-
head[hv] = imod;
|
|
43183
|
-
if (wi <= i) {
|
|
43184
|
-
var rem = s - i;
|
|
43185
|
-
if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
|
|
43186
|
-
pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
|
|
43187
|
-
li = lc_1 = eb = 0, bs = i;
|
|
43188
|
-
for (var j = 0; j < 286; ++j)
|
|
43189
|
-
lf[j] = 0;
|
|
43190
|
-
for (var j = 0; j < 30; ++j)
|
|
43191
|
-
df[j] = 0;
|
|
43192
|
-
}
|
|
43193
|
-
var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
|
|
43194
|
-
if (rem > 2 && hv == hsh(i - dif)) {
|
|
43195
|
-
var maxn = Math.min(n, rem) - 1;
|
|
43196
|
-
var maxd = Math.min(32767, i);
|
|
43197
|
-
var ml = Math.min(258, rem);
|
|
43198
|
-
while (dif <= maxd && --ch_1 && imod != pimod) {
|
|
43199
|
-
if (dat[i + l] == dat[i + l - dif]) {
|
|
43200
|
-
var nl = 0;
|
|
43201
|
-
for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)
|
|
43202
|
-
;
|
|
43203
|
-
if (nl > l) {
|
|
43204
|
-
l = nl, d = dif;
|
|
43205
|
-
if (nl > maxn)
|
|
43206
|
-
break;
|
|
43207
|
-
var mmd = Math.min(dif, nl - 2);
|
|
43208
|
-
var md = 0;
|
|
43209
|
-
for (var j = 0; j < mmd; ++j) {
|
|
43210
|
-
var ti = i - dif + j & 32767;
|
|
43211
|
-
var pti = prev[ti];
|
|
43212
|
-
var cd = ti - pti & 32767;
|
|
43213
|
-
if (cd > md)
|
|
43214
|
-
md = cd, pimod = ti;
|
|
43215
|
-
}
|
|
43216
|
-
}
|
|
43217
|
-
}
|
|
43218
|
-
imod = pimod, pimod = prev[imod];
|
|
43219
|
-
dif += imod - pimod & 32767;
|
|
43220
|
-
}
|
|
43221
|
-
}
|
|
43222
|
-
if (d) {
|
|
43223
|
-
syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
|
|
43224
|
-
var lin = revfl[l] & 31, din = revfd[d] & 31;
|
|
43225
|
-
eb += fleb[lin] + fdeb[din];
|
|
43226
|
-
++lf[257 + lin];
|
|
43227
|
-
++df[din];
|
|
43228
|
-
wi = i + l;
|
|
43229
|
-
++lc_1;
|
|
43230
|
-
} else {
|
|
43231
|
-
syms[li++] = dat[i];
|
|
43232
|
-
++lf[dat[i]];
|
|
43233
|
-
}
|
|
43234
|
-
}
|
|
43235
|
-
}
|
|
43236
|
-
for (i = Math.max(i, wi); i < s; ++i) {
|
|
43237
|
-
syms[li++] = dat[i];
|
|
43238
|
-
++lf[dat[i]];
|
|
43239
|
-
}
|
|
43240
|
-
pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
|
|
43241
|
-
if (!lst) {
|
|
43242
|
-
st.r = pos & 7 | w[pos / 8 | 0] << 3;
|
|
43243
|
-
pos -= 7;
|
|
43244
|
-
st.h = head, st.p = prev, st.i = i, st.w = wi;
|
|
43245
|
-
}
|
|
43246
|
-
} else {
|
|
43247
|
-
for (var i = st.w || 0; i < s + lst; i += 65535) {
|
|
43248
|
-
var e = i + 65535;
|
|
43249
|
-
if (e >= s) {
|
|
43250
|
-
w[pos / 8 | 0] = lst;
|
|
43251
|
-
e = s;
|
|
43252
|
-
}
|
|
43253
|
-
pos = wfblk(w, pos + 1, dat.subarray(i, e));
|
|
43254
|
-
}
|
|
43255
|
-
st.i = s;
|
|
43256
|
-
}
|
|
43257
|
-
return slc(o, 0, pre + shft(pos) + post);
|
|
43258
|
-
};
|
|
43259
|
-
var adler = function() {
|
|
43260
|
-
var a = 1, b = 0;
|
|
43261
|
-
return {
|
|
43262
|
-
p: function(d) {
|
|
43263
|
-
var n = a, m = b;
|
|
43264
|
-
var l = d.length | 0;
|
|
43265
|
-
for (var i = 0; i != l; ) {
|
|
43266
|
-
var e = Math.min(i + 2655, l);
|
|
43267
|
-
for (; i < e; ++i)
|
|
43268
|
-
m += n += d[i];
|
|
43269
|
-
n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);
|
|
43270
|
-
}
|
|
43271
|
-
a = n, b = m;
|
|
43272
|
-
},
|
|
43273
|
-
d: function() {
|
|
43274
|
-
a %= 65521, b %= 65521;
|
|
43275
|
-
return (a & 255) << 24 | (a & 65280) << 8 | (b & 255) << 8 | b >> 8;
|
|
43276
|
-
}
|
|
43277
|
-
};
|
|
43278
|
-
};
|
|
43279
|
-
var dopt = function(dat, opt, pre, post, st) {
|
|
43280
|
-
if (!st) {
|
|
43281
|
-
st = { l: 1 };
|
|
43282
|
-
if (opt.dictionary) {
|
|
43283
|
-
var dict = opt.dictionary.subarray(-32768);
|
|
43284
|
-
var newDat = new u8(dict.length + dat.length);
|
|
43285
|
-
newDat.set(dict);
|
|
43286
|
-
newDat.set(dat, dict.length);
|
|
43287
|
-
dat = newDat;
|
|
43288
|
-
st.w = dict.length;
|
|
43289
|
-
}
|
|
43290
|
-
}
|
|
43291
|
-
return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
|
|
43292
|
-
};
|
|
43293
|
-
var wbytes = function(d, b, v) {
|
|
43294
|
-
for (; v; ++b)
|
|
43295
|
-
d[b] = v, v >>>= 8;
|
|
43296
|
-
};
|
|
43297
|
-
var zlh = function(c, o) {
|
|
43298
|
-
var lv = o.level, fl2 = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;
|
|
43299
|
-
c[0] = 120, c[1] = fl2 << 6 | (o.dictionary && 32);
|
|
43300
|
-
c[1] |= 31 - (c[0] << 8 | c[1]) % 31;
|
|
43301
|
-
if (o.dictionary) {
|
|
43302
|
-
var h = adler();
|
|
43303
|
-
h.p(o.dictionary);
|
|
43304
|
-
wbytes(c, 2, h.d());
|
|
43305
|
-
}
|
|
43306
|
-
};
|
|
43307
|
-
function zlibSync(data, opts) {
|
|
43308
|
-
if (!opts)
|
|
43309
|
-
opts = {};
|
|
43310
|
-
var a = adler();
|
|
43311
|
-
a.p(data);
|
|
43312
|
-
var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);
|
|
43313
|
-
return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;
|
|
43314
|
-
}
|
|
43315
|
-
var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
|
|
43316
|
-
var tds = 0;
|
|
43317
|
-
try {
|
|
43318
|
-
td.decode(et, { stream: true });
|
|
43319
|
-
tds = 1;
|
|
43320
|
-
} catch (e) {
|
|
43321
|
-
}
|
|
43322
42940
|
const utf8 = new TextEncoder();
|
|
43323
42941
|
function chunkByteLength(chunk) {
|
|
43324
42942
|
return typeof chunk === "string" ? byteLength(chunk) : chunk.length;
|
|
@@ -43617,36 +43235,36 @@ class OasisPdfWriter {
|
|
|
43617
43235
|
return this.pages.length;
|
|
43618
43236
|
}
|
|
43619
43237
|
drawRect(pageIndex, options) {
|
|
43620
|
-
var
|
|
43621
|
-
(
|
|
43238
|
+
var _a;
|
|
43239
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawRect(options);
|
|
43622
43240
|
}
|
|
43623
43241
|
drawLine(pageIndex, options) {
|
|
43624
|
-
var
|
|
43625
|
-
(
|
|
43242
|
+
var _a;
|
|
43243
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawLine(options);
|
|
43626
43244
|
}
|
|
43627
43245
|
drawPath(pageIndex, options) {
|
|
43628
|
-
var
|
|
43629
|
-
(
|
|
43246
|
+
var _a;
|
|
43247
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawPath(options);
|
|
43630
43248
|
}
|
|
43631
43249
|
saveGraphicsState(pageIndex) {
|
|
43632
|
-
var
|
|
43633
|
-
(
|
|
43250
|
+
var _a;
|
|
43251
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.saveGraphicsState();
|
|
43634
43252
|
}
|
|
43635
43253
|
restoreGraphicsState(pageIndex) {
|
|
43636
|
-
var
|
|
43637
|
-
(
|
|
43254
|
+
var _a;
|
|
43255
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.restoreGraphicsState();
|
|
43638
43256
|
}
|
|
43639
43257
|
rotateAbout(pageIndex, centerX, centerY, degrees) {
|
|
43640
|
-
var
|
|
43641
|
-
(
|
|
43258
|
+
var _a;
|
|
43259
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.rotateAbout(centerX, centerY, degrees);
|
|
43642
43260
|
}
|
|
43643
43261
|
clipRect(pageIndex, x, y, width, height) {
|
|
43644
|
-
var
|
|
43645
|
-
(
|
|
43262
|
+
var _a;
|
|
43263
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.clipRect(x, y, width, height);
|
|
43646
43264
|
}
|
|
43647
43265
|
drawText(pageIndex, options) {
|
|
43648
|
-
var
|
|
43649
|
-
(
|
|
43266
|
+
var _a;
|
|
43267
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawText(options);
|
|
43650
43268
|
}
|
|
43651
43269
|
/**
|
|
43652
43270
|
* Registers an axial (linear) gradient on a page for use as a glyph fill, and
|
|
@@ -43654,23 +43272,23 @@ class OasisPdfWriter {
|
|
|
43654
43272
|
* subsequent `drawText`. Coordinates are in the writer's top-left point space.
|
|
43655
43273
|
*/
|
|
43656
43274
|
registerAxialGradient(pageIndex, gradient) {
|
|
43657
|
-
var
|
|
43658
|
-
return ((
|
|
43275
|
+
var _a;
|
|
43276
|
+
return ((_a = this.streams[pageIndex]) == null ? void 0 : _a.registerAxialGradient(gradient)) ?? null;
|
|
43659
43277
|
}
|
|
43660
43278
|
registerImageResource(resource) {
|
|
43661
43279
|
return this.images.registerImageResource(resource);
|
|
43662
43280
|
}
|
|
43663
43281
|
drawImage(pageIndex, options) {
|
|
43664
|
-
var
|
|
43665
|
-
(
|
|
43282
|
+
var _a;
|
|
43283
|
+
(_a = this.streams[pageIndex]) == null ? void 0 : _a.drawImage(options);
|
|
43666
43284
|
}
|
|
43667
43285
|
/**
|
|
43668
43286
|
* Attaches a clickable external link annotation to a page. The rect is in the
|
|
43669
43287
|
* writer's top-left point space; the serializer flips it to PDF space.
|
|
43670
43288
|
*/
|
|
43671
43289
|
addLinkAnnotation(pageIndex, annotation) {
|
|
43672
|
-
var
|
|
43673
|
-
(
|
|
43290
|
+
var _a;
|
|
43291
|
+
(_a = this.pages[pageIndex]) == null ? void 0 : _a.annotations.push(annotation);
|
|
43674
43292
|
}
|
|
43675
43293
|
/**
|
|
43676
43294
|
* Registers a named destination (jump target). Position is in the writer's
|
|
@@ -43731,7 +43349,7 @@ function resolveDocumentInfo(document2) {
|
|
|
43731
43349
|
};
|
|
43732
43350
|
}
|
|
43733
43351
|
function collectBookmarkNamesByParagraph(document2) {
|
|
43734
|
-
var
|
|
43352
|
+
var _a;
|
|
43735
43353
|
const byParagraph = /* @__PURE__ */ new Map();
|
|
43736
43354
|
const bookmarks = document2.bookmarks;
|
|
43737
43355
|
if (!bookmarks) {
|
|
@@ -43739,7 +43357,7 @@ function collectBookmarkNamesByParagraph(document2) {
|
|
|
43739
43357
|
}
|
|
43740
43358
|
for (const id of bookmarks.order) {
|
|
43741
43359
|
const bookmark = bookmarks.items[id];
|
|
43742
|
-
const paragraphId = (
|
|
43360
|
+
const paragraphId = (_a = bookmark == null ? void 0 : bookmark.start) == null ? void 0 : _a.paragraphId;
|
|
43743
43361
|
if (!bookmark || !paragraphId) {
|
|
43744
43362
|
continue;
|
|
43745
43363
|
}
|
|
@@ -43775,8 +43393,12 @@ function registerBookmarkDestinations(writer, pageIndex, originX, bookmarkNamesB
|
|
|
43775
43393
|
async function exportEditorDocumentToPdf(document2) {
|
|
43776
43394
|
document2 = renumberImageCaptionsInDocument(document2);
|
|
43777
43395
|
const fontRegistry = new PdfFontRegistry();
|
|
43396
|
+
const fontFamilies = collectPdfFontFamilies(document2);
|
|
43778
43397
|
await fontRegistry.loadBundledUnicodeFaces({
|
|
43779
|
-
families:
|
|
43398
|
+
families: fontFamilies
|
|
43399
|
+
});
|
|
43400
|
+
await fontRegistry.loadRemoteWebFontFaces({
|
|
43401
|
+
families: fontFamilies
|
|
43780
43402
|
});
|
|
43781
43403
|
const writer = new OasisPdfWriter(fontRegistry.getPdfFontResources());
|
|
43782
43404
|
writer.setDocumentInfo(resolveDocumentInfo(document2));
|
|
@@ -43914,15 +43536,15 @@ async function exportEditorDocumentToPdfBlob(document2) {
|
|
|
43914
43536
|
return new Blob([buffer], { type: "application/pdf" });
|
|
43915
43537
|
}
|
|
43916
43538
|
async function drawFootnoteBlockList(writer, pageIndex, blocks, footnoteReferenceIds, document2, originX, originY, contentWidth, fontRegistry, listOrdinals) {
|
|
43917
|
-
var
|
|
43539
|
+
var _a;
|
|
43918
43540
|
let cursorY = originY;
|
|
43919
43541
|
const markerDrawn = /* @__PURE__ */ new Set();
|
|
43920
43542
|
const markerByFootnoteId = new Map(
|
|
43921
43543
|
footnoteReferenceIds.map((footnoteId) => {
|
|
43922
|
-
var
|
|
43544
|
+
var _a2;
|
|
43923
43545
|
return [
|
|
43924
43546
|
footnoteId,
|
|
43925
|
-
((
|
|
43547
|
+
((_a2 = findFootnoteReference(document2, footnoteId)) == null ? void 0 : _a2.run.text) ?? ""
|
|
43926
43548
|
];
|
|
43927
43549
|
})
|
|
43928
43550
|
);
|
|
@@ -43936,7 +43558,7 @@ async function drawFootnoteBlockList(writer, pageIndex, blocks, footnoteReferenc
|
|
|
43936
43558
|
const firstParagraph = block.sourceBlock.type === "paragraph" ? block.sourceBlock : void 0;
|
|
43937
43559
|
const styles = resolveEffectiveTextStyleForParagraph(
|
|
43938
43560
|
void 0,
|
|
43939
|
-
(
|
|
43561
|
+
(_a = firstParagraph == null ? void 0 : firstParagraph.style) == null ? void 0 : _a.styleId,
|
|
43940
43562
|
document2.styles
|
|
43941
43563
|
);
|
|
43942
43564
|
const fontFace = fontRegistry.resolveFontFace({
|
|
@@ -44038,7 +43660,7 @@ function buildImportedDocumentDiagnostics(document2) {
|
|
|
44038
43660
|
return buildImportedDocumentDiagnosticsImpl(document2);
|
|
44039
43661
|
}
|
|
44040
43662
|
function buildImportedDocumentDiagnosticsImpl(document2) {
|
|
44041
|
-
var
|
|
43663
|
+
var _a;
|
|
44042
43664
|
const paragraphs = getDocumentParagraphs(document2);
|
|
44043
43665
|
const fontCounts = /* @__PURE__ */ new Map();
|
|
44044
43666
|
const alignCounts = /* @__PURE__ */ new Map();
|
|
@@ -44056,7 +43678,7 @@ function buildImportedDocumentDiagnosticsImpl(document2) {
|
|
|
44056
43678
|
for (const run of paragraph.runs) {
|
|
44057
43679
|
const textStyle = resolveEffectiveTextStyleForParagraph(
|
|
44058
43680
|
run.styles,
|
|
44059
|
-
(
|
|
43681
|
+
(_a = paragraph.style) == null ? void 0 : _a.styleId,
|
|
44060
43682
|
document2.styles
|
|
44061
43683
|
);
|
|
44062
43684
|
const fontFamily = textStyle.fontFamily ?? "<null>";
|
|
@@ -44076,7 +43698,7 @@ function buildImportedDocumentDiagnosticsImpl(document2) {
|
|
|
44076
43698
|
characterSpacingRuns,
|
|
44077
43699
|
characterScaleRuns,
|
|
44078
43700
|
firstParagraphs: paragraphs.slice(0, 30).map((paragraph, index) => {
|
|
44079
|
-
var
|
|
43701
|
+
var _a2;
|
|
44080
43702
|
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
44081
43703
|
paragraph.style,
|
|
44082
43704
|
document2.styles
|
|
@@ -44084,7 +43706,7 @@ function buildImportedDocumentDiagnosticsImpl(document2) {
|
|
|
44084
43706
|
const firstRun = paragraph.runs[0];
|
|
44085
43707
|
const textStyle = resolveEffectiveTextStyleForParagraph(
|
|
44086
43708
|
firstRun == null ? void 0 : firstRun.styles,
|
|
44087
|
-
(
|
|
43709
|
+
(_a2 = paragraph.style) == null ? void 0 : _a2.styleId,
|
|
44088
43710
|
document2.styles
|
|
44089
43711
|
);
|
|
44090
43712
|
return {
|
|
@@ -44125,6 +43747,7 @@ function createDocumentImporter(deps) {
|
|
|
44125
43747
|
size: file.size
|
|
44126
43748
|
});
|
|
44127
43749
|
deps.setImportPhase("reading-file");
|
|
43750
|
+
const localFontAccess = importer.id === "docx" ? deps.requestLocalFontAccess().catch(() => false) : Promise.resolve(false);
|
|
44128
43751
|
try {
|
|
44129
43752
|
const readingStartedAt = deps.now();
|
|
44130
43753
|
const arrayBuffer = await readFileBuffer(file);
|
|
@@ -44162,6 +43785,14 @@ function createDocumentImporter(deps) {
|
|
|
44162
43785
|
"import:document-diagnostics",
|
|
44163
43786
|
buildImportedDocumentDiagnostics(document2)
|
|
44164
43787
|
);
|
|
43788
|
+
const fontPreparationStartedAt = deps.now();
|
|
43789
|
+
deps.setImportPhase("preparing-fonts");
|
|
43790
|
+
await localFontAccess;
|
|
43791
|
+
await deps.prepareDocumentFonts(document2);
|
|
43792
|
+
deps.logger.info("import:phase", {
|
|
43793
|
+
phase: "preparing-fonts",
|
|
43794
|
+
durationMs: roundTo(deps.now() - fontPreparationStartedAt, 2)
|
|
43795
|
+
});
|
|
44165
43796
|
deps.setImportPhase("applying-editor-state");
|
|
44166
43797
|
deps.resetEditorChromeState();
|
|
44167
43798
|
deps.applyState(createEditorStateFromDocument(document2));
|
|
@@ -44175,8 +43806,8 @@ function createDocumentImporter(deps) {
|
|
|
44175
43806
|
const sections = getDocumentSectionsCanonical(document2);
|
|
44176
43807
|
const canonicalBlocks = sections.reduce(
|
|
44177
43808
|
(total, section) => {
|
|
44178
|
-
var
|
|
44179
|
-
return total + (((
|
|
43809
|
+
var _a, _b;
|
|
43810
|
+
return total + (((_a = section.header) == null ? void 0 : _a.length) ?? 0) + section.blocks.length + (((_b = section.footer) == null ? void 0 : _b.length) ?? 0);
|
|
44180
43811
|
},
|
|
44181
43812
|
0
|
|
44182
43813
|
);
|
|
@@ -44277,8 +43908,8 @@ function applyMoveWithText(floating, fixed) {
|
|
|
44277
43908
|
};
|
|
44278
43909
|
}
|
|
44279
43910
|
function isFloatingFixedPosition(floating) {
|
|
44280
|
-
var
|
|
44281
|
-
return ((
|
|
43911
|
+
var _a;
|
|
43912
|
+
return ((_a = floating == null ? void 0 : floating.positionV) == null ? void 0 : _a.relativeFrom) === "page";
|
|
44282
43913
|
}
|
|
44283
43914
|
function getSelectedImageRun(state) {
|
|
44284
43915
|
return getSelectedObjectRun(state, (run) => run.kind === "image");
|
|
@@ -44421,6 +44052,33 @@ function applySelectedImageCropAspect(state, mode) {
|
|
|
44421
44052
|
}
|
|
44422
44053
|
return setSelectedImageCrop(state, computeImageAspectCrop(image, mode));
|
|
44423
44054
|
}
|
|
44055
|
+
function getSelectedImageBorder(state) {
|
|
44056
|
+
const selectedImage = getSelectedImageRun(state);
|
|
44057
|
+
const image = selectedImage && getRunImage(selectedImage.run);
|
|
44058
|
+
return (image == null ? void 0 : image.border) ?? null;
|
|
44059
|
+
}
|
|
44060
|
+
const DEFAULT_IMAGE_BORDER_COLOR = "#000000";
|
|
44061
|
+
function setSelectedImageBorder(state, patch) {
|
|
44062
|
+
return patchSelectedImage(state, (image) => {
|
|
44063
|
+
if (patch.color === null) {
|
|
44064
|
+
const { border: _removed, ...rest } = image;
|
|
44065
|
+
return rest;
|
|
44066
|
+
}
|
|
44067
|
+
const border = {
|
|
44068
|
+
...image.border ?? { color: DEFAULT_IMAGE_BORDER_COLOR }
|
|
44069
|
+
};
|
|
44070
|
+
if (patch.color !== void 0) {
|
|
44071
|
+
border.color = patch.color;
|
|
44072
|
+
}
|
|
44073
|
+
if (patch.widthPt !== void 0) {
|
|
44074
|
+
border.widthPt = patch.widthPt;
|
|
44075
|
+
}
|
|
44076
|
+
if (patch.dash !== void 0) {
|
|
44077
|
+
border.dash = patch.dash;
|
|
44078
|
+
}
|
|
44079
|
+
return { ...image, border };
|
|
44080
|
+
});
|
|
44081
|
+
}
|
|
44424
44082
|
function normalizeRotation$1(rotation) {
|
|
44425
44083
|
if (!Number.isFinite(rotation)) {
|
|
44426
44084
|
return void 0;
|
|
@@ -44722,8 +44380,9 @@ const PHASE_RANGES = {
|
|
|
44722
44380
|
opening: [8, 20],
|
|
44723
44381
|
parsing: [20, 72],
|
|
44724
44382
|
finishing: [72, 78],
|
|
44725
|
-
"
|
|
44726
|
-
"
|
|
44383
|
+
"preparing-fonts": [78, 90],
|
|
44384
|
+
"applying-editor-state": [90, 94],
|
|
44385
|
+
"stabilizing-layout": [94, 99],
|
|
44727
44386
|
done: [100, 100],
|
|
44728
44387
|
error: [100, 100]
|
|
44729
44388
|
};
|
|
@@ -44760,6 +44419,8 @@ function createEditorDocumentIOImpl(deps) {
|
|
|
44760
44419
|
stabilizeLayoutAfterImport: deps.stabilizeLayoutAfterImport,
|
|
44761
44420
|
resetEditorChromeState: deps.resetEditorChromeState,
|
|
44762
44421
|
focusInput: deps.focusInput,
|
|
44422
|
+
requestLocalFontAccess: deps.requestLocalFontAccess,
|
|
44423
|
+
prepareDocumentFonts: deps.prepareDocumentFonts,
|
|
44763
44424
|
setImportPhase,
|
|
44764
44425
|
clearImportProgressSoon,
|
|
44765
44426
|
now: () => performance.now(),
|
|
@@ -44885,7 +44546,7 @@ function resolveCaretSlot(paragraphs, focusOffset) {
|
|
|
44885
44546
|
};
|
|
44886
44547
|
}
|
|
44887
44548
|
function computeCanvasSelectionGeometry(snapshot, state) {
|
|
44888
|
-
var
|
|
44549
|
+
var _a, _b, _c, _d, _e, _f;
|
|
44889
44550
|
const normalized = normalizeSelection(state);
|
|
44890
44551
|
const selectionBoxes = [];
|
|
44891
44552
|
const surfaceRect = snapshot.surfaceRect;
|
|
@@ -44948,9 +44609,9 @@ function computeCanvasSelectionGeometry(snapshot, state) {
|
|
|
44948
44609
|
const section = sections[activeSectionIndex];
|
|
44949
44610
|
let tableBlock;
|
|
44950
44611
|
if (anchorLoc.zone === "header") {
|
|
44951
|
-
tableBlock = (
|
|
44612
|
+
tableBlock = (_a = section == null ? void 0 : section.header) == null ? void 0 : _a[anchorLoc.blockIndex];
|
|
44952
44613
|
} else if (anchorLoc.zone === "footer") {
|
|
44953
|
-
tableBlock = (
|
|
44614
|
+
tableBlock = (_b = section == null ? void 0 : section.footer) == null ? void 0 : _b[anchorLoc.blockIndex];
|
|
44954
44615
|
} else {
|
|
44955
44616
|
tableBlock = (_c = section == null ? void 0 : section.blocks) == null ? void 0 : _c[anchorLoc.blockIndex];
|
|
44956
44617
|
}
|
|
@@ -45185,9 +44846,9 @@ function areLayoutParagraphsEquivalentForRender(previous, next) {
|
|
|
45185
44846
|
});
|
|
45186
44847
|
}
|
|
45187
44848
|
function canReuseLayoutBlock(previous, next) {
|
|
45188
|
-
var
|
|
44849
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
45189
44850
|
return Boolean(
|
|
45190
|
-
previous && previous.blockId === next.blockId && previous.sourceBlock === next.sourceBlock && previous.estimatedHeight === next.estimatedHeight && ((
|
|
44851
|
+
previous && previous.blockId === next.blockId && previous.sourceBlock === next.sourceBlock && previous.estimatedHeight === next.estimatedHeight && ((_a = previous.tableSegment) == null ? void 0 : _a.startRowIndex) === ((_b = next.tableSegment) == null ? void 0 : _b.startRowIndex) && ((_c = previous.tableSegment) == null ? void 0 : _c.endRowIndex) === ((_d = next.tableSegment) == null ? void 0 : _d.endRowIndex) && ((_e = previous.tableSegment) == null ? void 0 : _e.repeatedHeaderRowCount) === ((_f = next.tableSegment) == null ? void 0 : _f.repeatedHeaderRowCount) && sameNumberArray(
|
|
45191
44852
|
(_g = previous.tableSegment) == null ? void 0 : _g.startRowCellBlockStarts,
|
|
45192
44853
|
(_h = next.tableSegment) == null ? void 0 : _h.startRowCellBlockStarts
|
|
45193
44854
|
) && sameNumberArray(
|
|
@@ -45337,7 +44998,7 @@ function useEditorLayoutImpl(props) {
|
|
|
45337
44998
|
const canvasSnapshotProvider = createCanvasLayoutSnapshotProvider();
|
|
45338
44999
|
let syncRequestId = 0;
|
|
45339
45000
|
const syncInputBox = (_reason = "selection") => {
|
|
45340
|
-
var
|
|
45001
|
+
var _a;
|
|
45341
45002
|
const surface = props.surfaceRef();
|
|
45342
45003
|
if (!surface) {
|
|
45343
45004
|
setSelectionBoxes([]);
|
|
@@ -45357,7 +45018,7 @@ function useEditorLayoutImpl(props) {
|
|
|
45357
45018
|
surface,
|
|
45358
45019
|
state: props.state,
|
|
45359
45020
|
documentLayout: documentLayout(),
|
|
45360
|
-
zoomFactor: (
|
|
45021
|
+
zoomFactor: (_a = props.zoomFactor) == null ? void 0 : _a.call(props)
|
|
45361
45022
|
});
|
|
45362
45023
|
if (!snapshot) {
|
|
45363
45024
|
setSelectionBoxes([]);
|
|
@@ -45406,15 +45067,15 @@ function useEditorLayoutImpl(props) {
|
|
|
45406
45067
|
return options.resolveWhenDone ? Promise.resolve() : null;
|
|
45407
45068
|
};
|
|
45408
45069
|
const applyInvalidation = (invalidation) => {
|
|
45409
|
-
var
|
|
45410
|
-
if ((
|
|
45070
|
+
var _a, _b;
|
|
45071
|
+
if ((_a = props.isImporting) == null ? void 0 : _a.call(props)) {
|
|
45411
45072
|
return;
|
|
45412
45073
|
}
|
|
45413
45074
|
if (invalidation.dirtyAll || invalidation.structureChanged) {
|
|
45414
45075
|
setMeasuredBlockHeights({});
|
|
45415
45076
|
setMeasuredParagraphLayouts({});
|
|
45416
45077
|
bumpLayoutMetricsEpoch();
|
|
45417
|
-
} else if ((((
|
|
45078
|
+
} else if ((((_b = invalidation.dirtyParagraphIds) == null ? void 0 : _b.length) ?? 0) > 0) {
|
|
45418
45079
|
const dirtyIds = invalidation.dirtyParagraphIds ?? [];
|
|
45419
45080
|
setMeasuredParagraphLayouts(
|
|
45420
45081
|
(current) => normalizeParagraphLayouts(current, dirtyIds)
|
|
@@ -45442,11 +45103,11 @@ function useEditorLayoutImpl(props) {
|
|
|
45442
45103
|
requestInputBoxSync("selection");
|
|
45443
45104
|
});
|
|
45444
45105
|
createEffect(() => {
|
|
45445
|
-
var
|
|
45106
|
+
var _a;
|
|
45446
45107
|
props.state.document;
|
|
45447
45108
|
props.state.activeSectionIndex;
|
|
45448
45109
|
props.state.activeZone;
|
|
45449
|
-
if ((
|
|
45110
|
+
if ((_a = props.isImporting) == null ? void 0 : _a.call(props)) {
|
|
45450
45111
|
return;
|
|
45451
45112
|
}
|
|
45452
45113
|
requestInputBoxSync("content-change");
|
|
@@ -45508,7 +45169,7 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45508
45169
|
const isEnabled = () => options.enabled ?? false;
|
|
45509
45170
|
const persistence = options.persistence;
|
|
45510
45171
|
const debouncedSave = debounce(async (doc) => {
|
|
45511
|
-
var
|
|
45172
|
+
var _a;
|
|
45512
45173
|
if (!isEnabled() || !isInitialized()) return;
|
|
45513
45174
|
setStatus("Saving...");
|
|
45514
45175
|
try {
|
|
@@ -45516,7 +45177,7 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45516
45177
|
await persistence.saveDocument(rawDoc);
|
|
45517
45178
|
setStatus("Saved");
|
|
45518
45179
|
} catch (err) {
|
|
45519
|
-
(
|
|
45180
|
+
(_a = options.logger) == null ? void 0 : _a.error("persistence:autosave failed", err);
|
|
45520
45181
|
setStatus("Error");
|
|
45521
45182
|
}
|
|
45522
45183
|
}, 1e3);
|
|
@@ -45532,7 +45193,7 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45532
45193
|
)
|
|
45533
45194
|
);
|
|
45534
45195
|
onMount(async () => {
|
|
45535
|
-
var
|
|
45196
|
+
var _a;
|
|
45536
45197
|
if (!isEnabled()) {
|
|
45537
45198
|
setIsInitialized(true);
|
|
45538
45199
|
setStatus("Saved");
|
|
@@ -45544,7 +45205,7 @@ function useEditorPersistence(state, onLoaded, options) {
|
|
|
45544
45205
|
onLoaded(loadedDoc);
|
|
45545
45206
|
}
|
|
45546
45207
|
} catch (err) {
|
|
45547
|
-
(
|
|
45208
|
+
(_a = options.logger) == null ? void 0 : _a.error("persistence:load failed", err);
|
|
45548
45209
|
} finally {
|
|
45549
45210
|
setIsInitialized(true);
|
|
45550
45211
|
setStatus("Saved");
|
|
@@ -45560,8 +45221,8 @@ function createEmptyEditorHistoryState() {
|
|
|
45560
45221
|
};
|
|
45561
45222
|
}
|
|
45562
45223
|
function applyEditorHistoryTransaction(history, previous, next, options, now = Date.now()) {
|
|
45563
|
-
var
|
|
45564
|
-
const canMerge = (options == null ? void 0 : options.mergeKey) !== void 0 && ((
|
|
45224
|
+
var _a;
|
|
45225
|
+
const canMerge = (options == null ? void 0 : options.mergeKey) !== void 0 && ((_a = history.lastTransactionMeta) == null ? void 0 : _a.mergeKey) === options.mergeKey && now - history.lastTransactionMeta.timestamp < 1e3;
|
|
45565
45226
|
return {
|
|
45566
45227
|
undoStack: canMerge ? history.undoStack : [...history.undoStack, previous],
|
|
45567
45228
|
redoStack: [],
|
|
@@ -45725,13 +45386,13 @@ function createEditorHistoryActionsImpl(deps) {
|
|
|
45725
45386
|
return true;
|
|
45726
45387
|
};
|
|
45727
45388
|
const applySelectionPreservingStructure = (nextSelection) => {
|
|
45728
|
-
var
|
|
45389
|
+
var _a;
|
|
45729
45390
|
const snapshot = deps.stateSnapshot();
|
|
45730
45391
|
deps.applyHistoryState({
|
|
45731
45392
|
...snapshot,
|
|
45732
45393
|
document: {
|
|
45733
45394
|
...snapshot.document,
|
|
45734
|
-
sections: (
|
|
45395
|
+
sections: (_a = snapshot.document.sections) == null ? void 0 : _a.map(cloneSection)
|
|
45735
45396
|
},
|
|
45736
45397
|
selection: {
|
|
45737
45398
|
anchor: { ...nextSelection.anchor },
|
|
@@ -45750,8 +45411,8 @@ function openDB(options) {
|
|
|
45750
45411
|
return new Promise((resolve, reject) => {
|
|
45751
45412
|
const request = indexedDB.open(options.name, options.version);
|
|
45752
45413
|
request.onerror = () => {
|
|
45753
|
-
var
|
|
45754
|
-
reject(new Error(`Failed to open IndexedDB: ${(
|
|
45414
|
+
var _a;
|
|
45415
|
+
reject(new Error(`Failed to open IndexedDB: ${(_a = request.error) == null ? void 0 : _a.message}`));
|
|
45755
45416
|
};
|
|
45756
45417
|
request.onsuccess = () => {
|
|
45757
45418
|
resolve(request.result);
|
|
@@ -45769,10 +45430,10 @@ function putItem(db, storeName, key, value) {
|
|
|
45769
45430
|
const store = transaction.objectStore(storeName);
|
|
45770
45431
|
const request = store.put(value, key);
|
|
45771
45432
|
request.onerror = () => {
|
|
45772
|
-
var
|
|
45433
|
+
var _a;
|
|
45773
45434
|
reject(
|
|
45774
45435
|
new Error(
|
|
45775
|
-
`Failed to put item in ${storeName}: ${(
|
|
45436
|
+
`Failed to put item in ${storeName}: ${(_a = request.error) == null ? void 0 : _a.message}`
|
|
45776
45437
|
)
|
|
45777
45438
|
);
|
|
45778
45439
|
};
|
|
@@ -45780,10 +45441,10 @@ function putItem(db, storeName, key, value) {
|
|
|
45780
45441
|
resolve();
|
|
45781
45442
|
};
|
|
45782
45443
|
transaction.onabort = transaction.onerror = () => {
|
|
45783
|
-
var
|
|
45444
|
+
var _a;
|
|
45784
45445
|
reject(
|
|
45785
45446
|
new Error(
|
|
45786
|
-
`Transaction failed putting item in ${storeName}: ${(
|
|
45447
|
+
`Transaction failed putting item in ${storeName}: ${(_a = transaction.error) == null ? void 0 : _a.message}`
|
|
45787
45448
|
)
|
|
45788
45449
|
);
|
|
45789
45450
|
};
|
|
@@ -45799,10 +45460,10 @@ function getItem(db, storeName, key) {
|
|
|
45799
45460
|
const store = transaction.objectStore(storeName);
|
|
45800
45461
|
const request = store.get(key);
|
|
45801
45462
|
request.onerror = () => {
|
|
45802
|
-
var
|
|
45463
|
+
var _a;
|
|
45803
45464
|
reject(
|
|
45804
45465
|
new Error(
|
|
45805
|
-
`Failed to get item from ${storeName}: ${(
|
|
45466
|
+
`Failed to get item from ${storeName}: ${(_a = request.error) == null ? void 0 : _a.message}`
|
|
45806
45467
|
)
|
|
45807
45468
|
);
|
|
45808
45469
|
};
|
|
@@ -45821,10 +45482,10 @@ function deleteItem(db, storeName, key) {
|
|
|
45821
45482
|
const store = transaction.objectStore(storeName);
|
|
45822
45483
|
const request = store.delete(key);
|
|
45823
45484
|
request.onerror = () => {
|
|
45824
|
-
var
|
|
45485
|
+
var _a;
|
|
45825
45486
|
reject(
|
|
45826
45487
|
new Error(
|
|
45827
|
-
`Failed to delete item from ${storeName}: ${(
|
|
45488
|
+
`Failed to delete item from ${storeName}: ${(_a = request.error) == null ? void 0 : _a.message}`
|
|
45828
45489
|
)
|
|
45829
45490
|
);
|
|
45830
45491
|
};
|
|
@@ -45832,10 +45493,10 @@ function deleteItem(db, storeName, key) {
|
|
|
45832
45493
|
resolve();
|
|
45833
45494
|
};
|
|
45834
45495
|
transaction.onabort = transaction.onerror = () => {
|
|
45835
|
-
var
|
|
45496
|
+
var _a;
|
|
45836
45497
|
reject(
|
|
45837
45498
|
new Error(
|
|
45838
|
-
`Transaction failed deleting item from ${storeName}: ${(
|
|
45499
|
+
`Transaction failed deleting item from ${storeName}: ${(_a = transaction.error) == null ? void 0 : _a.message}`
|
|
45839
45500
|
)
|
|
45840
45501
|
);
|
|
45841
45502
|
};
|
|
@@ -45887,7 +45548,7 @@ function createIndexedDbPersistence(options = {}) {
|
|
|
45887
45548
|
};
|
|
45888
45549
|
}
|
|
45889
45550
|
function computeLayoutInvalidationFromTransaction(prev, next) {
|
|
45890
|
-
var
|
|
45551
|
+
var _a, _b, _c, _d, _e, _f;
|
|
45891
45552
|
if (prev === next || prev.document === next.document) {
|
|
45892
45553
|
return {};
|
|
45893
45554
|
}
|
|
@@ -45931,7 +45592,7 @@ function computeLayoutInvalidationFromTransaction(prev, next) {
|
|
|
45931
45592
|
}
|
|
45932
45593
|
const aImage = getRunImage(a);
|
|
45933
45594
|
const bImage = getRunImage(b);
|
|
45934
|
-
if (Boolean(aImage) !== Boolean(bImage) || ((aImage == null ? void 0 : aImage.width) ?? -1) !== ((bImage == null ? void 0 : bImage.width) ?? -1) || ((aImage == null ? void 0 : aImage.height) ?? -1) !== ((bImage == null ? void 0 : bImage.height) ?? -1) || (((
|
|
45595
|
+
if (Boolean(aImage) !== Boolean(bImage) || ((aImage == null ? void 0 : aImage.width) ?? -1) !== ((bImage == null ? void 0 : bImage.width) ?? -1) || ((aImage == null ? void 0 : aImage.height) ?? -1) !== ((bImage == null ? void 0 : bImage.height) ?? -1) || (((_a = aImage == null ? void 0 : aImage.floating) == null ? void 0 : _a.wrap) ?? "") !== (((_b = bImage == null ? void 0 : bImage.floating) == null ? void 0 : _b.wrap) ?? "") || Boolean((_c = aImage == null ? void 0 : aImage.floating) == null ? void 0 : _c.behindDoc) !== Boolean((_d = bImage == null ? void 0 : bImage.floating) == null ? void 0 : _d.behindDoc) || (((_e = aImage == null ? void 0 : aImage.wrapPolygon) == null ? void 0 : _e.length) ?? -1) !== (((_f = bImage == null ? void 0 : bImage.wrapPolygon) == null ? void 0 : _f.length) ?? -1)) {
|
|
45935
45596
|
changed = true;
|
|
45936
45597
|
break;
|
|
45937
45598
|
}
|
|
@@ -46001,7 +45662,7 @@ function useEditorTransactionsImpl(ctx) {
|
|
|
46001
45662
|
}
|
|
46002
45663
|
function createEditorChangeBroadcast(deps) {
|
|
46003
45664
|
createEffect(() => {
|
|
46004
|
-
var
|
|
45665
|
+
var _a;
|
|
46005
45666
|
deps.state.document;
|
|
46006
45667
|
deps.state.selection;
|
|
46007
45668
|
deps.state.activeSectionIndex;
|
|
@@ -46011,7 +45672,7 @@ function createEditorChangeBroadcast(deps) {
|
|
|
46011
45672
|
return;
|
|
46012
45673
|
}
|
|
46013
45674
|
const snapshot = deps.cloneState(deps.getStateSnapshot());
|
|
46014
|
-
(
|
|
45675
|
+
(_a = deps.getOnStateChange()) == null ? void 0 : _a(snapshot);
|
|
46015
45676
|
deps.emit("change", snapshot);
|
|
46016
45677
|
deps.emit("documentChange", snapshot.document);
|
|
46017
45678
|
deps.emit("selectionChange", snapshot.selection);
|
|
@@ -46048,11 +45709,17 @@ function createEditorDocumentRuntimeImpl(deps) {
|
|
|
46048
45709
|
},
|
|
46049
45710
|
resetEditorChromeState: () => resetEditorChromeState(),
|
|
46050
45711
|
focusInput,
|
|
45712
|
+
requestLocalFontAccess: enablePreciseFontMode,
|
|
45713
|
+
prepareDocumentFonts: async (document2) => {
|
|
45714
|
+
await prepareDocumentFonts(document2, {
|
|
45715
|
+
remoteWebFonts: documentOptions().remoteWebFonts
|
|
45716
|
+
});
|
|
45717
|
+
},
|
|
46051
45718
|
logger
|
|
46052
45719
|
});
|
|
46053
45720
|
const isImportInProgress = () => {
|
|
46054
|
-
var
|
|
46055
|
-
return ((
|
|
45721
|
+
var _a, _b;
|
|
45722
|
+
return ((_a = docIO.importProgress()) == null ? void 0 : _a.phase) !== "done" && ((_b = docIO.importProgress()) == null ? void 0 : _b.phase) !== "error" && docIO.importProgress() !== null;
|
|
46056
45723
|
};
|
|
46057
45724
|
const {
|
|
46058
45725
|
measuredBlockHeights,
|
|
@@ -46337,7 +46004,7 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
|
46337
46004
|
return {
|
|
46338
46005
|
...cloneParagraph(candidate),
|
|
46339
46006
|
runs: candidate.runs.map((run) => {
|
|
46340
|
-
var
|
|
46007
|
+
var _a;
|
|
46341
46008
|
if (run.id !== targetRun.id || run.kind !== "textBox") {
|
|
46342
46009
|
return cloneRun(run);
|
|
46343
46010
|
}
|
|
@@ -46347,7 +46014,7 @@ function resizeSelectedTextBox(state, width, height, options = {}) {
|
|
|
46347
46014
|
width: nextWidth,
|
|
46348
46015
|
height: nextHeight
|
|
46349
46016
|
};
|
|
46350
|
-
if (changesHeight && ((
|
|
46017
|
+
if (changesHeight && ((_a = textBox.body) == null ? void 0 : _a.autoFit)) {
|
|
46351
46018
|
nextTextBox.body = { ...textBox.body, autoFit: false };
|
|
46352
46019
|
}
|
|
46353
46020
|
if (textBox.floating) {
|
|
@@ -46452,7 +46119,7 @@ const updateBlocksInCurrentSection = (current, blocks, zone = "main") => {
|
|
|
46452
46119
|
};
|
|
46453
46120
|
};
|
|
46454
46121
|
const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
|
|
46455
|
-
var
|
|
46122
|
+
var _a;
|
|
46456
46123
|
const location = findParagraphTableLocation(
|
|
46457
46124
|
current.document,
|
|
46458
46125
|
current.selection.focus.paragraphId,
|
|
@@ -46473,7 +46140,7 @@ const applyTableAwareParagraphEdit = (current, getTargetBlocks, edit) => {
|
|
|
46473
46140
|
(block, i) => i === location.blockIndex ? clonedTable : block
|
|
46474
46141
|
);
|
|
46475
46142
|
const tableBlock = clonedTable;
|
|
46476
|
-
const targetCell = (
|
|
46143
|
+
const targetCell = (_a = tableBlock.rows[location.rowIndex]) == null ? void 0 : _a.cells[location.cellIndex];
|
|
46477
46144
|
if (!targetCell) {
|
|
46478
46145
|
return edit(current);
|
|
46479
46146
|
}
|
|
@@ -46539,7 +46206,7 @@ function createTableOpsGuardsImpl(deps) {
|
|
|
46539
46206
|
return Boolean(range && range.endCellIndex > range.startCellIndex);
|
|
46540
46207
|
};
|
|
46541
46208
|
const canSplitSelectedTableCell = (current) => {
|
|
46542
|
-
var
|
|
46209
|
+
var _a;
|
|
46543
46210
|
const location = findParagraphTableLocation(
|
|
46544
46211
|
current.document,
|
|
46545
46212
|
current.selection.focus.paragraphId,
|
|
@@ -46553,11 +46220,11 @@ function createTableOpsGuardsImpl(deps) {
|
|
|
46553
46220
|
if (!block || block.type !== "table") {
|
|
46554
46221
|
return false;
|
|
46555
46222
|
}
|
|
46556
|
-
const cell = (
|
|
46223
|
+
const cell = (_a = block.rows[location.rowIndex]) == null ? void 0 : _a.cells[location.cellIndex];
|
|
46557
46224
|
return Boolean(((cell == null ? void 0 : cell.colSpan) ?? 1) > 1);
|
|
46558
46225
|
};
|
|
46559
46226
|
const canMergeSelectedTableRows = (current) => {
|
|
46560
|
-
var
|
|
46227
|
+
var _a;
|
|
46561
46228
|
const range = deps.resolveVerticalTableCellRange(current);
|
|
46562
46229
|
if (!range) {
|
|
46563
46230
|
return false;
|
|
@@ -46568,7 +46235,7 @@ function createTableOpsGuardsImpl(deps) {
|
|
|
46568
46235
|
return false;
|
|
46569
46236
|
}
|
|
46570
46237
|
for (let rowIndex = range.startRowIndex; rowIndex <= range.endRowIndex; rowIndex += 1) {
|
|
46571
|
-
const cell = (
|
|
46238
|
+
const cell = (_a = tableBlock.rows[rowIndex]) == null ? void 0 : _a.cells[range.cellIndex];
|
|
46572
46239
|
if (!cell || cell.vMerge === "continue" || cell.blocks.length !== 1) {
|
|
46573
46240
|
return false;
|
|
46574
46241
|
}
|
|
@@ -46579,7 +46246,7 @@ function createTableOpsGuardsImpl(deps) {
|
|
|
46579
46246
|
return canMergeSelectedTableCells(current) || canMergeSelectedTableRows(current);
|
|
46580
46247
|
};
|
|
46581
46248
|
const canSplitSelectedTableCellVertically = (current) => {
|
|
46582
|
-
var
|
|
46249
|
+
var _a;
|
|
46583
46250
|
const location = findParagraphTableLocation(
|
|
46584
46251
|
current.document,
|
|
46585
46252
|
current.selection.focus.paragraphId,
|
|
@@ -46593,7 +46260,7 @@ function createTableOpsGuardsImpl(deps) {
|
|
|
46593
46260
|
if (!block || block.type !== "table") {
|
|
46594
46261
|
return false;
|
|
46595
46262
|
}
|
|
46596
|
-
const cell = (
|
|
46263
|
+
const cell = (_a = block.rows[location.rowIndex]) == null ? void 0 : _a.cells[location.cellIndex];
|
|
46597
46264
|
return Boolean(((cell == null ? void 0 : cell.rowSpan) ?? 1) > 1 && (cell == null ? void 0 : cell.vMerge) === "restart");
|
|
46598
46265
|
};
|
|
46599
46266
|
const canSplitSelectedTable = (current) => {
|
|
@@ -46696,11 +46363,11 @@ function createTableSelectionResolvers(deps) {
|
|
|
46696
46363
|
}
|
|
46697
46364
|
function createTableSelectionResolversImpl(deps) {
|
|
46698
46365
|
const resolveTableCellRangeSelection = (current) => {
|
|
46699
|
-
var
|
|
46366
|
+
var _a, _b, _c, _d, _e;
|
|
46700
46367
|
const selection = current.selection;
|
|
46701
46368
|
const context = getSelectionTableContext(current, deps);
|
|
46702
46369
|
if (!context || context.anchorLocation.rowIndex === context.focusLocation.rowIndex && context.anchorLocation.cellIndex === context.focusLocation.cellIndex) {
|
|
46703
|
-
(
|
|
46370
|
+
(_a = deps.logger) == null ? void 0 : _a.debug(
|
|
46704
46371
|
`resolveTableCellRangeSelection: no expansion (anchor=${selection.anchor.paragraphId} focus=${selection.focus.paragraphId})`
|
|
46705
46372
|
);
|
|
46706
46373
|
return null;
|
|
@@ -46721,7 +46388,7 @@ function createTableSelectionResolversImpl(deps) {
|
|
|
46721
46388
|
context.anchorLocation.cellIndex,
|
|
46722
46389
|
context.focusLocation.cellIndex
|
|
46723
46390
|
);
|
|
46724
|
-
(
|
|
46391
|
+
(_b = deps.logger) == null ? void 0 : _b.info(
|
|
46725
46392
|
`resolveTableCellRangeSelection: expanding r${context.anchorLocation.rowIndex}:c${context.anchorLocation.cellIndex}->r${context.focusLocation.rowIndex}:c${context.focusLocation.cellIndex} (anchor=${selection.anchor.paragraphId} focus=${selection.focus.paragraphId}) range=[rows ${rangeStartRow}..${rangeEndRow}, cells ${rangeStartCell}..${rangeEndCell}]`
|
|
46726
46393
|
);
|
|
46727
46394
|
const startLocation = compareCellLocations(context.anchorCell, context.focusCell) <= 0 ? context.anchorLocation : context.focusLocation;
|
|
@@ -46988,11 +46655,11 @@ function createTableCellSpanOperationsImpl(deps) {
|
|
|
46988
46655
|
return current;
|
|
46989
46656
|
};
|
|
46990
46657
|
const splitSelectedTableCellVertically = (current) => {
|
|
46991
|
-
var
|
|
46658
|
+
var _a;
|
|
46992
46659
|
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
46993
46660
|
if (!mut) return current;
|
|
46994
46661
|
const { tableBlock, location, targetBlocks } = mut;
|
|
46995
|
-
const cell = (
|
|
46662
|
+
const cell = (_a = tableBlock.rows[location.rowIndex]) == null ? void 0 : _a.cells[location.cellIndex];
|
|
46996
46663
|
const span = Math.max(1, (cell == null ? void 0 : cell.rowSpan) ?? 1);
|
|
46997
46664
|
if (!cell || span <= 1 || cell.vMerge !== "restart") {
|
|
46998
46665
|
return current;
|
|
@@ -47024,8 +46691,8 @@ function createTableCellSpanOperationsImpl(deps) {
|
|
|
47024
46691
|
...Array.from(
|
|
47025
46692
|
{ length: span - 1 },
|
|
47026
46693
|
(_, offset) => {
|
|
47027
|
-
var
|
|
47028
|
-
const prior = (
|
|
46694
|
+
var _a2;
|
|
46695
|
+
const prior = (_a2 = tableBlock.rows[location.rowIndex + offset + 1]) == null ? void 0 : _a2.cells[location.cellIndex];
|
|
47029
46696
|
return prior ? cloneCellSnapshot(prior) : createEditorTableCell([], preservedColSpan);
|
|
47030
46697
|
}
|
|
47031
46698
|
)
|
|
@@ -47055,7 +46722,7 @@ function createTableCellSpanOperationsImpl(deps) {
|
|
|
47055
46722
|
);
|
|
47056
46723
|
};
|
|
47057
46724
|
const splitSelectedTableCell = (current) => {
|
|
47058
|
-
var
|
|
46725
|
+
var _a;
|
|
47059
46726
|
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
47060
46727
|
if (!mut) return current;
|
|
47061
46728
|
const { tableBlock, location, targetBlocks } = mut;
|
|
@@ -47101,7 +46768,7 @@ function createTableCellSpanOperationsImpl(deps) {
|
|
|
47101
46768
|
)
|
|
47102
46769
|
];
|
|
47103
46770
|
row.cells.splice(location.cellIndex, 1, ...nextCells);
|
|
47104
|
-
const nextParagraph = (
|
|
46771
|
+
const nextParagraph = (_a = nextCells[0]) == null ? void 0 : _a.blocks[0];
|
|
47105
46772
|
if (!nextParagraph) {
|
|
47106
46773
|
return current;
|
|
47107
46774
|
}
|
|
@@ -47137,10 +46804,10 @@ function markTableRevision(target, type) {
|
|
|
47137
46804
|
};
|
|
47138
46805
|
}
|
|
47139
46806
|
function resolveNextTableParagraph(tableBlock, targetCell, fallbackRow) {
|
|
47140
|
-
var
|
|
47141
|
-
return (targetCell == null ? void 0 : targetCell.blocks[0]) ?? ((
|
|
46807
|
+
var _a;
|
|
46808
|
+
return (targetCell == null ? void 0 : targetCell.blocks[0]) ?? ((_a = fallbackRow == null ? void 0 : fallbackRow.cells.find(
|
|
47142
46809
|
(cell) => cell.vMerge !== "continue" && cell.blocks[0]
|
|
47143
|
-
)) == null ? void 0 :
|
|
46810
|
+
)) == null ? void 0 : _a.blocks[0]) ?? findFirstNavigableParagraphInTable(tableBlock);
|
|
47144
46811
|
}
|
|
47145
46812
|
function createTableRowColumnOperations(deps) {
|
|
47146
46813
|
return createTableRowColumnOperationsImpl(deps);
|
|
@@ -47304,7 +46971,7 @@ function createTableRowColumnOperationsImpl(deps) {
|
|
|
47304
46971
|
);
|
|
47305
46972
|
};
|
|
47306
46973
|
const insertSelectedTableColumn = (current, direction) => {
|
|
47307
|
-
var
|
|
46974
|
+
var _a;
|
|
47308
46975
|
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
47309
46976
|
if (!mut) return current;
|
|
47310
46977
|
const { tableBlock, location, targetBlocks } = mut;
|
|
@@ -47378,7 +47045,7 @@ function createTableRowColumnOperationsImpl(deps) {
|
|
|
47378
47045
|
const insertIndex = Math.max(
|
|
47379
47046
|
0,
|
|
47380
47047
|
Math.min(
|
|
47381
|
-
((
|
|
47048
|
+
((_a = tableBlock.rows[0]) == null ? void 0 : _a.cells.length) ?? 0,
|
|
47382
47049
|
location.cellIndex + (direction > 0 ? 1 : 0)
|
|
47383
47050
|
)
|
|
47384
47051
|
);
|
|
@@ -47400,7 +47067,7 @@ function createTableRowColumnOperationsImpl(deps) {
|
|
|
47400
47067
|
);
|
|
47401
47068
|
};
|
|
47402
47069
|
const deleteSelectedTableColumn = (current) => {
|
|
47403
|
-
var
|
|
47070
|
+
var _a;
|
|
47404
47071
|
const mut = resolveLocationTableMutation(current, deps.getTargetBlocks);
|
|
47405
47072
|
if (!mut) return current;
|
|
47406
47073
|
const { tableBlock, location, targetBlocks } = mut;
|
|
@@ -47465,7 +47132,7 @@ function createTableRowColumnOperationsImpl(deps) {
|
|
|
47465
47132
|
nextParagraph2
|
|
47466
47133
|
);
|
|
47467
47134
|
}
|
|
47468
|
-
if (((
|
|
47135
|
+
if (((_a = tableBlock.rows[0]) == null ? void 0 : _a.cells.length) <= 1) {
|
|
47469
47136
|
return current;
|
|
47470
47137
|
}
|
|
47471
47138
|
for (const row of tableBlock.rows) {
|
|
@@ -47504,19 +47171,19 @@ function createTableSelectionAwareCommandsImpl(deps) {
|
|
|
47504
47171
|
};
|
|
47505
47172
|
const applySelectionAwareCommand = (command, logPrefix) => {
|
|
47506
47173
|
deps.applyTransactionalState((current) => {
|
|
47507
|
-
var
|
|
47174
|
+
var _a, _b, _c;
|
|
47508
47175
|
const selection = deps.resolveSelectedTableCells(current);
|
|
47509
47176
|
if (!selection || selection.cells.length <= 1) {
|
|
47510
47177
|
const expanded = withExpandedTableCellSelection(current);
|
|
47511
47178
|
if (expanded !== current) {
|
|
47512
|
-
(
|
|
47179
|
+
(_a = deps.logger) == null ? void 0 : _a.info(
|
|
47513
47180
|
`${logPrefix}: expanded selection to ${expanded.selection.anchor.paragraphId}[${expanded.selection.anchor.offset}]..${expanded.selection.focus.paragraphId}[${expanded.selection.focus.offset}]`
|
|
47514
47181
|
);
|
|
47515
47182
|
}
|
|
47516
47183
|
return command(expanded);
|
|
47517
47184
|
}
|
|
47518
47185
|
const { blockIndex, cells, zone } = selection;
|
|
47519
|
-
(
|
|
47186
|
+
(_b = deps.logger) == null ? void 0 : _b.info(
|
|
47520
47187
|
`${logPrefix}: multi-cell selection in table block ${blockIndex} (${cells.length} cells) in zone ${zone}`
|
|
47521
47188
|
);
|
|
47522
47189
|
const allParagraphs = [];
|
|
@@ -47664,8 +47331,8 @@ function createEditorTableOperationsImpl(deps) {
|
|
|
47664
47331
|
logger: deps.logger
|
|
47665
47332
|
});
|
|
47666
47333
|
const insertTableCommand = (rows, cols) => {
|
|
47667
|
-
var
|
|
47668
|
-
(
|
|
47334
|
+
var _a;
|
|
47335
|
+
(_a = deps.logger) == null ? void 0 : _a.info(`insertTableCommand: ${rows}x${cols}`);
|
|
47669
47336
|
deps.applyTransactionalState(
|
|
47670
47337
|
(current) => insertTableAtSelection(current, rows, cols),
|
|
47671
47338
|
{
|
|
@@ -47731,12 +47398,12 @@ function createResizeSession(adapter, deps) {
|
|
|
47731
47398
|
}
|
|
47732
47399
|
});
|
|
47733
47400
|
const handleMouseMove = (event) => {
|
|
47734
|
-
var
|
|
47401
|
+
var _a;
|
|
47735
47402
|
const resize = active;
|
|
47736
47403
|
if (!resize) {
|
|
47737
47404
|
return;
|
|
47738
47405
|
}
|
|
47739
|
-
const z = ((
|
|
47406
|
+
const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
|
|
47740
47407
|
const deltaX = (event.clientX - resize.startClientX) / z;
|
|
47741
47408
|
const deltaY = (event.clientY - resize.startClientY) / z;
|
|
47742
47409
|
const maxWidth = adapter.getMaxWidth(deps.state, resize.paragraphId);
|
|
@@ -47965,12 +47632,12 @@ function createCropSession(deps) {
|
|
|
47965
47632
|
}
|
|
47966
47633
|
});
|
|
47967
47634
|
const handleMouseMove = (event) => {
|
|
47968
|
-
var
|
|
47635
|
+
var _a;
|
|
47969
47636
|
const crop = active;
|
|
47970
47637
|
if (!crop) {
|
|
47971
47638
|
return;
|
|
47972
47639
|
}
|
|
47973
|
-
const z = ((
|
|
47640
|
+
const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
|
|
47974
47641
|
const deltaX = (event.clientX - crop.startClientX) / z;
|
|
47975
47642
|
const deltaY = (event.clientY - crop.startClientY) / z;
|
|
47976
47643
|
const result = resolveCroppedImage(crop, deltaX, deltaY);
|
|
@@ -48827,7 +48494,7 @@ function resolveImageAtPoint(snapshot, pageIndex, zone, clientX, clientY, pierce
|
|
|
48827
48494
|
return null;
|
|
48828
48495
|
}
|
|
48829
48496
|
function resolveCanvasSurfaceHitAtPoint(options) {
|
|
48830
|
-
var
|
|
48497
|
+
var _a, _b, _c;
|
|
48831
48498
|
const { snapshot, state } = options;
|
|
48832
48499
|
const pierce = options.pierce ?? false;
|
|
48833
48500
|
const zoomFactor = options.zoomFactor && options.zoomFactor > 0 ? options.zoomFactor : 1;
|
|
@@ -48869,7 +48536,7 @@ function resolveCanvasSurfaceHitAtPoint(options) {
|
|
|
48869
48536
|
position: position2,
|
|
48870
48537
|
source: "canvas-layout",
|
|
48871
48538
|
resolvedFromParagraph: true,
|
|
48872
|
-
tableCellAnchorPosition: (
|
|
48539
|
+
tableCellAnchorPosition: (_a = paragraphSegment.tableCell) == null ? void 0 : _a.anchorPosition,
|
|
48873
48540
|
caretViewport: {
|
|
48874
48541
|
left: textBoxHit.left,
|
|
48875
48542
|
top: textBoxHit.top,
|
|
@@ -48918,7 +48585,7 @@ function resolveCanvasSurfaceHitAtPoint(options) {
|
|
|
48918
48585
|
position: position2,
|
|
48919
48586
|
source: "canvas-layout",
|
|
48920
48587
|
resolvedFromParagraph: true,
|
|
48921
|
-
tableCellAnchorPosition: (
|
|
48588
|
+
tableCellAnchorPosition: (_b = paragraphSegment.tableCell) == null ? void 0 : _b.anchorPosition,
|
|
48922
48589
|
caretViewport: {
|
|
48923
48590
|
left: imageHit.left,
|
|
48924
48591
|
top: imageHit.top,
|
|
@@ -49269,20 +48936,20 @@ function createEditorClipboardController(deps) {
|
|
|
49269
48936
|
}
|
|
49270
48937
|
function createEditorClipboardControllerImpl(deps) {
|
|
49271
48938
|
const handleCopy = (event) => {
|
|
49272
|
-
var
|
|
48939
|
+
var _a, _b;
|
|
49273
48940
|
const text = getSelectedText(deps.state());
|
|
49274
48941
|
if (text.length === 0) {
|
|
49275
48942
|
return;
|
|
49276
48943
|
}
|
|
49277
48944
|
event.preventDefault();
|
|
49278
|
-
(
|
|
49279
|
-
(
|
|
48945
|
+
(_a = event.clipboardData) == null ? void 0 : _a.setData("text/plain", text);
|
|
48946
|
+
(_b = event.clipboardData) == null ? void 0 : _b.setData(
|
|
49280
48947
|
"text/html",
|
|
49281
48948
|
serializeEditorSelectionToHtml(deps.state())
|
|
49282
48949
|
);
|
|
49283
48950
|
};
|
|
49284
48951
|
const handleCut = (event) => {
|
|
49285
|
-
var
|
|
48952
|
+
var _a, _b;
|
|
49286
48953
|
if (deps.isReadOnly()) {
|
|
49287
48954
|
event.preventDefault();
|
|
49288
48955
|
return;
|
|
@@ -49292,8 +48959,8 @@ function createEditorClipboardControllerImpl(deps) {
|
|
|
49292
48959
|
return;
|
|
49293
48960
|
}
|
|
49294
48961
|
event.preventDefault();
|
|
49295
|
-
(
|
|
49296
|
-
(
|
|
48962
|
+
(_a = event.clipboardData) == null ? void 0 : _a.setData("text/plain", text);
|
|
48963
|
+
(_b = event.clipboardData) == null ? void 0 : _b.setData(
|
|
49297
48964
|
"text/html",
|
|
49298
48965
|
serializeEditorSelectionToHtml(deps.state())
|
|
49299
48966
|
);
|
|
@@ -49308,14 +48975,14 @@ function createEditorClipboardControllerImpl(deps) {
|
|
|
49308
48975
|
deps.focusInput();
|
|
49309
48976
|
};
|
|
49310
48977
|
const handlePaste = (event) => {
|
|
49311
|
-
var
|
|
48978
|
+
var _a, _b, _c;
|
|
49312
48979
|
if (deps.isReadOnly()) {
|
|
49313
48980
|
event.preventDefault();
|
|
49314
48981
|
return;
|
|
49315
48982
|
}
|
|
49316
48983
|
if (deps.forcePlainTextPaste()) {
|
|
49317
48984
|
deps.setForcePlainTextPaste(false);
|
|
49318
|
-
const text2 = ((
|
|
48985
|
+
const text2 = ((_a = event.clipboardData) == null ? void 0 : _a.getData("text/plain")) ?? "";
|
|
49319
48986
|
if (text2.length === 0) {
|
|
49320
48987
|
event.preventDefault();
|
|
49321
48988
|
return;
|
|
@@ -49343,7 +49010,7 @@ function createEditorClipboardControllerImpl(deps) {
|
|
|
49343
49010
|
deps.focusInput();
|
|
49344
49011
|
return;
|
|
49345
49012
|
}
|
|
49346
|
-
const html = ((
|
|
49013
|
+
const html = ((_b = event.clipboardData) == null ? void 0 : _b.getData("text/html")) ?? "";
|
|
49347
49014
|
const paragraphs = parseEditorClipboardHtmlWithDom(html);
|
|
49348
49015
|
if (paragraphs.length > 0) {
|
|
49349
49016
|
event.preventDefault();
|
|
@@ -49591,17 +49258,17 @@ const CONTENT_MIN_WIDTH_GUARD_PX = 12;
|
|
|
49591
49258
|
const CONTENT_MIN_HEIGHT_GUARD_PX = 4;
|
|
49592
49259
|
const DEFAULT_CELL_PADDING_LEFT_RIGHT_PX = 7.2;
|
|
49593
49260
|
function resolveHorizontalCellChromePx(cell) {
|
|
49594
|
-
var
|
|
49595
|
-
const padding = typeof ((
|
|
49261
|
+
var _a, _b, _c, _d, _e;
|
|
49262
|
+
const padding = typeof ((_a = cell.style) == null ? void 0 : _a.padding) === "number" && Number.isFinite(cell.style.padding) ? Math.max(0, ptToPx(cell.style.padding)) * 2 : Math.max(
|
|
49596
49263
|
0,
|
|
49597
|
-
(((
|
|
49264
|
+
(((_b = cell.style) == null ? void 0 : _b.paddingLeft) !== void 0 ? ptToPx(cell.style.paddingLeft) : DEFAULT_CELL_PADDING_LEFT_RIGHT_PX) + (((_c = cell.style) == null ? void 0 : _c.paddingRight) !== void 0 ? ptToPx(cell.style.paddingRight) : DEFAULT_CELL_PADDING_LEFT_RIGHT_PX)
|
|
49598
49265
|
);
|
|
49599
49266
|
const borderLeft = ((_d = cell.style) == null ? void 0 : _d.borderLeft) ? Math.max(0, ptToPx(cell.style.borderLeft.width)) : 1;
|
|
49600
49267
|
const borderRight = ((_e = cell.style) == null ? void 0 : _e.borderRight) ? Math.max(0, ptToPx(cell.style.borderRight.width)) : 1;
|
|
49601
49268
|
return padding + borderLeft + borderRight;
|
|
49602
49269
|
}
|
|
49603
49270
|
function resolveRowHeightsPx(tableNode, tableLayout, geometry) {
|
|
49604
|
-
var
|
|
49271
|
+
var _a, _b;
|
|
49605
49272
|
const rowCount = Math.max(1, tableNode.rows.length);
|
|
49606
49273
|
const baseRowHeight = geometry.bounds.height / rowCount;
|
|
49607
49274
|
const rowHeights = Array(rowCount).fill(baseRowHeight);
|
|
@@ -49611,7 +49278,7 @@ function resolveRowHeightsPx(tableNode, tableLayout, geometry) {
|
|
|
49611
49278
|
)
|
|
49612
49279
|
);
|
|
49613
49280
|
for (let rowIndex = 0; rowIndex < rowCount; rowIndex += 1) {
|
|
49614
|
-
const explicitPt = parseSizeToPt((
|
|
49281
|
+
const explicitPt = parseSizeToPt((_b = (_a = tableNode.rows[rowIndex]) == null ? void 0 : _a.style) == null ? void 0 : _b.height);
|
|
49615
49282
|
if (explicitPt !== null) {
|
|
49616
49283
|
rowHeights[rowIndex] = Math.max(1, ptToPx(explicitPt));
|
|
49617
49284
|
continue;
|
|
@@ -49701,7 +49368,7 @@ function resolveMinRowHeightPx(tableNode, tableLayout, geometry, targetRowIndex)
|
|
|
49701
49368
|
return Math.max(minFloor, minHeight);
|
|
49702
49369
|
}
|
|
49703
49370
|
function resolveMinColumnWidthsPx(state, tableNode, tableLayout, geometry) {
|
|
49704
|
-
var
|
|
49371
|
+
var _a;
|
|
49705
49372
|
const minFloor = ptToPx(MIN_TABLE_SIZE_PT);
|
|
49706
49373
|
const result = {};
|
|
49707
49374
|
const geometryByKey = new Map(
|
|
@@ -49715,7 +49382,7 @@ function resolveMinColumnWidthsPx(state, tableNode, tableLayout, geometry) {
|
|
|
49715
49382
|
`${entry.rowIndex}:${entry.cellIndex}`
|
|
49716
49383
|
);
|
|
49717
49384
|
if (!geometryCell) continue;
|
|
49718
|
-
const cell = (
|
|
49385
|
+
const cell = (_a = tableNode.rows[entry.rowIndex]) == null ? void 0 : _a.cells[entry.cellIndex];
|
|
49719
49386
|
if (!cell) continue;
|
|
49720
49387
|
const visualCol = entry.visualColumnIndex;
|
|
49721
49388
|
const currentMin = result[visualCol] ?? minFloor;
|
|
@@ -49747,7 +49414,7 @@ function applyRowResize(state, resize, delta) {
|
|
|
49747
49414
|
return setTableRowHeight(state, resize.tableId, resize.index, newSizePt);
|
|
49748
49415
|
}
|
|
49749
49416
|
function applyColumnResize(state, resize, delta) {
|
|
49750
|
-
var
|
|
49417
|
+
var _a;
|
|
49751
49418
|
if (resize.type !== "column") return state;
|
|
49752
49419
|
const deltaPt = pxToPt(delta);
|
|
49753
49420
|
const maxColumnIndex = resize.maxColumnIndex ?? resize.index;
|
|
@@ -49813,7 +49480,7 @@ function applyColumnResize(state, resize, delta) {
|
|
|
49813
49480
|
0
|
|
49814
49481
|
);
|
|
49815
49482
|
const tableNode = getTableById(state, resize.tableId);
|
|
49816
|
-
const currentTableWidthPt = parseSizeToPt((
|
|
49483
|
+
const currentTableWidthPt = parseSizeToPt((_a = tableNode == null ? void 0 : tableNode.style) == null ? void 0 : _a.width);
|
|
49817
49484
|
const tableWidthToPersist = isLastColumn ? tableWidthPt : currentTableWidthPt !== null ? currentTableWidthPt : void 0;
|
|
49818
49485
|
return setTableColumnWidths(
|
|
49819
49486
|
state,
|
|
@@ -49863,7 +49530,7 @@ const DRAG_THRESHOLD_PX$1 = 2;
|
|
|
49863
49530
|
function createEditorTableResize(deps) {
|
|
49864
49531
|
const [resizing, setResizing] = createSignal(null);
|
|
49865
49532
|
const handleMouseMove = (event) => {
|
|
49866
|
-
var
|
|
49533
|
+
var _a;
|
|
49867
49534
|
if (resizing()) {
|
|
49868
49535
|
setActiveCursorClass(resizing().type === "column");
|
|
49869
49536
|
return;
|
|
@@ -49879,7 +49546,7 @@ function createEditorTableResize(deps) {
|
|
|
49879
49546
|
deps.state(),
|
|
49880
49547
|
deps.documentLayout(),
|
|
49881
49548
|
deps.canvasSnapshotProvider,
|
|
49882
|
-
(
|
|
49549
|
+
(_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
|
|
49883
49550
|
);
|
|
49884
49551
|
if (!info) {
|
|
49885
49552
|
clearResizeCursorClasses();
|
|
@@ -49888,7 +49555,7 @@ function createEditorTableResize(deps) {
|
|
|
49888
49555
|
setHoverCursorClass(info.side === "left" || info.side === "right");
|
|
49889
49556
|
};
|
|
49890
49557
|
const handleMouseDown = (event) => {
|
|
49891
|
-
var
|
|
49558
|
+
var _a, _b;
|
|
49892
49559
|
const surface = deps.surfaceRef();
|
|
49893
49560
|
if (!surface) return false;
|
|
49894
49561
|
const info = findTableResizeHoverInfo(
|
|
@@ -49897,7 +49564,7 @@ function createEditorTableResize(deps) {
|
|
|
49897
49564
|
deps.state(),
|
|
49898
49565
|
deps.documentLayout(),
|
|
49899
49566
|
deps.canvasSnapshotProvider,
|
|
49900
|
-
(
|
|
49567
|
+
(_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
|
|
49901
49568
|
);
|
|
49902
49569
|
if (!info) return false;
|
|
49903
49570
|
const state = deps.state();
|
|
@@ -49929,7 +49596,7 @@ function createEditorTableResize(deps) {
|
|
|
49929
49596
|
maxColumnIndex,
|
|
49930
49597
|
minColumnWidthsPx,
|
|
49931
49598
|
resizeFromLeftEdge: isLeftTableEdge,
|
|
49932
|
-
initialTableIndentLeftPt: parseSizeToPt((
|
|
49599
|
+
initialTableIndentLeftPt: parseSizeToPt((_b = info.tableNode.style) == null ? void 0 : _b.indentLeft) ?? 0,
|
|
49933
49600
|
guideBounds: getGuideBounds(deps.viewportRef)
|
|
49934
49601
|
});
|
|
49935
49602
|
setActiveCursorClass(true);
|
|
@@ -49983,10 +49650,10 @@ function createEditorTableResize(deps) {
|
|
|
49983
49650
|
setActiveCursorClass(currentResizing.type === "column");
|
|
49984
49651
|
};
|
|
49985
49652
|
const handleWindowMouseUp = (event) => {
|
|
49986
|
-
var
|
|
49653
|
+
var _a;
|
|
49987
49654
|
const currentResizing = resizing();
|
|
49988
49655
|
if (!currentResizing) return;
|
|
49989
|
-
const z = ((
|
|
49656
|
+
const z = ((_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)) ?? 1;
|
|
49990
49657
|
const delta = ((currentResizing.type === "column" ? event.clientX : event.clientY) - currentResizing.initialPos) / z;
|
|
49991
49658
|
if (Math.abs(delta) >= DRAG_THRESHOLD_PX$1) {
|
|
49992
49659
|
deps.applyTransactionalState((current) => {
|
|
@@ -50097,7 +49764,7 @@ function createEditorTableCornerResize(deps) {
|
|
|
50097
49764
|
stop();
|
|
50098
49765
|
};
|
|
50099
49766
|
const handleMouseDown = (tableId, event) => {
|
|
50100
|
-
var
|
|
49767
|
+
var _a;
|
|
50101
49768
|
const surface = deps.surfaceRef();
|
|
50102
49769
|
if (!surface) return;
|
|
50103
49770
|
const geometries = buildTableGeometries(
|
|
@@ -50105,7 +49772,7 @@ function createEditorTableCornerResize(deps) {
|
|
|
50105
49772
|
deps.state(),
|
|
50106
49773
|
deps.documentLayout(),
|
|
50107
49774
|
deps.canvasSnapshotProvider,
|
|
50108
|
-
(
|
|
49775
|
+
(_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
|
|
50109
49776
|
);
|
|
50110
49777
|
const geometry = geometries.find(
|
|
50111
49778
|
(candidate) => candidate.tableId === tableId
|
|
@@ -50168,7 +49835,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
50168
49835
|
document.body.style.cursor = "";
|
|
50169
49836
|
};
|
|
50170
49837
|
const handleMouseMove = (event) => {
|
|
50171
|
-
var
|
|
49838
|
+
var _a;
|
|
50172
49839
|
setMousePos({ x: event.clientX, y: event.clientY });
|
|
50173
49840
|
if (!dragging()) {
|
|
50174
49841
|
const delta = Math.abs(event.clientY - startClientY());
|
|
@@ -50184,7 +49851,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
50184
49851
|
event.clientX,
|
|
50185
49852
|
event.clientY
|
|
50186
49853
|
);
|
|
50187
|
-
const tableId = (
|
|
49854
|
+
const tableId = (_a = draggedTableInfo()) == null ? void 0 : _a.tableId;
|
|
50188
49855
|
if (pos && tableId) {
|
|
50189
49856
|
const state = deps.state();
|
|
50190
49857
|
const location = findParagraphTableLocation(
|
|
@@ -50213,7 +49880,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
50213
49880
|
const tableId = info == null ? void 0 : info.tableId;
|
|
50214
49881
|
if (tableId) {
|
|
50215
49882
|
deps.applyTransactionalState((current) => {
|
|
50216
|
-
var
|
|
49883
|
+
var _a;
|
|
50217
49884
|
const findTable = () => {
|
|
50218
49885
|
for (const zone of ["main", "header", "footer"]) {
|
|
50219
49886
|
const blocks = getEditableBlocksForZone(current, zone);
|
|
@@ -50225,7 +49892,7 @@ function createEditorTableDragImpl(deps) {
|
|
|
50225
49892
|
return void 0;
|
|
50226
49893
|
};
|
|
50227
49894
|
const table = findTable();
|
|
50228
|
-
if ((table == null ? void 0 : table.type) === "table" && ((
|
|
49895
|
+
if ((table == null ? void 0 : table.type) === "table" && ((_a = table.style) == null ? void 0 : _a.floating)) {
|
|
50229
49896
|
const floating = table.style.floating;
|
|
50230
49897
|
return setActiveTableStyleValue(current, tableId, "floating", {
|
|
50231
49898
|
...floating,
|
|
@@ -50397,9 +50064,9 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
50397
50064
|
globalThis.clearTimeout(handle);
|
|
50398
50065
|
};
|
|
50399
50066
|
const applyWithZone = (state, targetZone, newState, targetPosition) => {
|
|
50400
|
-
var
|
|
50067
|
+
var _a;
|
|
50401
50068
|
const isZoneTransition = targetZone !== (state.activeZone ?? "main");
|
|
50402
|
-
const targetFootnoteId = targetZone === "footnote" && targetPosition ? (
|
|
50069
|
+
const targetFootnoteId = targetZone === "footnote" && targetPosition ? (_a = findParagraphLocation(newState.document, targetPosition.paragraphId)) == null ? void 0 : _a.footnoteId : void 0;
|
|
50403
50070
|
const isFootnoteTransition = targetZone === "footnote" && targetFootnoteId !== state.activeFootnoteId;
|
|
50404
50071
|
if (!isZoneTransition && !isFootnoteTransition) {
|
|
50405
50072
|
deps.applyState(newState);
|
|
@@ -50659,7 +50326,7 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
50659
50326
|
deps.focusInputAfterPointerSelection();
|
|
50660
50327
|
};
|
|
50661
50328
|
const handleSurfaceMouseDown = (event) => {
|
|
50662
|
-
var
|
|
50329
|
+
var _a;
|
|
50663
50330
|
if (event.button !== 0) {
|
|
50664
50331
|
return;
|
|
50665
50332
|
}
|
|
@@ -50694,7 +50361,7 @@ function createEditorSurfaceEventsImpl(deps) {
|
|
|
50694
50361
|
deps.focusInputAfterPointerSelection();
|
|
50695
50362
|
return;
|
|
50696
50363
|
}
|
|
50697
|
-
if ((
|
|
50364
|
+
if ((_a = deps.textDrag) == null ? void 0 : _a.tryStartTextDrag(event, hit)) {
|
|
50698
50365
|
dragAnchor = null;
|
|
50699
50366
|
stopDragging();
|
|
50700
50367
|
deps.focusInputAfterPointerSelection();
|
|
@@ -50804,7 +50471,7 @@ function createEditorTextInputImpl(deps) {
|
|
|
50804
50471
|
const [composing, setComposing] = createSignal(false);
|
|
50805
50472
|
let suppressedInputText = null;
|
|
50806
50473
|
const handleTextInput = (event) => {
|
|
50807
|
-
var
|
|
50474
|
+
var _a, _b, _c, _d;
|
|
50808
50475
|
markStart("input:text");
|
|
50809
50476
|
if (deps.isReadOnly()) {
|
|
50810
50477
|
deps.logger.debug(
|
|
@@ -50829,9 +50496,9 @@ function createEditorTextInputImpl(deps) {
|
|
|
50829
50496
|
}
|
|
50830
50497
|
const state = deps.state();
|
|
50831
50498
|
const sel = state.selection;
|
|
50832
|
-
const currentRun = (
|
|
50499
|
+
const currentRun = (_a = getParagraphs(state).find((p) => p.id === sel.anchor.paragraphId)) == null ? void 0 : _a.runs.find((r) => r.id === sel.anchor.runId);
|
|
50833
50500
|
const runStyle = currentRun ? {
|
|
50834
|
-
bold: (
|
|
50501
|
+
bold: (_b = currentRun.styles) == null ? void 0 : _b.bold,
|
|
50835
50502
|
italic: (_c = currentRun.styles) == null ? void 0 : _c.italic,
|
|
50836
50503
|
underline: (_d = currentRun.styles) == null ? void 0 : _d.underline
|
|
50837
50504
|
} : null;
|
|
@@ -50950,8 +50617,8 @@ function createEditorTextDragImpl(deps) {
|
|
|
50950
50617
|
document.head.appendChild(cursorStyleEl);
|
|
50951
50618
|
};
|
|
50952
50619
|
const stopDrag = () => {
|
|
50953
|
-
var
|
|
50954
|
-
(
|
|
50620
|
+
var _a;
|
|
50621
|
+
(_a = deps.logger) == null ? void 0 : _a.info("text-drag:stop", {
|
|
50955
50622
|
dragging: dragging(),
|
|
50956
50623
|
dropTarget: dropTargetPos() ? `${dropTargetPos().paragraphId}:${dropTargetPos().runId}[${dropTargetPos().offset}]` : null,
|
|
50957
50624
|
copyMode: copyMode()
|
|
@@ -50968,7 +50635,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
50968
50635
|
window.removeEventListener("mouseup", handleWindowMouseUp);
|
|
50969
50636
|
};
|
|
50970
50637
|
const handleWindowMouseMove = (event) => {
|
|
50971
|
-
var
|
|
50638
|
+
var _a, _b, _c;
|
|
50972
50639
|
if (!pendingStart) {
|
|
50973
50640
|
return;
|
|
50974
50641
|
}
|
|
@@ -50980,7 +50647,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
50980
50647
|
if (deltaX + deltaY < 4) {
|
|
50981
50648
|
return;
|
|
50982
50649
|
}
|
|
50983
|
-
(
|
|
50650
|
+
(_a = deps.logger) == null ? void 0 : _a.info("text-drag:activate", {
|
|
50984
50651
|
start: pendingStart,
|
|
50985
50652
|
at: { x: event.clientX, y: event.clientY },
|
|
50986
50653
|
deltaX,
|
|
@@ -50992,7 +50659,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
50992
50659
|
setPointerPos({ x: event.clientX, y: event.clientY });
|
|
50993
50660
|
const hit = deps.resolveSurfaceHitAtPoint(event.clientX, event.clientY);
|
|
50994
50661
|
if (!(hit == null ? void 0 : hit.resolvedFromParagraph)) {
|
|
50995
|
-
(
|
|
50662
|
+
(_b = deps.logger) == null ? void 0 : _b.debug("text-drag:hit-miss", {
|
|
50996
50663
|
x: event.clientX,
|
|
50997
50664
|
y: event.clientY
|
|
50998
50665
|
});
|
|
@@ -51020,8 +50687,8 @@ function createEditorTextDragImpl(deps) {
|
|
|
51020
50687
|
setCaretViewport(hit.caretViewport ?? null);
|
|
51021
50688
|
};
|
|
51022
50689
|
const handleWindowMouseUp = (event) => {
|
|
51023
|
-
var
|
|
51024
|
-
(
|
|
50690
|
+
var _a, _b, _c;
|
|
50691
|
+
(_a = deps.logger) == null ? void 0 : _a.info("text-drag:mouseup", {
|
|
51025
50692
|
x: event.clientX,
|
|
51026
50693
|
y: event.clientY,
|
|
51027
50694
|
dragging: dragging(),
|
|
@@ -51042,7 +50709,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
51042
50709
|
mergeKey: copy ? MERGE_KEYS.copyTextByDrag : MERGE_KEYS.moveTextByDrag
|
|
51043
50710
|
}
|
|
51044
50711
|
);
|
|
51045
|
-
(
|
|
50712
|
+
(_b = deps.logger) == null ? void 0 : _b.info("text-drag:apply", {
|
|
51046
50713
|
mode: copy ? "copy" : "move",
|
|
51047
50714
|
destination: `${destination.paragraphId}:${destination.runId}[${destination.offset}]`
|
|
51048
50715
|
});
|
|
@@ -51068,9 +50735,9 @@ function createEditorTextDragImpl(deps) {
|
|
|
51068
50735
|
deps.focusInputAfterPointerSelection();
|
|
51069
50736
|
};
|
|
51070
50737
|
const tryStartTextDrag = (event, hit) => {
|
|
51071
|
-
var
|
|
50738
|
+
var _a, _b, _c;
|
|
51072
50739
|
if (deps.isReadOnly() || !(hit == null ? void 0 : hit.resolvedFromParagraph)) {
|
|
51073
|
-
(
|
|
50740
|
+
(_a = deps.logger) == null ? void 0 : _a.debug("text-drag:skip-start", {
|
|
51074
50741
|
reason: deps.isReadOnly() ? "readonly" : "no-hit",
|
|
51075
50742
|
x: event.clientX,
|
|
51076
50743
|
y: event.clientY
|
|
@@ -51079,7 +50746,7 @@ function createEditorTextDragImpl(deps) {
|
|
|
51079
50746
|
}
|
|
51080
50747
|
const current = deps.state();
|
|
51081
50748
|
if (!isPositionInsideSelection(current, hit.position)) {
|
|
51082
|
-
(
|
|
50749
|
+
(_b = deps.logger) == null ? void 0 : _b.debug("text-drag:skip-start", {
|
|
51083
50750
|
reason: "outside-selection",
|
|
51084
50751
|
x: event.clientX,
|
|
51085
50752
|
y: event.clientY,
|
|
@@ -51218,7 +50885,7 @@ function createEditorNavigationImpl(deps) {
|
|
|
51218
50885
|
return moveVerticalSelection(direction, false);
|
|
51219
50886
|
};
|
|
51220
50887
|
const moveVerticalSelection = (direction, extend) => {
|
|
51221
|
-
var
|
|
50888
|
+
var _a, _b, _c, _d, _e, _f;
|
|
51222
50889
|
const state = deps.state();
|
|
51223
50890
|
const paragraphs = getParagraphs(state);
|
|
51224
50891
|
const currentIndex = paragraphs.findIndex(
|
|
@@ -51235,7 +50902,7 @@ function createEditorNavigationImpl(deps) {
|
|
|
51235
50902
|
surface: surfaceRef,
|
|
51236
50903
|
state,
|
|
51237
50904
|
documentLayout: deps.documentLayout(),
|
|
51238
|
-
zoomFactor: (
|
|
50905
|
+
zoomFactor: (_a = deps.zoomFactor) == null ? void 0 : _a.call(deps)
|
|
51239
50906
|
}) : null;
|
|
51240
50907
|
let targetIndex = currentIndex + direction;
|
|
51241
50908
|
const tableLocation = findParagraphTableLocation(
|
|
@@ -51268,18 +50935,18 @@ function createEditorNavigationImpl(deps) {
|
|
|
51268
50935
|
}
|
|
51269
50936
|
const scoredCandidates = rowCandidates.map(
|
|
51270
50937
|
(entry) => {
|
|
51271
|
-
var
|
|
51272
|
-
const paragraphId = (
|
|
51273
|
-
const cellRect = paragraphId ? (
|
|
50938
|
+
var _a2, _b2;
|
|
50939
|
+
const paragraphId = (_a2 = entry.cell.blocks[0]) == null ? void 0 : _a2.id;
|
|
50940
|
+
const cellRect = paragraphId ? (_b2 = snapshot == null ? void 0 : snapshot.paragraphs.find(
|
|
51274
50941
|
(paragraph) => paragraph.paragraphId === paragraphId && paragraph.tableCell && paragraph.tableCell.tableId === block.id
|
|
51275
|
-
)) == null ? void 0 :
|
|
50942
|
+
)) == null ? void 0 : _b2.tableCell : null;
|
|
51276
50943
|
const left = (cellRect == null ? void 0 : cellRect.left) ?? desiredX;
|
|
51277
50944
|
const right = cellRect ? cellRect.left + cellRect.width : desiredX;
|
|
51278
50945
|
const distance = desiredX < left ? left - desiredX : desiredX > right ? desiredX - right : 0;
|
|
51279
50946
|
return { entry, distance };
|
|
51280
50947
|
}
|
|
51281
50948
|
).sort((left, right) => left.distance - right.distance);
|
|
51282
|
-
const candidate = (
|
|
50949
|
+
const candidate = (_b = scoredCandidates[0]) == null ? void 0 : _b.entry;
|
|
51283
50950
|
if (!candidate) {
|
|
51284
50951
|
continue;
|
|
51285
50952
|
}
|
|
@@ -51351,12 +51018,12 @@ function createEditorRevisionController(deps) {
|
|
|
51351
51018
|
function createEditorRevisionControllerImpl(deps) {
|
|
51352
51019
|
const [hoveredRevision, setHoveredRevision] = createSignal(null);
|
|
51353
51020
|
const handleRevisionMouseEnter = (revisionId, event) => {
|
|
51354
|
-
var
|
|
51021
|
+
var _a, _b, _c;
|
|
51355
51022
|
const paragraphs = getParagraphs(deps.state());
|
|
51356
51023
|
let foundRevision;
|
|
51357
51024
|
for (const p of paragraphs) {
|
|
51358
51025
|
for (const run of p.runs) {
|
|
51359
|
-
if (((
|
|
51026
|
+
if (((_a = run.revision) == null ? void 0 : _a.id) === revisionId) {
|
|
51360
51027
|
foundRevision = run.revision;
|
|
51361
51028
|
break;
|
|
51362
51029
|
}
|
|
@@ -51364,10 +51031,10 @@ function createEditorRevisionControllerImpl(deps) {
|
|
|
51364
51031
|
if (foundRevision) break;
|
|
51365
51032
|
}
|
|
51366
51033
|
const findInBlocks = (blocks) => {
|
|
51367
|
-
var
|
|
51034
|
+
var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
51368
51035
|
for (const block of blocks) {
|
|
51369
51036
|
if (block.type === "paragraph") continue;
|
|
51370
|
-
if (((
|
|
51037
|
+
if (((_b2 = (_a2 = block.style) == null ? void 0 : _a2.revision) == null ? void 0 : _b2.id) === revisionId) {
|
|
51371
51038
|
return block.style.revision;
|
|
51372
51039
|
}
|
|
51373
51040
|
if (((_c2 = block.gridRevision) == null ? void 0 : _c2.id) === revisionId) return block.gridRevision;
|
|
@@ -51410,7 +51077,7 @@ function createEditorRevisionControllerImpl(deps) {
|
|
|
51410
51077
|
}
|
|
51411
51078
|
if (!foundRevision) return;
|
|
51412
51079
|
const rect = event.currentTarget.getBoundingClientRect();
|
|
51413
|
-
const surfaceRect = (
|
|
51080
|
+
const surfaceRect = (_b = deps.surfaceRef()) == null ? void 0 : _b.getBoundingClientRect();
|
|
51414
51081
|
if (!surfaceRect) return;
|
|
51415
51082
|
const z = ((_c = deps.zoomFactor) == null ? void 0 : _c.call(deps)) ?? 1;
|
|
51416
51083
|
setHoveredRevision({
|
|
@@ -51604,8 +51271,8 @@ function createEditorInteractionRuntimeImpl(deps) {
|
|
|
51604
51271
|
logger
|
|
51605
51272
|
});
|
|
51606
51273
|
const resolvePositionAtSurfacePoint = (clientX, clientY) => {
|
|
51607
|
-
var
|
|
51608
|
-
return ((
|
|
51274
|
+
var _a;
|
|
51275
|
+
return ((_a = resolveSurfaceHitAtPoint(clientX, clientY)) == null ? void 0 : _a.position) ?? null;
|
|
51609
51276
|
};
|
|
51610
51277
|
const imageOps = createEditorImageOperations({
|
|
51611
51278
|
state,
|
|
@@ -51704,10 +51371,10 @@ function ensureFootnotes(footnotes) {
|
|
|
51704
51371
|
return { items: {} };
|
|
51705
51372
|
}
|
|
51706
51373
|
function nextAutoMarker(document2) {
|
|
51707
|
-
var
|
|
51374
|
+
var _a, _b;
|
|
51708
51375
|
const footnotes = document2.footnotes;
|
|
51709
|
-
const format = ((
|
|
51710
|
-
const startAt = ((
|
|
51376
|
+
const format = ((_a = footnotes == null ? void 0 : footnotes.settings) == null ? void 0 : _a.numberFormat) ?? "decimal";
|
|
51377
|
+
const startAt = ((_b = footnotes == null ? void 0 : footnotes.settings) == null ? void 0 : _b.startAt) ?? 1;
|
|
51711
51378
|
let autoCount = startAt - 1;
|
|
51712
51379
|
const seen = /* @__PURE__ */ new Set();
|
|
51713
51380
|
for (const { run } of iterateFootnoteReferenceRuns(document2)) {
|
|
@@ -51782,10 +51449,10 @@ function toggleTrackChanges(state) {
|
|
|
51782
51449
|
}
|
|
51783
51450
|
function transformTableRevisionBlocks(blocks, revisionId, accept) {
|
|
51784
51451
|
return blocks.flatMap((block) => {
|
|
51785
|
-
var
|
|
51452
|
+
var _a;
|
|
51786
51453
|
if (block.type === "paragraph") return [block];
|
|
51787
51454
|
let style2 = block.style;
|
|
51788
|
-
if (((
|
|
51455
|
+
if (((_a = style2 == null ? void 0 : style2.revision) == null ? void 0 : _a.id) === revisionId) {
|
|
51789
51456
|
if (accept) {
|
|
51790
51457
|
const { revision: _revision, ...current } = style2;
|
|
51791
51458
|
style2 = current;
|
|
@@ -51829,8 +51496,8 @@ function transformTableRevisionBlocks(blocks, revisionId, accept) {
|
|
|
51829
51496
|
}
|
|
51830
51497
|
}
|
|
51831
51498
|
const rows = sourceRows.flatMap((row) => {
|
|
51832
|
-
var
|
|
51833
|
-
if (((
|
|
51499
|
+
var _a2, _b, _c, _d;
|
|
51500
|
+
if (((_b = (_a2 = row.style) == null ? void 0 : _a2.revision) == null ? void 0 : _b.id) === revisionId) {
|
|
51834
51501
|
const remove = accept && row.style.revision.type === "delete" || !accept && row.style.revision.type === "insert";
|
|
51835
51502
|
if (remove) return [];
|
|
51836
51503
|
}
|
|
@@ -51851,8 +51518,8 @@ function transformTableRevisionBlocks(blocks, revisionId, accept) {
|
|
|
51851
51518
|
rowStyle = current;
|
|
51852
51519
|
}
|
|
51853
51520
|
const cells = row.cells.flatMap((cell) => {
|
|
51854
|
-
var
|
|
51855
|
-
if (((
|
|
51521
|
+
var _a3, _b2, _c2, _d2, _e;
|
|
51522
|
+
if (((_b2 = (_a3 = cell.style) == null ? void 0 : _a3.revision) == null ? void 0 : _b2.id) === revisionId) {
|
|
51856
51523
|
const remove = accept && cell.style.revision.type === "delete" || !accept && cell.style.revision.type === "insert";
|
|
51857
51524
|
if (remove) return [];
|
|
51858
51525
|
}
|
|
@@ -51927,12 +51594,12 @@ function acceptRevision(state, revisionId) {
|
|
|
51927
51594
|
const nextParagraphs = paragraphs.map((paragraph) => {
|
|
51928
51595
|
const nextRuns = paragraph.runs.filter(
|
|
51929
51596
|
(run) => {
|
|
51930
|
-
var
|
|
51931
|
-
return !(((
|
|
51597
|
+
var _a;
|
|
51598
|
+
return !(((_a = run.revision) == null ? void 0 : _a.id) === revisionId && run.revision.type === "delete");
|
|
51932
51599
|
}
|
|
51933
51600
|
).map((run) => {
|
|
51934
|
-
var
|
|
51935
|
-
if (((
|
|
51601
|
+
var _a;
|
|
51602
|
+
if (((_a = run.revision) == null ? void 0 : _a.id) === revisionId && run.revision.type === "insert") {
|
|
51936
51603
|
const nextRun = { ...run };
|
|
51937
51604
|
delete nextRun.revision;
|
|
51938
51605
|
return nextRun;
|
|
@@ -51959,12 +51626,12 @@ function rejectRevision(state, revisionId) {
|
|
|
51959
51626
|
const nextParagraphs = paragraphs.map((paragraph) => {
|
|
51960
51627
|
const nextRuns = paragraph.runs.filter(
|
|
51961
51628
|
(run) => {
|
|
51962
|
-
var
|
|
51963
|
-
return !(((
|
|
51629
|
+
var _a;
|
|
51630
|
+
return !(((_a = run.revision) == null ? void 0 : _a.id) === revisionId && run.revision.type === "insert");
|
|
51964
51631
|
}
|
|
51965
51632
|
).map((run) => {
|
|
51966
|
-
var
|
|
51967
|
-
if (((
|
|
51633
|
+
var _a;
|
|
51634
|
+
if (((_a = run.revision) == null ? void 0 : _a.id) === revisionId && run.revision.type === "delete") {
|
|
51968
51635
|
const nextRun = { ...run };
|
|
51969
51636
|
delete nextRun.revision;
|
|
51970
51637
|
return nextRun;
|
|
@@ -51987,7 +51654,7 @@ function rejectRevision(state, revisionId) {
|
|
|
51987
51654
|
return transformTableRevision(textState, revisionId, false);
|
|
51988
51655
|
}
|
|
51989
51656
|
function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
|
|
51990
|
-
var
|
|
51657
|
+
var _a, _b, _c, _d, _e;
|
|
51991
51658
|
for (const block of blocks) {
|
|
51992
51659
|
if (block.type === "paragraph") continue;
|
|
51993
51660
|
const tableSelected = block.rows.some(
|
|
@@ -51998,7 +51665,7 @@ function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
|
|
|
51998
51665
|
)
|
|
51999
51666
|
);
|
|
52000
51667
|
if (tableSelected) {
|
|
52001
|
-
if ((
|
|
51668
|
+
if ((_a = block.style) == null ? void 0 : _a.revision) revisionIds.add(block.style.revision.id);
|
|
52002
51669
|
if (block.gridRevision) revisionIds.add(block.gridRevision.id);
|
|
52003
51670
|
}
|
|
52004
51671
|
for (const row of block.rows) {
|
|
@@ -52008,7 +51675,7 @@ function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
|
|
|
52008
51675
|
)
|
|
52009
51676
|
);
|
|
52010
51677
|
if (selectedCells.length > 0) {
|
|
52011
|
-
if ((
|
|
51678
|
+
if ((_b = row.style) == null ? void 0 : _b.revision) revisionIds.add(row.style.revision.id);
|
|
52012
51679
|
if ((_c = row.style) == null ? void 0 : _c.propertyRevision) {
|
|
52013
51680
|
revisionIds.add(row.style.propertyRevision.id);
|
|
52014
51681
|
}
|
|
@@ -52024,7 +51691,7 @@ function collectTableRevisionIds(blocks, selectedParagraphIds, revisionIds) {
|
|
|
52024
51691
|
}
|
|
52025
51692
|
}
|
|
52026
51693
|
function acceptRevisionsInSelection(state) {
|
|
52027
|
-
var
|
|
51694
|
+
var _a;
|
|
52028
51695
|
const normalized = normalizeSelection(state);
|
|
52029
51696
|
const paragraphs = getParagraphs(state);
|
|
52030
51697
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
@@ -52034,7 +51701,7 @@ function acceptRevisionsInSelection(state) {
|
|
|
52034
51701
|
const endOffset = i === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
|
|
52035
51702
|
const runs = sliceRuns(paragraph, startOffset, endOffset);
|
|
52036
51703
|
for (const run of runs) {
|
|
52037
|
-
if ((
|
|
51704
|
+
if ((_a = run.revision) == null ? void 0 : _a.id) {
|
|
52038
51705
|
revisionIds.add(run.revision.id);
|
|
52039
51706
|
}
|
|
52040
51707
|
}
|
|
@@ -52064,7 +51731,7 @@ function acceptRevisionsInSelection(state) {
|
|
|
52064
51731
|
return nextState;
|
|
52065
51732
|
}
|
|
52066
51733
|
function rejectRevisionsInSelection(state) {
|
|
52067
|
-
var
|
|
51734
|
+
var _a;
|
|
52068
51735
|
const normalized = normalizeSelection(state);
|
|
52069
51736
|
const paragraphs = getParagraphs(state);
|
|
52070
51737
|
const revisionIds = /* @__PURE__ */ new Set();
|
|
@@ -52074,7 +51741,7 @@ function rejectRevisionsInSelection(state) {
|
|
|
52074
51741
|
const endOffset = i === normalized.endIndex ? normalized.endParagraphOffset : getParagraphLength(paragraph);
|
|
52075
51742
|
const runs = sliceRuns(paragraph, startOffset, endOffset);
|
|
52076
51743
|
for (const run of runs) {
|
|
52077
|
-
if ((
|
|
51744
|
+
if ((_a = run.revision) == null ? void 0 : _a.id) {
|
|
52078
51745
|
revisionIds.add(run.revision.id);
|
|
52079
51746
|
}
|
|
52080
51747
|
}
|
|
@@ -52104,7 +51771,7 @@ function rejectRevisionsInSelection(state) {
|
|
|
52104
51771
|
return nextState;
|
|
52105
51772
|
}
|
|
52106
51773
|
function getLinkAtSelection(state) {
|
|
52107
|
-
var
|
|
51774
|
+
var _a, _b, _c;
|
|
52108
51775
|
const normalized = normalizeSelection(state);
|
|
52109
51776
|
const paragraphs = getParagraphs(state);
|
|
52110
51777
|
if (normalized.isCollapsed) {
|
|
@@ -52112,7 +51779,7 @@ function getLinkAtSelection(state) {
|
|
|
52112
51779
|
if (!paragraph) {
|
|
52113
51780
|
return null;
|
|
52114
51781
|
}
|
|
52115
|
-
return ((
|
|
51782
|
+
return ((_a = expandLinkRangeInParagraph(paragraph, normalized.startParagraphOffset)) == null ? void 0 : _a.href) ?? null;
|
|
52116
51783
|
}
|
|
52117
51784
|
const touchedRuns = paragraphs.slice(normalized.startIndex, normalized.endIndex + 1).flatMap((paragraph, relativeIndex) => {
|
|
52118
51785
|
const paragraphIndex = normalized.startIndex + relativeIndex;
|
|
@@ -52123,13 +51790,13 @@ function getLinkAtSelection(state) {
|
|
|
52123
51790
|
if (touchedRuns.length === 0) {
|
|
52124
51791
|
return null;
|
|
52125
51792
|
}
|
|
52126
|
-
const href = (_c = (
|
|
51793
|
+
const href = (_c = (_b = touchedRuns[0]) == null ? void 0 : _b.styles) == null ? void 0 : _c.link;
|
|
52127
51794
|
if (!href) {
|
|
52128
51795
|
return null;
|
|
52129
51796
|
}
|
|
52130
51797
|
return touchedRuns.every((run) => {
|
|
52131
|
-
var
|
|
52132
|
-
return ((
|
|
51798
|
+
var _a2;
|
|
51799
|
+
return ((_a2 = run.styles) == null ? void 0 : _a2.link) === href;
|
|
52133
51800
|
}) ? href : null;
|
|
52134
51801
|
}
|
|
52135
51802
|
function setLinkAtSelection(state, href) {
|
|
@@ -52279,13 +51946,13 @@ function toggleParagraphList(state, kind) {
|
|
|
52279
51946
|
const targetedParagraphs = paragraphs.slice(startIndex, endIndex + 1);
|
|
52280
51947
|
const shouldClear = targetedParagraphs.length > 0 && targetedParagraphs.every(
|
|
52281
51948
|
(paragraph) => {
|
|
52282
|
-
var
|
|
52283
|
-
return ((
|
|
51949
|
+
var _a;
|
|
51950
|
+
return ((_a = paragraph.list) == null ? void 0 : _a.kind) === kind;
|
|
52284
51951
|
}
|
|
52285
51952
|
);
|
|
52286
51953
|
const nextParagraphs = paragraphs.map(
|
|
52287
51954
|
(paragraph, paragraphIndex) => {
|
|
52288
|
-
var
|
|
51955
|
+
var _a, _b, _c;
|
|
52289
51956
|
if (paragraphIndex < startIndex || paragraphIndex > endIndex) {
|
|
52290
51957
|
return cloneParagraph(paragraph);
|
|
52291
51958
|
}
|
|
@@ -52296,8 +51963,8 @@ function toggleParagraphList(state, kind) {
|
|
|
52296
51963
|
}
|
|
52297
51964
|
nextParagraph.list = {
|
|
52298
51965
|
kind,
|
|
52299
|
-
level: ((
|
|
52300
|
-
format: (
|
|
51966
|
+
level: ((_a = paragraph.list) == null ? void 0 : _a.level) ?? 0,
|
|
51967
|
+
format: (_b = paragraph.list) == null ? void 0 : _b.format,
|
|
52301
51968
|
startAt: (_c = paragraph.list) == null ? void 0 : _c.startAt
|
|
52302
51969
|
};
|
|
52303
51970
|
return nextParagraph;
|
|
@@ -52646,12 +52313,12 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
52646
52313
|
);
|
|
52647
52314
|
};
|
|
52648
52315
|
const promptForImageAlt = () => {
|
|
52649
|
-
var
|
|
52316
|
+
var _a;
|
|
52650
52317
|
const run = selectedImageRun();
|
|
52651
52318
|
if (!run) {
|
|
52652
52319
|
return;
|
|
52653
52320
|
}
|
|
52654
|
-
const currentAlt = ((
|
|
52321
|
+
const currentAlt = ((_a = getRunImage(run.run)) == null ? void 0 : _a.alt) ?? "";
|
|
52655
52322
|
deps.openImageAltDialog(currentAlt);
|
|
52656
52323
|
};
|
|
52657
52324
|
const applyImageCaptionCommand = (caption) => {
|
|
@@ -52701,6 +52368,14 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
52701
52368
|
(current) => applySelectedImageCropAspect(current, mode)
|
|
52702
52369
|
);
|
|
52703
52370
|
};
|
|
52371
|
+
const applyImageBorderCommand = (patch) => {
|
|
52372
|
+
if (!selectedImageRun()) {
|
|
52373
|
+
return;
|
|
52374
|
+
}
|
|
52375
|
+
execTransactional(
|
|
52376
|
+
(current) => setSelectedImageBorder(current, patch)
|
|
52377
|
+
);
|
|
52378
|
+
};
|
|
52704
52379
|
return {
|
|
52705
52380
|
applyBooleanStyleCommand,
|
|
52706
52381
|
applyValueStyleCommand,
|
|
@@ -52732,6 +52407,7 @@ function createEditorCommandsControllerImpl(deps) {
|
|
|
52732
52407
|
applyImageWidthCmCommand,
|
|
52733
52408
|
applyImageHeightCmCommand,
|
|
52734
52409
|
applyImageCropAspectCommand,
|
|
52410
|
+
applyImageBorderCommand,
|
|
52735
52411
|
handleListTab,
|
|
52736
52412
|
handleListEnter,
|
|
52737
52413
|
handleListBoundaryBackspace
|
|
@@ -52780,13 +52456,13 @@ class EditorCommandRegistry {
|
|
|
52780
52456
|
return Array.from(this.bindings.values());
|
|
52781
52457
|
}
|
|
52782
52458
|
execute(event, deps, commandExecutor) {
|
|
52783
|
-
var
|
|
52459
|
+
var _a;
|
|
52784
52460
|
const isCtrlOrMeta = event.ctrlKey || event.metaKey;
|
|
52785
52461
|
const lowerKey = event.key.toLowerCase();
|
|
52786
52462
|
for (const binding of this.bindings.values()) {
|
|
52787
52463
|
if (binding.key.toLowerCase() === lowerKey && Boolean(binding.ctrlOrMeta) === isCtrlOrMeta && Boolean(binding.shift) === event.shiftKey && Boolean(binding.alt) === event.altKey) {
|
|
52788
52464
|
if (binding.command && commandExecutor) {
|
|
52789
|
-
const canExecute = ((
|
|
52465
|
+
const canExecute = ((_a = commandExecutor.canExecuteCommand) == null ? void 0 : _a.call(commandExecutor, binding.command)) ?? true;
|
|
52790
52466
|
if (canExecute) {
|
|
52791
52467
|
commandExecutor.executeCommand(binding.command);
|
|
52792
52468
|
event.preventDefault();
|
|
@@ -53060,12 +52736,12 @@ function createEditorKeyboardControllerImpl(deps) {
|
|
|
53060
52736
|
}
|
|
53061
52737
|
const commandExecutor = deps.executeCommand ? {
|
|
53062
52738
|
executeCommand: (commandName, payload) => {
|
|
53063
|
-
var
|
|
53064
|
-
return (
|
|
52739
|
+
var _a;
|
|
52740
|
+
return (_a = deps.executeCommand) == null ? void 0 : _a.call(deps, commandName, payload);
|
|
53065
52741
|
},
|
|
53066
52742
|
canExecuteCommand: (commandName, payload) => {
|
|
53067
|
-
var
|
|
53068
|
-
return (
|
|
52743
|
+
var _a;
|
|
52744
|
+
return (_a = deps.canExecuteCommand) == null ? void 0 : _a.call(deps, commandName, payload);
|
|
53069
52745
|
}
|
|
53070
52746
|
} : void 0;
|
|
53071
52747
|
if (registry.execute(event, deps, commandExecutor)) {
|
|
@@ -53750,10 +53426,10 @@ function buildDocumentAndBrowserCommands({
|
|
|
53750
53426
|
"imageWidthCm",
|
|
53751
53427
|
(p) => image.setWidthCm(Number(p)),
|
|
53752
53428
|
() => {
|
|
53753
|
-
var
|
|
53429
|
+
var _a;
|
|
53754
53430
|
return {
|
|
53755
53431
|
isEnabled: image.isSelected(),
|
|
53756
|
-
value: ((
|
|
53432
|
+
value: ((_a = image.getSizeCm()) == null ? void 0 : _a.width) ?? null
|
|
53757
53433
|
};
|
|
53758
53434
|
}
|
|
53759
53435
|
),
|
|
@@ -53761,10 +53437,10 @@ function buildDocumentAndBrowserCommands({
|
|
|
53761
53437
|
"imageHeightCm",
|
|
53762
53438
|
(p) => image.setHeightCm(Number(p)),
|
|
53763
53439
|
() => {
|
|
53764
|
-
var
|
|
53440
|
+
var _a;
|
|
53765
53441
|
return {
|
|
53766
53442
|
isEnabled: image.isSelected(),
|
|
53767
|
-
value: ((
|
|
53443
|
+
value: ((_a = image.getSizeCm()) == null ? void 0 : _a.height) ?? null
|
|
53768
53444
|
};
|
|
53769
53445
|
}
|
|
53770
53446
|
),
|
|
@@ -53782,6 +53458,14 @@ function buildDocumentAndBrowserCommands({
|
|
|
53782
53458
|
() => ({
|
|
53783
53459
|
isEnabled: image.isSelected()
|
|
53784
53460
|
})
|
|
53461
|
+
),
|
|
53462
|
+
imageBorder: actionCommand(
|
|
53463
|
+
"imageBorder",
|
|
53464
|
+
(p) => image.setBorder(p),
|
|
53465
|
+
() => ({
|
|
53466
|
+
isEnabled: image.isSelected(),
|
|
53467
|
+
value: image.getBorder()
|
|
53468
|
+
})
|
|
53785
53469
|
)
|
|
53786
53470
|
};
|
|
53787
53471
|
}
|
|
@@ -53989,6 +53673,28 @@ function buildTableCommands({
|
|
|
53989
53673
|
"tableCellNoBorders",
|
|
53990
53674
|
() => table.cellNoBorders()
|
|
53991
53675
|
),
|
|
53676
|
+
tableApplyBorderPreset: actionCommand(
|
|
53677
|
+
"tableApplyBorderPreset",
|
|
53678
|
+
(p) => table.applyBorderPreset(
|
|
53679
|
+
p
|
|
53680
|
+
)
|
|
53681
|
+
),
|
|
53682
|
+
toggleTableDrawBorders: actionCommand(
|
|
53683
|
+
"toggleTableDrawBorders",
|
|
53684
|
+
() => table.toggleDrawingBorders(),
|
|
53685
|
+
() => ({
|
|
53686
|
+
isEnabled: table.insideTable(),
|
|
53687
|
+
isActive: table.isDrawingBorders()
|
|
53688
|
+
})
|
|
53689
|
+
),
|
|
53690
|
+
toggleTableGridlines: actionCommand(
|
|
53691
|
+
"toggleTableGridlines",
|
|
53692
|
+
() => table.toggleGridlines(),
|
|
53693
|
+
() => ({
|
|
53694
|
+
isEnabled: table.insideTable(),
|
|
53695
|
+
isActive: table.isShowingGridlines()
|
|
53696
|
+
})
|
|
53697
|
+
),
|
|
53992
53698
|
tableWidth100: actionCommand("tableWidth100", () => table.width100()),
|
|
53993
53699
|
tableAlignLeft: actionCommand(
|
|
53994
53700
|
"tableAlignLeft",
|
|
@@ -54010,10 +53716,10 @@ function buildTableCommands({
|
|
|
54010
53716
|
"tableToggleHeaderRow",
|
|
54011
53717
|
() => table.toggleTblLook("firstRow"),
|
|
54012
53718
|
() => {
|
|
54013
|
-
var
|
|
53719
|
+
var _a;
|
|
54014
53720
|
return {
|
|
54015
53721
|
isEnabled: table.insideTable(),
|
|
54016
|
-
isActive: ((
|
|
53722
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.firstRow) ?? false
|
|
54017
53723
|
};
|
|
54018
53724
|
}
|
|
54019
53725
|
),
|
|
@@ -54021,10 +53727,10 @@ function buildTableCommands({
|
|
|
54021
53727
|
"tableToggleTotalRow",
|
|
54022
53728
|
() => table.toggleTblLook("lastRow"),
|
|
54023
53729
|
() => {
|
|
54024
|
-
var
|
|
53730
|
+
var _a;
|
|
54025
53731
|
return {
|
|
54026
53732
|
isEnabled: table.insideTable(),
|
|
54027
|
-
isActive: ((
|
|
53733
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.lastRow) ?? false
|
|
54028
53734
|
};
|
|
54029
53735
|
}
|
|
54030
53736
|
),
|
|
@@ -54032,10 +53738,10 @@ function buildTableCommands({
|
|
|
54032
53738
|
"tableToggleBandedRows",
|
|
54033
53739
|
() => table.toggleTblLook("bandedRows"),
|
|
54034
53740
|
() => {
|
|
54035
|
-
var
|
|
53741
|
+
var _a;
|
|
54036
53742
|
return {
|
|
54037
53743
|
isEnabled: table.insideTable(),
|
|
54038
|
-
isActive: ((
|
|
53744
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.bandedRows) ?? false
|
|
54039
53745
|
};
|
|
54040
53746
|
}
|
|
54041
53747
|
),
|
|
@@ -54043,10 +53749,10 @@ function buildTableCommands({
|
|
|
54043
53749
|
"tableToggleFirstColumn",
|
|
54044
53750
|
() => table.toggleTblLook("firstCol"),
|
|
54045
53751
|
() => {
|
|
54046
|
-
var
|
|
53752
|
+
var _a;
|
|
54047
53753
|
return {
|
|
54048
53754
|
isEnabled: table.insideTable(),
|
|
54049
|
-
isActive: ((
|
|
53755
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.firstCol) ?? false
|
|
54050
53756
|
};
|
|
54051
53757
|
}
|
|
54052
53758
|
),
|
|
@@ -54054,10 +53760,10 @@ function buildTableCommands({
|
|
|
54054
53760
|
"tableToggleLastColumn",
|
|
54055
53761
|
() => table.toggleTblLook("lastCol"),
|
|
54056
53762
|
() => {
|
|
54057
|
-
var
|
|
53763
|
+
var _a;
|
|
54058
53764
|
return {
|
|
54059
53765
|
isEnabled: table.insideTable(),
|
|
54060
|
-
isActive: ((
|
|
53766
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.lastCol) ?? false
|
|
54061
53767
|
};
|
|
54062
53768
|
}
|
|
54063
53769
|
),
|
|
@@ -54065,10 +53771,10 @@ function buildTableCommands({
|
|
|
54065
53771
|
"tableToggleBandedColumns",
|
|
54066
53772
|
() => table.toggleTblLook("bandedCols"),
|
|
54067
53773
|
() => {
|
|
54068
|
-
var
|
|
53774
|
+
var _a;
|
|
54069
53775
|
return {
|
|
54070
53776
|
isEnabled: table.insideTable(),
|
|
54071
|
-
isActive: ((
|
|
53777
|
+
isActive: ((_a = table.getTblLook()) == null ? void 0 : _a.bandedCols) ?? false
|
|
54072
53778
|
};
|
|
54073
53779
|
}
|
|
54074
53780
|
),
|
|
@@ -54180,10 +53886,10 @@ const DEFAULT_TOC_MAX_LEVEL = 3;
|
|
|
54180
53886
|
const TOC_INSTRUCTION = ' TOC \\o "1-3" \\h \\z \\u ';
|
|
54181
53887
|
const twipsToPx = (twips) => Math.round(twips / TWIPS_PER_INCH * PX_PER_INCH);
|
|
54182
53888
|
function collectTocHeadings(state, maxLevel = DEFAULT_TOC_MAX_LEVEL) {
|
|
54183
|
-
var
|
|
53889
|
+
var _a;
|
|
54184
53890
|
const headings = [];
|
|
54185
53891
|
for (const paragraph of getDocumentParagraphs(state.document)) {
|
|
54186
|
-
const level = getHeadingLevel((
|
|
53892
|
+
const level = getHeadingLevel((_a = paragraph.style) == null ? void 0 : _a.styleId);
|
|
54187
53893
|
if (level === null || level > maxLevel) continue;
|
|
54188
53894
|
const text = getParagraphText(paragraph).trim();
|
|
54189
53895
|
if (!text) continue;
|
|
@@ -54543,19 +54249,24 @@ function insertShapeAtSelection(state, preset) {
|
|
|
54543
54249
|
function buildEssentialsDocument(options) {
|
|
54544
54250
|
return {
|
|
54545
54251
|
documentStyles: () => {
|
|
54546
|
-
var
|
|
54252
|
+
var _a, _b;
|
|
54547
54253
|
const document2 = options.state().document;
|
|
54548
54254
|
const styles = (document2 == null ? void 0 : document2.styles) ?? {};
|
|
54549
54255
|
const usedStyleIds = /* @__PURE__ */ new Set();
|
|
54550
54256
|
for (const paragraph of getDocumentParagraphs(document2)) {
|
|
54551
|
-
if ((
|
|
54257
|
+
if ((_a = paragraph.style) == null ? void 0 : _a.styleId) usedStyleIds.add(paragraph.style.styleId);
|
|
54552
54258
|
for (const run of paragraph.runs) {
|
|
54553
|
-
if ((
|
|
54259
|
+
if ((_b = run.styles) == null ? void 0 : _b.styleId) usedStyleIds.add(run.styles.styleId);
|
|
54554
54260
|
}
|
|
54555
54261
|
}
|
|
54556
54262
|
return Object.values(styles).map((style2) => {
|
|
54557
|
-
var
|
|
54263
|
+
var _a2, _b2, _c, _d, _e, _f, _g;
|
|
54558
54264
|
const preview = resolveNamedTextStyle(style2.id, styles);
|
|
54265
|
+
const tableStyle = style2.type === "table" ? resolveNamedTableStyle(style2.id, styles).tableStyle : void 0;
|
|
54266
|
+
const whole = (_a2 = tableStyle == null ? void 0 : tableStyle.conditionalFormats) == null ? void 0 : _a2.wholeTable;
|
|
54267
|
+
const header = (_b2 = tableStyle == null ? void 0 : tableStyle.conditionalFormats) == null ? void 0 : _b2.firstRow;
|
|
54268
|
+
const band = (_c = tableStyle == null ? void 0 : tableStyle.conditionalFormats) == null ? void 0 : _c.band1Horz;
|
|
54269
|
+
const border = ((_d = whole == null ? void 0 : whole.borders) == null ? void 0 : _d.borderBottom) ?? ((_e = tableStyle == null ? void 0 : tableStyle.borders) == null ? void 0 : _e.borderBottom);
|
|
54559
54270
|
return {
|
|
54560
54271
|
id: style2.id,
|
|
54561
54272
|
name: style2.name,
|
|
@@ -54565,23 +54276,30 @@ function buildEssentialsDocument(options) {
|
|
|
54565
54276
|
semiHidden: style2.semiHidden,
|
|
54566
54277
|
unhideWhenUsed: style2.unhideWhenUsed,
|
|
54567
54278
|
isUsed: usedStyleIds.has(style2.id),
|
|
54568
|
-
fontFamily: ((
|
|
54279
|
+
fontFamily: ((_f = preview.fontFamily) == null ? void 0 : _f.trim()) || void 0,
|
|
54569
54280
|
fontSize: typeof preview.fontSize === "number" ? preview.fontSize : void 0,
|
|
54570
54281
|
color: preview.color ?? void 0,
|
|
54571
54282
|
bold: preview.bold ?? void 0,
|
|
54572
|
-
italic: preview.italic ?? void 0
|
|
54283
|
+
italic: preview.italic ?? void 0,
|
|
54284
|
+
tablePreview: tableStyle ? {
|
|
54285
|
+
wholeFill: whole == null ? void 0 : whole.shading,
|
|
54286
|
+
headerFill: header == null ? void 0 : header.shading,
|
|
54287
|
+
bandFill: band == null ? void 0 : band.shading,
|
|
54288
|
+
borderColor: border == null ? void 0 : border.color,
|
|
54289
|
+
headerColor: ((_g = header == null ? void 0 : header.textStyle) == null ? void 0 : _g.color) ?? void 0
|
|
54290
|
+
} : void 0
|
|
54573
54291
|
};
|
|
54574
54292
|
});
|
|
54575
54293
|
},
|
|
54576
54294
|
exportDocx: () => void options.docIO.handleExportDocx(),
|
|
54577
54295
|
exportPdf: () => void options.docIO.handleExportPdf(),
|
|
54578
54296
|
importDocument: () => {
|
|
54579
|
-
var
|
|
54580
|
-
return (
|
|
54297
|
+
var _a;
|
|
54298
|
+
return (_a = options.importInputRef()) == null ? void 0 : _a.click();
|
|
54581
54299
|
},
|
|
54582
54300
|
insertImage: () => {
|
|
54583
|
-
var
|
|
54584
|
-
return (
|
|
54301
|
+
var _a;
|
|
54302
|
+
return (_a = options.imageInputRef()) == null ? void 0 : _a.click();
|
|
54585
54303
|
},
|
|
54586
54304
|
insertShape: (preset) => options.applyTransactionalState(
|
|
54587
54305
|
(current) => insertShapeAtSelection(current, preset)
|
|
@@ -54605,7 +54323,9 @@ function buildEssentialsImage(options) {
|
|
|
54605
54323
|
setHeightCm: (cm) => options.commandsController.applyImageHeightCmCommand(cm),
|
|
54606
54324
|
isCropActive: () => options.imageCropMode.isActive(),
|
|
54607
54325
|
toggleCrop: () => options.imageCropMode.toggle(),
|
|
54608
|
-
applyCropAspect: (preset) => options.commandsController.applyImageCropAspectCommand(preset)
|
|
54326
|
+
applyCropAspect: (preset) => options.commandsController.applyImageCropAspectCommand(preset),
|
|
54327
|
+
getBorder: () => getSelectedImageBorder(options.state()),
|
|
54328
|
+
setBorder: (patch) => options.commandsController.applyImageBorderCommand(patch)
|
|
54609
54329
|
};
|
|
54610
54330
|
}
|
|
54611
54331
|
function buildEssentialsBrowser() {
|
|
@@ -54695,15 +54415,15 @@ function buildEssentialsParagraph(options) {
|
|
|
54695
54415
|
function buildEssentialsSection(options) {
|
|
54696
54416
|
const section = {
|
|
54697
54417
|
isLandscape: () => {
|
|
54698
|
-
var
|
|
54418
|
+
var _a, _b;
|
|
54699
54419
|
const idx = getActiveSectionIndex(options.state());
|
|
54700
|
-
const target = ((
|
|
54701
|
-
return ((
|
|
54420
|
+
const target = ((_a = options.state().document.sections) == null ? void 0 : _a[idx]) ?? options.state().document;
|
|
54421
|
+
return ((_b = target == null ? void 0 : target.pageSettings) == null ? void 0 : _b.orientation) === "landscape";
|
|
54702
54422
|
},
|
|
54703
54423
|
setOrientation: (orientation) => {
|
|
54704
|
-
var
|
|
54424
|
+
var _a;
|
|
54705
54425
|
const idx = getActiveSectionIndex(options.state());
|
|
54706
|
-
const target = ((
|
|
54426
|
+
const target = ((_a = options.state().document.sections) == null ? void 0 : _a[idx]) ?? options.state().document;
|
|
54707
54427
|
if (!target) return;
|
|
54708
54428
|
options.commandsController.applyUpdateSectionSettingsCommand(idx, {
|
|
54709
54429
|
pageSettings: {
|
|
@@ -54713,25 +54433,25 @@ function buildEssentialsSection(options) {
|
|
|
54713
54433
|
});
|
|
54714
54434
|
},
|
|
54715
54435
|
toggleOrientation: () => {
|
|
54716
|
-
var
|
|
54436
|
+
var _a, _b;
|
|
54717
54437
|
const idx = getActiveSectionIndex(options.state());
|
|
54718
|
-
const target = ((
|
|
54438
|
+
const target = ((_a = options.state().document.sections) == null ? void 0 : _a[idx]) ?? options.state().document;
|
|
54719
54439
|
if (!target) return;
|
|
54720
|
-
const current = ((
|
|
54440
|
+
const current = ((_b = target.pageSettings) == null ? void 0 : _b.orientation) ?? "portrait";
|
|
54721
54441
|
section.setOrientation(current === "portrait" ? "landscape" : "portrait");
|
|
54722
54442
|
},
|
|
54723
54443
|
breakNextPage: () => options.commandsController.applyInsertSectionBreakCommand("nextPage"),
|
|
54724
54444
|
breakContinuous: () => options.commandsController.applyInsertSectionBreakCommand("continuous"),
|
|
54725
54445
|
getMargins: () => {
|
|
54726
|
-
var
|
|
54446
|
+
var _a, _b;
|
|
54727
54447
|
const idx = getActiveSectionIndex(options.state());
|
|
54728
|
-
const target = ((
|
|
54729
|
-
return (
|
|
54448
|
+
const target = ((_a = options.state().document.sections) == null ? void 0 : _a[idx]) ?? options.state().document;
|
|
54449
|
+
return (_b = target == null ? void 0 : target.pageSettings) == null ? void 0 : _b.margins;
|
|
54730
54450
|
},
|
|
54731
54451
|
setPageMargins: (margins) => {
|
|
54732
|
-
var
|
|
54452
|
+
var _a;
|
|
54733
54453
|
const idx = getActiveSectionIndex(options.state());
|
|
54734
|
-
const target = ((
|
|
54454
|
+
const target = ((_a = options.state().document.sections) == null ? void 0 : _a[idx]) ?? options.state().document;
|
|
54735
54455
|
if (!(target == null ? void 0 : target.pageSettings)) return;
|
|
54736
54456
|
options.commandsController.applyUpdateSectionSettingsCommand(idx, {
|
|
54737
54457
|
pageSettings: {
|
|
@@ -54747,6 +54467,8 @@ function buildEssentialsSection(options) {
|
|
|
54747
54467
|
return section;
|
|
54748
54468
|
}
|
|
54749
54469
|
function buildEssentialsTable(options) {
|
|
54470
|
+
let drawingBorders = false;
|
|
54471
|
+
let showingGridlines = false;
|
|
54750
54472
|
const insideTable = () => Boolean(
|
|
54751
54473
|
findParagraphTableLocation(
|
|
54752
54474
|
options.state().document,
|
|
@@ -54781,10 +54503,10 @@ function buildEssentialsTable(options) {
|
|
|
54781
54503
|
return table && table.type === "table" ? table : null;
|
|
54782
54504
|
};
|
|
54783
54505
|
const rawTblLookIn = (state) => {
|
|
54784
|
-
var
|
|
54506
|
+
var _a;
|
|
54785
54507
|
const table = selectedTableIn(state);
|
|
54786
54508
|
if (!table) return null;
|
|
54787
|
-
return { ...RAW_TBL_LOOK_DEFAULTS, ...((
|
|
54509
|
+
return { ...RAW_TBL_LOOK_DEFAULTS, ...((_a = table.style) == null ? void 0 : _a.tblLook) ?? {} };
|
|
54788
54510
|
};
|
|
54789
54511
|
const selectionLabel = () => {
|
|
54790
54512
|
const normalized = normalizeSelection(options.state());
|
|
@@ -54850,21 +54572,21 @@ function buildEssentialsTable(options) {
|
|
|
54850
54572
|
return setTableStyleValue(current, "tblLook", next);
|
|
54851
54573
|
}, MERGE_KEYS.tableStyleOptions),
|
|
54852
54574
|
getStyleId: () => {
|
|
54853
|
-
var
|
|
54854
|
-
return ((
|
|
54575
|
+
var _a, _b;
|
|
54576
|
+
return ((_b = (_a = selectedTableIn(options.state())) == null ? void 0 : _a.style) == null ? void 0 : _b.styleId) ?? null;
|
|
54855
54577
|
},
|
|
54856
54578
|
setStyleId: (styleId) => apply(
|
|
54857
54579
|
(current) => setTableStyleValue(current, "styleId", styleId || null),
|
|
54858
54580
|
MERGE_KEYS.tableStyleGallery
|
|
54859
54581
|
),
|
|
54860
54582
|
getLayout: () => {
|
|
54861
|
-
var
|
|
54862
|
-
return ((
|
|
54583
|
+
var _a, _b;
|
|
54584
|
+
return ((_b = (_a = selectedTableIn(options.state())) == null ? void 0 : _a.style) == null ? void 0 : _b.layout) ?? null;
|
|
54863
54585
|
},
|
|
54864
54586
|
toggleAutoFit: () => apply((current) => {
|
|
54865
|
-
var
|
|
54587
|
+
var _a;
|
|
54866
54588
|
const table = selectedTableIn(current);
|
|
54867
|
-
const nextLayout = ((
|
|
54589
|
+
const nextLayout = ((_a = table == null ? void 0 : table.style) == null ? void 0 : _a.layout) === "autofit" ? "fixed" : "autofit";
|
|
54868
54590
|
return setTableStyleValue(current, "layout", nextLayout);
|
|
54869
54591
|
}, MERGE_KEYS.tableDistribute),
|
|
54870
54592
|
distributeColumns: () => apply(
|
|
@@ -54931,6 +54653,20 @@ function buildEssentialsTable(options) {
|
|
|
54931
54653
|
}),
|
|
54932
54654
|
MERGE_KEYS.tableBorders
|
|
54933
54655
|
),
|
|
54656
|
+
applyBorderPreset: (preset) => apply(
|
|
54657
|
+
(current) => applyTableBorderPreset(current, preset),
|
|
54658
|
+
MERGE_KEYS.tableBorders
|
|
54659
|
+
),
|
|
54660
|
+
isDrawingBorders: () => drawingBorders,
|
|
54661
|
+
toggleDrawingBorders: () => {
|
|
54662
|
+
drawingBorders = !drawingBorders;
|
|
54663
|
+
options.applyState({ ...options.state() });
|
|
54664
|
+
},
|
|
54665
|
+
isShowingGridlines: () => showingGridlines,
|
|
54666
|
+
toggleGridlines: () => {
|
|
54667
|
+
showingGridlines = !showingGridlines;
|
|
54668
|
+
options.applyState({ ...options.state() });
|
|
54669
|
+
},
|
|
54934
54670
|
width100: () => apply(
|
|
54935
54671
|
(current) => setTableStyleValue(current, "width", "100%"),
|
|
54936
54672
|
MERGE_KEYS.tableWidth
|
|
@@ -55326,7 +55062,7 @@ const defaultMenuItems = [
|
|
|
55326
55062
|
}
|
|
55327
55063
|
];
|
|
55328
55064
|
function useEditorRuntimePlugins(options) {
|
|
55329
|
-
var
|
|
55065
|
+
var _a, _b;
|
|
55330
55066
|
const runtimePlugins = [
|
|
55331
55067
|
options.essentialsPlugin,
|
|
55332
55068
|
...options.externalPlugins ?? []
|
|
@@ -55370,8 +55106,8 @@ function useEditorRuntimePlugins(options) {
|
|
|
55370
55106
|
contributedMenuIds.push(item.id);
|
|
55371
55107
|
}
|
|
55372
55108
|
}
|
|
55373
|
-
(
|
|
55374
|
-
(
|
|
55109
|
+
(_a = options.customizeToolbar) == null ? void 0 : _a.call(options, toolbarRegistry);
|
|
55110
|
+
(_b = options.customizeMenubar) == null ? void 0 : _b.call(options, menuRegistry);
|
|
55375
55111
|
return {
|
|
55376
55112
|
runtimePlugins,
|
|
55377
55113
|
toolbarRegistry,
|
|
@@ -55395,13 +55131,13 @@ function createRuntimeCommandHost(options) {
|
|
|
55395
55131
|
);
|
|
55396
55132
|
let disposed = false;
|
|
55397
55133
|
const commandStateOf = (commandRef) => {
|
|
55398
|
-
var
|
|
55134
|
+
var _a;
|
|
55399
55135
|
const commandName = commandRefName(commandRef);
|
|
55400
55136
|
const cmd = runtimeEditor().commands.get(commandName);
|
|
55401
55137
|
if (!cmd) {
|
|
55402
55138
|
return { isEnabled: false, isActive: false, value: void 0 };
|
|
55403
55139
|
}
|
|
55404
|
-
const refreshed = ((
|
|
55140
|
+
const refreshed = ((_a = cmd.refresh) == null ? void 0 : _a.call(cmd)) ?? { isEnabled: true };
|
|
55405
55141
|
return {
|
|
55406
55142
|
isEnabled: refreshed.isEnabled !== false,
|
|
55407
55143
|
isActive: Boolean(refreshed.isActive),
|
|
@@ -55429,7 +55165,7 @@ function createRuntimeCommandHost(options) {
|
|
|
55429
55165
|
focusEditor: options.focusEditor
|
|
55430
55166
|
});
|
|
55431
55167
|
const initialize = async () => {
|
|
55432
|
-
var
|
|
55168
|
+
var _a, _b;
|
|
55433
55169
|
try {
|
|
55434
55170
|
const initializedRuntimeEditor = await Editor.create({
|
|
55435
55171
|
doc: options.initialDocument,
|
|
@@ -55444,14 +55180,14 @@ function createRuntimeCommandHost(options) {
|
|
|
55444
55180
|
await previousRuntimeEditor.destroy();
|
|
55445
55181
|
setRuntimeReady(true);
|
|
55446
55182
|
requestAnimationFrame(() => {
|
|
55447
|
-
var
|
|
55448
|
-
(
|
|
55449
|
-
(
|
|
55183
|
+
var _a2, _b2;
|
|
55184
|
+
(_a2 = options.onSettled) == null ? void 0 : _a2.call(options);
|
|
55185
|
+
(_b2 = options.onReady) == null ? void 0 : _b2.call(options, initializedRuntimeEditor);
|
|
55450
55186
|
});
|
|
55451
55187
|
} catch (error) {
|
|
55452
55188
|
options.logger.error("runtime:init failed", error);
|
|
55453
|
-
(
|
|
55454
|
-
(
|
|
55189
|
+
(_a = options.onError) == null ? void 0 : _a.call(options, error);
|
|
55190
|
+
(_b = options.onSettled) == null ? void 0 : _b.call(options);
|
|
55455
55191
|
}
|
|
55456
55192
|
};
|
|
55457
55193
|
const dispose = async () => {
|
|
@@ -55574,9 +55310,9 @@ function createEditorCommandRuntimeImpl(deps) {
|
|
|
55574
55310
|
focusEditor: deps.focusInput,
|
|
55575
55311
|
logger: deps.logger,
|
|
55576
55312
|
onReady: (editor) => {
|
|
55577
|
-
var
|
|
55313
|
+
var _a, _b;
|
|
55578
55314
|
runtimeClient.resolveReady(editor);
|
|
55579
|
-
(
|
|
55315
|
+
(_b = (_a = deps.runtimeOptions()).onReady) == null ? void 0 : _b.call(_a, runtimeClient);
|
|
55580
55316
|
},
|
|
55581
55317
|
onSettled: () => {
|
|
55582
55318
|
deps.setInitialLoading(false);
|
|
@@ -55637,8 +55373,8 @@ function createEditorCommandRuntimeImpl(deps) {
|
|
|
55637
55373
|
}
|
|
55638
55374
|
var _tmpl$ = /* @__PURE__ */ template(`<div class="oasis-editor-shell oasis-editor-app">`);
|
|
55639
55375
|
function OasisEditorApp(props = {}) {
|
|
55640
|
-
var
|
|
55641
|
-
const runtimeClient = ((
|
|
55376
|
+
var _a;
|
|
55377
|
+
const runtimeClient = ((_a = props.runtime) == null ? void 0 : _a.client) ?? createOasisEditorClient();
|
|
55642
55378
|
const ui = () => props.ui ?? {};
|
|
55643
55379
|
const documentOptions = () => props.document ?? {};
|
|
55644
55380
|
const runtimeOptions = () => props.runtime ?? {};
|
|
@@ -55865,6 +55601,7 @@ function OasisEditorApp(props = {}) {
|
|
|
55865
55601
|
} = buildEditorViewProps({
|
|
55866
55602
|
layout: {
|
|
55867
55603
|
documentLayout,
|
|
55604
|
+
remoteWebFonts: documentOptions().remoteWebFonts,
|
|
55868
55605
|
viewportHeight: ui().viewportHeight,
|
|
55869
55606
|
className: ui().class,
|
|
55870
55607
|
style: ui().style,
|
|
@@ -56059,12 +55796,12 @@ function OasisEditorApp(props = {}) {
|
|
|
56059
55796
|
return loadingLabel();
|
|
56060
55797
|
},
|
|
56061
55798
|
get ["class"]() {
|
|
56062
|
-
var
|
|
56063
|
-
return (
|
|
55799
|
+
var _a2;
|
|
55800
|
+
return (_a2 = loadingOptions()) == null ? void 0 : _a2.class;
|
|
56064
55801
|
},
|
|
56065
55802
|
get style() {
|
|
56066
|
-
var
|
|
56067
|
-
return (
|
|
55803
|
+
var _a2;
|
|
55804
|
+
return (_a2 = loadingOptions()) == null ? void 0 : _a2.style;
|
|
56068
55805
|
}
|
|
56069
55806
|
});
|
|
56070
55807
|
}
|
|
@@ -56076,13 +55813,15 @@ function OasisEditorApp(props = {}) {
|
|
|
56076
55813
|
onClose: () => setWelcomeOpen(false)
|
|
56077
55814
|
}), null);
|
|
56078
55815
|
createRenderEffect((_p$) => {
|
|
56079
|
-
var _v$ = !!useComposedShell(), _v$
|
|
56080
|
-
_v$ !== _p$.e && _el
|
|
56081
|
-
_v$2 !== _p$.t && _el$.classList.toggle("oasis-editor-
|
|
55816
|
+
var _v$ = ui().theme ?? "light", _v$2 = !!useComposedShell(), _v$3 = !!isReadOnly();
|
|
55817
|
+
_v$ !== _p$.e && setAttribute(_el$, "data-theme", _p$.e = _v$);
|
|
55818
|
+
_v$2 !== _p$.t && _el$.classList.toggle("oasis-editor-docs", _p$.t = _v$2);
|
|
55819
|
+
_v$3 !== _p$.a && _el$.classList.toggle("oasis-editor-read-only", _p$.a = _v$3);
|
|
56082
55820
|
return _p$;
|
|
56083
55821
|
}, {
|
|
56084
55822
|
e: void 0,
|
|
56085
|
-
t: void 0
|
|
55823
|
+
t: void 0,
|
|
55824
|
+
a: void 0
|
|
56086
55825
|
});
|
|
56087
55826
|
return _el$;
|
|
56088
55827
|
}
|