diff --git a/blocksuite/affine/block-embed/src/common/render-linked-doc.ts b/blocksuite/affine/block-embed/src/common/render-linked-doc.ts
index 6c96c6dd99..9848889c6f 100644
--- a/blocksuite/affine/block-embed/src/common/render-linked-doc.ts
+++ b/blocksuite/affine/block-embed/src/common/render-linked-doc.ts
@@ -16,6 +16,7 @@ import {
type DraftModel,
type Query,
Slice,
+ Store,
Text,
} from '@blocksuite/store';
import { render, type TemplateResult } from 'lit';
@@ -197,8 +198,9 @@ async function renderNoteContent(
};
const previewDoc = doc.doc.getBlocks({ query });
const previewSpec = SpecProvider.getInstance().getSpec('page:preview');
+ const store = new Store({ blocks: previewDoc });
const previewStd = new BlockStdScope({
- doc: previewDoc,
+ store,
extensions: previewSpec.value,
});
const previewTemplate = previewStd.render();
diff --git a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts
index a1a00698f0..4a0e5827fa 100644
--- a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts
+++ b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-edgeless-synced-doc-block.ts
@@ -9,8 +9,9 @@ import {
ThemeProvider,
} from '@blocksuite/affine-shared/services';
import { BlockSelection, BlockStdScope } from '@blocksuite/block-std';
-import { assertExists, Bound } from '@blocksuite/global/utils';
-import { html } from 'lit';
+import { Bound } from '@blocksuite/global/utils';
+import { Store } from '@blocksuite/store';
+import { html, nothing } from 'lit';
import { choose } from 'lit/directives/choose.js';
import { classMap } from 'lit/directives/class-map.js';
import { guard } from 'lit/directives/guard.js';
@@ -25,7 +26,12 @@ export class EmbedEdgelessSyncedDocBlockComponent extends toEdgelessEmbedBlock(
protected override _renderSyncedView = () => {
const { syncedDoc, editorMode } = this;
- assertExists(syncedDoc, 'Doc should exist');
+ if (!syncedDoc) {
+ console.error('Synced doc is not found');
+ return html`${nothing}`;
+ }
+
+ const store = new Store({ blocks: syncedDoc });
let containerStyleMap = styleMap({
position: 'relative',
@@ -64,7 +70,7 @@ export class EmbedEdgelessSyncedDocBlockComponent extends toEdgelessEmbedBlock(
() => html`
${new BlockStdScope({
- doc: syncedDoc,
+ store,
extensions: this._buildPreviewSpec('page:preview'),
}).render()}
@@ -75,7 +81,7 @@ export class EmbedEdgelessSyncedDocBlockComponent extends toEdgelessEmbedBlock(
() => html`
${new BlockStdScope({
- doc: syncedDoc,
+ store,
extensions: this._buildPreviewSpec('edgeless:preview'),
}).render()}
diff --git a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts
index be6e9a54b1..0659256534 100644
--- a/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts
+++ b/blocksuite/affine/block-embed/src/embed-synced-doc-block/embed-synced-doc-block.ts
@@ -26,9 +26,14 @@ import {
} from '@blocksuite/block-std';
import { GfxControllerIdentifier } from '@blocksuite/block-std/gfx';
import { assertExists, Bound, getCommonBound } from '@blocksuite/global/utils';
-import { type GetBlocksOptions, type Query, Text } from '@blocksuite/store';
+import {
+ type GetBlocksOptions,
+ type Query,
+ Store,
+ Text,
+} from '@blocksuite/store';
import { computed } from '@preact/signals-core';
-import { html, type PropertyValues } from 'lit';
+import { html, nothing, type PropertyValues } from 'lit';
import { query, state } from 'lit/decorators.js';
import { choose } from 'lit/directives/choose.js';
import { classMap } from 'lit/directives/class-map.js';
@@ -146,7 +151,12 @@ export class EmbedSyncedDocBlockComponent extends EmbedBlockComponent html`
${new BlockStdScope({
- doc: syncedDoc,
+ store,
extensions: this._buildPreviewSpec('page:preview'),
}).render()}
@@ -187,7 +197,7 @@ export class EmbedSyncedDocBlockComponent extends EmbedBlockComponent html`
${new BlockStdScope({
- doc: syncedDoc,
+ store,
extensions: this._buildPreviewSpec('edgeless:preview'),
}).render()}
diff --git a/blocksuite/affine/block-surface-ref/src/portal/note.ts b/blocksuite/affine/block-surface-ref/src/portal/note.ts
index 13594ba155..dcab7ed774 100644
--- a/blocksuite/affine/block-surface-ref/src/portal/note.ts
+++ b/blocksuite/affine/block-surface-ref/src/portal/note.ts
@@ -18,7 +18,7 @@ import {
ShadowlessElement,
} from '@blocksuite/block-std';
import { deserializeXYWH, WithDisposable } from '@blocksuite/global/utils';
-import { type BlockModel, type Query } from '@blocksuite/store';
+import { type BlockModel, type Query, Store } from '@blocksuite/store';
import { css, nothing } from 'lit';
import { property } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
@@ -118,9 +118,10 @@ export class SurfaceRefNotePortal extends WithDisposable(ShadowlessElement) {
query: this.query,
readonly: true,
});
+ const store = new Store({ blocks: doc });
const previewSpec = SpecProvider.getInstance().getSpec('page:preview');
return new BlockStdScope({
- doc,
+ store,
extensions: previewSpec.value.slice(),
}).render();
}
diff --git a/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts b/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts
index 1a587c682e..f66a68012e 100644
--- a/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts
+++ b/blocksuite/affine/block-surface-ref/src/surface-ref-block.ts
@@ -47,7 +47,7 @@ import {
DisposableGroup,
type SerializedXYWH,
} from '@blocksuite/global/utils';
-import type { Blocks } from '@blocksuite/store';
+import { type Blocks, Store } from '@blocksuite/store';
import { css, html, nothing, type TemplateResult } from 'lit';
import { query, state } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
@@ -545,10 +545,15 @@ export class SurfaceRefBlockComponent extends BlockComponent
diff --git a/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts b/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts
index cce841e068..86daa58e20 100644
--- a/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts
+++ b/blocksuite/affine/widget-drag-handle/src/helpers/preview-helper.ts
@@ -5,7 +5,7 @@ import {
type DndEventState,
} from '@blocksuite/block-std';
import { Point } from '@blocksuite/global/utils';
-import type { BlockViewType, Query } from '@blocksuite/store';
+import { type BlockViewType, type Query, Store } from '@blocksuite/store';
import { DragPreview } from '../components/drag-preview.js';
import type { AffineDragHandleWidget } from '../drag-handle.js';
@@ -82,8 +82,9 @@ export class PreviewHelper {
const doc = this.widget.doc.doc.getBlocks({ query });
const previewSpec = SpecProvider.getInstance().getSpec('page:preview');
+ const store = new Store({ blocks: doc });
const previewStd = new BlockStdScope({
- doc,
+ store,
extensions: previewSpec.value,
});
const previewTemplate = previewStd.render();
diff --git a/blocksuite/blocks/src/root-block/edgeless/components/frame/frame-preview.ts b/blocksuite/blocks/src/root-block/edgeless/components/frame/frame-preview.ts
index 630be03302..3f52a5611c 100644
--- a/blocksuite/blocks/src/root-block/edgeless/components/frame/frame-preview.ts
+++ b/blocksuite/blocks/src/root-block/edgeless/components/frame/frame-preview.ts
@@ -12,7 +12,7 @@ import {
DisposableGroup,
WithDisposable,
} from '@blocksuite/global/utils';
-import { type Blocks, type Query } from '@blocksuite/store';
+import { type Blocks, type Query, Store } from '@blocksuite/store';
import { css, html, nothing, type PropertyValues } from 'lit';
import { property, query, state } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
@@ -155,6 +155,7 @@ export class FramePreview extends WithDisposable(ShadowlessElement) {
private _renderSurfaceContent() {
if (!this._previewDoc || !this.frame) return nothing;
const { width, height } = this.frameViewportWH;
+ const store = new Store({ blocks: this._previewDoc });
const _previewSpec = this._previewSpec.value;
return html`
${new BlockStdScope({
- doc: this._previewDoc,
+ store,
extensions: _previewSpec,
}).render()}
diff --git a/blocksuite/framework/block-std/src/__tests__/test-editor.ts b/blocksuite/framework/block-std/src/__tests__/test-editor.ts
index b5b03c8818..718f7230ff 100644
--- a/blocksuite/framework/block-std/src/__tests__/test-editor.ts
+++ b/blocksuite/framework/block-std/src/__tests__/test-editor.ts
@@ -1,5 +1,5 @@
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
-import type { Blocks, ExtensionType } from '@blocksuite/store';
+import { type Blocks, type ExtensionType, Store } from '@blocksuite/store';
import { html } from 'lit';
import { customElement, property } from 'lit/decorators.js';
@@ -18,8 +18,9 @@ export class TestEditorContainer extends SignalWatcher(
override connectedCallback() {
super.connectedCallback();
+ const store = new Store({ blocks: this.doc });
this._std = new BlockStdScope({
- doc: this.doc,
+ store,
extensions: this.specs,
});
}
diff --git a/blocksuite/framework/block-std/src/scope/block-std-scope.ts b/blocksuite/framework/block-std/src/scope/block-std-scope.ts
index eaf623c506..8805fb1192 100644
--- a/blocksuite/framework/block-std/src/scope/block-std-scope.ts
+++ b/blocksuite/framework/block-std/src/scope/block-std-scope.ts
@@ -1,11 +1,10 @@
-import type { ServiceProvider } from '@blocksuite/global/di';
-import { Container } from '@blocksuite/global/di';
+import { Container, type ServiceProvider } from '@blocksuite/global/di';
import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
import {
- type Blocks,
type ExtensionType,
Job,
type JobMiddleware,
+ type Store,
} from '@blocksuite/store';
import { Clipboard } from '../clipboard/index.js';
@@ -36,7 +35,7 @@ import { EditorHost } from '../view/element/index.js';
import { ViewStore } from '../view/view-store.js';
export interface BlockStdOptions {
- doc: Blocks;
+ store: Store;
extensions: ExtensionType[];
}
@@ -65,7 +64,7 @@ export class BlockStdScope {
readonly container: Container;
- readonly doc: Blocks;
+ readonly store: Store;
readonly provider: ServiceProvider;
@@ -75,6 +74,10 @@ export class BlockStdScope {
return this.provider.getAll(LifeCycleWatcherIdentifier);
}
+ get doc() {
+ return this.store.blocks;
+ }
+
get clipboard() {
return this.get(Clipboard);
}
@@ -122,7 +125,7 @@ export class BlockStdScope {
'Host is not ready to use, the `render` method should be called first'
);
};
- this.doc = options.doc;
+ this.store = options.store;
this.userExtensions = options.extensions;
this.container = new Container();
this.container.addImpl(StdIdentifier, () => this);
@@ -137,7 +140,7 @@ export class BlockStdScope {
ext.setup(container);
});
- this.provider = this.container.provider();
+ this.provider = this.container.provider(undefined, this.store.provider);
this._lifeCycleWatchers.forEach(watcher => {
watcher.created.call(watcher);
diff --git a/blocksuite/framework/store/src/extension/extension.ts b/blocksuite/framework/store/src/extension/extension.ts
new file mode 100644
index 0000000000..925c543a53
--- /dev/null
+++ b/blocksuite/framework/store/src/extension/extension.ts
@@ -0,0 +1,17 @@
+import type { Container } from '@blocksuite/global/di';
+
+/**
+ * Generic extension.
+ * Extensions are used to set up the dependency injection container.
+ * In most cases, you won't need to use this class directly.
+ * We provide helper classes like `CommandExtension` and `BlockViewExtension` to make it easier to create extensions.
+ */
+export abstract class Extension {
+ static setup(_di: Container): void {
+ // do nothing
+ }
+}
+
+export interface ExtensionType {
+ setup(di: Container): void;
+}
diff --git a/blocksuite/framework/store/src/extension/index.ts b/blocksuite/framework/store/src/extension/index.ts
index 925c543a53..8b7ae56bdb 100644
--- a/blocksuite/framework/store/src/extension/index.ts
+++ b/blocksuite/framework/store/src/extension/index.ts
@@ -1,17 +1,2 @@
-import type { Container } from '@blocksuite/global/di';
-
-/**
- * Generic extension.
- * Extensions are used to set up the dependency injection container.
- * In most cases, you won't need to use this class directly.
- * We provide helper classes like `CommandExtension` and `BlockViewExtension` to make it easier to create extensions.
- */
-export abstract class Extension {
- static setup(_di: Container): void {
- // do nothing
- }
-}
-
-export interface ExtensionType {
- setup(di: Container): void;
-}
+export * from './extension';
+export * from './store-extension';
diff --git a/blocksuite/framework/store/src/extension/store-extension.ts b/blocksuite/framework/store/src/extension/store-extension.ts
new file mode 100644
index 0000000000..d18cc57493
--- /dev/null
+++ b/blocksuite/framework/store/src/extension/store-extension.ts
@@ -0,0 +1,41 @@
+import { type Container, createIdentifier } from '@blocksuite/global/di';
+import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';
+
+import { StoreIdentifier } from '../store/identifier';
+import type { Store } from '../store/store';
+import { Extension } from './extension';
+
+export const StoreExtensionIdentifier =
+ createIdentifier('StoreExtension');
+
+export const storeExtensionSymbol = Symbol('StoreExtension');
+
+export class StoreExtension extends Extension {
+ constructor(readonly store: Store) {
+ super();
+ }
+
+ static readonly [storeExtensionSymbol] = true;
+
+ static override setup(di: Container) {
+ if (!this.key) {
+ throw new BlockSuiteError(
+ ErrorCode.ValueNotExists,
+ 'Key is not defined in the StoreExtension'
+ );
+ }
+
+ di.add(this, [StoreIdentifier]);
+ di.addImpl(StoreExtensionIdentifier(this.key), provider =>
+ provider.get(this)
+ );
+ }
+
+ static readonly key: string;
+}
+
+export function isStoreExtensionConstructor(
+ extension: object
+): extension is typeof StoreExtension {
+ return storeExtensionSymbol in extension;
+}
diff --git a/blocksuite/framework/store/src/index.ts b/blocksuite/framework/store/src/index.ts
index 526a50bbef..d5895ea9cd 100644
--- a/blocksuite/framework/store/src/index.ts
+++ b/blocksuite/framework/store/src/index.ts
@@ -6,6 +6,7 @@ export * from './extension';
export * from './model';
export * from './reactive';
export * from './schema';
+export * from './store';
export * from './transformer';
export { type IdGenerator, nanoid, uuidv4 } from './utils/id-generator';
export * from './yjs';
diff --git a/blocksuite/framework/store/src/store/identifier.ts b/blocksuite/framework/store/src/store/identifier.ts
new file mode 100644
index 0000000000..c09516ea41
--- /dev/null
+++ b/blocksuite/framework/store/src/store/identifier.ts
@@ -0,0 +1,5 @@
+import { createIdentifier } from '@blocksuite/global/di';
+
+import type { Store } from './store';
+
+export const StoreIdentifier = createIdentifier('Store');
diff --git a/blocksuite/framework/store/src/store/index.ts b/blocksuite/framework/store/src/store/index.ts
new file mode 100644
index 0000000000..63c6027f1e
--- /dev/null
+++ b/blocksuite/framework/store/src/store/index.ts
@@ -0,0 +1,2 @@
+export * from './identifier';
+export * from './store';
diff --git a/blocksuite/framework/store/src/store/store.ts b/blocksuite/framework/store/src/store/store.ts
new file mode 100644
index 0000000000..2fa4f455e4
--- /dev/null
+++ b/blocksuite/framework/store/src/store/store.ts
@@ -0,0 +1,41 @@
+import { Container, type ServiceProvider } from '@blocksuite/global/di';
+
+import type { Extension, StoreExtension } from '../extension';
+import type { Blocks } from '../model';
+import { StoreIdentifier } from './identifier';
+
+export interface StoreOptions {
+ blocks: Blocks;
+ provider?: ServiceProvider;
+ extensions?: (typeof Extension | typeof StoreExtension)[];
+}
+
+export class Store {
+ private readonly _blocks: Blocks;
+ private readonly _provider: ServiceProvider;
+
+ get blocks() {
+ return this._blocks;
+ }
+
+ get provider() {
+ return this._provider;
+ }
+
+ get awareness() {
+ return this._blocks.awarenessStore;
+ }
+
+ constructor(options: StoreOptions) {
+ this._blocks = options.blocks;
+ const container = new Container();
+ container.addImpl(StoreIdentifier, () => this);
+
+ const userExtensions = options.extensions ?? [];
+ userExtensions.forEach(extension => {
+ extension.setup(container);
+ });
+
+ this._provider = container.provider(undefined, options.provider);
+ }
+}
diff --git a/blocksuite/presets/src/editors/edgeless-editor.ts b/blocksuite/presets/src/editors/edgeless-editor.ts
index b7b9a927d2..73f6becfdb 100644
--- a/blocksuite/presets/src/editors/edgeless-editor.ts
+++ b/blocksuite/presets/src/editors/edgeless-editor.ts
@@ -1,7 +1,7 @@
import { BlockStdScope, ShadowlessElement } from '@blocksuite/block-std';
import { EdgelessEditorBlockSpecs, ThemeProvider } from '@blocksuite/blocks';
import { SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
-import type { Blocks } from '@blocksuite/store';
+import { type Blocks, Store } from '@blocksuite/store';
import { css, html, nothing, type TemplateResult } from 'lit';
import { property, state } from 'lit/decorators.js';
import { guard } from 'lit/directives/guard.js';
@@ -48,8 +48,9 @@ export class EdgelessEditor extends SignalWatcher(
this._disposables.add(
this.doc.slots.rootAdded.on(() => this.requestUpdate())
);
+ const store = new Store({ blocks: this.doc });
this.std = new BlockStdScope({
- doc: this.doc,
+ store,
extensions: this.specs,
});
}
@@ -77,8 +78,9 @@ export class EdgelessEditor extends SignalWatcher(
) {
super.willUpdate(changedProperties);
if (changedProperties.has('doc')) {
+ const store = new Store({ blocks: this.doc });
this.std = new BlockStdScope({
- doc: this.doc,
+ store,
extensions: this.specs,
});
}
diff --git a/blocksuite/presets/src/editors/editor-container.ts b/blocksuite/presets/src/editors/editor-container.ts
index 75891680d1..fa276d7772 100644
--- a/blocksuite/presets/src/editors/editor-container.ts
+++ b/blocksuite/presets/src/editors/editor-container.ts
@@ -7,7 +7,12 @@ import {
ThemeProvider,
} from '@blocksuite/blocks';
import { SignalWatcher, Slot, WithDisposable } from '@blocksuite/global/utils';
-import type { BlockModel, Blocks, ExtensionType } from '@blocksuite/store';
+import {
+ type BlockModel,
+ type Blocks,
+ type ExtensionType,
+ Store,
+} from '@blocksuite/store';
import { computed, signal } from '@preact/signals-core';
import { css, html } from 'lit';
import { property } from 'lit/decorators.js';
@@ -100,9 +105,13 @@ export class AffineEditorContainer
: this._edgelessSpecs.value
);
+ private readonly _store = computed(() => {
+ return new Store({ blocks: this.doc });
+ });
+
private readonly _std = computed(() => {
return new BlockStdScope({
- doc: this.doc,
+ store: this._store.value,
extensions: this._specs.value,
});
});
diff --git a/blocksuite/presets/src/editors/page-editor.ts b/blocksuite/presets/src/editors/page-editor.ts
index 7177d9cc9a..8865b3b0a2 100644
--- a/blocksuite/presets/src/editors/page-editor.ts
+++ b/blocksuite/presets/src/editors/page-editor.ts
@@ -5,7 +5,7 @@ import {
} from '@blocksuite/block-std';
import { PageEditorBlockSpecs, ThemeProvider } from '@blocksuite/blocks';
import { noop, SignalWatcher, WithDisposable } from '@blocksuite/global/utils';
-import type { Blocks } from '@blocksuite/store';
+import { type Blocks, Store } from '@blocksuite/store';
import { css, html, nothing } from 'lit';
import { property, state } from 'lit/decorators.js';
import { guard } from 'lit/directives/guard.js';
@@ -59,8 +59,9 @@ export class PageEditor extends SignalWatcher(
this._disposables.add(
this.doc.slots.rootAdded.on(() => this.requestUpdate())
);
+ const store = new Store({ blocks: this.doc });
this.std = new BlockStdScope({
- doc: this.doc,
+ store,
extensions: this.specs,
});
}
@@ -93,8 +94,9 @@ export class PageEditor extends SignalWatcher(
) {
super.willUpdate(changedProperties);
if (changedProperties.has('doc')) {
+ const store = new Store({ blocks: this.doc });
this.std = new BlockStdScope({
- doc: this.doc,
+ store,
extensions: this.specs,
});
}
diff --git a/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts b/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts
index f75ac32dba..490adeaeb6 100644
--- a/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts
+++ b/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts
@@ -24,6 +24,7 @@ import {
type JobMiddleware,
type Query,
type Schema,
+ Store,
} from '@blocksuite/affine/store';
import { css, html, nothing, type PropertyValues } from 'lit';
import { property, query } from 'lit/decorators.js';
@@ -286,7 +287,7 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) {
this._doc,
html`
${new BlockStdScope({
- doc: this._doc,
+ store: new Store({ blocks: this._doc }),
extensions: this.options.extensions ?? CustomPageEditorBlockSpecs,
}).render()}
`
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts b/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts
index c6e7413bbe..eb1b2318a2 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/messages/slides-renderer.ts
@@ -7,7 +7,7 @@ import {
import { AffineSchemas } from '@blocksuite/affine/blocks/schemas';
import { WithDisposable } from '@blocksuite/affine/global/utils';
import type { Blocks } from '@blocksuite/affine/store';
-import { Schema } from '@blocksuite/affine/store';
+import { Schema, Store } from '@blocksuite/affine/store';
import { css, html, LitElement, nothing } from 'lit';
import { property, query } from 'lit/decorators.js';
import { createRef, type Ref, ref } from 'lit/directives/ref.js';
@@ -208,7 +208,7 @@ export class AISlidesRenderer extends WithDisposable(LitElement) {
${ref(this._editorContainer)}
>
${new BlockStdScope({
- doc: this._doc,
+ store: new Store({ blocks: this._doc }),
extensions:
SpecProvider.getInstance().getSpec('edgeless:preview').value,
}).render()}
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/mini-mindmap/mindmap-preview.ts b/packages/frontend/core/src/blocksuite/presets/ai/mini-mindmap/mindmap-preview.ts
index ac2a111866..f77b2c80ab 100644
--- a/packages/frontend/core/src/blocksuite/presets/ai/mini-mindmap/mindmap-preview.ts
+++ b/packages/frontend/core/src/blocksuite/presets/ai/mini-mindmap/mindmap-preview.ts
@@ -12,7 +12,7 @@ import {
} from '@blocksuite/affine/blocks';
import type { ServiceProvider } from '@blocksuite/affine/global/di';
import { WithDisposable } from '@blocksuite/affine/global/utils';
-import { type Blocks, Job, Schema } from '@blocksuite/affine/store';
+import { type Blocks, Job, Schema, Store } from '@blocksuite/affine/store';
import { css, html, LitElement, nothing } from 'lit';
import { property, query } from 'lit/decorators.js';
import { repeat } from 'lit/directives/repeat.js';
@@ -175,7 +175,7 @@ export class MiniMindmapPreview extends WithDisposable(LitElement) {
})}
>
${new BlockStdScope({
- doc: this.doc,
+ store: new Store({ blocks: this.doc }),
extensions: MiniMindmapSpecs,
}).render()}
diff --git a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx
index 1fb61f0302..93d77c863c 100644
--- a/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx
+++ b/packages/frontend/core/src/desktop/dialogs/setting/general-setting/editor/edgeless/snapshot.tsx
@@ -19,7 +19,7 @@ import {
ThemeExtensionIdentifier,
} from '@blocksuite/affine/blocks';
import { Bound } from '@blocksuite/affine/global/utils';
-import type { Block, Blocks } from '@blocksuite/affine/store';
+import { type Block, type Blocks, Store } from '@blocksuite/affine/store';
import { createSignalFromObservable } from '@blocksuite/affine-shared/utils';
import type { Container } from '@blocksuite/global/di';
import type { Signal } from '@preact/signals-core';
@@ -90,7 +90,7 @@ export const EdgelessSnapshot = (props: Props) => {
if (!doc) return;
const editorHost = new BlockStdScope({
- doc,
+ store: new Store({ blocks: doc }),
extensions: [
...SpecProvider.getInstance().getSpec('edgeless:preview').value,
getThemeExtension(framework),
diff --git a/packages/frontend/core/src/modules/dnd/services/index.ts b/packages/frontend/core/src/modules/dnd/services/index.ts
index 0e5d942892..f071abe04a 100644
--- a/packages/frontend/core/src/modules/dnd/services/index.ts
+++ b/packages/frontend/core/src/modules/dnd/services/index.ts
@@ -7,7 +7,7 @@ import { createPageModeSpecs } from '@affine/core/components/blocksuite/block-su
import type { AffineDNDData } from '@affine/core/types/dnd';
import { BlockStdScope } from '@blocksuite/affine/block-std';
import { DndApiExtensionIdentifier } from '@blocksuite/affine/blocks';
-import { type SliceSnapshot } from '@blocksuite/affine/store';
+import { type SliceSnapshot, Store } from '@blocksuite/affine/store';
import { Service } from '@toeverything/infra';
import type { DocsService } from '../../doc';
@@ -69,7 +69,7 @@ export class DndService extends Service {
}
const std = new BlockStdScope({
- doc,
+ store: new Store({ blocks: doc }),
extensions: createPageModeSpecs(this.framework),
});
const dndAPI = std.get(DndApiExtensionIdentifier);
diff --git a/packages/frontend/core/src/modules/doc-info/utils.ts b/packages/frontend/core/src/modules/doc-info/utils.ts
index d38a2d0c8d..587a848f0b 100644
--- a/packages/frontend/core/src/modules/doc-info/utils.ts
+++ b/packages/frontend/core/src/modules/doc-info/utils.ts
@@ -1,7 +1,7 @@
import { DebugLogger } from '@affine/debug';
import { BlockStdScope } from '@blocksuite/affine/block-std';
import { PageEditorBlockSpecs } from '@blocksuite/affine/blocks';
-import type { Blocks } from '@blocksuite/affine/store';
+import { type Blocks, Store } from '@blocksuite/affine/store';
import { LiveData } from '@toeverything/infra';
import { useMemo } from 'react';
import { Observable } from 'rxjs';
@@ -45,7 +45,7 @@ export function signalToLiveData(
export function createBlockStdScope(doc: Blocks) {
logger.debug('createBlockStdScope', doc.id);
const std = new BlockStdScope({
- doc,
+ store: new Store({ blocks: doc }),
extensions: PageEditorBlockSpecs,
});
return std;