Fix error when pasting image in caption#4603
Merged
Conversation
aduth
requested changes
Jan 28, 2018
| // Necessary to allow the paste bin to be removed without errors. | ||
| setTimeout( () => this.props.onReplace( content ) ); | ||
| } else { | ||
| } else if ( this.props.onSplit ) { |
Member
There was a problem hiding this comment.
Should this check be consolidated in splitContent instead, so in case we add another call to the function we don't need to similarly guard?
| } else if ( this.props.onSplit ) { | ||
| // Necessary to get the right range. | ||
| // Also done in the TinyMCE paste plugin. | ||
| setTimeout( () => this.splitContent( content ) ); |
Member
There was a problem hiding this comment.
We're not clearing this timeout if the component unmounts.
| @@ -303,7 +303,7 @@ export default class Editable extends Component { | |||
| if ( isEmpty && this.props.onReplace ) { | |||
| // Necessary to allow the paste bin to be removed without errors. | |||
| setTimeout( () => this.props.onReplace( content ) ); | |||
Member
There was a problem hiding this comment.
We're not clearing this timeout if the component unmounts.
121a5b1 to
4b9e8a2
Compare
Member
Author
|
@aduth Fixed the timeouts... What do you think of this solution? |
4b9e8a2 to
88ac125
Compare
Member
Author
|
Rebased after |
3 tasks
Member
Author
|
Blocked by #4839 if we really want to fix the timeouts here too. |
88ac125 to
1e74241
Compare
Member
Author
Member
Author
|
With the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Caused by #4298. An error occurs if you paste a single image (right click, copy image) inside an editable field that does not support the splitting of content, e.g. an image caption.
How Has This Been Tested?
See above.