Skip to content

Commit

Permalink
Fix creation of space blocks on bulk delete
Browse files Browse the repository at this point in the history
  • Loading branch information
apsinghdev committed May 22, 2024
1 parent 46b62b1 commit 0022fad
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions js/piemenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -3452,8 +3452,24 @@ const piemenuBlockContext = (block) => {
that.blocks.extract();
if (that.blocks.selectionModeOn){
const blocksArray = that.blocks.selectedBlocks;
for(let i = 0; i < blocksArray.length; i++){
that.blocks.sendStackToTrash(blocksArray[i]);
// figure out which of blocks in selectedBlocks are clamp blocks and nonClamp one's.
const clampBlocks = [];
const nonClampBlocks = [];

for (let i = 0; i < blocksArray.length; i++) {
if (that.blocks.selectedBlocks[i].isClampBlock()) {
clampBlocks.push(that.blocks.selectedBlocks[i]);
} else if (that.blocks.selectedBlocks[i].isDisconnected()) {
nonClampBlocks.push(that.blocks.selectedBlocks[i]);
}
}

for (let i = 0; i < clampBlocks.length; i++) {
that.blocks.sendStackToTrash(clampBlocks[i]);
}

for (let i = 0; i < nonClampBlocks.length; i++) {
that.blocks.sendStackToTrash(nonClampBlocks[i]);
}
// set selection mode to false
that.blocks.setSelectionToActivity(false);
Expand Down

0 comments on commit 0022fad

Please sign in to comment.