feat(editor): add editor store (#9584)

This commit is contained in:
Saul-Mirone
2025-01-08 07:47:43 +00:00
parent 0554df6bc2
commit fe727412be
25 changed files with 203 additions and 67 deletions

View File

@@ -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`<div class="ai-answer-text-editor affine-page-viewport">
${new BlockStdScope({
doc: this._doc,
store: new Store({ blocks: this._doc }),
extensions: this.options.extensions ?? CustomPageEditorBlockSpecs,
}).render()}
</div>`

View File

@@ -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()}

View File

@@ -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()}
</div>