oasis-editor 0.0.124 → 0.0.125
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-gxYuoU70.js → OasisEditorApp-CZVAf0XI.js} +138 -6
- package/dist/assets/{importDocxWorker-A73eR_fM.js → importDocxWorker-C9tO3vbp.js} +1 -1
- package/dist/core/layoutConstants.d.ts +13 -0
- package/dist/core/model/types/styles.d.ts +44 -0
- package/dist/export/docx/borders.d.ts +2 -0
- package/dist/import/docx/borders.d.ts +4 -0
- package/dist/{index-zlwh4WsF.js → index-JfmhzLRe.js} +571 -362
- package/dist/layoutProjection/index.d.ts +1 -1
- package/dist/layoutProjection/paragraphBorders.d.ts +8 -0
- package/dist/oasis-editor.js +49 -49
- package/dist/oasis-editor.umd.cjs +4 -4
- 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 setAttribute, ag as setStyleProperty, 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 createStore, aE as reconcile, aF as RadioGroup, aG as Radio$1, aH as TextAreaField, aI as Text, aJ as SurfaceButton, aK as delegateEvents, aL as onMount, aM as onCleanup, aN as use, aO as PluginUiHost, aP as OasisEditorEditor, aQ as OasisBrandMark, aR as setPreciseFontPreference, aS as setWelcomeSeen, aT as enablePreciseFontMode, aU as TWIPS_PER_POINT, aV as PX_PER_INCH, aW as TWIPS_PER_INCH, aX as normalizeHex6, aY as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aZ as TABLE_BORDER_EDGE_KEYS, a_ as resolveEffectiveParagraphStyle, a$ as resolveEffectiveTextStyleForParagraph, b0 as EMU_PER_PT, b1 as OOXML_ROTATION_UNITS, b2 as OOXML_PERCENT_DENOMINATOR, b3 as parseHexColorToRgb255, b4 as EMU_PER_PX, b5 as getRunEndnoteReference, b6 as iterateFootnoteReferenceRuns, b7 as iterateEndnoteReferenceRuns, b8 as imageContentTypeDefaults, b9 as getRunFieldChar, ba as getRunFieldInstruction, bb as createEditorRun, bc as JSZip, bd as imageExtensionFromMime, be as pxToPt$1, bf as resolveFloatingObjectRect, bg as getTextBoxFloatingGeometry, bh as getPresetPathSegments, bi as buildListLabels, bj as DEFAULT_FONT_SIZE_PX, bk as resolveGradientAxis, bl as isDoubleUnderlineStyle, bm as isWavyUnderlineStyle, bn as underlineStyleLineWidthPx, bo as WAVY_UNDERLINE_WAVELENGTH_PX, bp as WAVY_UNDERLINE_AMPLITUDE_PX, bq as DOUBLE_UNDERLINE_OFFSET_PX, br as underlineStyleDashArray, bs as EMPHASIS_GLYPH, bt as rgb255ToHex, bu as getImageFloatingGeometry, bv as textStyleToFontSizePt, bw 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 setAttribute, ag as setStyleProperty, 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 createStore, aE as reconcile, aF as RadioGroup, aG as Radio$1, aH as TextAreaField, aI as Text, aJ as SurfaceButton, aK as delegateEvents, aL as onMount, aM as onCleanup, aN as use, aO as PluginUiHost, aP as OasisEditorEditor, aQ as OasisBrandMark, aR as setPreciseFontPreference, aS as setWelcomeSeen, aT as enablePreciseFontMode, aU as TWIPS_PER_POINT, aV as PX_PER_INCH, aW as TWIPS_PER_INCH, aX as normalizeHex6, aY as TABLE_CONDITIONAL_FLAG_ATTRIBUTES, aZ as TABLE_BORDER_EDGE_KEYS, a_ as resolveEffectiveParagraphStyle, a$ as resolveEffectiveTextStyleForParagraph, b0 as EMU_PER_PT, b1 as OOXML_ROTATION_UNITS, b2 as OOXML_PERCENT_DENOMINATOR, b3 as parseHexColorToRgb255, b4 as EMU_PER_PX, b5 as getRunEndnoteReference, b6 as iterateFootnoteReferenceRuns, b7 as iterateEndnoteReferenceRuns, b8 as imageContentTypeDefaults, b9 as getRunFieldChar, ba as getRunFieldInstruction, bb as createEditorRun, bc as JSZip, bd as imageExtensionFromMime, be as pxToPt$1, bf as resolveFloatingObjectRect, bg as getTextBoxFloatingGeometry, bh as getPresetPathSegments, bi as buildListLabels, bj as DEFAULT_FONT_SIZE_PX, bk as resolveGradientAxis, bl as isDoubleUnderlineStyle, bm as isWavyUnderlineStyle, bn as underlineStyleLineWidthPx, bo as WAVY_UNDERLINE_WAVELENGTH_PX, bp as WAVY_UNDERLINE_AMPLITUDE_PX, bq as DOUBLE_UNDERLINE_OFFSET_PX, br as underlineStyleDashArray, bs as EMPHASIS_GLYPH, bt as rgb255ToHex, bu as getImageFloatingGeometry, bv as textStyleToFontSizePt, bw as resolveTextAlignmentBaselineOffset, bx as TEXT_BASELINE_RATIO, by as resolveOpenTypeFeatureTags, bz as resolveDecorationLineY, bA as DOUBLE_STRIKE_OFFSET_PX, bB as resolveListLabel, bC as getListLabelInset, bD as getAlignedListLabelInset, bE as getParagraphBorderInsets, bF as buildSegmentTable, bG as buildCanvasTableLayout, bH as resolveCanvasTableWidth, bI as resolveFloatingTableRect, bJ as paragraphBetweenBorderMatches, bK as normalizeFamily, bL as ROBOTO_FONT_FILES, bM as loadFontAsset, bN as OFFICE_COMPAT_FONT_FAMILIES, bO as BinaryReader, bP as buildSfnt, bQ as defaultFontDecoderRegistry, bR as SfntFontProgram, bS as collectPdfFontFamilies, bT as outlineFrom, bU as getPageHeaderZoneTop, bV as getPageColumnRects, bW as findFootnoteReference, bX as resolveImporterForFile, bY as roundTo, bZ as getDocumentSectionsCanonical, b_ as getDocumentParagraphsCanonical, b$ as getDocumentParagraphs, c0 as getDocumentPageSettings, c1 as getTableCellContentWidthForParagraph, c2 as layoutMetricsEpoch, c3 as bumpLayoutMetricsEpoch, c4 as createCanvasLayoutSnapshotProvider, c5 as on, c6 as debounce, c7 as unwrap, c8 as perfTimer, c9 as getRunTextBox, ca as createEditorDocument, cb as resolveResizedDimensions, cc as resolveTextBoxRenderHeight, cd as getToolbarStyleState, ce as VERTICAL_HIT_WEIGHT, cf as getCachedCanvasImage, cg as measureParagraphMinContentWidthPx, ch as getEditableBlocksForZone, ci as findParagraphLocation, cj as createSectionBoundaryParagraph, ck as normalizePageSettings, cl as DEFAULT_EDITOR_PAGE_SETTINGS, cm as markStart, cn as markEnd, co as getParagraphEntries, cp as getParagraphById, cq as createEditorFootnote, cr as createFootnoteReferenceRun, cs as renumberFootnotes, ct as getHeadingLevel, cu as preciseFontModeVersion, cv as isPreciseFontModeEnabled, cw as resolveNamedTextStyle, cx as togglePreciseFontMode, cy as nextFontSizePt, cz as previousFontSizePt, cA as fontSizePtToPx, cB as createDefaultToolbarPreset, cC as MenuRegistry, cD as createToolbarRegistry, cE as Editor, cF as resolveCommandRef, cG as commandRefName, cH as createOasisEditorClient, cI as createEditorZoom, cJ as startLongTaskObserver, cK as installGlobalReport, cL as applyStoredPreciseFontPreference, cM as getWelcomeSeen, cN as isLocalFontAccessSupported, cO as EDITOR_SCROLL_PADDING_PX, cP as Toolbar, cQ as OasisEditorLoading, cR as I18nProvider, cS as createTranslator, cT as registerDomStatsSurface, cU as createEditorLogger } from "./index-JfmhzLRe.js";
|
|
5
5
|
function projectHeaderFooterBlocksWithDependencies(blocks, deps, context = {}) {
|
|
6
6
|
const {
|
|
7
7
|
pageIndex,
|
|
@@ -36252,7 +36252,9 @@ function serializeParagraphBorders(style2) {
|
|
|
36252
36252
|
["top", style2.borderTop],
|
|
36253
36253
|
["left", style2.borderLeft],
|
|
36254
36254
|
["bottom", style2.borderBottom],
|
|
36255
|
-
["right", style2.borderRight]
|
|
36255
|
+
["right", style2.borderRight],
|
|
36256
|
+
["between", style2.borderBetween],
|
|
36257
|
+
["bar", style2.borderBar]
|
|
36256
36258
|
];
|
|
36257
36259
|
const parts = edges.filter((entry) => entry[1] != null).map(
|
|
36258
36260
|
([name, border]) => `<w:${name} ${serializeDocxBorderAttrs(border)}`
|
|
@@ -36765,7 +36767,23 @@ function materializeParagraphStyle(paragraph, styles) {
|
|
|
36765
36767
|
borderLeft: effective.borderLeft,
|
|
36766
36768
|
tabs: effective.tabs,
|
|
36767
36769
|
textDirection: effective.textDirection,
|
|
36768
|
-
outlineLevel: effective.outlineLevel
|
|
36770
|
+
outlineLevel: effective.outlineLevel,
|
|
36771
|
+
suppressLineNumbers: effective.suppressLineNumbers,
|
|
36772
|
+
bidi: effective.bidi,
|
|
36773
|
+
kinsoku: effective.kinsoku,
|
|
36774
|
+
wordWrap: effective.wordWrap,
|
|
36775
|
+
overflowPunct: effective.overflowPunct,
|
|
36776
|
+
topLinePunct: effective.topLinePunct,
|
|
36777
|
+
autoSpaceDE: effective.autoSpaceDE,
|
|
36778
|
+
autoSpaceDN: effective.autoSpaceDN,
|
|
36779
|
+
adjustRightInd: effective.adjustRightInd,
|
|
36780
|
+
textAlignment: effective.textAlignment,
|
|
36781
|
+
textboxTightWrap: effective.textboxTightWrap,
|
|
36782
|
+
divId: effective.divId,
|
|
36783
|
+
conditionalStyle: effective.conditionalStyle,
|
|
36784
|
+
borderBetween: effective.borderBetween,
|
|
36785
|
+
borderBar: effective.borderBar,
|
|
36786
|
+
framePrXml: effective.framePrXml
|
|
36769
36787
|
};
|
|
36770
36788
|
}
|
|
36771
36789
|
function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
@@ -36849,6 +36867,62 @@ function serializeParagraphTabs(tabs) {
|
|
|
36849
36867
|
}).filter(Boolean);
|
|
36850
36868
|
return parts.length > 0 ? `<w:tabs>${parts.join("")}</w:tabs>` : "";
|
|
36851
36869
|
}
|
|
36870
|
+
function serializeConditionalStyle(flags) {
|
|
36871
|
+
if (!flags) {
|
|
36872
|
+
return "";
|
|
36873
|
+
}
|
|
36874
|
+
const bits = TABLE_CONDITIONAL_FLAG_ATTRIBUTES.map(
|
|
36875
|
+
([, key]) => flags[key] ? "1" : "0"
|
|
36876
|
+
).join("");
|
|
36877
|
+
return `<w:cnfStyle w:val="${bits}"/>`;
|
|
36878
|
+
}
|
|
36879
|
+
function serializeParagraphDecorations(style2) {
|
|
36880
|
+
const parts = [];
|
|
36881
|
+
if (style2.framePrXml) {
|
|
36882
|
+
parts.push(style2.framePrXml);
|
|
36883
|
+
}
|
|
36884
|
+
if (style2.suppressLineNumbers) {
|
|
36885
|
+
parts.push("<w:suppressLineNumbers/>");
|
|
36886
|
+
}
|
|
36887
|
+
if (style2.bidi) {
|
|
36888
|
+
parts.push("<w:bidi/>");
|
|
36889
|
+
}
|
|
36890
|
+
if (style2.kinsoku === false) {
|
|
36891
|
+
parts.push('<w:kinsoku w:val="0"/>');
|
|
36892
|
+
}
|
|
36893
|
+
if (style2.wordWrap === false) {
|
|
36894
|
+
parts.push('<w:wordWrap w:val="0"/>');
|
|
36895
|
+
}
|
|
36896
|
+
if (style2.overflowPunct === false) {
|
|
36897
|
+
parts.push('<w:overflowPunct w:val="0"/>');
|
|
36898
|
+
}
|
|
36899
|
+
if (style2.topLinePunct) {
|
|
36900
|
+
parts.push("<w:topLinePunct/>");
|
|
36901
|
+
}
|
|
36902
|
+
if (style2.autoSpaceDE === false) {
|
|
36903
|
+
parts.push('<w:autoSpaceDE w:val="0"/>');
|
|
36904
|
+
}
|
|
36905
|
+
if (style2.autoSpaceDN === false) {
|
|
36906
|
+
parts.push('<w:autoSpaceDN w:val="0"/>');
|
|
36907
|
+
}
|
|
36908
|
+
if (style2.adjustRightInd === false) {
|
|
36909
|
+
parts.push('<w:adjustRightInd w:val="0"/>');
|
|
36910
|
+
}
|
|
36911
|
+
if (style2.textAlignment) {
|
|
36912
|
+
parts.push(`<w:textAlignment w:val="${style2.textAlignment}"/>`);
|
|
36913
|
+
}
|
|
36914
|
+
if (style2.textboxTightWrap) {
|
|
36915
|
+
parts.push(`<w:textboxTightWrap w:val="${style2.textboxTightWrap}"/>`);
|
|
36916
|
+
}
|
|
36917
|
+
if (style2.divId != null) {
|
|
36918
|
+
parts.push(`<w:divId w:val="${style2.divId}"/>`);
|
|
36919
|
+
}
|
|
36920
|
+
const cnfStyle = serializeConditionalStyle(style2.conditionalStyle);
|
|
36921
|
+
if (cnfStyle) {
|
|
36922
|
+
parts.push(cnfStyle);
|
|
36923
|
+
}
|
|
36924
|
+
return parts;
|
|
36925
|
+
}
|
|
36852
36926
|
function serializeParagraphStyleXml(style2) {
|
|
36853
36927
|
const parts = [];
|
|
36854
36928
|
if (style2.align) {
|
|
@@ -36906,6 +36980,7 @@ function serializeParagraphStyleXml(style2) {
|
|
|
36906
36980
|
if (style2.outlineLevel != null) {
|
|
36907
36981
|
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
36908
36982
|
}
|
|
36983
|
+
parts.push(...serializeParagraphDecorations(style2));
|
|
36909
36984
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
36910
36985
|
}
|
|
36911
36986
|
function serializeParagraphProperties(paragraph, numberingInfo, styles, overrides) {
|
|
@@ -36971,6 +37046,7 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
36971
37046
|
if (style2.outlineLevel != null) {
|
|
36972
37047
|
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
36973
37048
|
}
|
|
37049
|
+
parts.push(...serializeParagraphDecorations(style2));
|
|
36974
37050
|
const numbering = numberingInfo.get(paragraph.id);
|
|
36975
37051
|
if (numbering) {
|
|
36976
37052
|
parts.push(
|
|
@@ -39803,7 +39879,16 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
39803
39879
|
});
|
|
39804
39880
|
const fontSizePt = styles.smallCaps ? textStyleToFontSizePt(styles) * 0.8 : textStyleToFontSizePt(styles);
|
|
39805
39881
|
const baselineShiftPx = (styles.baselineShift ?? 0) * PX_PER_POINT;
|
|
39806
|
-
const
|
|
39882
|
+
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
39883
|
+
paragraph.style,
|
|
39884
|
+
document2.styles
|
|
39885
|
+
);
|
|
39886
|
+
const textAlignOffset = resolveTextAlignmentBaselineOffset(
|
|
39887
|
+
paragraphStyle.textAlignment,
|
|
39888
|
+
styles.fontSize ?? DEFAULT_FONT_SIZE_PX,
|
|
39889
|
+
line.height
|
|
39890
|
+
);
|
|
39891
|
+
const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO - baselineShiftPx + textAlignOffset;
|
|
39807
39892
|
const chars = resolveFragmentSlots(line, fragment);
|
|
39808
39893
|
const text = chars.map(
|
|
39809
39894
|
(char) => styles.allCaps ? char.char.toUpperCase() : char.char
|
|
@@ -40003,7 +40088,7 @@ function drawParagraphDecorations(writer, pageIndex, paragraphStyle, lines, orig
|
|
|
40003
40088
|
];
|
|
40004
40089
|
const hasBorder = edges.some(
|
|
40005
40090
|
([border]) => border && border.type !== "none" && border.width > 0
|
|
40006
|
-
);
|
|
40091
|
+
) || paragraphStyle.borderBar != null && paragraphStyle.borderBar.type !== "none" && paragraphStyle.borderBar.width > 0;
|
|
40007
40092
|
if (!paragraphStyle.shading && !hasBorder) {
|
|
40008
40093
|
return;
|
|
40009
40094
|
}
|
|
@@ -40043,6 +40128,18 @@ function drawParagraphDecorations(writer, pageIndex, paragraphStyle, lines, orig
|
|
|
40043
40128
|
dashArray: borderDashArray(border.type)
|
|
40044
40129
|
});
|
|
40045
40130
|
}
|
|
40131
|
+
const bar = paragraphStyle.borderBar;
|
|
40132
|
+
if (bar && bar.type !== "none" && bar.width > 0) {
|
|
40133
|
+
writer.drawLine(pageIndex, {
|
|
40134
|
+
x1: pxToPt$1(left),
|
|
40135
|
+
y1: pxToPt$1(contentTop),
|
|
40136
|
+
x2: pxToPt$1(left),
|
|
40137
|
+
y2: pxToPt$1(bottom),
|
|
40138
|
+
stroke: bar.color,
|
|
40139
|
+
lineWidth: bar.width,
|
|
40140
|
+
dashArray: borderDashArray(bar.type)
|
|
40141
|
+
});
|
|
40142
|
+
}
|
|
40046
40143
|
}
|
|
40047
40144
|
async function drawParagraph(writer, pageIndex, paragraph, lines, document2, originX, originY, fontRegistry, listOrdinals, drawers) {
|
|
40048
40145
|
for (const line of lines) {
|
|
@@ -40203,7 +40300,8 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
40203
40300
|
}
|
|
40204
40301
|
const contentTop = originY;
|
|
40205
40302
|
let cursorY = originY;
|
|
40206
|
-
for (
|
|
40303
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
40304
|
+
const block = blocks[blockIndex];
|
|
40207
40305
|
switch (block.sourceBlock.type) {
|
|
40208
40306
|
case "paragraph": {
|
|
40209
40307
|
if (!block.layout) {
|
|
@@ -40344,6 +40442,40 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
40344
40442
|
default:
|
|
40345
40443
|
assertNever(block.sourceBlock, "block");
|
|
40346
40444
|
}
|
|
40445
|
+
if (block.sourceBlock.type === "paragraph" && block.layout) {
|
|
40446
|
+
const nextBlock = blocks[blockIndex + 1];
|
|
40447
|
+
if ((nextBlock == null ? void 0 : nextBlock.sourceBlock.type) === "paragraph" && nextBlock.layout && nextBlock.sourceBlock.id !== block.sourceBlock.id) {
|
|
40448
|
+
const curStyle = resolveEffectiveParagraphStyle(
|
|
40449
|
+
block.sourceBlock.style,
|
|
40450
|
+
document2.styles
|
|
40451
|
+
);
|
|
40452
|
+
const nextStyle = resolveEffectiveParagraphStyle(
|
|
40453
|
+
nextBlock.sourceBlock.style,
|
|
40454
|
+
document2.styles
|
|
40455
|
+
);
|
|
40456
|
+
if (paragraphBetweenBorderMatches(curStyle, nextStyle)) {
|
|
40457
|
+
const spacingBefore = block.layout.startOffset === 0 && cursorY > originY ? curStyle.spacingBefore ?? 0 : 0;
|
|
40458
|
+
const textTop = cursorY + spacingBefore + getParagraphBorderInsets(curStyle).top;
|
|
40459
|
+
let linesHeight = 0;
|
|
40460
|
+
for (const line of block.layout.lines) {
|
|
40461
|
+
linesHeight = Math.max(linesHeight, line.top + line.height);
|
|
40462
|
+
}
|
|
40463
|
+
const betweenY = textTop + linesHeight;
|
|
40464
|
+
const barLeft = originX + (curStyle.indentLeft ?? 0);
|
|
40465
|
+
const barRight = originX + contentWidth - (curStyle.indentRight ?? 0);
|
|
40466
|
+
const between = curStyle.borderBetween;
|
|
40467
|
+
writer.drawLine(pageIndex, {
|
|
40468
|
+
x1: pxToPt$1(barLeft),
|
|
40469
|
+
y1: pxToPt$1(betweenY),
|
|
40470
|
+
x2: pxToPt$1(barRight),
|
|
40471
|
+
y2: pxToPt$1(betweenY),
|
|
40472
|
+
stroke: between.color,
|
|
40473
|
+
lineWidth: between.width,
|
|
40474
|
+
dashArray: borderDashArray(between.type)
|
|
40475
|
+
});
|
|
40476
|
+
}
|
|
40477
|
+
}
|
|
40478
|
+
}
|
|
40347
40479
|
cursorY += Math.max(0, block.estimatedHeight);
|
|
40348
40480
|
}
|
|
40349
40481
|
}
|