Skip to content

Commit

Permalink
fix: optimization of create empty doc (#4149)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jocs authored Nov 26, 2024
1 parent ace8f93 commit c88e709
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mockdata/src/docs/default-document-data-cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {
marginRight: ptToPixel(50),
marginLeft: ptToPixel(50),
renderConfig: {
zeroWidthParagraphBreak: BooleanNumber.TRUE,
zeroWidthParagraphBreak: BooleanNumber.FALSE,
vertexAngle: 0,
centerAngle: 0,
background: {
Expand Down
32 changes: 29 additions & 3 deletions packages/core/src/docs/data-model/empty-snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
*/

import { Tools } from '../../shared/tools';
import { BooleanNumber } from '../../types/enum';
import { LocaleType } from '../../types/enum/locale-type';
import type { IDocumentData } from '../../types/interfaces';
import { DocumentFlavor, type IDocumentData } from '../../types/interfaces';

export function getEmptySnapshot(
unitID = Tools.generateRandomId(6),
Expand All @@ -27,9 +28,16 @@ export function getEmptySnapshot(
id: unitID,
locale,
title, // title should get from request.
tableSource: {},
drawings: {},
drawingsOrder: [],
headers: {},
footers: {},
body: {
dataStream: '\r\n',
textRuns: [],
customBlocks: [],
tables: [],
paragraphs: [
{
startIndex: 0,
Expand All @@ -51,14 +59,32 @@ export function getEmptySnapshot(
width: 595 / 0.75,
height: 842 / 0.75,
},
documentFlavor: DocumentFlavor.TRADITIONAL,
marginTop: 50,
marginBottom: 50,
marginRight: 40,
marginLeft: 40,
marginRight: 50,
marginLeft: 50,
renderConfig: {
zeroWidthParagraphBreak: BooleanNumber.FALSE,
vertexAngle: 0,
centerAngle: 0,
background: {
rgb: '#ccc',
},
},
autoHyphenation: BooleanNumber.TRUE,
doNotHyphenateCaps: BooleanNumber.FALSE,
consecutiveHyphenLimit: 2,
defaultHeaderId: '',
defaultFooterId: '',
evenPageHeaderId: '',
evenPageFooterId: '',
firstPageHeaderId: '',
firstPageFooterId: '',
evenAndOddHeaders: BooleanNumber.FALSE,
useFirstPageHeaderFooter: BooleanNumber.FALSE,
marginHeader: 30,
marginFooter: 30,
},
settings: {},

Expand Down

0 comments on commit c88e709

Please sign in to comment.