8000 fix: Do not replace smart quotes in code by tommoor · Pull Request #7450 · outline/outline · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: Do not replace smart quotes in code #7450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions app/editor/extensions/SmartText.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { ellipsis, smartQuotes } from "prosemirror-inputrules";
import Extension from "@shared/editor/lib/Extension";
import { InputRule } from "@shared/editor/lib/InputRule";

Expand All @@ -9,6 +8,21 @@ const threeQuarters = new InputRule(/(?:^|\s)3\/4$/, "¾");
const copyright = new InputRule(/\(c\)$/, "©️");
const registered = new InputRule(/\(r\)$/, "®️");
const trademarked = new InputRule(/\(tm\)$/, "™️");
const ellipsis = new InputRule(/\.\.\.$/, "…");

// Double quotes
const openDoubleQuote = new InputRule(
/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,
"“"
);
const closeDoubleQuote = new InputRule(/^(?!.*`)[\s\S]*(")$/, "”");

// Single quotes
const openSingleQuote = new InputRule(
/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,
"‘"
);
const closeSingleQuote = new InputRule(/^(?!.*`)[\s\S]*(')$/, "’");

export default class SmartText extends Extension {
get name() {
Expand All @@ -25,7 +39,10 @@ export default class SmartText extends Extension {
registered,
trademarked,
ellipsis,
...smartQuotes,
openDoubleQuote,
closeDoubleQuote,
openSingleQuote,
closeSingleQuote,
];
}
}
Loading
0