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

Media & Text: Allow drag n drop media replacement #29710

Merged

Conversation

Mamaduka
Copy link
Member

Description

Adds dropzone to the media part of the block when an image/video is already set. Fixes #26320.

How has this been tested?

Manually on local dev environment.

Steps:

  1. Add the "Media & Text" block to the post.
  2. Add media.
  3. Drag and drop media replacement.
  4. See if the dropzone indicator appears.
  5. See if media is replaced.

Types of changes

New feature

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@Mamaduka Mamaduka requested a review from ajitbohra as a code owner March 10, 2021 11:02
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Mamaduka! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 10, 2021
@youknowriad youknowriad requested a review from a team March 10, 2021 14:42
@youknowriad youknowriad added [Block] Media & Text Affects the Media & Text Block [Type] Enhancement A suggestion for improvement. labels Mar 10, 2021
@draganescu
Copy link
Contributor

Howdy @Mamaduka and welcome! Thank you for contributing. I tested this PR and it does work, but it would be great if the block would show something is happening upon drag. Here is a video comparing to how the image block handles drag and drop:

dropmediatext.mp4

@Mamaduka
Copy link
Member Author

Thanks, @draganescu for testing the PR.

100% with you about the upload indicator.

I'm reusing the PlaceholderContainer component. I'm not sure if those changes should be part of this PR or be a separate one.

@Mamaduka Mamaduka force-pushed the update/media-text-dragndrop-replace branch from fa206d3 to b4033b3 Compare March 12, 2021 06:08
@Mamaduka
Copy link
Member Author

Hi, @draganescu

After thinking more about this, it makes sense to include Spinner change as a part of this PR. See b4033b3.

@Mamaduka Mamaduka self-assigned this Mar 18, 2021
@Mamaduka Mamaduka force-pushed the update/media-text-dragndrop-replace branch from b4033b3 to 631a2d9 Compare March 22, 2021 02:53
@Mamaduka Mamaduka removed the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Mar 25, 2021
@Mamaduka Mamaduka force-pushed the update/media-text-dragndrop-replace branch from 631a2d9 to 79f262f Compare April 6, 2021 15:49
@Mamaduka
Copy link
Member Author

Hi, @draganescu

Is it possible to get another review on this PR? 🙇

@Mamaduka Mamaduka requested a review from jasmussen June 24, 2021 10:29
@jasmussen
Copy link
Contributor

Sorry about the delay on this one. In fact the branch was so old I had to rebase it in order to compile it 🙈

You can always feel free to request a review from me in the future if you get stalled.

Here's before:

before

Here's after:

after

Very nice. It could use a code sanity check, and I'd recommend giving it a good rebase first. But giving it a green check for the experience. Excellent work.

@Mamaduka Mamaduka force-pushed the update/media-text-dragndrop-replace branch from 79f262f to a65cbf2 Compare June 24, 2021 13:39
@Mamaduka
Copy link
Member Author

Thanks for the review, @jasmussen.

Rebased and will merge once all checks are green 🤞

@Mamaduka Mamaduka merged commit 761f983 into WordPress:trunk Jun 24, 2021
@Mamaduka Mamaduka deleted the update/media-text-dragndrop-replace branch June 24, 2021 18:24
@github-actions github-actions bot added this to the Gutenberg 11.0 milestone Jun 24, 2021
@draganescu
Copy link
Contributor

Thanks for chiming in @jasmussen and sorry for not following up @Mamaduka! Nevertheless 🎉 great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Media & Text Affects the Media & Text Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I should be able to drag and drop to replace media uploaded to the Media & Text block
4 participants