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(editor): preload the editor #1662

Merged
merged 4 commits into from
Mar 23, 2024
Merged
Show file tree
Hide file tree
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 @@ -121,7 +121,7 @@ enum InputPanelState {

const sheetEditorUnitIds = [DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY];

@OnLifecycle(LifecycleStages.Steady, PromptController)
@OnLifecycle(LifecycleStages.Rendered, PromptController)
export class PromptController extends Disposable {
private _formulaRefColors: string[] = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { IRenderManagerService } from '@univerjs/engine-render';
import { Inject } from '@wendellhu/redi';
import { takeUntil } from 'rxjs';

@OnLifecycle(LifecycleStages.Steady, EditingController)
@OnLifecycle(LifecycleStages.Rendered, EditingController)
export class EditingController extends RxDisposable {
constructor(
@IUniverInstanceService private readonly _currentUniverService: IUniverInstanceService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ enum CursorChange {
StartEditor,
CursorChange,
}

@OnLifecycle(LifecycleStages.Steady, EndEditController)
@OnLifecycle(LifecycleStages.Rendered, EndEditController)
export class EndEditController extends Disposable {
private _cursorChangeObservers: Nullable<Observer<IPointerEvent | IMouseEvent>>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ interface ICanvasOffset {
top: number;
}

@OnLifecycle(LifecycleStages.Steady, StartEditController)
@OnLifecycle(LifecycleStages.Rendered, StartEditController)
export class StartEditController extends Disposable {
private _editorVisiblePrevious = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type { Nullable } from '@univerjs/core';
import type { IDisposable } from '@wendellhu/redi';
import { createIdentifier } from '@wendellhu/redi';
import type { Observable } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { BehaviorSubject, Subject } from 'rxjs';

export interface IFormulaEditorManagerService {
position$: Observable<Nullable<DOMRect>>;
Expand All @@ -42,10 +42,10 @@ export class FormulaEditorManagerService implements IDisposable {
private readonly _focus$ = new BehaviorSubject<boolean>(this._focus);
readonly focus$ = this._focus$.asObservable();

private readonly _fxBtnClick$ = new BehaviorSubject<boolean>(false);
private readonly _fxBtnClick$ = new Subject<boolean>();
readonly fxBtnClick$ = this._fxBtnClick$.asObservable();

private readonly _foldBtnStatus$ = new BehaviorSubject<boolean>(false);
private readonly _foldBtnStatus$ = new Subject<boolean>();
readonly foldBtnStatus$ = this._foldBtnStatus$.asObservable();

dispose(): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class ZenEditorController extends RxDisposable {

this._commandExecutedListener();

this._createZenEditorInstance();
// this._createZenEditorInstance();
}

private _createZenEditorInstance() {
Expand Down Expand Up @@ -142,7 +142,14 @@ export class ZenEditorController extends RxDisposable {
});
}

private _zenEditorInitialState = false;

private _handleOpenZenEditor() {
if (!this._zenEditorInitialState) {
this._createZenEditorInstance();
this._zenEditorInitialState = true;
}

this._zenZoneService.open();

// Need to clear undo/redo service when open zen mode.
Expand Down
Loading