@univerjs/engine-render 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/cjs/index.js CHANGED
@@ -14851,7 +14851,7 @@ function _finishTableSkeletonBuild(state) {
14851
14851
  applyTableOuterBorderSpacing(tableSkeleton, state.sectionBreakConfig);
14852
14852
  for (const rowSkeleton of tableSkeleton.rows) _verticalAlignInCell(rowSkeleton, table.tableRows[rowSkeleton.index]);
14853
14853
  const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
14854
- tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent);
14854
+ tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
14855
14855
  state.complete = true;
14856
14856
  }
14857
14857
  function applyMergedCellContentHeights(tableSkeleton, mergedCellContentHeights) {
@@ -15006,7 +15006,7 @@ function cachePrecomputedSlicedTableSkeletons(ctx, tableNode, availableHeight, r
15006
15006
  });
15007
15007
  }
15008
15008
  function _finishTableSkeletonsBuild(state) {
15009
- updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table);
15009
+ updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table, state.sectionBreakConfig);
15010
15010
  state.skeTables.forEach((table) => applyTableOuterBorderSpacing(table, state.sectionBreakConfig));
15011
15011
  const policy = state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
15012
15012
  state.result = {
@@ -15065,7 +15065,7 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
15065
15065
  cellPageHeights = dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, row, table, createCache, false, precomputedTable === null || precomputedTable === void 0 ? void 0 : precomputedTable.rows[row], void 0, cellPageHeights);
15066
15066
  while (cellPageHeights);
15067
15067
  }
15068
- updateTableSkeletonsPosition(createCache, curPage, skeTables, table);
15068
+ updateTableSkeletonsPosition(createCache, curPage, skeTables, table, sectionBreakConfig);
15069
15069
  skeTables.forEach((table) => applyTableOuterBorderSpacing(table, sectionBreakConfig));
15070
15070
  const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
15071
15071
  return {
@@ -15073,10 +15073,10 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
15073
15073
  fromCurrentPage: createCache.fromCurrentPage !== false && skeTables[0].height <= availableHeight + documentCompatibilityPolicy.table.currentPageOverflowTolerance
15074
15074
  };
15075
15075
  }
15076
- function updateTableSkeletonsPosition(cache, curPage, skeTables, table) {
15076
+ function updateTableSkeletonsPosition(cache, curPage, skeTables, table, sectionBreakConfig) {
15077
15077
  const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
15078
15078
  const { tableWidth } = cache;
15079
- const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent);
15079
+ const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
15080
15080
  const rowFragments = /* @__PURE__ */ new Map();
15081
15081
  for (const part of skeTables) for (const row of part.rows) if (!row.isRepeatRow) rowFragments.set(row.index, (rowFragments.get(row.index) ?? 0) + 1);
15082
15082
  let tableIndex = 0;
@@ -15410,11 +15410,11 @@ function resolveTableLayoutColumns(table, availableWidth, traditional = false) {
15410
15410
  }))
15411
15411
  };
15412
15412
  }
15413
- function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }) {
15413
+ function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }, allowMarginOverflow = false) {
15414
15414
  switch (align) {
15415
15415
  case _univerjs_core.TableAlignmentType.START: return indent.v;
15416
- case _univerjs_core.TableAlignmentType.END: return Math.max(0, pageWidth - tableWidth);
15417
- case _univerjs_core.TableAlignmentType.CENTER: return Math.max(0, (pageWidth - tableWidth) / 2);
15416
+ case _univerjs_core.TableAlignmentType.END: return allowMarginOverflow ? pageWidth - tableWidth : Math.max(0, pageWidth - tableWidth);
15417
+ case _univerjs_core.TableAlignmentType.CENTER: return allowMarginOverflow ? (pageWidth - tableWidth) / 2 : Math.max(0, (pageWidth - tableWidth) / 2);
15418
15418
  default: throw new Error("Unknown table alignment type");
15419
15419
  }
15420
15420
  }
@@ -16051,6 +16051,19 @@ function _isDocxColumnBreakVisuallyBlankColumn(column) {
16051
16051
  function _hasOnlyCustomBlockGlyphs(glyphs) {
16052
16052
  return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.CUSTOM_BLOCK);
16053
16053
  }
16054
+ function _mergeTrailingBlockEndShapedTexts(shapedTextList) {
16055
+ const result = [];
16056
+ for (const shapedText of shapedTextList) {
16057
+ const previous = result[result.length - 1];
16058
+ if ((previous === null || previous === void 0 ? void 0 : previous.breakPointType) === "Mandatory" && _endsWithToken(previous.text, previous.glyphs, _univerjs_core.DataStreamTreeTokenType.PARAGRAPH) && shapedText.glyphs.length > 0 && shapedText.glyphs.some((glyph) => glyph.streamType === _univerjs_core.DataStreamTreeTokenType.BLOCK_END) && shapedText.glyphs.every((glyph, index) => glyph.width === 0 && (glyph.streamType === _univerjs_core.DataStreamTreeTokenType.BLOCK_END || index === shapedText.glyphs.length - 1 && glyph.streamType === _univerjs_core.DataStreamTreeTokenType.SECTION_BREAK))) result[result.length - 1] = {
16059
+ ...previous,
16060
+ text: previous.text + shapedText.text,
16061
+ glyphs: [...previous.glyphs, ...shapedText.glyphs]
16062
+ };
16063
+ else result.push(shapedText);
16064
+ }
16065
+ return result;
16066
+ }
16054
16067
  function _mergeAdjacentCustomBlockShapedTexts(shapedTextList, customBlockDrawings) {
16055
16068
  const mergedShapedTextList = [];
16056
16069
  for (const originShapedText of shapedTextList) {
@@ -16533,7 +16546,7 @@ function _prepareLineBreaking(ctx, viewModel, curPage, paragraphNode, sectionBre
16533
16546
  ...getFontCreateConfig(endIndex - paragraphNode.contentStartIndex, viewModel, paragraphNode, sectionBreakConfig, {
16534
16547
  ...paragraph,
16535
16548
  paragraphStyle: resolvedParagraphStyle
16536
- }).textStyle,
16549
+ }, false).textStyle,
16537
16550
  ul: { s: _univerjs_core.BooleanNumber.FALSE }
16538
16551
  } : void 0;
16539
16552
  const bulletSkeleton = dealWithBullet(bullet, lists, listLevelAncestors, localeService, false, markerTextStyle);
@@ -16602,7 +16615,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16602
16615
  let deferredRenderedMarkers = [];
16603
16616
  const retainedBreaks = (_ctx$footnoteLayout = ctx.footnoteLayout) === null || _ctx$footnoteLayout === void 0 ? void 0 : _ctx$footnoteLayout.getReferencePageBreaks(paragraphNode.endIndex);
16604
16617
  const referencePageBreaks = retainedBreaks ? new Set(retainedBreaks.map((offset) => offset - paragraphNode.contentStartIndex)) : void 0;
16605
- const mergedShapedTextList = _mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId);
16618
+ const mergedShapedTextList = _mergeTrailingBlockEndShapedTexts(_mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId));
16606
16619
  for (let shapedIndex = 0; shapedIndex < mergedShapedTextList.length; shapedIndex++) {
16607
16620
  const { text, glyphs, breakPointType } = mergedShapedTextList[shapedIndex];
16608
16621
  const textStartIndex = paragraphNode.contentStartIndex + shapedTextOffset;
@@ -16612,6 +16625,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16612
16625
  const textEndIndex = textStartIndex + textGlyphCount;
16613
16626
  const pushPending = (pendingGlyphs = glyphs, layoutBreakPointType = breakPointType) => {
16614
16627
  if (pendingGlyphs.length === 0) return;
16628
+ const markerSourceIndex = textStartIndex - paragraphNode.contentStartIndex - _glyphCount(deferredRenderedMarkers);
16615
16629
  if (deferredRenderedMarkers.length > 0) {
16616
16630
  pendingGlyphs = [...deferredRenderedMarkers, ...pendingGlyphs];
16617
16631
  deferredRenderedMarkers = [];
@@ -16619,7 +16633,16 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16619
16633
  syncActiveParagraphDrawings(pendingGlyphs, paragraphNonInlineSkeDrawings, paragraphInlineSkeDrawings, paragraphNonInlineSkeDrawingsByBlockId, paragraphInlineSkeDrawingsByBlockId);
16620
16634
  const nonFlowAnchor = isNonFlowFloatingAnchor(pendingGlyphs, paragraphNonInlineSkeDrawings);
16621
16635
  const preserveParagraphStart = nonFlowAnchor && mergedShapedTextList.slice(shapedIndex + 1).some(({ glyphs }) => glyphs.some((glyph) => glyph.width > 0 && glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.PARAGRAPH && glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.SECTION_BREAK && glyph.streamType !== _univerjs_core.DataStreamTreeTokenType.DOCS_END));
16622
- allPages = layoutParagraph(ctx, pendingGlyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || !nonFlowAnchor && hasOnlyFloatingCustomBlockGlyphs(pendingGlyphs, paragraphNonInlineSkeDrawingsByBlockId), layoutBreakPointType, renderParagraphBullet && !preserveParagraphStart, startNewLine);
16636
+ const renderBullet = renderParagraphBullet && !preserveParagraphStart;
16637
+ const paragraph = renderBullet && paragraphConfig.bulletSkeleton ? viewModel.getParagraph(paragraphNode.endIndex) : void 0;
16638
+ const markerTextStyle = paragraph ? getFontCreateConfig(markerSourceIndex, viewModel, paragraphNode, sectionBreakConfig, {
16639
+ ...paragraph,
16640
+ paragraphStyle: paragraphConfig.paragraphStyle
16641
+ }, false).textStyle : void 0;
16642
+ allPages = layoutParagraph(ctx, pendingGlyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || !nonFlowAnchor && hasOnlyFloatingCustomBlockGlyphs(pendingGlyphs, paragraphNonInlineSkeDrawingsByBlockId), layoutBreakPointType, renderBullet, startNewLine, markerTextStyle ? {
16643
+ cl: markerTextStyle.cl,
16644
+ ul: markerTextStyle.ul
16645
+ } : void 0);
16623
16646
  if (!preserveParagraphStart) {
16624
16647
  isParagraphFirstShapedText = false;
16625
16648
  renderParagraphBullet = false;
@@ -17819,7 +17842,7 @@ function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth, hang
17819
17842
  const shrinkability = precedingGlyphs !== void 0 && (wordFitsWithPunctuationCompression || spacedWesternWordFits || !precedingLineCanStretch && offsetLeft + width - trailingShrinkability - hangingExtra - divideWidth <= divideWidth - offsetLeft) && !precedingGlyphs.some((glyph) => glyph.glyphType === 4) && !glyphGroup.some((glyph) => glyph.glyphType === 4) ? getGlyphGroupShrinkability(precedingGlyphs) + getGlyphGroupShrinkability(glyphGroup) - (trailingAutoSpacing + leadingAutoSpacing) / 2 : trailingShrinkability;
17820
17843
  return isBeyondDivideWidth(offsetLeft + width - shrinkability - hangingExtra, divideWidth, lineWrapTolerance);
17821
17844
  }
17822
- function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false) {
17845
+ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false, markerTextStyle) {
17823
17846
  paragraphConfig.documentCompatibilityPolicy ??= sectionBreakConfig.documentCompatibilityPolicy;
17824
17847
  if (isParagraphFirstShapedText || startNewLine) {
17825
17848
  if (renderBullet && paragraphConfig.bulletSkeleton) {
@@ -17828,7 +17851,14 @@ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
17828
17851
  const { gridType = _univerjs_core.GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig;
17829
17852
  const { snapToGrid = _univerjs_core.BooleanNumber.TRUE } = paragraphStyle;
17830
17853
  const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
17831
- const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], bulletSkeleton, charSpaceApply, paragraphConfig.documentCompatibilityPolicy ?? sectionBreakConfig.documentCompatibilityPolicy);
17854
+ const resolvedBulletSkeleton = markerTextStyle ? {
17855
+ ...bulletSkeleton,
17856
+ ts: {
17857
+ ...markerTextStyle,
17858
+ ...bulletSkeleton.ts
17859
+ }
17860
+ } : bulletSkeleton;
17861
+ const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], resolvedBulletSkeleton, charSpaceApply, paragraphConfig.documentCompatibilityPolicy ?? sectionBreakConfig.documentCompatibilityPolicy);
17832
17862
  const paragraphProperties = bulletSkeleton.paragraphProperties || {};
17833
17863
  paragraphConfig.paragraphStyle = {
17834
17864
  ...paragraphProperties,
@@ -18332,7 +18362,7 @@ function _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionB
18332
18362
  };
18333
18363
  }
18334
18364
  function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics) {
18335
- var _sectionBreakConfig$d2;
18365
+ var _paragraphConfig$skeT, _sectionBreakConfig$d2;
18336
18366
  const metrics = _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18337
18367
  const { preLine, paragraphIndex, paragraphStyle, spaceAbove, spaceBelow, spacingRule, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, drawingMLLineHeight, drawingMLBaselineHeight, isZeroWidthNonFlowFloatingAnchorLine, isStructuralTableAnchorLine, isEmptyFramedParagraph, isStandalonePageBoundary, wordAutoLeading } = metrics;
18338
18368
  let { paddingTop, paddingBottom, contentHeight, lineSpacingApply } = metrics;
@@ -18346,10 +18376,12 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
18346
18376
  var _section$children$;
18347
18377
  return index > 0 && ((_section$children$ = section.children[0]) === null || _section$children$ === void 0 ? void 0 : _section$children$.endIndex) === paragraphIndex;
18348
18378
  }) : void 0;
18379
+ const hasInlineTableBoundary = isParagraphFirstShapedText && ((_paragraphConfig$skeT = paragraphConfig.skeTablesInParagraph) === null || _paragraphConfig$skeT === void 0 || (_paragraphConfig$skeT = _paragraphConfig$skeT.find((item) => !item.hasPositioned)) === null || _paragraphConfig$skeT === void 0 ? void 0 : _paragraphConfig$skeT.table.tableSource.textWrap) === _univerjs_core.TableTextWrapType.NONE;
18380
+ const spaceBeforeTable = hasInlineTableBoundary ? Math.max(0, (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0) : 0;
18349
18381
  let { marginTop, spaceBelowApply } = isHiddenParagraph ? {
18350
18382
  marginTop: 0,
18351
18383
  spaceBelowApply: (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0
18352
- } : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine, _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
18384
+ } : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, hasInlineTableBoundary ? void 0 : preLine, !hasInlineTableBoundary && _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
18353
18385
  if (preLine) marginTop += sectionBreakConfig.lineGap ?? 0;
18354
18386
  if (startingSection && marginTop > 0 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy)) marginTop = _collapseSectionBeforeSpacing(ctx, startingSection.children[0].startIndex - 2, marginTop);
18355
18387
  if (positionedCustomBlockOnly) spaceBelowApply = 0;
@@ -18388,6 +18420,7 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
18388
18420
  paddingBottom,
18389
18421
  contentHeight,
18390
18422
  marginTop,
18423
+ spaceBeforeTable,
18391
18424
  spaceBelowApply,
18392
18425
  borderTopSpace,
18393
18426
  borderBottomSpace,
@@ -18476,7 +18509,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
18476
18509
  const previousLineHeight = preLine === null || preLine === void 0 ? void 0 : preLine.lineHeight;
18477
18510
  const previousLineMarginBottom = preLine === null || preLine === void 0 ? void 0 : preLine.marginBottom;
18478
18511
  const { paragraphNonInlineSkeDrawings, skeTablesInParagraph, skeHeaders, skeFooters, pDrawingAnchor, paragraphIndex } = paragraphConfig;
18479
- const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18512
+ const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBeforeTable, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18480
18513
  const { indentFirstLine, hanging, indentStart, indentEnd } = paragraphStyle;
18481
18514
  const lineHeight = marginTop + paddingTop + contentHeight + paddingBottom;
18482
18515
  const { charSpace, defaultTabStop } = getCharSpaceConfig(sectionBreakConfig, paragraphConfig);
@@ -18494,7 +18527,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
18494
18527
  const { deferredInlineGroupAnchorDrawings, deferredTopBottomAnchorDrawings } = _positionLineDrawings(ctx, glyphGroup, column, lastPage, paragraphConfig, lineTop, lineHeight, paragraphAnchorLeft, hasInlineCustomBlock, isParagraphFirstShapedText);
18495
18528
  if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
18496
18529
  var _pDrawingAnchor$get2;
18497
- needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
18530
+ needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop + spaceBeforeTable, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
18498
18531
  }
18499
18532
  const hasSameParagraphTopBottomDrawingWithInline = hasInlineCustomBlock && paragraphNonInlineSkeDrawings != null && [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingOrigin.layoutType === _univerjs_core.PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
18500
18533
  let tableFlowTop = lineTop;
@@ -18673,7 +18706,7 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, pages, column,
18673
18706
  if (firstUnPositionedTable.isSlideTable === false || tableSource.textWrap === _univerjs_core.TableTextWrapType.NONE) switch (tableSource.textWrap) {
18674
18707
  case _univerjs_core.TableTextWrapType.NONE:
18675
18708
  table.top = section.top + lineTop;
18676
- table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent);
18709
+ table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), tableSource));
18677
18710
  __avoidFlowAffectingDrawingsForTable(table, page, column);
18678
18711
  __avoidNonOverlappingFloatingTables(table, page);
18679
18712
  break;
@@ -20113,7 +20146,7 @@ const DEFAULT_TEXT_RUN = {
20113
20146
  st: 0,
20114
20147
  ed: 0
20115
20148
  };
20116
- function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph) {
20149
+ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph, includeCustomRangeStyle = true) {
20117
20150
  var _textStyle$eastAsiaFo;
20118
20151
  const { gridType = _univerjs_core.GridType.LINES, charSpace = 0, documentTextStyle = {}, pageSize = {
20119
20152
  width: Number.POSITIVE_INFINITY,
@@ -20127,7 +20160,7 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
20127
20160
  const customDecoration = viewModel.getCustomDecoration(index + startIndex);
20128
20161
  const showCustomDecoration = customDecoration && customDecoration.show !== false;
20129
20162
  const customDecorationStyle = showCustomDecoration ? getCustomDecorationStyle(customDecoration) : null;
20130
- const customRange = viewModel.getCustomRange(index + startIndex);
20163
+ const customRange = includeCustomRangeStyle ? viewModel.getCustomRange(index + startIndex) : null;
20131
20164
  const showCustomRange = customRange && customRange.show !== false;
20132
20165
  const customRangeStyle = showCustomRange ? getCustomRangeStyle(customRange) : null;
20133
20166
  const hasAddonStyle = showCustomRange || showCustomDecoration || !!bullet || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.namedStyleType) || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.textStyle) != null || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.paragraphMarkTextStyle) != null;
@@ -35744,7 +35777,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
35744
35777
  //#endregion
35745
35778
  //#region package.json
35746
35779
  var name = "@univerjs/engine-render";
35747
- var version = "1.2.0";
35780
+ var version = "1.3.0";
35748
35781
 
35749
35782
  //#endregion
35750
35783
  //#region src/config/config.ts
package/lib/es/index.js CHANGED
@@ -14850,7 +14850,7 @@ function _finishTableSkeletonBuild(state) {
14850
14850
  applyTableOuterBorderSpacing(tableSkeleton, state.sectionBreakConfig);
14851
14851
  for (const rowSkeleton of tableSkeleton.rows) _verticalAlignInCell(rowSkeleton, table.tableRows[rowSkeleton.index]);
14852
14852
  const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
14853
- tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent);
14853
+ tableSkeleton.left = getTableLeft(pageWidth - marginLeft - marginRight, state.tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
14854
14854
  state.complete = true;
14855
14855
  }
14856
14856
  function applyMergedCellContentHeights(tableSkeleton, mergedCellContentHeights) {
@@ -15005,7 +15005,7 @@ function cachePrecomputedSlicedTableSkeletons(ctx, tableNode, availableHeight, r
15005
15005
  });
15006
15006
  }
15007
15007
  function _finishTableSkeletonsBuild(state) {
15008
- updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table);
15008
+ updateTableSkeletonsPosition(state.createCache, state.curPage, state.skeTables, state.table, state.sectionBreakConfig);
15009
15009
  state.skeTables.forEach((table) => applyTableOuterBorderSpacing(table, state.sectionBreakConfig));
15010
15010
  const policy = state.sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
15011
15011
  state.result = {
@@ -15064,7 +15064,7 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
15064
15064
  cellPageHeights = dealWithTableRow(ctx, curPage, skeTables, viewModel, sectionBreakConfig, rowNode, row, table, createCache, false, precomputedTable === null || precomputedTable === void 0 ? void 0 : precomputedTable.rows[row], void 0, cellPageHeights);
15065
15065
  while (cellPageHeights);
15066
15066
  }
15067
- updateTableSkeletonsPosition(createCache, curPage, skeTables, table);
15067
+ updateTableSkeletonsPosition(createCache, curPage, skeTables, table, sectionBreakConfig);
15068
15068
  skeTables.forEach((table) => applyTableOuterBorderSpacing(table, sectionBreakConfig));
15069
15069
  const documentCompatibilityPolicy = sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy();
15070
15070
  return {
@@ -15072,10 +15072,10 @@ function createTableSkeletons(ctx, curPage, viewModel, tableNode, sectionBreakCo
15072
15072
  fromCurrentPage: createCache.fromCurrentPage !== false && skeTables[0].height <= availableHeight + documentCompatibilityPolicy.table.currentPageOverflowTolerance
15073
15073
  };
15074
15074
  }
15075
- function updateTableSkeletonsPosition(cache, curPage, skeTables, table) {
15075
+ function updateTableSkeletonsPosition(cache, curPage, skeTables, table, sectionBreakConfig) {
15076
15076
  const { pageWidth, marginLeft = 0, marginRight = 0 } = curPage;
15077
15077
  const { tableWidth } = cache;
15078
- const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent);
15078
+ const tableLeft = getTableLeft(pageWidth - marginLeft - marginRight, tableWidth, table.align, table.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), table));
15079
15079
  const rowFragments = /* @__PURE__ */ new Map();
15080
15080
  for (const part of skeTables) for (const row of part.rows) if (!row.isRepeatRow) rowFragments.set(row.index, (rowFragments.get(row.index) ?? 0) + 1);
15081
15081
  let tableIndex = 0;
@@ -15409,11 +15409,11 @@ function resolveTableLayoutColumns(table, availableWidth, traditional = false) {
15409
15409
  }))
15410
15410
  };
15411
15411
  }
15412
- function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }) {
15412
+ function getTableLeft(pageWidth, tableWidth, align, indent = { v: 0 }, allowMarginOverflow = false) {
15413
15413
  switch (align) {
15414
15414
  case TableAlignmentType.START: return indent.v;
15415
- case TableAlignmentType.END: return Math.max(0, pageWidth - tableWidth);
15416
- case TableAlignmentType.CENTER: return Math.max(0, (pageWidth - tableWidth) / 2);
15415
+ case TableAlignmentType.END: return allowMarginOverflow ? pageWidth - tableWidth : Math.max(0, pageWidth - tableWidth);
15416
+ case TableAlignmentType.CENTER: return allowMarginOverflow ? (pageWidth - tableWidth) / 2 : Math.max(0, (pageWidth - tableWidth) / 2);
15417
15417
  default: throw new Error("Unknown table alignment type");
15418
15418
  }
15419
15419
  }
@@ -16050,6 +16050,19 @@ function _isDocxColumnBreakVisuallyBlankColumn(column) {
16050
16050
  function _hasOnlyCustomBlockGlyphs(glyphs) {
16051
16051
  return glyphs.length > 0 && glyphs.every((glyph) => glyph.streamType === DataStreamTreeTokenType.CUSTOM_BLOCK);
16052
16052
  }
16053
+ function _mergeTrailingBlockEndShapedTexts(shapedTextList) {
16054
+ const result = [];
16055
+ for (const shapedText of shapedTextList) {
16056
+ const previous = result[result.length - 1];
16057
+ if ((previous === null || previous === void 0 ? void 0 : previous.breakPointType) === "Mandatory" && _endsWithToken(previous.text, previous.glyphs, DataStreamTreeTokenType.PARAGRAPH) && shapedText.glyphs.length > 0 && shapedText.glyphs.some((glyph) => glyph.streamType === DataStreamTreeTokenType.BLOCK_END) && shapedText.glyphs.every((glyph, index) => glyph.width === 0 && (glyph.streamType === DataStreamTreeTokenType.BLOCK_END || index === shapedText.glyphs.length - 1 && glyph.streamType === DataStreamTreeTokenType.SECTION_BREAK))) result[result.length - 1] = {
16058
+ ...previous,
16059
+ text: previous.text + shapedText.text,
16060
+ glyphs: [...previous.glyphs, ...shapedText.glyphs]
16061
+ };
16062
+ else result.push(shapedText);
16063
+ }
16064
+ return result;
16065
+ }
16053
16066
  function _mergeAdjacentCustomBlockShapedTexts(shapedTextList, customBlockDrawings) {
16054
16067
  const mergedShapedTextList = [];
16055
16068
  for (const originShapedText of shapedTextList) {
@@ -16532,7 +16545,7 @@ function _prepareLineBreaking(ctx, viewModel, curPage, paragraphNode, sectionBre
16532
16545
  ...getFontCreateConfig(endIndex - paragraphNode.contentStartIndex, viewModel, paragraphNode, sectionBreakConfig, {
16533
16546
  ...paragraph,
16534
16547
  paragraphStyle: resolvedParagraphStyle
16535
- }).textStyle,
16548
+ }, false).textStyle,
16536
16549
  ul: { s: BooleanNumber.FALSE }
16537
16550
  } : void 0;
16538
16551
  const bulletSkeleton = dealWithBullet(bullet, lists, listLevelAncestors, localeService, false, markerTextStyle);
@@ -16601,7 +16614,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16601
16614
  let deferredRenderedMarkers = [];
16602
16615
  const retainedBreaks = (_ctx$footnoteLayout = ctx.footnoteLayout) === null || _ctx$footnoteLayout === void 0 ? void 0 : _ctx$footnoteLayout.getReferencePageBreaks(paragraphNode.endIndex);
16603
16616
  const referencePageBreaks = retainedBreaks ? new Set(retainedBreaks.map((offset) => offset - paragraphNode.contentStartIndex)) : void 0;
16604
- const mergedShapedTextList = _mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId);
16617
+ const mergedShapedTextList = _mergeTrailingBlockEndShapedTexts(_mergeAdjacentCustomBlockShapedTexts(_splitAtReferencePageBreaks(shapedTextList, referencePageBreaks), paragraphNonInlineSkeDrawingsByBlockId));
16605
16618
  for (let shapedIndex = 0; shapedIndex < mergedShapedTextList.length; shapedIndex++) {
16606
16619
  const { text, glyphs, breakPointType } = mergedShapedTextList[shapedIndex];
16607
16620
  const textStartIndex = paragraphNode.contentStartIndex + shapedTextOffset;
@@ -16611,6 +16624,7 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16611
16624
  const textEndIndex = textStartIndex + textGlyphCount;
16612
16625
  const pushPending = (pendingGlyphs = glyphs, layoutBreakPointType = breakPointType) => {
16613
16626
  if (pendingGlyphs.length === 0) return;
16627
+ const markerSourceIndex = textStartIndex - paragraphNode.contentStartIndex - _glyphCount(deferredRenderedMarkers);
16614
16628
  if (deferredRenderedMarkers.length > 0) {
16615
16629
  pendingGlyphs = [...deferredRenderedMarkers, ...pendingGlyphs];
16616
16630
  deferredRenderedMarkers = [];
@@ -16618,7 +16632,16 @@ function _layoutShapedTexts({ ctx, viewModel, shapedTextList, allPages: initialP
16618
16632
  syncActiveParagraphDrawings(pendingGlyphs, paragraphNonInlineSkeDrawings, paragraphInlineSkeDrawings, paragraphNonInlineSkeDrawingsByBlockId, paragraphInlineSkeDrawingsByBlockId);
16619
16633
  const nonFlowAnchor = isNonFlowFloatingAnchor(pendingGlyphs, paragraphNonInlineSkeDrawings);
16620
16634
  const preserveParagraphStart = nonFlowAnchor && mergedShapedTextList.slice(shapedIndex + 1).some(({ glyphs }) => glyphs.some((glyph) => glyph.width > 0 && glyph.streamType !== DataStreamTreeTokenType.PARAGRAPH && glyph.streamType !== DataStreamTreeTokenType.SECTION_BREAK && glyph.streamType !== DataStreamTreeTokenType.DOCS_END));
16621
- allPages = layoutParagraph(ctx, pendingGlyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || !nonFlowAnchor && hasOnlyFloatingCustomBlockGlyphs(pendingGlyphs, paragraphNonInlineSkeDrawingsByBlockId), layoutBreakPointType, renderParagraphBullet && !preserveParagraphStart, startNewLine);
16635
+ const renderBullet = renderParagraphBullet && !preserveParagraphStart;
16636
+ const paragraph = renderBullet && paragraphConfig.bulletSkeleton ? viewModel.getParagraph(paragraphNode.endIndex) : void 0;
16637
+ const markerTextStyle = paragraph ? getFontCreateConfig(markerSourceIndex, viewModel, paragraphNode, sectionBreakConfig, {
16638
+ ...paragraph,
16639
+ paragraphStyle: paragraphConfig.paragraphStyle
16640
+ }, false).textStyle : void 0;
16641
+ allPages = layoutParagraph(ctx, pendingGlyphs, allPages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText || !nonFlowAnchor && hasOnlyFloatingCustomBlockGlyphs(pendingGlyphs, paragraphNonInlineSkeDrawingsByBlockId), layoutBreakPointType, renderBullet, startNewLine, markerTextStyle ? {
16642
+ cl: markerTextStyle.cl,
16643
+ ul: markerTextStyle.ul
16644
+ } : void 0);
16622
16645
  if (!preserveParagraphStart) {
16623
16646
  isParagraphFirstShapedText = false;
16624
16647
  renderParagraphBullet = false;
@@ -17818,7 +17841,7 @@ function isGlyphGroupBeyondDivideWidth(glyphGroup, offsetLeft, divideWidth, hang
17818
17841
  const shrinkability = precedingGlyphs !== void 0 && (wordFitsWithPunctuationCompression || spacedWesternWordFits || !precedingLineCanStretch && offsetLeft + width - trailingShrinkability - hangingExtra - divideWidth <= divideWidth - offsetLeft) && !precedingGlyphs.some((glyph) => glyph.glyphType === 4) && !glyphGroup.some((glyph) => glyph.glyphType === 4) ? getGlyphGroupShrinkability(precedingGlyphs) + getGlyphGroupShrinkability(glyphGroup) - (trailingAutoSpacing + leadingAutoSpacing) / 2 : trailingShrinkability;
17819
17842
  return isBeyondDivideWidth(offsetLeft + width - shrinkability - hangingExtra, divideWidth, lineWrapTolerance);
17820
17843
  }
17821
- function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false) {
17844
+ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, breakPointType = "Normal", renderBullet = isParagraphFirstShapedText, startNewLine = false, markerTextStyle) {
17822
17845
  paragraphConfig.documentCompatibilityPolicy ??= sectionBreakConfig.documentCompatibilityPolicy;
17823
17846
  if (isParagraphFirstShapedText || startNewLine) {
17824
17847
  if (renderBullet && paragraphConfig.bulletSkeleton) {
@@ -17827,7 +17850,14 @@ function layoutParagraph(ctx, glyphGroup, pages, sectionBreakConfig, paragraphCo
17827
17850
  const { gridType = GridType.LINES, charSpace = 0, defaultTabStop = 10.5 } = sectionBreakConfig;
17828
17851
  const { snapToGrid = BooleanNumber.TRUE } = paragraphStyle;
17829
17852
  const charSpaceApply = getCharSpaceApply(charSpace, defaultTabStop, gridType, snapToGrid);
17830
- const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], bulletSkeleton, charSpaceApply, paragraphConfig.documentCompatibilityPolicy ?? sectionBreakConfig.documentCompatibilityPolicy);
17853
+ const resolvedBulletSkeleton = markerTextStyle ? {
17854
+ ...bulletSkeleton,
17855
+ ts: {
17856
+ ...markerTextStyle,
17857
+ ...bulletSkeleton.ts
17858
+ }
17859
+ } : bulletSkeleton;
17860
+ const bulletGlyph = createSkeletonBulletGlyph(glyphGroup[0], resolvedBulletSkeleton, charSpaceApply, paragraphConfig.documentCompatibilityPolicy ?? sectionBreakConfig.documentCompatibilityPolicy);
17831
17861
  const paragraphProperties = bulletSkeleton.paragraphProperties || {};
17832
17862
  paragraphConfig.paragraphStyle = {
17833
17863
  ...paragraphProperties,
@@ -18331,7 +18361,7 @@ function _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionB
18331
18361
  };
18332
18362
  }
18333
18363
  function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics) {
18334
- var _sectionBreakConfig$d2;
18364
+ var _paragraphConfig$skeT, _sectionBreakConfig$d2;
18335
18365
  const metrics = _getParagraphContentMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18336
18366
  const { preLine, paragraphIndex, paragraphStyle, spaceAbove, spaceBelow, spacingRule, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, drawingMLLineHeight, drawingMLBaselineHeight, isZeroWidthNonFlowFloatingAnchorLine, isStructuralTableAnchorLine, isEmptyFramedParagraph, isStandalonePageBoundary, wordAutoLeading } = metrics;
18337
18367
  let { paddingTop, paddingBottom, contentHeight, lineSpacingApply } = metrics;
@@ -18345,10 +18375,12 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
18345
18375
  var _section$children$;
18346
18376
  return index > 0 && ((_section$children$ = section.children[0]) === null || _section$children$ === void 0 ? void 0 : _section$children$.endIndex) === paragraphIndex;
18347
18377
  }) : void 0;
18378
+ const hasInlineTableBoundary = isParagraphFirstShapedText && ((_paragraphConfig$skeT = paragraphConfig.skeTablesInParagraph) === null || _paragraphConfig$skeT === void 0 || (_paragraphConfig$skeT = _paragraphConfig$skeT.find((item) => !item.hasPositioned)) === null || _paragraphConfig$skeT === void 0 ? void 0 : _paragraphConfig$skeT.table.tableSource.textWrap) === TableTextWrapType.NONE;
18379
+ const spaceBeforeTable = hasInlineTableBoundary ? Math.max(0, (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0) : 0;
18348
18380
  let { marginTop, spaceBelowApply } = isHiddenParagraph ? {
18349
18381
  marginTop: 0,
18350
18382
  spaceBelowApply: (preLine === null || preLine === void 0 ? void 0 : preLine.spaceBelowApply) ?? 0
18351
- } : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, preLine, _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
18383
+ } : __getParagraphSpace(((_sectionBreakConfig$d2 = sectionBreakConfig.documentCompatibilityPolicy) === null || _sectionBreakConfig$d2 === void 0 ? void 0 : _sectionBreakConfig$d2.mode) === "drawingml", lineSpacingApply, suppressCellAutoSpaceAbove ? void 0 : spaceAbove, spaceBelow, isParagraphFirstShapedText, hasInlineTableBoundary ? void 0 : preLine, !hasInlineTableBoundary && _shouldSuppressPageTopSpacing(lastPage, column, paragraphConfig, preLine, firstPageNumber, startingSection != null), drawingMLLineHeight);
18352
18384
  if (preLine) marginTop += sectionBreakConfig.lineGap ?? 0;
18353
18385
  if (startingSection && marginTop > 0 && isTraditionalDocumentCompatibility(paragraphConfig.documentCompatibilityPolicy)) marginTop = _collapseSectionBeforeSpacing(ctx, startingSection.children[0].startIndex - 2, marginTop);
18354
18386
  if (positionedCustomBlockOnly) spaceBelowApply = 0;
@@ -18387,6 +18419,7 @@ function _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBrea
18387
18419
  paddingBottom,
18388
18420
  contentHeight,
18389
18421
  marginTop,
18422
+ spaceBeforeTable,
18390
18423
  spaceBelowApply,
18391
18424
  borderTopSpace,
18392
18425
  borderBottomSpace,
@@ -18475,7 +18508,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
18475
18508
  const previousLineHeight = preLine === null || preLine === void 0 ? void 0 : preLine.lineHeight;
18476
18509
  const previousLineMarginBottom = preLine === null || preLine === void 0 ? void 0 : preLine.marginBottom;
18477
18510
  const { paragraphNonInlineSkeDrawings, skeTablesInParagraph, skeHeaders, skeFooters, pDrawingAnchor, paragraphIndex } = paragraphConfig;
18478
- const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18511
+ const { paragraphStyle, spacingRule, drawingMLLineHeight, drawingMLBaselineHeight, gridType, snapToGrid, hasInlineCustomBlock, positionedCustomBlockOnly, isStandalonePageBoundary, paddingTop, paddingBottom, contentHeight, marginTop, spaceBeforeTable, spaceBelowApply, borderTopSpace, borderBottomSpace, wordAutoLeading } = _getParagraphLineMetrics(ctx, glyphGroup, lastPage, column, sectionBreakConfig, paragraphConfig, isParagraphFirstShapedText, defaultSpanMetrics);
18479
18512
  const { indentFirstLine, hanging, indentStart, indentEnd } = paragraphStyle;
18480
18513
  const lineHeight = marginTop + paddingTop + contentHeight + paddingBottom;
18481
18514
  const { charSpace, defaultTabStop } = getCharSpaceConfig(sectionBreakConfig, paragraphConfig);
@@ -18493,7 +18526,7 @@ function _lineOperator(ctx, glyphGroup, pages, sectionBreakConfig, paragraphConf
18493
18526
  const { deferredInlineGroupAnchorDrawings, deferredTopBottomAnchorDrawings } = _positionLineDrawings(ctx, glyphGroup, column, lastPage, paragraphConfig, lineTop, lineHeight, paragraphAnchorLeft, hasInlineCustomBlock, isParagraphFirstShapedText);
18494
18527
  if (skeTablesInParagraph != null && skeTablesInParagraph.length > 0) {
18495
18528
  var _pDrawingAnchor$get2;
18496
- needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
18529
+ needOpenNewPageByTableLayout = _updateAndPositionTable(ctx, lineTop + spaceBeforeTable, lineHeight, lastPage, pages, column, section, skeTablesInParagraph, paragraphConfig.paragraphIndex, sectionBreakConfig, pDrawingAnchor === null || pDrawingAnchor === void 0 || (_pDrawingAnchor$get2 = pDrawingAnchor.get(paragraphIndex)) === null || _pDrawingAnchor$get2 === void 0 ? void 0 : _pDrawingAnchor$get2.top);
18497
18530
  }
18498
18531
  const hasSameParagraphTopBottomDrawingWithInline = hasInlineCustomBlock && paragraphNonInlineSkeDrawings != null && [...paragraphNonInlineSkeDrawings.values()].some((drawing) => drawing.drawingOrigin.layoutType === PositionedObjectLayoutType.WRAP_TOP_AND_BOTTOM);
18499
18532
  let tableFlowTop = lineTop;
@@ -18672,7 +18705,7 @@ function _updateAndPositionTable(ctx, lineTop, lineHeight, page, pages, column,
18672
18705
  if (firstUnPositionedTable.isSlideTable === false || tableSource.textWrap === TableTextWrapType.NONE) switch (tableSource.textWrap) {
18673
18706
  case TableTextWrapType.NONE:
18674
18707
  table.top = section.top + lineTop;
18675
- table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent);
18708
+ table.left = column.left + getTableLeft(column.width, table.width, tableSource.align, tableSource.indent, shouldAllowImportedTableMarginOverflow(sectionBreakConfig.documentCompatibilityPolicy ?? getDocumentCompatibilityPolicy(), tableSource));
18676
18709
  __avoidFlowAffectingDrawingsForTable(table, page, column);
18677
18710
  __avoidNonOverlappingFloatingTables(table, page);
18678
18711
  break;
@@ -20112,7 +20145,7 @@ const DEFAULT_TEXT_RUN = {
20112
20145
  st: 0,
20113
20146
  ed: 0
20114
20147
  };
20115
- function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph) {
20148
+ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig, paragraph, includeCustomRangeStyle = true) {
20116
20149
  var _textStyle$eastAsiaFo;
20117
20150
  const { gridType = GridType.LINES, charSpace = 0, documentTextStyle = {}, pageSize = {
20118
20151
  width: Number.POSITIVE_INFINITY,
@@ -20126,7 +20159,7 @@ function getFontCreateConfig(index, viewModel, paragraphNode, sectionBreakConfig
20126
20159
  const customDecoration = viewModel.getCustomDecoration(index + startIndex);
20127
20160
  const showCustomDecoration = customDecoration && customDecoration.show !== false;
20128
20161
  const customDecorationStyle = showCustomDecoration ? getCustomDecorationStyle(customDecoration) : null;
20129
- const customRange = viewModel.getCustomRange(index + startIndex);
20162
+ const customRange = includeCustomRangeStyle ? viewModel.getCustomRange(index + startIndex) : null;
20130
20163
  const showCustomRange = customRange && customRange.show !== false;
20131
20164
  const customRangeStyle = showCustomRange ? getCustomRangeStyle(customRange) : null;
20132
20165
  const hasAddonStyle = showCustomRange || showCustomDecoration || !!bullet || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.namedStyleType) || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.textStyle) != null || (paragraphStyle === null || paragraphStyle === void 0 ? void 0 : paragraphStyle.paragraphMarkTextStyle) != null;
@@ -35743,7 +35776,7 @@ Engine = __decorate([__decorateParam(2, ICanvasColorService)], Engine);
35743
35776
  //#endregion
35744
35777
  //#region package.json
35745
35778
  var name = "@univerjs/engine-render";
35746
- var version = "1.2.0";
35779
+ var version = "1.3.0";
35747
35780
 
35748
35781
  //#endregion
35749
35782
  //#region src/config/config.ts