mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 13:15:51 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * from './list-model.js';
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { SchemaToModel, Text } from '@blocksuite/store';
|
||||
import { defineBlockSchema } from '@blocksuite/store';
|
||||
|
||||
// `toggle` type has been deprecated, do not use it
|
||||
export type ListType = 'bulleted' | 'numbered' | 'todo' | 'toggle';
|
||||
|
||||
export interface ListProps {
|
||||
type: ListType;
|
||||
text: Text;
|
||||
checked: boolean;
|
||||
collapsed: boolean;
|
||||
order: number | null;
|
||||
}
|
||||
|
||||
export const ListBlockSchema = defineBlockSchema({
|
||||
flavour: 'affine:list',
|
||||
props: internal =>
|
||||
({
|
||||
type: 'bulleted',
|
||||
text: internal.Text(),
|
||||
checked: false,
|
||||
collapsed: false,
|
||||
|
||||
// number type only for numbered list
|
||||
order: null,
|
||||
}) as ListProps,
|
||||
metadata: {
|
||||
version: 1,
|
||||
role: 'content',
|
||||
parent: [
|
||||
'affine:note',
|
||||
'affine:database',
|
||||
'affine:list',
|
||||
'affine:paragraph',
|
||||
'affine:edgeless-text',
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
export type ListBlockModel = SchemaToModel<typeof ListBlockSchema>;
|
||||
|
||||
declare global {
|
||||
namespace BlockSuite {
|
||||
interface BlockModels {
|
||||
'affine:list': ListBlockModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user