mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-21 03:56:23 +08:00
205cd7a86d
Closes: BS-2946
30 lines
1016 B
TypeScript
30 lines
1016 B
TypeScript
import { FootNoteSchema } from '@blocksuite/affine-model';
|
|
import type { AffineTextAttributes } from '@blocksuite/affine-shared/types';
|
|
import { StdIdentifier } from '@blocksuite/std';
|
|
import { InlineSpecExtension } from '@blocksuite/std/inline';
|
|
import { html } from 'lit';
|
|
|
|
import { FootNoteNodeConfigIdentifier } from './footnote-node/footnote-config';
|
|
|
|
export const FootNoteInlineSpecExtension =
|
|
InlineSpecExtension<AffineTextAttributes>('footnote', provider => {
|
|
const std = provider.get(StdIdentifier);
|
|
const config =
|
|
provider.getOptional(FootNoteNodeConfigIdentifier) ?? undefined;
|
|
return {
|
|
name: 'footnote',
|
|
schema: FootNoteSchema.optional().nullable().catch(undefined),
|
|
match: delta => {
|
|
return !!delta.attributes?.footnote;
|
|
},
|
|
renderer: ({ delta }) => {
|
|
return html`<affine-footnote-node
|
|
.delta=${delta}
|
|
.std=${std}
|
|
.config=${config}
|
|
></affine-footnote-node>`;
|
|
},
|
|
embed: true,
|
|
};
|
|
});
|