oasis-editor 0.0.124 → 0.0.126
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-DFgUxV_0.js} +142 -6
- package/dist/assets/{importDocxWorker-A73eR_fM.js → importDocxWorker-ayg-B322.js} +1 -1
- package/dist/core/layoutConstants.d.ts +13 -0
- package/dist/core/model/types/styles.d.ts +46 -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-BGUkA0aZ.js} +585 -363
- 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-BGUkA0aZ.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,24 @@ 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
|
+
suppressAutoHyphens: effective.suppressAutoHyphens,
|
|
36773
|
+
bidi: effective.bidi,
|
|
36774
|
+
kinsoku: effective.kinsoku,
|
|
36775
|
+
wordWrap: effective.wordWrap,
|
|
36776
|
+
overflowPunct: effective.overflowPunct,
|
|
36777
|
+
topLinePunct: effective.topLinePunct,
|
|
36778
|
+
autoSpaceDE: effective.autoSpaceDE,
|
|
36779
|
+
autoSpaceDN: effective.autoSpaceDN,
|
|
36780
|
+
adjustRightInd: effective.adjustRightInd,
|
|
36781
|
+
textAlignment: effective.textAlignment,
|
|
36782
|
+
textboxTightWrap: effective.textboxTightWrap,
|
|
36783
|
+
divId: effective.divId,
|
|
36784
|
+
conditionalStyle: effective.conditionalStyle,
|
|
36785
|
+
borderBetween: effective.borderBetween,
|
|
36786
|
+
borderBar: effective.borderBar,
|
|
36787
|
+
framePrXml: effective.framePrXml
|
|
36769
36788
|
};
|
|
36770
36789
|
}
|
|
36771
36790
|
function materializeRunStyle(run, paragraphStyleId, styles) {
|
|
@@ -36849,6 +36868,65 @@ function serializeParagraphTabs(tabs) {
|
|
|
36849
36868
|
}).filter(Boolean);
|
|
36850
36869
|
return parts.length > 0 ? `<w:tabs>${parts.join("")}</w:tabs>` : "";
|
|
36851
36870
|
}
|
|
36871
|
+
function serializeConditionalStyle(flags) {
|
|
36872
|
+
if (!flags) {
|
|
36873
|
+
return "";
|
|
36874
|
+
}
|
|
36875
|
+
const bits = TABLE_CONDITIONAL_FLAG_ATTRIBUTES.map(
|
|
36876
|
+
([, key]) => flags[key] ? "1" : "0"
|
|
36877
|
+
).join("");
|
|
36878
|
+
return `<w:cnfStyle w:val="${bits}"/>`;
|
|
36879
|
+
}
|
|
36880
|
+
function serializeParagraphDecorations(style2) {
|
|
36881
|
+
const parts = [];
|
|
36882
|
+
if (style2.framePrXml) {
|
|
36883
|
+
parts.push(style2.framePrXml);
|
|
36884
|
+
}
|
|
36885
|
+
if (style2.suppressLineNumbers) {
|
|
36886
|
+
parts.push("<w:suppressLineNumbers/>");
|
|
36887
|
+
}
|
|
36888
|
+
if (style2.suppressAutoHyphens) {
|
|
36889
|
+
parts.push("<w:suppressAutoHyphens/>");
|
|
36890
|
+
}
|
|
36891
|
+
if (style2.bidi) {
|
|
36892
|
+
parts.push("<w:bidi/>");
|
|
36893
|
+
}
|
|
36894
|
+
if (style2.kinsoku === false) {
|
|
36895
|
+
parts.push('<w:kinsoku w:val="0"/>');
|
|
36896
|
+
}
|
|
36897
|
+
if (style2.wordWrap === false) {
|
|
36898
|
+
parts.push('<w:wordWrap w:val="0"/>');
|
|
36899
|
+
}
|
|
36900
|
+
if (style2.overflowPunct === false) {
|
|
36901
|
+
parts.push('<w:overflowPunct w:val="0"/>');
|
|
36902
|
+
}
|
|
36903
|
+
if (style2.topLinePunct) {
|
|
36904
|
+
parts.push("<w:topLinePunct/>");
|
|
36905
|
+
}
|
|
36906
|
+
if (style2.autoSpaceDE === false) {
|
|
36907
|
+
parts.push('<w:autoSpaceDE w:val="0"/>');
|
|
36908
|
+
}
|
|
36909
|
+
if (style2.autoSpaceDN === false) {
|
|
36910
|
+
parts.push('<w:autoSpaceDN w:val="0"/>');
|
|
36911
|
+
}
|
|
36912
|
+
if (style2.adjustRightInd === false) {
|
|
36913
|
+
parts.push('<w:adjustRightInd w:val="0"/>');
|
|
36914
|
+
}
|
|
36915
|
+
if (style2.textAlignment) {
|
|
36916
|
+
parts.push(`<w:textAlignment w:val="${style2.textAlignment}"/>`);
|
|
36917
|
+
}
|
|
36918
|
+
if (style2.textboxTightWrap) {
|
|
36919
|
+
parts.push(`<w:textboxTightWrap w:val="${style2.textboxTightWrap}"/>`);
|
|
36920
|
+
}
|
|
36921
|
+
if (style2.divId != null) {
|
|
36922
|
+
parts.push(`<w:divId w:val="${style2.divId}"/>`);
|
|
36923
|
+
}
|
|
36924
|
+
const cnfStyle = serializeConditionalStyle(style2.conditionalStyle);
|
|
36925
|
+
if (cnfStyle) {
|
|
36926
|
+
parts.push(cnfStyle);
|
|
36927
|
+
}
|
|
36928
|
+
return parts;
|
|
36929
|
+
}
|
|
36852
36930
|
function serializeParagraphStyleXml(style2) {
|
|
36853
36931
|
const parts = [];
|
|
36854
36932
|
if (style2.align) {
|
|
@@ -36906,6 +36984,7 @@ function serializeParagraphStyleXml(style2) {
|
|
|
36906
36984
|
if (style2.outlineLevel != null) {
|
|
36907
36985
|
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
36908
36986
|
}
|
|
36987
|
+
parts.push(...serializeParagraphDecorations(style2));
|
|
36909
36988
|
return parts.length > 0 ? `<w:pPr>${parts.join("")}</w:pPr>` : "";
|
|
36910
36989
|
}
|
|
36911
36990
|
function serializeParagraphProperties(paragraph, numberingInfo, styles, overrides) {
|
|
@@ -36971,6 +37050,7 @@ function serializeParagraphProperties(paragraph, numberingInfo, styles, override
|
|
|
36971
37050
|
if (style2.outlineLevel != null) {
|
|
36972
37051
|
parts.push(`<w:outlineLvl w:val="${style2.outlineLevel}"/>`);
|
|
36973
37052
|
}
|
|
37053
|
+
parts.push(...serializeParagraphDecorations(style2));
|
|
36974
37054
|
const numbering = numberingInfo.get(paragraph.id);
|
|
36975
37055
|
if (numbering) {
|
|
36976
37056
|
parts.push(
|
|
@@ -39803,7 +39883,16 @@ async function drawFragmentText(writer, pageIndex, paragraph, line, fragment, do
|
|
|
39803
39883
|
});
|
|
39804
39884
|
const fontSizePt = styles.smallCaps ? textStyleToFontSizePt(styles) * 0.8 : textStyleToFontSizePt(styles);
|
|
39805
39885
|
const baselineShiftPx = (styles.baselineShift ?? 0) * PX_PER_POINT;
|
|
39806
|
-
const
|
|
39886
|
+
const paragraphStyle = resolveEffectiveParagraphStyle(
|
|
39887
|
+
paragraph.style,
|
|
39888
|
+
document2.styles
|
|
39889
|
+
);
|
|
39890
|
+
const textAlignOffset = resolveTextAlignmentBaselineOffset(
|
|
39891
|
+
paragraphStyle.textAlignment,
|
|
39892
|
+
styles.fontSize ?? DEFAULT_FONT_SIZE_PX,
|
|
39893
|
+
line.height
|
|
39894
|
+
);
|
|
39895
|
+
const baselineY = originY + line.top + line.height * TEXT_BASELINE_RATIO - baselineShiftPx + textAlignOffset;
|
|
39807
39896
|
const chars = resolveFragmentSlots(line, fragment);
|
|
39808
39897
|
const text = chars.map(
|
|
39809
39898
|
(char) => styles.allCaps ? char.char.toUpperCase() : char.char
|
|
@@ -40003,7 +40092,7 @@ function drawParagraphDecorations(writer, pageIndex, paragraphStyle, lines, orig
|
|
|
40003
40092
|
];
|
|
40004
40093
|
const hasBorder = edges.some(
|
|
40005
40094
|
([border]) => border && border.type !== "none" && border.width > 0
|
|
40006
|
-
);
|
|
40095
|
+
) || paragraphStyle.borderBar != null && paragraphStyle.borderBar.type !== "none" && paragraphStyle.borderBar.width > 0;
|
|
40007
40096
|
if (!paragraphStyle.shading && !hasBorder) {
|
|
40008
40097
|
return;
|
|
40009
40098
|
}
|
|
@@ -40043,6 +40132,18 @@ function drawParagraphDecorations(writer, pageIndex, paragraphStyle, lines, orig
|
|
|
40043
40132
|
dashArray: borderDashArray(border.type)
|
|
40044
40133
|
});
|
|
40045
40134
|
}
|
|
40135
|
+
const bar = paragraphStyle.borderBar;
|
|
40136
|
+
if (bar && bar.type !== "none" && bar.width > 0) {
|
|
40137
|
+
writer.drawLine(pageIndex, {
|
|
40138
|
+
x1: pxToPt$1(left),
|
|
40139
|
+
y1: pxToPt$1(contentTop),
|
|
40140
|
+
x2: pxToPt$1(left),
|
|
40141
|
+
y2: pxToPt$1(bottom),
|
|
40142
|
+
stroke: bar.color,
|
|
40143
|
+
lineWidth: bar.width,
|
|
40144
|
+
dashArray: borderDashArray(bar.type)
|
|
40145
|
+
});
|
|
40146
|
+
}
|
|
40046
40147
|
}
|
|
40047
40148
|
async function drawParagraph(writer, pageIndex, paragraph, lines, document2, originX, originY, fontRegistry, listOrdinals, drawers) {
|
|
40048
40149
|
for (const line of lines) {
|
|
@@ -40203,7 +40304,8 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
40203
40304
|
}
|
|
40204
40305
|
const contentTop = originY;
|
|
40205
40306
|
let cursorY = originY;
|
|
40206
|
-
for (
|
|
40307
|
+
for (let blockIndex = 0; blockIndex < blocks.length; blockIndex += 1) {
|
|
40308
|
+
const block = blocks[blockIndex];
|
|
40207
40309
|
switch (block.sourceBlock.type) {
|
|
40208
40310
|
case "paragraph": {
|
|
40209
40311
|
if (!block.layout) {
|
|
@@ -40344,6 +40446,40 @@ async function drawBlockList(writer, pageIndex, blocks, document2, originX, orig
|
|
|
40344
40446
|
default:
|
|
40345
40447
|
assertNever(block.sourceBlock, "block");
|
|
40346
40448
|
}
|
|
40449
|
+
if (block.sourceBlock.type === "paragraph" && block.layout) {
|
|
40450
|
+
const nextBlock = blocks[blockIndex + 1];
|
|
40451
|
+
if ((nextBlock == null ? void 0 : nextBlock.sourceBlock.type) === "paragraph" && nextBlock.layout && nextBlock.sourceBlock.id !== block.sourceBlock.id) {
|
|
40452
|
+
const curStyle = resolveEffectiveParagraphStyle(
|
|
40453
|
+
block.sourceBlock.style,
|
|
40454
|
+
document2.styles
|
|
40455
|
+
);
|
|
40456
|
+
const nextStyle = resolveEffectiveParagraphStyle(
|
|
40457
|
+
nextBlock.sourceBlock.style,
|
|
40458
|
+
document2.styles
|
|
40459
|
+
);
|
|
40460
|
+
if (paragraphBetweenBorderMatches(curStyle, nextStyle)) {
|
|
40461
|
+
const spacingBefore = block.layout.startOffset === 0 && cursorY > originY ? curStyle.spacingBefore ?? 0 : 0;
|
|
40462
|
+
const textTop = cursorY + spacingBefore + getParagraphBorderInsets(curStyle).top;
|
|
40463
|
+
let linesHeight = 0;
|
|
40464
|
+
for (const line of block.layout.lines) {
|
|
40465
|
+
linesHeight = Math.max(linesHeight, line.top + line.height);
|
|
40466
|
+
}
|
|
40467
|
+
const betweenY = textTop + linesHeight;
|
|
40468
|
+
const barLeft = originX + (curStyle.indentLeft ?? 0);
|
|
40469
|
+
const barRight = originX + contentWidth - (curStyle.indentRight ?? 0);
|
|
40470
|
+
const between = curStyle.borderBetween;
|
|
40471
|
+
writer.drawLine(pageIndex, {
|
|
40472
|
+
x1: pxToPt$1(barLeft),
|
|
40473
|
+
y1: pxToPt$1(betweenY),
|
|
40474
|
+
x2: pxToPt$1(barRight),
|
|
40475
|
+
y2: pxToPt$1(betweenY),
|
|
40476
|
+
stroke: between.color,
|
|
40477
|
+
lineWidth: between.width,
|
|
40478
|
+
dashArray: borderDashArray(between.type)
|
|
40479
|
+
});
|
|
40480
|
+
}
|
|
40481
|
+
}
|
|
40482
|
+
}
|
|
40347
40483
|
cursorY += Math.max(0, block.estimatedHeight);
|
|
40348
40484
|
}
|
|
40349
40485
|
}
|