Skip to content

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.

fix(sheet): doc in slide center fix

DR-Univerf1bf593bf51b
diff --git a/packages/base-render/src/Component/Docs/Document.ts b/packages/base-render/src/Component/Docs/Document.ts
index 851ee14773..1feadcbb1e 100644
--- a/packages/base-render/src/Component/Docs/Document.ts
+++ b/packages/base-render/src/Component/Docs/Document.ts
@@ -12,7 +12,6 @@ import { DocsEditor } from './Document.Editor';
import { Liquid } from './Common';
import { Scene } from '../../Scene';
import { TextSelection } from './Common/TextSelection';
-import { Engine } from '../..';
export interface IDocumentsConfig {
pageMarginLeft?: number;
@@ -190,17 +189,15 @@ export class Documents extends DocComponent {
};
}
- calculatePagePosition(engine: Nullable<Engine>) {
+ calculatePagePosition() {
const scene = this.getScene() as Scene;
- if (engine == null) {
- engine = scene?.getEngine();
- }
+ let parent = scene?.getParent();
const { width: docsWidth, height: docsHeight, pageMarginLeft, pageMarginTop } = this;
- if (engine == null) {
+ if (parent == null) {
return;
}
- const { width: engineWidth, height: engineHeight } = engine;
+ const { width: engineWidth, height: engineHeight } = parent;
let docsLeft = 0;
let docsTop = 0;
diff --git a/packages/base-slides/src/View/Render/Adaptors/DocsAdaptor.ts b/packages/base-slides/src/View/Render/Adaptors/DocsAdaptor.ts
index a0d3c7d978..eb0b4f8f40 100644
--- a/packages/base-slides/src/View/Render/Adaptors/DocsAdaptor.ts
+++ b/packages/base-slides/src/View/Render/Adaptors/DocsAdaptor.ts
@@ -105,7 +105,7 @@ export class DocsAdaptor extends ObjectAdaptor {
scene.addObject(documents);
- documents.calculatePagePosition(mainScene.getEngine());
+ documents.calculatePagePosition();
const pageSize = documents.getSkeleton()?.getPageSize();
diff --git a/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts b/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
index 36b843870c..a8d5dda0a3 100644
--- a/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
+++ b/packages/common-plugin-data/src/Sheets/SLIDE_WORKBOOK_DATA.ts
@@ -1,4 +1,5 @@
import { BooleanNumber, BorderStyleTypes, IWorkbookConfig, LocaleType, SheetTypes } from '@univer/core';
+import { PAGE5_RICHTEXT_1 } from '../Slides/RichText/PAGE5_RICHTEXT_1';
export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
id: 'workbook-01',
@@ -164,6 +165,43 @@ export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
},
},
},
+ '6': {
+ ht: 1,
+ vt: 2,
+ tb: 3,
+ bg: {
+ rgb: 'rgba(244,79,86)',
+ },
+ cl: {
+ rgb: 'rgb(255,255,255)',
+ },
+ bd: {
+ t: {
+ s: BorderStyleTypes.THIN,
+ cl: {
+ rgb: 'rgb(217,217,217)',
+ },
+ },
+ l: {
+ s: BorderStyleTypes.THIN,
+ cl: {
+ rgb: 'rgb(217,217,217)',
+ },
+ },
+ r: {
+ s: BorderStyleTypes.THIN,
+ cl: {
+ rgb: 'rgb(217,217,217)',
+ },
+ },
+ b: {
+ s: BorderStyleTypes.THIN,
+ cl: {
+ rgb: 'rgb(217,217,217)',
+ },
+ },
+ },
+ },
},
timeZone: 'GMT+8',
createdTime: '2021-11-28 12:10:10',
@@ -200,6 +238,10 @@ export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
v: 'UGC Buzz volume',
s: '2',
},
+ '9': {
+ p: PAGE5_RICHTEXT_1,
+ s: '6',
+ },
},
'2': {
'3': {
@@ -517,7 +559,14 @@ export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
startColumn: 1,
endColumn: 1,
},
+ {
+ startRow: 1,
+ endRow: 10,
+ startColumn: 9,
+ endColumn: 10,
+ },
],
+
rowData: {
'0': {
h: 20,
@@ -530,6 +579,24 @@ export const SLIDE_WORKBOOK_DATA: IWorkbookConfig = {
'2': {
w: 120,
},
+ '3': {
+ w: 60,
+ },
+ '4': {
+ w: 60,
+ },
+ '5': {
+ w: 60,
+ },
+ '6': {
+ w: 60,
+ },
+ '7': {
+ w: 60,
+ },
+ '8': {
+ w: 60,
+ },
},
status: 1,
showGridlines: 0,
diff --git a/packages/common-plugin-data/src/Slides/RichText/PAGE5_RICHTEXT_1.ts b/packages/common-plugin-data/src/Slides/RichText/PAGE5_RICHTEXT_1.ts
new file mode 100644
index 0000000000..de483281b9
--- /dev/null
+++ b/packages/common-plugin-data/src/Slides/RichText/PAGE5_RICHTEXT_1.ts
@@ -0,0 +1,377 @@
+import { BlockType, BooleanNumber, IDocumentData, ParagraphElementType } from '@univer/core';
+import { DEFAULT_LIST_TEST } from '../../Docs/DEFAULT_LIST';
+
+export const PAGE5_RICHTEXT_1: IDocumentData = {
+ id: 'd',
+ lists: DEFAULT_LIST_TEST,
+ body: {
+ blockElements: {
+ p1: {
+ blockId: 'p1',
+ st: 0,
+ ed: 66,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 0,
+ ed: 66,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'What’s New in the 2022 Gartner Hype Cycle for Emerging Technologies',
+ ts: {
+ bl: BooleanNumber.TRUE,
+ fs: 16,
+ cl: {
+ rgb: 'rgb(255,255,255)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p2: {
+ blockId: 'p2',
+ st: 67,
+ ed: 251,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ paragraphStyle: {
+ spaceAbove: 20,
+ indentFirstLine: 20,
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 67,
+ ed: 251,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Emerging technologies for 2022 fit into three main themes: evolving/expanding immersive experiences, accelerated artificial intelligence automation, and optimized technologist delivery.',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(0,40,86)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p3: {
+ blockId: 'p3',
+ st: 252,
+ ed: 401,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ paragraphStyle: {
+ spaceAbove: 20,
+ indentFirstLine: 20,
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 252,
+ ed: 401,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'The 2022 Gartner Hype Cycle identifies 25 must-know emerging technologies designed to help enterprise architecture and technology innovation leaders: ',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p4: {
+ blockId: 'p4',
+ st: 402,
+ ed: 429,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 0,
+ textStyle: {
+ fs: 20,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ paragraphStyle: {
+ lineSpacing: 1.5,
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 402,
+ ed: 429,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Expand immersive experiences',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p13: {
+ blockId: 'p13',
+ st: 2020 + 28,
+ ed: 2250 + 28,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ paragraphStyle: {
+ indentFirstLine: 20,
+ },
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 1,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 2020 + 28,
+ ed: 2042 + 28,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Decentralized identity ',
+ ts: {
+ fs: 12,
+ bl: BooleanNumber.TRUE,
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p14: {
+ blockId: 'p14',
+ st: 2251 + 28,
+ ed: 2393 + 28,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ paragraphStyle: {
+ indentFirstLine: 20,
+ },
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 1,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 2251 + 28,
+ ed: 2265 + 28,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Digital humans ',
+ ts: {
+ fs: 12,
+
+ bl: BooleanNumber.TRUE,
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p5: {
+ blockId: 'p5',
+ st: 430,
+ ed: 479,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 0,
+ textStyle: {
+ fs: 20,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ paragraphStyle: {
+ lineSpacing: 1.5,
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 430,
+ ed: 479,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Accelerate artificial intelligence (AI) automation',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p15: {
+ blockId: 'p15',
+ st: 2394 + 28,
+ ed: 2582 + 28,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ paragraphStyle: {
+ indentFirstLine: 20,
+ },
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 1,
+ textStyle: {
+ fs: 20,
+ },
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 2394 + 28,
+ ed: 2422 + 28,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Internal talent marketplaces ',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(0, 0, 0)',
+ },
+ bl: BooleanNumber.TRUE,
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ p6: {
+ blockId: 'p6',
+ st: 480,
+ ed: 510,
+ blockType: BlockType.PARAGRAPH,
+ paragraph: {
+ bullet: {
+ listId: 'testBullet',
+ nestingLevel: 0,
+ textStyle: {
+ fs: 20,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ paragraphStyle: {
+ lineSpacing: 1.5,
+ },
+ elements: {
+ e1: {
+ eId: 'e1',
+ st: 480,
+ ed: 510,
+ et: ParagraphElementType.TEXT_RUN,
+ tr: {
+ ct: 'Optimize technologist delivery ',
+ ts: {
+ fs: 12,
+ cl: {
+ rgb: 'rgb(249,249,249)',
+ },
+ },
+ },
+ },
+ },
+ elementOrder: [
+ {
+ elementId: 'e1',
+ paragraphElementType: ParagraphElementType.TEXT_RUN,
+ },
+ ],
+ },
+ },
+ },
+ blockElementOrder: ['p1', 'p3', 'p4', 'p13', 'p14', 'p5', 'p15', 'p6'],
+ },
+ documentStyle: {
+ pageSize: {
+ width: undefined,
+ height: undefined,
+ },
+ marginTop: 0,
+ marginBottom: 0,
+ marginRight: 2,
+ marginLeft: 2,
+ },
+};