Skip to content

Commit

Permalink
chore: console log delete
Browse files Browse the repository at this point in the history
  • Loading branch information
MXerFix committed Sep 30, 2024
1 parent 775eed9 commit da4f4a3
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions frontend/src/contexts/undoRedoContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,12 @@ export function UndoRedoProvider({ children }: { children: React.ReactNode }) {
}

const keyDownHandler = (event: KeyboardEvent) => {
if (event.key === "z" && (event.ctrlKey || event.metaKey) && event.shiftKey && !disableCopyPaste) {
if (
event.key === "z" &&
(event.ctrlKey || event.metaKey) &&
event.shiftKey &&
!disableCopyPaste
) {
redo()
} else if (event.key === "y" && (event.ctrlKey || event.metaKey) && !disableCopyPaste) {
event.preventDefault() // prevent the default action
Expand All @@ -177,12 +182,10 @@ export function UndoRedoProvider({ children }: { children: React.ReactNode }) {
const [copiedSelection, setCopiedSelection] = useState<OnSelectionChangeParams | null>(null)

useEffect(() => {
console.log(modalsOpened)
if (modalsOpened === 0) {
setDisableCopyPaste(false)
} else if (modalsOpened > 0) {
setDisableCopyPaste(true)
console.log(true)
}
}, [modalsOpened])

Expand Down Expand Up @@ -212,7 +215,7 @@ export function UndoRedoProvider({ children }: { children: React.ReactNode }) {
/**
* Paste function
* @param selectionInstance last selection of nodes&edges
* @param position position of pasting nodes&edges
* @param position position of pasting nodes&edges
*/
const paste = (
selectionInstance: OnSelectionChangeParams,
Expand Down Expand Up @@ -313,7 +316,6 @@ export function UndoRedoProvider({ children }: { children: React.ReactNode }) {

const newNodes = [...nodes.map((e: AppNode) => ({ ...e, selected: false })), ...resultNodes]


selectionInstance.edges.forEach((e) => {
const source = idsMap[e.source]
const target = idsMap[e.target]
Expand Down

0 comments on commit da4f4a3

Please sign in to comment.