mirror of
https://github.com/codex-team/editor.js
synced 2024-06-01 21:42:26 +02:00
fix: issue #2632
This commit is contained in:
parent
b619946e8f
commit
54df65951b
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue