dd/node_modules/prosemirror-inputrules/src/rules.ts
2026-06-14 15:46:45 +08:00

18 lines
979 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {InputRule} from "./inputrules"
/// Converts double dashes to an emdash.
export const emDash = new InputRule(/--$/, "—", {inCodeMark: false})
/// Converts three dots to an ellipsis character.
export const ellipsis = new InputRule(/\.\.\.$/, "…", {inCodeMark: false})
/// “Smart” opening double quotes.
export const openDoubleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/, "“", {inCodeMark: false})
/// “Smart” closing double quotes.
export const closeDoubleQuote = new InputRule(/"$/, "”", {inCodeMark: false})
/// “Smart” opening single quotes.
export const openSingleQuote = new InputRule(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/, "", {inCodeMark: false})
/// “Smart” closing single quotes.
export const closeSingleQuote = new InputRule(/'$/, "", {inCodeMark: false})
/// Smart-quote related input rules.
export const smartQuotes: readonly InputRule[] = [openDoubleQuote, closeDoubleQuote, openSingleQuote, closeSingleQuote]