// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import type { MatchType } from "./match-type"; import type { FormattingNode } from "./tree"; export interface SurroundFormat { /** * Determine whether element matches the format. Confirm by calling * `match.remove` or `match.clear`. Sustain parameters provided to the format * by calling `match.setCache`. */ matcher: (element: HTMLElement | SVGElement, match: MatchType) => void; /** * @returns Whether before or after are allowed to merge to a single * FormattingNode range */ merger?: (before: FormattingNode, after: FormattingNode) => boolean; /** * Apply according to this formatter. * * @returns Whether formatter added a new element around the range. */ formatter?: (node: FormattingNode) => boolean; /** * Surround with this node as formatting. Shorthand alternative to `formatter`. */ surroundElement?: Element; }