refactor(editor): playground doc collection typing migration (#9593)

This commit is contained in:
doodlewind
2025-01-09 03:07:43 +00:00
parent 5ff2254c83
commit e269cce141
19 changed files with 48 additions and 84 deletions
@@ -30,7 +30,7 @@ import {
import { type SerializedXYWH, SignalWatcher } from '@blocksuite/global/utils';
import type { DeltaInsert } from '@blocksuite/inline';
import type { AffineEditorContainer } from '@blocksuite/presets';
import { type DocCollection, Text } from '@blocksuite/store';
import { Text, type Workspace } from '@blocksuite/store';
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path.js';
import { css, html, nothing } from 'lit';
import { customElement, property, state } from 'lit/decorators.js';
@@ -158,7 +158,9 @@ export class CollabDebugMenu extends SignalWatcher(ShadowlessElement) {
const zipTransformer = this.rootService.transformers.zip;
await zipTransformer.exportDocs(
this.collection,
[...this.collection.docs.values()].map(collection => collection.getDoc())
Array.from(this.collection.docs.values()).map(collection =>
collection.getStore()
)
);
}
@@ -611,7 +613,7 @@ export class CollabDebugMenu extends SignalWatcher(ShadowlessElement) {
private accessor _docMode: DocMode = 'page';
@property({ attribute: false })
accessor collection!: DocCollection;
accessor collection!: Workspace;
@property({ attribute: false })
accessor docsPanel!: DocsPanel;
@@ -50,7 +50,7 @@ import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import type { SerializedXYWH } from '@blocksuite/global/utils';
import type { DeltaInsert } from '@blocksuite/inline/types';
import { AffineEditorContainer, type CommentPanel } from '@blocksuite/presets';
import { type DocCollection, Job, Text } from '@blocksuite/store';
import { Job, Text, type Workspace } from '@blocksuite/store';
import type { SlDropdown } from '@shoelace-style/shoelace';
import { setBasePath } from '@shoelace-style/shoelace/dist/utilities/base-path.js';
import { css, html } from 'lit';
@@ -329,7 +329,9 @@ export class StarterDebugMenu extends ShadowlessElement {
private async _exportSnapshot() {
await ZipTransformer.exportDocs(
this.collection,
[...this.collection.docs.values()].map(collection => collection.getDoc())
Array.from(this.collection.docs.values()).map(collection =>
collection.getStore()
)
);
}
@@ -1019,7 +1021,7 @@ export class StarterDebugMenu extends ShadowlessElement {
accessor blockTypeDropdown!: SlDropdown;
@property({ attribute: false })
accessor collection!: DocCollection;
accessor collection!: Workspace;
@property({ attribute: false })
accessor commentPanel!: CommentPanel;