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: cell number display when set text wrap (#2314)
Ran Luo0144179a6128
diff --git a/packages/engine-render/src/components/docs/document.ts b/packages/engine-render/src/components/docs/document.tsindex 1b0df2d4b7..635c3a9207 100644--- a/packages/engine-render/src/components/docs/document.ts+++ b/packages/engine-render/src/components/docs/document.ts@@ -57,9 +57,9 @@ export class Documents extends DocComponent {docsTop: number = 0;- private _drawLiquid: Liquid;+ private _drawLiquid: Nullable<Liquid> = new Liquid();- private _findLiquid: Liquid;+ // private _findLiquid: Nullable<Liquid> = new Liquid();// private _hasEditor = false;@@ -72,10 +72,6 @@ export class Documents extends DocComponent {constructor(oKey: string, documentSkeleton?: DocumentSkeleton, config?: IDocumentsConfig) {super(oKey, documentSkeleton, config);- this._drawLiquid = new Liquid();-- this._findLiquid = new Liquid();-this._initialDefaultExtension();// this._addSkeletonChangeObserver(documentSkeleton);@@ -93,8 +89,8 @@ export class Documents extends DocComponent {this._skeletonObserver?.dispose();this._skeletonObserver = null;this.onPageRenderObservable.clear();- this._drawLiquid = null as unknown as Liquid;- this._findLiquid = null as unknown as Liquid;+ this._drawLiquid = null;+ // this._findLiquid = null;}getOffsetConfig(): IDocumentOffsetConfig {@@ -167,7 +163,7 @@ export class Documents extends DocComponent {override draw(ctx: UniverRenderingContext, bounds?: IViewportInfo) {const skeletonData = this.getSkeleton()?.getSkeletonData();- if (skeletonData == null) {+ if (skeletonData == null || this._drawLiquid == null) {return;}@@ -319,7 +315,12 @@ export class Documents extends DocComponent {this._drawLiquid.translate(0, -rotateTranslateY);rotateTranslateXListApply = rotateTranslateXList;- } else if (wrapStrategy === WrapStrategy.WRAP) {+ } else if (+ wrapStrategy === WrapStrategy.WRAP+ // Use fix: https://github.com/dream-num/univer-pro/issues/734+ && (horizontalAlign !== HorizontalAlign.UNSPECIFIED || cellValueType !== CellValueType.NUMBER)+ ) {+ // @Jocs, Why reset alignOffset.x? When you know the reason, add a descriptionalignOffset.x = pagePaddingLeft;}diff --git a/packages/sheets-ui/src/services/editor-bridge.service.ts b/packages/sheets-ui/src/services/editor-bridge.service.tsindex 1df64ecd9f..1c885ea76b 100644--- a/packages/sheets-ui/src/services/editor-bridge.service.ts+++ b/packages/sheets-ui/src/services/editor-bridge.service.ts@@ -16,6 +16,7 @@import type { ICellDataForSheetInterceptor, IPosition, ISelectionCell, Nullable, Workbook } from '@univerjs/core';import {+ CellValueType,createInterceptorKey,Disposable,DOCS_NORMAL_EDITOR_UNIT_ID_KEY,@@ -231,6 +232,12 @@ export class EditorBridgeService extends Disposable implements IEditorBridgeServlet documentLayoutObject = cell && skeleton.getCellDocumentModelWithFormula(cell);+ // Rewrite the cellValueType to STRING to avoid render the value on the right side when number type.+ const renderConfig = documentLayoutObject?.documentModel?.documentStyle.renderConfig;+ if (renderConfig != null) {+ renderConfig.cellValueType = CellValueType.STRING;+ }+if (!documentLayoutObject || documentLayoutObject.documentModel == null) {const blankModel = skeleton.getBlankCellDocumentModel(cell);