Files
outline/shared/editor/lib/embeds.ts

16 lines
348 B
TypeScript

import { EmbedDescriptor } from "../embeds";
export function getMatchingEmbed(
embeds: EmbedDescriptor[],
href: string
): { embed: EmbedDescriptor; matches: RegExpMatchArray } | undefined {
for (const e of embeds) {
const matches = e.matcher(href);
if (matches) {
return { embed: e, matches };
}
}
return undefined;
}