Skip to content

Commit

Permalink
fix: Failure on undo
Browse files Browse the repository at this point in the history
  • Loading branch information
surajshetty3416 committed Jan 18, 2024
1 parent cb93cb4 commit bfca191
Showing 1 changed file with 0 additions and 14 deletions.
14 changes: 0 additions & 14 deletions frontend/src/pages/PageBuilder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,11 @@ useEventListener(document, "keydown", (e) => {
if (isTargetEditable(e)) return;
if (e.key === "z" && isCtrlOrCmd(e) && !e.shiftKey && store.activeCanvas?.history.canUndo) {
store.activeCanvas?.history.undo();
updateSelectedBlocks();
e.preventDefault();
return;
}
if (e.key === "z" && e.shiftKey && isCtrlOrCmd(e) && store.activeCanvas?.history.canRedo) {
store.activeCanvas?.history.redo();
updateSelectedBlocks();
e.preventDefault();
return;
}
Expand Down Expand Up @@ -520,18 +518,6 @@ useEventListener(document, "visibilitychange", () => {
}
});
const updateSelectedBlocks = () => {
const selectedBlocks = blockController.getSelectedBlocks();
const activeCanvasBlocks = [store.activeCanvas?.block as Block];
for (const block of selectedBlocks) {
const blockInActiveCanvas = store.findBlock(block.blockId, activeCanvasBlocks);
if (blockInActiveCanvas) {
// replace in place
selectedBlocks.splice(selectedBlocks.indexOf(block), 1, blockInActiveCanvas);
}
}
};
watchEffect(() => {
if (componentCanvas.value) {
store.activeCanvas = componentCanvas.value;
Expand Down

0 comments on commit bfca191

Please sign in to comment.