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 type error when merging blocks #4791

Merged
merged 1 commit into from
Feb 2, 2018

Conversation

noisysocks
Copy link
Member

What this is

Fixes #4580. This was a regression introduced by #4395.

When we merge two blocks by pressing the BACKSPACE KEY, the TinyMCE instance belonging to the second block is destroyed. This results in a type error raised by a TinyMCE event handler that is listening to the same event.

By immediately preventing propagation, we can stop TinyMCE's handler from ever running.

How to test

Check that the bug is fixed:

  1. Navigate to Posts > New Post
  2. Create two paragraph blocks
  3. Place cursor at beginning of second paragraph block
  4. Press Backspace
  5. There should be no errors in the console

Check that we didn't break #4395:

  1. Place your cursor in the middle of some text
  2. Press ENTER
  3. The block controls should go away
  4. Move your mouse so that the block controls come back
  5. Press BACKSPACE
  6. The block controls should go away

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

This fixes the bug for me. 👍 Do you think it's possible to add a cypress test for this, these micro-interactions are so easy to break

@ellatrix
Copy link
Member

ellatrix commented Feb 1, 2018

Since it was added, removed, and now re-added, could you leave a comment on my this is needed? Seems good practice regardless to leave comments on any use of stopImmediatePropagation.

When we merge two blocks by pressing the BACKSPACE KEY, the TinyMCE
instance belonging to the second block is destroyed. This results in a
type error raised by a TinyMCE event handler that is listening to the
*same* event.

By *immediately* preventing propagation, we can stop TinyMCE's handler
from ever running.
@noisysocks noisysocks force-pushed the fix/type-error-when-merging-blocks branch from 0fd7d66 to 493ea9a Compare February 2, 2018 00:42
@noisysocks noisysocks merged commit 327040e into master Feb 2, 2018
@noisysocks noisysocks deleted the fix/type-error-when-merging-blocks branch February 2, 2018 00:56
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.

TinyMCE error when merging two paragraph blocks
3 participants