@blocknote/core
Version:
A "Notion-style" block-based extensible text editor built on top of Prosemirror and Tiptap.
17 lines (14 loc) • 409 B
text/typescript
export const parseFigureElement = (
figureElement: HTMLElement,
targetTag: string,
) => {
const targetElement = figureElement.querySelector(
targetTag,
) as HTMLElement | null;
if (!targetElement) {
return undefined;
}
const captionElement = figureElement.querySelector("figcaption");
const caption = captionElement?.textContent ?? undefined;
return { targetElement, caption };
};