From 44ca3d6a7ef89ab057fe9871fa8ef2bab80ed5f2 Mon Sep 17 00:00:00 2001 From: 01zulfi <85733202+01zulfi@users.noreply.github.com> Date: Sat, 4 Jan 2025 14:08:56 +0500 Subject: [PATCH] editor: add clear current node keyboard shortcut Signed-off-by: 01zulfi <85733202+01zulfi@users.noreply.github.com> --- packages/editor/src/extensions/key-map/key-map.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/editor/src/extensions/key-map/key-map.ts b/packages/editor/src/extensions/key-map/key-map.ts index 148005836d..0123cc1fda 100644 --- a/packages/editor/src/extensions/key-map/key-map.ts +++ b/packages/editor/src/extensions/key-map/key-map.ts @@ -22,6 +22,7 @@ import { isInTable } from "@tiptap/pm/tables"; import { CodeBlock } from "../code-block/index.js"; import { showLinkPopup } from "../../toolbar/popups/link-popup.js"; import { isListActive } from "../../utils/list.js"; +import { Node } from "@tiptap/pm/model"; export const KeyMap = Extension.create({ name: "key-map", @@ -70,6 +71,15 @@ export const KeyMap = Extension.create({ "Mod-k": ({ editor }) => { showLinkPopup(editor); return true; + }, + "Ctrl-Shift-K": ({ editor }) => { + let currentNode: Node; + if (isListActive(editor)) { + currentNode = editor.state.selection.$from.node(-1); + } else { + currentNode = editor.state.selection.$from.node(); + } + return editor.commands.deleteNode(currentNode.type); } }; }