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

TinyMCE: Assign dummy container during removal #3093

Merged
merged 1 commit into from
Oct 23, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Oct 20, 2017

Fixes #3091
Related: #2787

This pull request seeks to resolve an issue where changing level of a Heading block results in a block error. This began after a TinyMCE upgrade from 4.6.5 to 4.7.1. It is still not clear what specific changes occurred in TinyMCE in this time to introduce the error, since the problematic behavior has existed for some time. Namely, we call to this.editor.destroy when the TinyMCE component unmounts for TinyMCE to clean any lingering handlers. However, TinyMCE also tries to remove the container node itself, and when React then proceeds to do the same, an error occurs because the node no longer exists. The changes here assign a dummy container property to the TinyMCE instance while unmounting to trick TinyMCE into removing a different node instead.

Ultimately it would be nice if we could perform destroy clean-up logic without the node being removed, or alternatively not need to explicitly call destroy and rely on this cleanup to occur as a result of the natural DOM removal.

Testing instructions:

Repeat testing instructions from #3091, verifying that no error occurs in changing Heading level.

@codecov
Copy link

codecov bot commented Oct 20, 2017

Codecov Report

Merging #3093 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3093      +/-   ##
==========================================
- Coverage   32.24%   32.23%   -0.01%     
==========================================
  Files         216      216              
  Lines        6150     6151       +1     
  Branches     1081     1081              
==========================================
  Hits         1983     1983              
- Misses       3516     3517       +1     
  Partials      651      651
Impacted Files Coverage Δ
blocks/editable/tinymce.js 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e869a9d...17e3871. Read the comment docs.

@spocke
Copy link

spocke commented Oct 20, 2017

I will look into fixing this bug on Monday. I think I know exactly why this was introduced. This patch should work fine as a work around until we release 4.7.2 witha fix for the issue.

@aduth aduth merged commit 653e555 into master Oct 23, 2017
@aduth aduth deleted the fix/3091-tinymce-destroy-container branch October 23, 2017 12:13
@aduth
Copy link
Member Author

aduth commented Jan 18, 2018

@spocke Can you confirm whether this bug has been fixed?

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.

Heading Block: Unhandled DOMException when changing heading level
3 participants