Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(render-engine): paragraph horizontal align (#4010)
Ran Luo045eef36fd0e
diff --git a/packages/engine-render/src/components/docs/layout/block/paragraph/line-adjustment.ts b/packages/engine-render/src/components/docs/layout/block/paragraph/line-adjustment.tsindex 58bb538d79..e6565dfd62 100644--- a/packages/engine-render/src/components/docs/layout/block/paragraph/line-adjustment.ts+++ b/packages/engine-render/src/components/docs/layout/block/paragraph/line-adjustment.ts@@ -14,17 +14,17 @@* limitations under the License.*/-import { HorizontalAlign } from '@univerjs/core';import type { IParagraphStyle } from '@univerjs/core';+import type { ISectionBreakConfig } from '../../../../../basics';+import type { IDocumentSkeletonDivide, IDocumentSkeletonLine, IDocumentSkeletonPage } from '../../../../../basics/i-document-skeleton-cached';+import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';+import type { DocumentViewModel } from '../../../view-model/document-view-model';+import { HorizontalAlign } from '@univerjs/core';import { hasCJK, hasCJKText, isCjkLeftAlignedPunctuation, isCjkRightAlignedPunctuation } from '../../../../../basics/tools';import { BreakPointType } from '../../line-breaker/break';import { isLetter } from '../../line-breaker/enhancers/utils';import { createHyphenDashGlyph, glyphShrinkLeft, glyphShrinkRight, setGlyphGroupLeft } from '../../model/glyph';import { getFontConfigFromLastGlyph, getGlyphGroupWidth, lineIterator } from '../../tools';-import type { ISectionBreakConfig } from '../../../../../basics';-import type { IDocumentSkeletonDivide, IDocumentSkeletonLine, IDocumentSkeletonPage } from '../../../../../basics/i-document-skeleton-cached';-import type { DataStreamTreeNode } from '../../../view-model/data-stream-tree-node';-import type { DocumentViewModel } from '../../../view-model/document-view-model';// How much a character should hang into the end margin.// For more discussion, see:@@ -186,6 +186,9 @@ function horizontalAlignHandler(line: IDocumentSkeletonLine, horizontalAlign: Ho} else if (horizontalAlign === HorizontalAlign.RIGHT) {divide.paddingLeft = width - glyphGroupWidth;}++ // To fix https://github.com/dream-num/univer-pro/issues/2930+ divide.paddingLeft = Math.max(divide.paddingLeft, 0);}}diff --git a/packages/engine-render/src/components/docs/layout/block/section.ts b/packages/engine-render/src/components/docs/layout/block/section.tsindex c966f4c854..ef53827ac3 100644--- a/packages/engine-render/src/components/docs/layout/block/section.ts+++ b/packages/engine-render/src/components/docs/layout/block/section.ts@@ -15,12 +15,12 @@*/import type { Nullable } from '@univerjs/core';-import { DataStreamTreeNodeType } from '@univerjs/core';import type { IDocumentSkeletonPage } from '../../../../basics/i-document-skeleton-cached';import type { ISectionBreakConfig } from '../../../../basics/interfaces';import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';import type { DocumentViewModel } from '../../view-model/document-view-model';import type { ILayoutContext } from '../tools';+import { DataStreamTreeNodeType } from '@univerjs/core';import { createSkeletonPage } from '../model/page';import { dealWithBlockError } from './block-error';import { dealWidthParagraph } from './paragraph/paragraph-layout';diff --git a/packages/engine-render/src/components/docs/layout/block/table.ts b/packages/engine-render/src/components/docs/layout/block/table.tsindex f3ad4b1770..b1df95bb9f 100644--- a/packages/engine-render/src/components/docs/layout/block/table.ts+++ b/packages/engine-render/src/components/docs/layout/block/table.ts@@ -15,12 +15,12 @@*/import type { INumberUnit, ITable } from '@univerjs/core';-import { TableAlignmentType } from '@univerjs/core';import type { IDocumentSkeletonPage, IDocumentSkeletonRow, IDocumentSkeletonTable, ISectionBreakConfig } from '../../../../basics';import type { DataStreamTreeNode } from '../../view-model/data-stream-tree-node';import type { DocumentViewModel } from '../../view-model/document-view-model';-import { createSkeletonCellPage } from '../model/page';import type { ILayoutContext } from '../tools';+import { TableAlignmentType } from '@univerjs/core';+import { createSkeletonCellPage } from '../model/page';export function createTableSkeleton(ctx: ILayoutContext,