mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 05:29:08 +08:00
refactor(editor): remove global types in model (#10082)
Closes: [BS-2249](https://linear.app/affine-design/issue/BS-2249/remove-global-types-in-model) ```ts // before matchFlavours(model, ['affine:page']); // after matchFlavours(model, [PageBlockModel]); ```
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { defineBlockSchema, type SchemaToModel } from '@blocksuite/store';
|
||||
import { BlockModel, defineBlockSchema } from '@blocksuite/store';
|
||||
|
||||
export const DividerBlockSchema = defineBlockSchema({
|
||||
flavour: 'affine:divider',
|
||||
@@ -7,9 +7,14 @@ export const DividerBlockSchema = defineBlockSchema({
|
||||
role: 'content',
|
||||
children: [],
|
||||
},
|
||||
toModel: () => new DividerBlockModel(),
|
||||
});
|
||||
|
||||
export type DividerBlockModel = SchemaToModel<typeof DividerBlockSchema>;
|
||||
type Props = {
|
||||
text: string;
|
||||
};
|
||||
|
||||
export class DividerBlockModel extends BlockModel<Props> {}
|
||||
|
||||
declare global {
|
||||
namespace BlockSuite {
|
||||
|
||||
Reference in New Issue
Block a user