@udecode/plate-selection
Advanced tools
Comparing version
@@ -1127,2 +1127,6 @@ "use strict"; | ||
} | ||
if ((0, import_plate4.isHotkey)("mod+a")(e)) { | ||
api.blockSelection.selectAll(); | ||
return; | ||
} | ||
if ((0, import_plate4.isHotkey)("mod+shift+z")(e)) { | ||
@@ -1150,10 +1154,15 @@ editor.redo(); | ||
editor.tf.withoutNormalizing(() => { | ||
const entry = editor.api.block({ | ||
at: [], | ||
match: (n) => !!n.id && selectedIds?.has(n.id) | ||
}); | ||
if (entry) { | ||
const entries = [ | ||
...editor.api.nodes({ | ||
at: [], | ||
match: (n) => !!n.id && selectedIds?.has(n.id) | ||
}) | ||
]; | ||
for (const [, path] of [...entries].reverse()) { | ||
editor.tf.removeNodes({ | ||
at: entry[1] | ||
at: path | ||
}); | ||
} | ||
const entry = entries[0]; | ||
if (entry) { | ||
if (editor.children.length === 0) { | ||
@@ -1283,2 +1292,4 @@ editor.tf.focus(); | ||
api.blockSelection.set(prevNode.id); | ||
} else { | ||
api.blockSelection.set(blocks[0][0].id); | ||
} | ||
@@ -1296,2 +1307,4 @@ } else { | ||
api.blockSelection.set(nextNode.id); | ||
} else { | ||
api.blockSelection.set(blocks.at(-1)[0].id); | ||
} | ||
@@ -1298,0 +1311,0 @@ } |
@@ -160,3 +160,5 @@ import * as _udecode_plate_core_react from '@udecode/plate-core/react'; | ||
/** Get selected blocks */ | ||
getNodes: () => NodeEntry[]; | ||
getNodes: () => NodeEntry<TElement & { | ||
id: string; | ||
}>[]; | ||
/** Check if a block is selected. */ | ||
@@ -222,3 +224,5 @@ has: (id: string[] | string) => boolean; | ||
/** Get selected blocks */ | ||
getNodes: () => NodeEntry[]; | ||
getNodes: () => NodeEntry<TElement & { | ||
id: string; | ||
}>[]; | ||
/** Check if a block is selected. */ | ||
@@ -264,3 +268,5 @@ has: (id: string[] | string) => boolean; | ||
/** Get selected blocks */ | ||
getNodes: () => NodeEntry[]; | ||
getNodes: () => NodeEntry<TElement & { | ||
id: string; | ||
}>[]; | ||
/** Check if a block is selected. */ | ||
@@ -267,0 +273,0 @@ has: (id: string[] | string) => boolean; |
{ | ||
"name": "@udecode/plate-selection", | ||
"version": "45.1.0", | ||
"version": "46.0.4", | ||
"description": "Plate selection plugins", | ||
@@ -59,3 +59,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"@udecode/plate": ">=45.0.9", | ||
"@udecode/plate": ">=46.0.4", | ||
"react": ">=18.0.0", | ||
@@ -62,0 +62,0 @@ "react-dom": ">=18.0.0" |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
794617
0.6%8007
0.73%