UNPKG

@rr0/cms

Version:

RR0 Content Management System (CMS)

19 lines (18 loc) 557 B
import { DomReplaceCommand } from "ssg-api"; import { AnchorReplacer } from "./AnchorReplacer.js"; /** * Contextual replacement of anchors (`<a>` tags). */ export class AnchorReplaceCommand extends DomReplaceCommand { constructor(baseUrl, handlers) { super("a", undefined); this.singleton = new AnchorReplacer(baseUrl, handlers); } async createReplacer(context) { return { replace: async (original) => { return this.singleton.replacement(context, original); } }; } }