mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
**Directory Structure Changes** - Renamed multiple block-related directories by removing the "block-" prefix: - `block-attachment` → `attachment` - `block-bookmark` → `bookmark` - `block-callout` → `callout` - `block-code` → `code` - `block-data-view` → `data-view` - `block-database` → `database` - `block-divider` → `divider` - `block-edgeless-text` → `edgeless-text` - `block-embed` → `embed`
51 lines
1.2 KiB
TypeScript
51 lines
1.2 KiB
TypeScript
import type { ParagraphType } from '@blocksuite/affine-model';
|
|
import {
|
|
BulletedListIcon,
|
|
CheckBoxCheckLinearIcon,
|
|
Heading1Icon,
|
|
Heading2Icon,
|
|
Heading3Icon,
|
|
Heading4Icon,
|
|
Heading5Icon,
|
|
Heading6Icon,
|
|
NumberedListIcon,
|
|
QuoteIcon,
|
|
TextIcon,
|
|
} from '@blocksuite/icons/lit';
|
|
import type { BlockModel } from '@blocksuite/store';
|
|
import type { TemplateResult } from 'lit';
|
|
|
|
export const getIcon = (
|
|
model: BlockModel & {
|
|
props: {
|
|
type?: string;
|
|
};
|
|
}
|
|
): TemplateResult => {
|
|
if (model.flavour === 'affine:paragraph') {
|
|
const type = model.props.type as ParagraphType;
|
|
return (
|
|
{
|
|
text: TextIcon(),
|
|
quote: QuoteIcon(),
|
|
h1: Heading1Icon(),
|
|
h2: Heading2Icon(),
|
|
h3: Heading3Icon(),
|
|
h4: Heading4Icon(),
|
|
h5: Heading5Icon(),
|
|
h6: Heading6Icon(),
|
|
} as Record<ParagraphType, TemplateResult>
|
|
)[type];
|
|
}
|
|
if (model.flavour === 'affine:list') {
|
|
return (
|
|
{
|
|
bulleted: BulletedListIcon(),
|
|
numbered: NumberedListIcon(),
|
|
todo: CheckBoxCheckLinearIcon(),
|
|
}[model.props.type ?? 'bulleted'] ?? BulletedListIcon()
|
|
);
|
|
}
|
|
return TextIcon();
|
|
};
|