diff --git a/packages/docs-ui/src/commands/commands/switch-doc-mode.command.ts b/packages/docs-ui/src/commands/commands/switch-doc-mode.command.ts index 17b86036d6f..4f7c9721f9a 100644 --- a/packages/docs-ui/src/commands/commands/switch-doc-mode.command.ts +++ b/packages/docs-ui/src/commands/commands/switch-doc-mode.command.ts @@ -19,6 +19,7 @@ import type { IRichTextEditingMutationParams } from '@univerjs/docs'; import { CommandType, DocumentFlavor, ICommandService, IUniverInstanceService, JSONX, ObjectRelativeFromV } from '@univerjs/core'; import { DocSelectionManagerService, DocSkeletonManagerService, RichTextEditingMutation } from '@univerjs/docs'; import { IRenderManagerService } from '@univerjs/engine-render'; +import { DocPageLayoutService } from '../../services/doc-page-layout.service'; import { DocSelectionRenderService } from '../../services/selection/doc-selection-render.service'; export interface ISwitchDocModeCommandParams { } @@ -33,7 +34,6 @@ export const SwitchDocModeCommand: ICommand = { const commandService = accessor.get(ICommandService); const renderManagerService = accessor.get(IRenderManagerService); const docSelectionManagerService = accessor.get(DocSelectionManagerService); - const univerInstanceService = accessor.get(IUniverInstanceService); const docDataModel = univerInstanceService.getCurrentUniverDocInstance(); @@ -43,6 +43,8 @@ export const SwitchDocModeCommand: ICommand = { const unitId = docDataModel.getUnitId(); + const docPageLayoutService = renderManagerService.getRenderById(unitId)?.with(DocPageLayoutService); + const skeleton = renderManagerService.getRenderById(unitId) ?.with(DocSkeletonManagerService) .getSkeleton(); @@ -165,6 +167,8 @@ export const SwitchDocModeCommand: ICommand = { IRichTextEditingMutationParams >(doMutation.id, doMutation.params); + docPageLayoutService?.calculatePagePosition(); + return Boolean(result); }, }; diff --git a/packages/engine-render/src/components/docs/layout/tools.ts b/packages/engine-render/src/components/docs/layout/tools.ts index d4e61e72979..95dbef01731 100644 --- a/packages/engine-render/src/components/docs/layout/tools.ts +++ b/packages/engine-render/src/components/docs/layout/tools.ts @@ -985,6 +985,7 @@ const DEFAULT_MODERN_DOCUMENT_STYLE: IDocumentStyle = { width: ptToPixel(595), height: Number.POSITIVE_INFINITY, }, + pageOrient: PageOrientType.PORTRAIT, marginTop: ptToPixel(50), marginBottom: ptToPixel(50), marginRight: ptToPixel(50), @@ -1011,6 +1012,7 @@ const DEFAULT_MODERN_DOCUMENT_STYLE: IDocumentStyle = { const DEFAULT_MODERN_SECTION_BREAK: Partial = { columnProperties: [], columnSeparatorType: ColumnSeparatorType.NONE, + equalWidth: BooleanNumber.FALSE, sectionType: SectionType.SECTION_TYPE_UNSPECIFIED, };