Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add beforeDestroy to control the deletion of selected blocks #2632

Open
AricZhu opened this issue Feb 22, 2024 · 1 comment
Open

add beforeDestroy to control the deletion of selected blocks #2632

AricZhu opened this issue Feb 22, 2024 · 1 comment
Labels

Comments

@AricZhu
Copy link

AricZhu commented Feb 22, 2024

Sometimes we need to prevent the deletion of certain selected blocks, but the framework does not currently support this feature

Expected behavior:
Support preventing the deletion of certain selected blocks.

To do this, we can prevent deletions by adding the beforeSelectedDestroy hook function which return -1.

@AricZhu AricZhu added the bug label Feb 22, 2024
AricZhu added a commit to AricZhu/editor.js that referenced this issue Feb 22, 2024
@korytovaf
Copy link

Have you solved this problem somehow? If I have a similar task, I need to prevent the deletion of a certain block and also prevent it from moving. I solved the deletion problem as follows - The block tool has the destroy method, which is called before deleting the block and in it I create a new duplicate of the deleted block and place it in the same place. But I can't find a similar method to move the block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants