fix: Backspace at the beginning of code block should convert to paragraph
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { NodeType } from "prosemirror-model";
|
||||
import backspaceToParagraph from "../commands/backspaceToParagraph";
|
||||
import { selectAll } from "../commands/selectAll";
|
||||
import CodeFence from "./CodeFence";
|
||||
|
||||
@@ -13,6 +14,7 @@ export default class CodeBlock extends CodeFence {
|
||||
|
||||
keys({ type }: { type: NodeType }) {
|
||||
return {
|
||||
Backspace: backspaceToParagraph(type),
|
||||
"Mod-a": selectAll(type),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ import type { Dictionary } from "~/hooks/useDictionary";
|
||||
import { UserPreferences } from "../../types";
|
||||
import Storage from "../../utils/Storage";
|
||||
import { isMac } from "../../utils/browser";
|
||||
import backspaceToParagraph from "../commands/backspaceToParagraph";
|
||||
import {
|
||||
newlineInCode,
|
||||
insertSpaceTab,
|
||||
@@ -255,6 +256,7 @@ export default class CodeFence extends Node {
|
||||
|
||||
return newlineInCode(state, dispatch);
|
||||
},
|
||||
Backspace: backspaceToParagraph(type),
|
||||
"Shift-Enter": newlineInCode,
|
||||
"Mod-a": selectAll(type),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user