mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
21 lines
584 B
TypeScript
21 lines
584 B
TypeScript
import { html, type TemplateResult } from 'lit';
|
|
|
|
import type { DeltaInsert } from '../types.js';
|
|
import type { BaseTextAttributes } from './base-attributes.js';
|
|
|
|
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>`;
|
|
}
|