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

Fix unstable block cut process #1485

Merged
merged 4 commits into from
Feb 18, 2021

Conversation

hata6502
Copy link
Contributor

@hata6502 hata6502 commented Dec 22, 2020

const { BlockSelection, BlockManager, Caret } = this.Editor;

if (!BlockSelection.anyBlockSelected) {
return;
}

BlockSelection.copySelectedBlocks(event);
await BlockSelection.copySelectedBlocks(event);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the weakness of block cut program.
If await is used in copySelectedBlocks,
removeSelectedBlocks is executed before copySelectedBlocks

const { BlockSelection, BlockManager, Caret } = this.Editor;

if (!BlockSelection.anyBlockSelected) {
return;
}

BlockSelection.copySelectedBlocks(event);
await BlockSelection.copySelectedBlocks(event);

const selectionPositionIndex = BlockManager.removeSelectedBlocks();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line may be executed before copySelectedBlocks()!

@neSpecc neSpecc merged commit 143a539 into codex-team:next Feb 18, 2021
@hata6502 hata6502 deleted the bugfix/fix-unstable-cut-process branch February 19, 2021 14:38
@neSpecc neSpecc mentioned this pull request Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants