OpenTable: Fix error when pasting embed codes#14678
Merged
Conversation
We were accidentally relying on an error being thrown during the onChange handler, when an embed code was pasted into the input. The error meant that the event bubbled up and the onSubmit event handled the input correctly. This change sets the saveTransform function to check if the current input looks like an embed. If it does, then it prevents it from being treated like a token, and the onChange handler is never called.
Contributor
|
Caution: This PR has changes that must be merged to WordPress.com |
Collaborator
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: March 3, 2020. |
Member
|
r203005-wpcom |
jeherve
added a commit
that referenced
this pull request
Feb 25, 2020
* 8.3 release: changelog * Changelog: add #14516 * Changelog: add #14574 * Bring in changes from 8.2.1 and 8.2.2 * Update stable version * Bring in 8.2.3 changes * Changelog: add #14714 * Changelog: add #14639 * Changelog: add #14678 * Changelog: add #14673 * Changelog: add #14687 * Changelog: add #14704 * Changelog: add #14702 * Changelog: add #14541 * Changelog: add #14657 * Changelog: add #14622 * Changelog: add #14582 * Changelog: add #14638 * Changelog: add #14633 * Changelog: add #14571 * Changelog: add #14592 * Changelog: add #14539 * Changelog: add #14514 * Changelog: add #14643 * Changelog: add #14494 * Changelog: add #13739 * Changelog: add #14707 * Changelog: add #14736 * Changelog: add #14706 * Changelog: add #14730 * Changelog: add #14685 * Changelog: add #14727 * Changelog: add #14711 * Changelog: add #14742 * Changelog: add #14746 * Changelog: add #14725 * Changelog: add #13999 * Changelog: add #14740 * Changelog: add #14759 * Changelog: add #14703 * Changelog: add #14753 * Changelog: add #14754 * Changelog: add #14645 * Cahngelog: add #14599
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.
We were accidentally relying on an error being thrown during the
onChange handler, when an embed code was pasted into the input. The
error meant that the event bubbled up and the onSubmit event handled the
input correctly.
Changes proposed in this Pull Request:
This change sets the saveTransform function to check if the current
input looks like an embed. If it does, then it prevents it from being
treated like a token, and the onChange handler is never called.
Is this a new feature or does it add/remove features to an existing part of Jetpack?
This is a bug fix to an existing feature
Testing instructions:
Without this branch, and with the browser developer console open paste in an embed code into an OpenTable block - for example:
Hit Enter or click the Embed button.
Notice that you see an error along the lines of
parsed is nullDo the same thing with this branch and you should not see the error.
Proposed changelog entry for your changes:
I'm not sure this requires a changelog entry, but if it does:
Bug fixed that caused an unhandled error when inserting an OpenTable embed code