mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-19 02:56:23 +08:00
205cd7a86d
Closes: BS-2946
19 lines
545 B
TypeScript
19 lines
545 B
TypeScript
import type { BaseTextAttributes, DeltaInsert } from '@blocksuite/store';
|
|
import { html, type TemplateResult } from 'lit';
|
|
|
|
export function renderElement<TextAttributes extends BaseTextAttributes>(
|
|
delta: DeltaInsert<TextAttributes>,
|
|
parseAttributes: (
|
|
textAttributes?: TextAttributes
|
|
) => TextAttributes | undefined,
|
|
selected: boolean
|
|
): TemplateResult<1> {
|
|
return html`<v-element
|
|
.selected=${selected}
|
|
.delta=${{
|
|
insert: delta.insert,
|
|
attributes: parseAttributes(delta.attributes),
|
|
}}
|
|
></v-element>`;
|
|
}
|