Implement pasteHandler with plain text fallback #646
Closed
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:
Moves forward #624
This PR aims to guard against errors in production during a paste event on mobile. As there are potentially many unexplored code paths (not yet covered by tests), the goal here is to call the original
pasteHandler
in a try/catch block, and fallback to plain text if an error is encountered.Note that even in the plain text case, the
pasteHandler
may still call into some of the complex web code.Dependencies:
Gutenberg PR: WordPress/gutenberg#14044
Testing:
In order to test, we have to establish a state where a known error exists. A good source to trigger the error is here: #617 (review), but we need to rewind (or revert) the fixes introduced in #630.
git checkout 1fead08b5
in gutenberg-mobile andgit submodule update
)cd gutenberg
and cherry pick commityarn clean:install
first to clear cached dependencies)Text should paste as plain text (losing the link and styles). It should not error out to the red screen.