Files
Tom Moor 45c797653f feat: Format word at cursor position (#12492)
* wip

* refactor

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-05-27 18:44:07 -04:00

59 lines
1.1 KiB
TypeScript

import type { MarkSpec, MarkType } from "prosemirror-model";
import { toggleMark } from "../commands/toggleMark";
import { markInputRuleForPattern } from "../lib/markInputRule";
import Mark from "./Mark";
export default class Strikethrough extends Mark {
get name() {
return "strikethrough";
}
get schema(): MarkSpec {
return {
parseDOM: [
{
tag: "s",
},
{
tag: "del",
},
{
tag: "strike",
},
{
style: "text-decoration",
getAttrs: (value) => (value === "line-through" ? null : false),
},
],
toDOM: () => ["del", 0],
};
}
keys({ type }: { type: MarkType }) {
return {
"Mod-d": toggleMark(type),
};
}
inputRules({ type }: { type: MarkType }) {
return [markInputRuleForPattern("~", type)];
}
toMarkdown() {
return {
open: "~~",
close: "~~",
mixable: true,
expelEnclosingWhitespace: true,
};
}
get markdownToken() {
return "s";
}
parseMarkdown() {
return { mark: "strikethrough" };
}
}