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

refactor(docs-ui): refactor to RenderUnit #2539

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP
  • Loading branch information
wzhudev committed Jun 18, 2024
commit 64f55c4015c9aabdaf78e916377667ce403c7647
11 changes: 8 additions & 3 deletions packages/docs/src/services/doc-view-model-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import type { DocumentDataModel, Nullable } from '@univerjs/core';
import { DOCS_NORMAL_EDITOR_UNIT_ID_KEY, IUniverInstanceService, RxDisposable, UniverInstanceType } from '@univerjs/core';
import type { IRenderContext, IRenderModule } from '@univerjs/engine-render';
import { DocumentViewModel } from '@univerjs/engine-render';
import { BehaviorSubject, takeUntil } from 'rxjs';

Expand All @@ -27,15 +28,19 @@ export interface IDocumentViewModelManagerParam {
// TODO@wzhudev: move this manager service into render unit

/**
* The view model manager is used to manage Doc view model. has a one-to-one correspondence with the doc skeleton.
* The view model manager is used to manage Doc view model. Each view model has a one-to-one correspondence
* with the doc skeleton.
*/
export class DocViewModelManagerService extends RxDisposable {
export class DocViewModelManagerService extends RxDisposable implements IRenderModule {
private _docViewModelMap: Map<string, IDocumentViewModelManagerParam> = new Map();

private readonly _currentDocViewModel$ = new BehaviorSubject<Nullable<IDocumentViewModelManagerParam>>(null);
readonly currentDocViewModel$ = this._currentDocViewModel$.asObservable();

constructor(@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService) {
constructor(
private readonly _context: IRenderContext<DocumentDataModel>,
@IUniverInstanceService private readonly _univerInstanceService: IUniverInstanceService
) {
super();
this._initialize();
}
Expand Down