fix: Allow strikethrough of inline code (#5207

* fix: Allow strikethrough of inline code

* Remove unneccessary change
This commit is contained in:
Tom Moor
2023-04-17 22:26:36 -04:00
committed by GitHub
parent f2b3524d87
commit 746f4e4150
2 changed files with 35 additions and 15 deletions

View File

@@ -4,8 +4,10 @@ import {
MarkType,
Node as ProsemirrorNode,
Mark as ProsemirrorMark,
Slice,
} from "prosemirror-model";
import { Plugin } from "prosemirror-state";
import { EditorView } from "prosemirror-view";
import moveLeft from "../commands/moveLeft";
import moveRight from "../commands/moveRight";
import markInputRule from "../lib/markInputRule";
@@ -40,7 +42,7 @@ export default class Code extends Mark {
get schema(): MarkSpec {
return {
excludes: "_",
excludes: "comment mention link placeholder highlight em strong",
parseDOM: [{ tag: "code.inline", preserveWhitespace: true }],
toDOM: () => ["code", { class: "inline", spellCheck: "false" }],
};
@@ -66,7 +68,12 @@ export default class Code extends Mark {
props: {
// Typing a character inside of two backticks will wrap the character
// in an inline code mark.
handleTextInput: (view, from: number, to: number, text: string) => {
handleTextInput: (
view: EditorView,
from: number,
to: number,
text: string
) => {
const { state } = view;
// Prevent access out of document bounds
@@ -99,7 +106,7 @@ export default class Code extends Mark {
// Pasting a character inside of two backticks will wrap the character
// in an inline code mark.
handlePaste: (view, _event, slice) => {
handlePaste: (view: EditorView, _event: Event, slice: Slice) => {
const { state } = view;
const { from, to } = state.selection;