mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
45c797653f
* 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>
59 lines
1.1 KiB
TypeScript
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" };
|
|
}
|
|
}
|