a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

handle cut

+8 -2
+8 -2
components/SelectionManager.tsx
··· 17 17 import { copySelection } from "src/utils/copySelection"; 18 18 import { isTextBlock } from "src/utils/isTextBlock"; 19 19 import { useIsMobile } from "src/hooks/isMobile"; 20 + import { deleteBlock } from "./Blocks/DeleteBlock"; 20 21 export const useSelectingMouse = create(() => ({ 21 22 start: null as null | string, 22 23 })); ··· 227 228 ); 228 229 let listener = async (e: KeyboardEvent) => 229 230 undoManager.withUndoGroup(async () => { 230 - if (e.key === "Backspace" || e.key === "Delete") { 231 + //used here and in cut 232 + const deleteBlocks = async () => { 231 233 if (!entity_set.permissions.write) return; 232 234 if (moreThanOneSelected) { 233 235 e.preventDefault(); ··· 267 269 ); 268 270 } 269 271 } 272 + }; 273 + if (e.key === "Backspace" || e.key === "Delete") { 274 + deleteBlocks(); 270 275 } 271 276 if (e.key === "ArrowUp") { 272 277 let [sortedBlocks, siblings] = await getSortedSelection(); ··· 490 495 } 491 496 } 492 497 } 493 - if (e.key === "c" && (e.metaKey || e.ctrlKey)) { 498 + if ((e.key === "c" || e.key === "x") && (e.metaKey || e.ctrlKey)) { 494 499 if (!rep) return; 495 500 let [, , selectionWithFoldedChildren] = await getSortedSelection(); 496 501 if (!selectionWithFoldedChildren) return; ··· 503 508 return; 504 509 e.preventDefault(); 505 510 await copySelection(rep, selectionWithFoldedChildren); 511 + if (e.key === "x") deleteBlocks(); 506 512 } 507 513 }); 508 514 window.addEventListener("keydown", listener);