@tiptap/extension-list-keymap
Advanced tools
Comparing version 3.0.0-next.1 to 3.0.0-next.2
@@ -109,2 +109,5 @@ var __defProp = Object.defineProperty; | ||
} | ||
if (editor.state.selection.from !== editor.state.selection.to) { | ||
return false; | ||
} | ||
if (!isNodeActive(editor.state, name) && hasListBefore(editor.state, name, parentListTypes)) { | ||
@@ -182,2 +185,7 @@ const { $anchor } = editor.state.selection; | ||
} | ||
const { selection } = editor.state; | ||
const { $from, $to } = selection; | ||
if (!selection.empty && $from.sameParent($to)) { | ||
return false; | ||
} | ||
if (nextListIsDeeper(name, editor.state)) { | ||
@@ -184,0 +192,0 @@ return editor.chain().focus(editor.state.selection.from + 4).lift(name).joinBackward().run(); |
{ | ||
"name": "@tiptap/extension-list-keymap", | ||
"description": "list keymap extension for tiptap", | ||
"version": "3.0.0-next.1", | ||
"version": "3.0.0-next.2", | ||
"homepage": "https://tiptap.dev", | ||
@@ -31,3 +31,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@tiptap/core": "^3.0.0-next.1" | ||
"@tiptap/core": "^3.0.0-next.2" | ||
}, | ||
@@ -34,0 +34,0 @@ "peerDependencies": { |
@@ -15,2 +15,8 @@ import { Editor, isAtStartOfNode, isNodeActive } from '@tiptap/core' | ||
// if the selection is not collapsed | ||
// we can rely on the default backspace behavior | ||
if (editor.state.selection.from !== editor.state.selection.to) { | ||
return false | ||
} | ||
// if the current item is NOT inside a list item & | ||
@@ -17,0 +23,0 @@ // the previous item is a list (orderedList or bulletList) |
@@ -19,2 +19,11 @@ import { Editor, isAtEndOfNode, isNodeActive } from '@tiptap/core' | ||
// if the selection is not collapsed, or not within a single node | ||
// do nothing and proceed | ||
const { selection } = editor.state | ||
const { $from, $to } = selection | ||
if (!selection.empty && $from.sameParent($to)) { | ||
return false | ||
} | ||
// check if the next node is a list with a deeper depth | ||
@@ -21,0 +30,0 @@ if (nextListIsDeeper(name, editor.state)) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
72591
933
0