This commit is contained in:
kelin.zrh 2024-02-22 19:40:07 +08:00
parent b619946e8f
commit 54df65951b
2 changed files with 9 additions and 1 deletions

View file

@ -528,7 +528,7 @@ export default class Block extends EventsDispatcher<BlockEvents> {
try {
// eslint-disable-next-line no-useless-call
this.toolInstance[methodName].call(this.toolInstance, params);
return this.toolInstance[methodName].call(this.toolInstance, params);
} catch (e) {
_.log(`Error during '${methodName}' call: ${e.message}`, 'error');
}

View file

@ -546,6 +546,14 @@ export default class BlockManager extends Module {
continue;
}
/**
* prevent deletion if return -1
*/
const ret: any = this.blocks[index].call('beforeDestroy');
if (ret === -1) {
continue;
}
this.removeBlock(this.blocks[index]);
firstSelectedBlockIndex = index;
}