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(slide): remove duplicated calls to render.engine.setContainer (#2688)
白熱76e93f3490c3
diff --git a/examples/public/sheets/index.html b/examples/public/sheets/index.htmlindex c228b9f521..4005a1fcee 100644--- a/examples/public/sheets/index.html+++ b/examples/public/sheets/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta content="width=device-width, initial-scale=1" name="viewport" />- <title>Univer Sheets</title>+ <title>Univer Sheet</title><link rel="icon" type="image/x-icon" href="../favicon.svg" /><link rel="stylesheet" href="./main.css" />diff --git a/examples/public/slides/index.html b/examples/public/slides/index.htmlindex c7c500050b..0d453221a9 100644--- a/examples/public/slides/index.html+++ b/examples/public/slides/index.html@@ -3,7 +3,7 @@<head><meta charset="utf-8" /><meta content="width=device-width, initial-scale=1" name="viewport" />- <title>UniverSlides</title>+ <title>Univer Slide</title><link rel="icon" type="image/x-icon" href="../favicon.svg" /><link rel="stylesheet" href="./main.css" />@@ -17,18 +17,14 @@<script>new EventSource('/esbuild').addEventListener('change', () => {+ console.info('reload--');location.reload();});</script></head>- <body>- <div- id="app"- style="z-index: 1; position: fixed; font-size: 20px; color: green"- ></div>- <div id="univer-container" style="height: 100%"></div>-+ <body style="overflow: hidden">+ <div id="app" style="height: 100%"></div><script src="./main.js"></script></body></html>diff --git a/examples/src/slides/main.ts b/examples/src/slides/main.tsindex c4f6e2e6e0..5775c5be2e 100644--- a/examples/src/slides/main.ts+++ b/examples/src/slides/main.ts@@ -40,9 +40,11 @@ const univer = new Univer({univer.registerPlugin(UniverRenderEnginePlugin);univer.registerPlugin(UniverFormulaEnginePlugin);univer.registerPlugin(UniverUIPlugin, {- container: 'univer-container',+ container: 'app',});univer.registerPlugin(UniverSlidesPlugin);univer.registerPlugin(UniverSlidesUIPlugin);univer.createUnit(UniverInstanceType.UNIVER_SLIDE, DEFAULT_SLIDE_DATA);++window.univer = univer;diff --git a/packages/engine-render/src/render-manager/render-unit.ts b/packages/engine-render/src/render-manager/render-unit.tsindex d4eef12ea5..2d25cfcf57 100644--- a/packages/engine-render/src/render-manager/render-unit.ts+++ b/packages/engine-render/src/render-manager/render-unit.ts@@ -48,7 +48,7 @@ export interface IRenderContext<T extends UnitModel = UnitModel> extends Omit<IR* This class is responsible*/export class RenderUnit extends Disposable implements IRender {- readonly isRenderUnit: true;+ readonly isRenderUnit: boolean = true;get unitId(): string { return this._renderContext.unitId; }get type(): UnitType { return this._renderContext.type; }diff --git a/packages/slides-ui/src/slides-ui-plugin.ts b/packages/slides-ui/src/slides-ui-plugin.tsindex e22e45bf57..e0633b72b0 100644--- a/packages/slides-ui/src/slides-ui-plugin.ts+++ b/packages/slides-ui/src/slides-ui-plugin.ts@@ -15,13 +15,13 @@*/import type { SlideDataModel } from '@univerjs/core';-import { IUniverInstanceService, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';+import { IUniverInstanceService, Plugin, UniverInstanceType } from '@univerjs/core';import type { Dependency } from '@wendellhu/redi';import { Inject, Injector } from '@wendellhu/redi';import { SlideUIController } from './controllers/slide-ui.controller';-export const SLIDE_UI_PLUGIN_NAME = 'slides-ui';+export const SLIDE_UI_PLUGIN_NAME = 'SLIDE_UI';export class UniverSlidesUIPlugin extends Plugin {static override pluginName = SLIDE_UI_PLUGIN_NAME;@@ -30,7 +30,6 @@ export class UniverSlidesUIPlugin extends Plugin {constructor(_config: unknown,@Inject(Injector) override readonly _injector: Injector,- @Inject(LocaleService) private readonly _localeService: LocaleService,@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService) {super();diff --git a/packages/slides/src/slides-plugin.ts b/packages/slides/src/slides-plugin.tsindex 1788a24675..6532a22a89 100644--- a/packages/slides/src/slides-plugin.ts+++ b/packages/slides/src/slides-plugin.ts@@ -14,7 +14,7 @@* limitations under the License.*/-import { IUniverInstanceService, LocaleService, Plugin, UniverInstanceType } from '@univerjs/core';+import { Plugin, UniverInstanceType } from '@univerjs/core';import type { Engine } from '@univerjs/engine-render';import { IRenderingEngine } from '@univerjs/engine-render';import type { Dependency } from '@wendellhu/redi';@@ -40,8 +40,6 @@ export class UniverSlidesPlugin extends Plugin {constructor(config: Partial<IUniverSlidesConfig> = {},- @IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService,- @Inject(LocaleService) private readonly _localeService: LocaleService,@Inject(Injector) override readonly _injector: Injector) {super();diff --git a/packages/slides/src/views/render/canvas-view.ts b/packages/slides/src/views/render/canvas-view.tsindex 3c2e34c68a..0de1352222 100644--- a/packages/slides/src/views/render/canvas-view.ts+++ b/packages/slides/src/views/render/canvas-view.ts@@ -238,10 +238,6 @@ export class CanvasView extends RxDisposable {engine.runRenderLoop(() => {scene.render();- const app = document.getElementById('app');- if (app) {- app.innerText = `fps:${Math.round(engine.getFps()).toString()}`;- }});}diff --git a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx b/packages/ui/src/controllers/ui/ui-desktop.controller.tsxindex 55ae96ff81..6d631f9f28 100644--- a/packages/ui/src/controllers/ui/ui-desktop.controller.tsx+++ b/packages/ui/src/controllers/ui/ui-desktop.controller.tsx@@ -15,6 +15,7 @@*/import { Disposable, IConfigService, isInternalEditorID, LifecycleService, LifecycleStages, OnLifecycle, toDisposable } from '@univerjs/core';+import type { RenderUnit } from '@univerjs/engine-render';import { IRenderManagerService } from '@univerjs/engine-render';import type { IDisposable } from '@wendellhu/redi';import { Inject, Injector, Optional } from '@wendellhu/redi';@@ -73,7 +74,7 @@ export class DesktopUIController extends Disposable {const allRenders = this._renderManagerService.getRenderAll();for (const [key, render] of allRenders) {- if (isInternalEditorID(key)) continue;+ if (isInternalEditorID(key) || !((render) as RenderUnit).isRenderUnit) continue;render.engine.setContainer(canvasElement);}