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,70 @@
import type {
GfxCommonBlockProps,
GfxElementGeometry,
} from '@blocksuite/block-std/gfx';
import { GfxCompatible } from '@blocksuite/block-std/gfx';
import { BlockModel, defineBlockSchema } from '@blocksuite/store';
import type { EmbedCardStyle, LinkPreviewData } from '../../utils/index.js';
export const BookmarkStyles: EmbedCardStyle[] = [
'vertical',
'horizontal',
'list',
'cube',
] as const;
export type BookmarkBlockProps = {
style: (typeof BookmarkStyles)[number];
url: string;
caption: string | null;
} & LinkPreviewData &
Omit<GfxCommonBlockProps, 'scale'>;
const defaultBookmarkProps: BookmarkBlockProps = {
style: BookmarkStyles[1],
url: '',
caption: null,
description: null,
icon: null,
image: null,
title: null,
index: 'a0',
xywh: '[0,0,0,0]',
lockedBySelf: false,
rotate: 0,
};
export const BookmarkBlockSchema = defineBlockSchema({
flavour: 'affine:bookmark',
props: (): BookmarkBlockProps => defaultBookmarkProps,
metadata: {
version: 1,
role: 'content',
parent: [
'affine:note',
'affine:surface',
'affine:edgeless-text',
'affine:paragraph',
'affine:list',
],
},
toModel: () => new BookmarkBlockModel(),
});
export class BookmarkBlockModel
extends GfxCompatible<BookmarkBlockProps>(BlockModel)
implements GfxElementGeometry {}
declare global {
namespace BlockSuite {
interface EdgelessBlockModelMap {
'affine:bookmark': BookmarkBlockModel;
}
interface BlockModels {
'affine:bookmark': BookmarkBlockModel;
}
}
}
@@ -0,0 +1 @@
export * from './bookmark-model.js';