mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-24 05:07:06 +08:00
feat(editor): merge store and blocks (#9591)
This commit is contained in:
@@ -2,7 +2,7 @@ import { type Disposable, Slot } from '@blocksuite/global/utils';
|
||||
import { computed, type Signal, signal } from '@preact/signals-core';
|
||||
|
||||
import type { Text } from '../../reactive/index.js';
|
||||
import type { Blocks } from '../blocks/blocks.js';
|
||||
import type { Store } from '../store/store.js';
|
||||
import type { YBlock } from './types.js';
|
||||
import type { RoleType } from './zod.js';
|
||||
|
||||
@@ -38,7 +38,7 @@ export class BlockModel<
|
||||
/**
|
||||
* @deprecated use doc instead
|
||||
*/
|
||||
page!: Blocks;
|
||||
page!: Store;
|
||||
|
||||
private readonly _childModels = computed(() => {
|
||||
const value: BlockModel[] = [];
|
||||
@@ -102,7 +102,7 @@ export class BlockModel<
|
||||
return this.page;
|
||||
}
|
||||
|
||||
set doc(doc: Blocks) {
|
||||
set doc(doc: Store) {
|
||||
this.page = doc;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { Schema } from '../../schema/index.js';
|
||||
import type { Blocks } from '../blocks/blocks.js';
|
||||
import type { Store } from '../store/store.js';
|
||||
import { SyncController } from './sync-controller.js';
|
||||
import type { BlockOptions, YBlock } from './types.js';
|
||||
|
||||
@@ -37,7 +37,7 @@ export class Block {
|
||||
constructor(
|
||||
readonly schema: Schema,
|
||||
readonly yBlock: YBlock,
|
||||
readonly doc?: Blocks,
|
||||
readonly doc?: Store,
|
||||
readonly options: BlockOptions = {}
|
||||
) {
|
||||
const onChange = !options.onChange
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
y2Native,
|
||||
} from '../../reactive/index.js';
|
||||
import type { Schema } from '../../schema/schema.js';
|
||||
import type { Blocks } from '../blocks/blocks.js';
|
||||
import type { Store } from '../store/store.js';
|
||||
import { BlockModel } from './block-model.js';
|
||||
import type { YBlock } from './types.js';
|
||||
import { internalPrimitives } from './zod.js';
|
||||
@@ -104,7 +104,7 @@ export class SyncController {
|
||||
constructor(
|
||||
readonly schema: Schema,
|
||||
readonly yBlock: YBlock,
|
||||
readonly doc?: Blocks,
|
||||
readonly doc?: Store,
|
||||
readonly onChange?: (key: string, value: unknown) => void
|
||||
) {
|
||||
const { id, flavour, version, yChildren, props } = this._parseYBlock();
|
||||
|
||||
Reference in New Issue
Block a user