Files
AFFiNE-Mirror/blocksuite/affine/block-paragraph/src/paragraph-service.ts
T
2024-12-20 15:38:06 +08:00

27 lines
670 B
TypeScript

import {
type ParagraphBlockModel,
ParagraphBlockSchema,
} from '@blocksuite/affine-model';
import { BlockService } from '@blocksuite/block-std';
export class ParagraphBlockService extends BlockService {
static override readonly flavour = ParagraphBlockSchema.model.flavour;
placeholderGenerator: (model: ParagraphBlockModel) => string = model => {
if (model.type === 'text') {
return "Type '/' for commands";
}
const placeholders = {
h1: 'Heading 1',
h2: 'Heading 2',
h3: 'Heading 3',
h4: 'Heading 4',
h5: 'Heading 5',
h6: 'Heading 6',
quote: '',
};
return placeholders[model.type];
};
}