mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 08:47:10 +08:00
22 lines
694 B
TypeScript
22 lines
694 B
TypeScript
import { DividerBlockSchema } from '@blocksuite/affine-model';
|
|
import {
|
|
BlockPlainTextAdapterExtension,
|
|
type BlockPlainTextAdapterMatcher,
|
|
} from '@blocksuite/affine-shared/adapters';
|
|
|
|
export const dividerBlockPlainTextAdapterMatcher: BlockPlainTextAdapterMatcher =
|
|
{
|
|
flavour: DividerBlockSchema.model.flavour,
|
|
toMatch: () => false,
|
|
fromMatch: o => o.node.flavour === DividerBlockSchema.model.flavour,
|
|
toBlockSnapshot: {},
|
|
fromBlockSnapshot: {
|
|
enter: (_, context) => {
|
|
context.textBuffer.content += '---\n';
|
|
},
|
|
},
|
|
};
|
|
|
|
export const DividerBlockPlainTextAdapterExtension =
|
|
BlockPlainTextAdapterExtension(dividerBlockPlainTextAdapterMatcher);
|