Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(doc): should not resize all internal editors except zen mode #3005

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,25 @@
* 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,
@Inject(DocPageLayoutService) private readonly _docPageLayoutService: DocPageLayoutService,
@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() {
Expand Down
Loading