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(doc): should not resize all internal editors except zen mode (#3005)

Wenzhao Hu0cf5e2d574df
diff --git a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
index 116a452606..97d8fb7eb2 100644
--- a/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
+++ b/packages/docs-ui/src/controllers/render-controllers/doc-resize.render-controller.ts
@@ -14,19 +14,13 @@
* limitations under the License.
*/
-import { DEFAULT_EMPTY_DOCUMENT_VALUE, Disposable, DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, fromEventSubject, Inject } from '@univerjs/core';
+import { Disposable, DOCS_ZEN_EDITOR_UNIT_ID_KEY, fromEventSubject, Inject, isInternalEditorID } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from '@univerjs/engine-render';
import { filter, throttleTime } from 'rxjs';
import { TextSelectionManagerService } from '@univerjs/docs';
import { DocPageLayoutService } from '../../services/doc-page-layout.service';
-const SKIP_UNIT_IDS = [
- DEFAULT_EMPTY_DOCUMENT_VALUE,
- DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY,
- DOCS_NORMAL_EDITOR_UNIT_ID_KEY,
-];
-
export class DocResizeRenderController extends Disposable implements IRenderModule {
constructor(
private _context: IRenderContext,
@@ -34,9 +28,11 @@ export class DocResizeRenderController extends Disposable implements IRenderModu
@Inject(TextSelectionManagerService) private readonly _textSelectionManagerService: TextSelectionManagerService
) {
super();
- if (!SKIP_UNIT_IDS.includes(this._context.unitId)) {
- this._initResize();
- }
+
+ const unitId = this._context.unitId;
+ if (isInternalEditorID(unitId) && unitId !== DOCS_ZEN_EDITOR_UNIT_ID_KEY) return this;
+
+ this._initResize();
}
private _initResize() {