Insert document title when pasting internal doc url (#6352)

* refactor

* DRY
This commit is contained in:
Tom Moor
2024-01-06 13:44:11 -08:00
committed by GitHub
parent 08b1755f8e
commit 92cbceb6c7
14 changed files with 123 additions and 51 deletions

View File

@@ -0,0 +1,28 @@
import { ellipsis, smartQuotes, InputRule } from "prosemirror-inputrules";
import Extension from "@shared/editor/lib/Extension";
const rightArrow = new InputRule(/->$/, "→");
const oneHalf = new InputRule(/1\/2$/, "½");
const threeQuarters = new InputRule(/3\/4$/, "¾");
const copyright = new InputRule(/\(c\)$/, "©️");
const registered = new InputRule(/\(r\)$/, "®️");
const trademarked = new InputRule(/\(tm\)$/, "™️");
export default class SmartText extends Extension {
get name() {
return "smart_text";
}
inputRules() {
return [
rightArrow,
oneHalf,
threeQuarters,
copyright,
registered,
trademarked,
ellipsis,
...smartQuotes,
];
}
}