mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 01:09:54 +08:00
chore: merge blocksuite source code (#9213)
This commit is contained in:
@@ -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';
|
||||
Reference in New Issue
Block a user