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

Support the Text-to-Speech feature in the Classic Editor #518

Merged
merged 5 commits into from
Jul 5, 2023

Conversation

dkotter
Copy link
Collaborator

@dkotter dkotter commented Jun 29, 2023

Description of the Change

In #403 we introduced a feature that can convert your content into speech using the Microsoft Azure's Text to Speech API. This only worked in the Block Editor so this PR brings the same feature over to the Classic Editor.

There's a new meta box that shows in the Classic Editor that allows you to toggle audio generation on or off:

Classic Editor meta box to toggle speech generation

The text here mirrors what we show in the Block Editor. If this toggle is turned on, when the item is saved, we will generate an audio file for this item and connect the two.

We then show an audio preview in the same meta box:

Audio preview in meta box

Behind the scenes we use the same meta keys as are used in the Block Editor so things should all function the same. For example, if the toggle is turned off, we don't render the audio element on the front-end.

Closes #499

How to test the Change

  1. Install the Classic Editor plugin
  2. Ensure you have Text to Speech configured in ClassifAI
  3. Create a new item in whatever post type you have supported
  4. With the toggle off, save the item. Make sure audio isn't generated
  5. Turn the toggle on and save again. Ensure audio is generated and shows on the front-end
  6. Turn the toggle back off and ensure the audio file stays but doesn't show on the front-end
  7. Disable the Classic Editor plugin and repeat the steps to ensure Block Editor content still works as well

Changelog Entry

Added - Support our Text to Speech capability using Microsoft Azura Text to Speech in the Classic Editor

Credits

Props @dkotter

Checklist:

  • I agree to follow this project's Code of Conduct.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests pass.

@dkotter dkotter self-assigned this Jun 29, 2023
@dkotter dkotter added this to the 2.2.3 milestone Jun 29, 2023
@dkotter dkotter marked this pull request as ready for review June 30, 2023 16:22
@dkotter dkotter requested review from a team and jeffpaul as code owners June 30, 2023 16:22
@dkotter dkotter requested review from a team and iamdharmesh and removed request for jeffpaul and a team June 30, 2023 16:22
iamdharmesh
iamdharmesh previously approved these changes Jul 3, 2023
Copy link
Member

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @dkotter, This looks great. Just added one minor note to discuss otherwise all LGTM!

Thanks

</p>

<?php
if ( $audio_id && wp_get_attachment_url( $audio_id ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe only show audio preview if audio generation is enabled?

image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I debated on this as I'm not sure for a UX perspective it's clear that unchecking this option should also remove the previously generated audio. But that is how we do it right now in the Block Editor so in order to try and keep parity between the two, I've updated this.

Probably worth a follow up at some point to make it more clear in both the Block and Classic Editor that unchecking this box not only won't generate audio anymore but also removes the display of any previously generated audio

Copy link
Member

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

🚀

@dkotter dkotter merged commit acd594b into develop Jul 5, 2023
@dkotter dkotter deleted the feature/499 branch July 5, 2023 17:39
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.

Ensure the Text-to-Speech feature works in the Classic Editor
2 participants