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: OCR block stops working on WP 5.7 #275

Merged
merged 6 commits into from
Jul 13, 2021
Merged

Fix: OCR block stops working on WP 5.7 #275

merged 6 commits into from
Jul 13, 2021

Conversation

dinhtungdu
Copy link
Contributor

Description of the Change

Due to changes of Gutenberg shipped in WP 5.7, the OCR block has been stopped working:

  • The modal doesn't show up after inserting an image into the editor.
  • The OCR text inserter inserts only group block, not the text inside it.

This PR fixes those issues by:

  • Removing the usage of registerPlugin, moving the modal into the image control.
  • Use await to ensure the text block is inserted only after the group block has been inserted into the editor.
  • Simply the modal logic.

Verification Process

  1. Setup and config the Image processing API, enable OCR feature.
  2. Make sure the image is accessible from the Azure server.
  3. Insert a new image that contains text, see:
  • the modal shows up after the image has been inserted into the editor.
  • Click on the Insert button, see a new group contains a paragraph with the text on the image as content.
  • Click on the image, see a new disabled button (with clipboard icon).
  • Delete the group block, click on the image again, see the clipboard button enabled.
  • Click on that button, see the new description as using modal above.

Please check OCR functionality on both WP 5.6 and 5.7.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Changelog Entry

@jeffpaul jeffpaul added this to the 1.7.0 milestone Apr 21, 2021
@jeffpaul jeffpaul added the type:bug Something isn't working. label Apr 21, 2021
Copy link
Contributor

@helen helen left a comment

Choose a reason for hiding this comment

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

Minor typo, still need to test locally

src/js/editor-ocr.js Outdated Show resolved Hide resolved
src/js/editor-ocr.js Outdated Show resolved Hide resolved
src/js/editor-ocr.js Outdated Show resolved Hide resolved
src/js/editor-ocr.js Outdated Show resolved Hide resolved
@jeffpaul jeffpaul requested a review from helen June 3, 2021 03:23
@jeffpaul jeffpaul mentioned this pull request Jul 7, 2021
21 tasks
Copy link
Contributor

@helen helen left a comment

Choose a reason for hiding this comment

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

Works!

@helen helen merged commit 8e2f8bd into develop Jul 13, 2021
@helen helen deleted the fix/ocr-wp-57 branch July 13, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants