From 9ef96e2ea2531cf00468386a75e5351e3ec38b4c Mon Sep 17 00:00:00 2001 From: lumixraku Date: Thu, 26 Sep 2024 17:05:31 +0800 Subject: [PATCH] fix: cell margin bottom should over 1 --- .../src/components/sheets/sheet-skeleton.ts | 9 ++----- .../__tests__/end-edit.controller.spec.ts | 4 +-- .../clipboard-paste-form-excel.spec.ts | 6 ++--- .../clipboard-paste-from-google.spec.ts | 8 +++--- .../__tests__/clipboard-service.spec.ts | 26 +++++++++---------- 5 files changed, 24 insertions(+), 29 deletions(-) diff --git a/packages/engine-render/src/components/sheets/sheet-skeleton.ts b/packages/engine-render/src/components/sheets/sheet-skeleton.ts index 842f24c284f..b9e356d0aac 100644 --- a/packages/engine-render/src/components/sheets/sheet-skeleton.ts +++ b/packages/engine-render/src/components/sheets/sheet-skeleton.ts @@ -227,7 +227,7 @@ export interface IDocumentLayoutObject { export const DEFAULT_PADDING_DATA = { t: 0, - b: 1, + b: 2, // must over 1, see https://github.com/dream-num/univer/issues/2727 l: 2, r: 2, }; @@ -1931,12 +1931,7 @@ export class SpreadsheetSkeleton extends Skeleton { const contentLength = content.length; const { textRotation, - paddingData = { - t: 0, - r: 2, - b: 2, // must over 1, see https://github.com/dream-num/univer/issues/2727 - l: 2, - }, + paddingData = DEFAULT_PADDING_DATA, horizontalAlign = HorizontalAlign.UNSPECIFIED, verticalAlign = VerticalAlign.UNSPECIFIED, wrapStrategy = WrapStrategy.UNSPECIFIED, diff --git a/packages/sheets-ui/src/controllers/editor/__tests__/end-edit.controller.spec.ts b/packages/sheets-ui/src/controllers/editor/__tests__/end-edit.controller.spec.ts index 5fdfca835e7..1401eaf14c5 100644 --- a/packages/sheets-ui/src/controllers/editor/__tests__/end-edit.controller.spec.ts +++ b/packages/sheets-ui/src/controllers/editor/__tests__/end-edit.controller.spec.ts @@ -63,7 +63,7 @@ const richTextDemo: IDocumentData = { wrapStrategy: 0, }, marginTop: 0, - marginBottom: 1, + marginBottom: 2, marginRight: 2, marginLeft: 2, }, @@ -361,7 +361,7 @@ describe('Test EndEditController', () => { width: 320.4903259277344, }, marginTop: 0, - marginBottom: 1, + marginBottom: 2, marginRight: 2, marginLeft: 2, renderConfig: { diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts index 48d2bb21683..8302a12be8e 100644 --- a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts +++ b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-form-excel.spec.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import type { ICellData, Injector, IStyleData, Nullable, Univer } from '@univerjs/core'; import { ICommandService, IUniverInstanceService, LocaleType, RANGE_TYPE } from '@univerjs/core'; import { AddWorksheetMergeMutation, @@ -27,9 +26,10 @@ import { SheetsSelectionsService, } from '@univerjs/sheets'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import type { ICellData, Injector, IStyleData, Nullable, Univer } from '@univerjs/core'; -import { ISheetClipboardService } from '../clipboard.service'; import { SheetSkeletonManagerService } from '../../sheet-skeleton-manager.service'; +import { ISheetClipboardService } from '../clipboard.service'; import { clipboardTestBed } from './clipboard-test-bed'; import { excelSample } from './constant'; @@ -164,7 +164,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-from-google.spec.ts b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-from-google.spec.ts index 55af7ffd0cf..a3c8cf57869 100644 --- a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-from-google.spec.ts +++ b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-paste-from-google.spec.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import type { ICellData, Injector, IStyleData, Nullable, Univer } from '@univerjs/core'; import { ICommandService, IUniverInstanceService, LocaleType, RANGE_TYPE } from '@univerjs/core'; import { AddWorksheetMergeMutation, @@ -27,11 +26,12 @@ import { SheetsSelectionsService, } from '@univerjs/sheets'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; - -import { ISheetClipboardService } from '../clipboard.service'; +import type { ICellData, Injector, IStyleData, Nullable, Univer } from '@univerjs/core'; import { SheetSkeletonManagerService } from '../../sheet-skeleton-manager.service'; +import { ISheetClipboardService } from '../clipboard.service'; + import { clipboardTestBed } from './clipboard-test-bed'; import { googleSample } from './constant'; @@ -165,7 +165,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, diff --git a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-service.spec.ts b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-service.spec.ts index 71041628482..93a85995f0b 100644 --- a/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-service.spec.ts +++ b/packages/sheets-ui/src/services/clipboard/__tests__/clipboard-service.spec.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import type { ICellData, Injector, IRange, IStyleData, Nullable, Univer } from '@univerjs/core'; import { ICommandService, IUniverInstanceService, RANGE_TYPE, Rectangle, RedoCommand, UndoCommand } from '@univerjs/core'; import { AddWorksheetMergeMutation, @@ -27,13 +26,14 @@ import { SheetsSelectionsService, } from '@univerjs/sheets'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import type { ICellData, Injector, IRange, IStyleData, Nullable, Univer } from '@univerjs/core'; +import { discreteRangeToRange } from '../../../controllers/utils/range-tools'; import { ISheetClipboardService, PREDEFINED_HOOK_NAME } from '../clipboard.service'; import { COPY_TYPE } from '../type'; -import { discreteRangeToRange } from '../../../controllers/utils/range-tools'; import { clipboardTestBed } from './clipboard-test-bed'; -import type { IClipboardItem } from './mock-clipboard'; import { MockClipboard } from './mock-clipboard'; +import type { IClipboardItem } from './mock-clipboard'; describe('Test clipboard', () => { let univer: Univer; @@ -176,7 +176,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -249,7 +249,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -322,7 +322,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -399,7 +399,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -443,7 +443,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -527,7 +527,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -571,7 +571,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -693,7 +693,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -831,7 +831,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0, @@ -958,7 +958,7 @@ describe('Test clipboard', () => { s: 0, }, pd: { - b: 1, + b: 2, l: 2, r: 2, t: 0,