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

Prevent duplicated event dispatching #1381

Conversation

hata6502
Copy link
Contributor

@hata6502 hata6502 force-pushed the bugfix/fix-block-selection-multiple-detection branch from 00874d6 to 55acc92 Compare October 15, 2020 15:13
@@ -185,7 +185,6 @@ export default class Core {
a: true,
} as SanitizerConfig;


Copy link
Contributor Author

Choose a reason for hiding this comment

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

yarn lint:fix

@@ -175,7 +175,7 @@ export default class BlockSelection extends Module {
*
* Prevent such actions if focus is not inside the Editor
*/
if (!BlockManager.currentBlock) {
if (!event.target.closest(`.${this.Editor.UI.CSS.editorWrapper}`)?.isEqualNode(this.Editor.UI.nodes.wrapper)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When multiple Editor.js instances are launched, BlockManager.currentBlock can't be changed to null by focusing other instances.

Copy link
Member

@khaydarov khaydarov Nov 21, 2020

Choose a reason for hiding this comment

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

maybe it makes sense to create a function inside UI module that gets event and checks if event's target is under editor's instance wrapper?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, this method seems DOM hacking!
Sorry, this problem has been resolved by #1431

) {
return;
}

Copy link
Contributor Author

@hata6502 hata6502 Nov 23, 2020

Choose a reason for hiding this comment

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

And... This fix is also already resolved in next.
This PR is invalid.
Sorry, I'll close it!

@hata6502
Copy link
Contributor Author

These fixes are resolved by #1431
Sorry, I'll close this PR because it is invalid.

@hata6502 hata6502 closed this Nov 23, 2020
@hata6502 hata6502 deleted the bugfix/fix-block-selection-multiple-detection branch November 23, 2020 02:31
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.

2 participants