chore: merge blocksuite source code (#9213)

This commit is contained in:
Mirone
2024-12-20 15:38:06 +08:00
committed by GitHub
parent 2c9ef916f4
commit 30200ff86d
2031 changed files with 238888 additions and 229 deletions
@@ -0,0 +1,74 @@
import type {
GfxCommonBlockProps,
GfxElementGeometry,
} from '@blocksuite/block-std/gfx';
import { GfxCompatible } from '@blocksuite/block-std/gfx';
import { BlockModel, defineBlockSchema } from '@blocksuite/store';
import {
FontFamily,
FontStyle,
FontWeight,
TextAlign,
type TextStyleProps,
} from '../../consts/index.js';
type EdgelessTextProps = {
hasMaxWidth: boolean;
} & Omit<TextStyleProps, 'fontSize'> &
GfxCommonBlockProps;
export const EdgelessTextBlockSchema = defineBlockSchema({
flavour: 'affine:edgeless-text',
props: (): EdgelessTextProps => ({
xywh: '[0,0,16,16]',
index: 'a0',
lockedBySelf: false,
color: '#000000',
fontFamily: FontFamily.Inter,
fontStyle: FontStyle.Normal,
fontWeight: FontWeight.Regular,
textAlign: TextAlign.Left,
scale: 1,
rotate: 0,
hasMaxWidth: false,
}),
metadata: {
version: 1,
role: 'hub',
parent: ['affine:surface'],
children: [
'affine:paragraph',
'affine:list',
'affine:code',
'affine:image',
'affine:bookmark',
'affine:attachment',
'affine:embed-!(synced-doc)',
'affine:latex',
],
},
toModel: () => {
return new EdgelessTextBlockModel();
},
});
export class EdgelessTextBlockModel
extends GfxCompatible<EdgelessTextProps>(BlockModel)
implements GfxElementGeometry {}
declare global {
namespace BlockSuite {
interface BlockModels {
'affine:edgeless-text': EdgelessTextBlockModel;
}
interface EdgelessBlockModelMap {
'affine:edgeless-text': EdgelessTextBlockModel;
}
interface EdgelessTextModelMap {
'edgeless-text': EdgelessTextBlockModel;
}
}
}
@@ -0,0 +1 @@
export * from './edgeless-text-model.js';