Skip to content

Conversation

@joshuatf
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

  • Fixes initial block selection so the toolbar is shown on page load
  • Updates the rich text editor toolbar height
  • Adds a prop for placeholder text on initial block
  • Adds image and video block types

Screen Shot 2022-10-24 at 3 17 57 PM

  • This PR is a very minor change/addition and does not require testing instructions (if checked you can ignore/remove the next section).

How to test the changes in this Pull Request:

  1. Navigate to the new product experience at Products-> Add new (MVP)
  2. Note that the description editor has the toolbar buttons initially shown
  3. Check that the toolbar is 40px in height
  4. Note that the placeholder text is initially shown (Describe this product...)
  5. Type / and insert an image or video block
  6. Note that you an insert images via the media library
  7. Insert a couple of blocks and hover between blocks to see that the block inserter (+ sign and blue line) is shown between blocks

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you created a changelog file for each project being changed, ie pnpm changelog add --filter=<project>?

FOR PR REVIEWER ONLY:

  • I have reviewed that everything is sanitized/escaped appropriately for any SQL or XSS injection possibilities. I made sure Linting is not ignored or disabled.

@joshuatf joshuatf requested a review from a team October 24, 2022 22:35
@joshuatf joshuatf self-assigned this Oct 24, 2022
@github-actions github-actions bot added focus: react admin package: @woocommerce/components issues related to @woocommerce/components plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Oct 24, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2022

Test Results Summary

Commit SHA: 134b32e

Test 🧪Passed ✅Failed 🚨Broken 🚧Skipped ⏭️Unknown ❔Total 📊Duration ⏱️
API Tests23200302350m 48s
E2E Tests186006019216m 12s

To view the full API test report, click here.
To view the full E2E test report, click here.
To view all test reports, visit the WooCommerce Test Reports Dashboard.

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

This tested well, and code changes look good!
Before approving, I was wondering if we could hide the Upload button on the image and video blocks for now? Given they don't work yet (just like the image library).

Also I wonder if we should increase the spacing between the blocks a little bit? The plus icon does show up, but it is a rather fine line to be hovering over. It's also very hard to notice as it appears GB added a delay, and you have be hovering for close to a second.

@louwie17
Copy link
Contributor

@joshuatf there also appears to be two broken tests.

@louwie17
Copy link
Contributor

One last issue I noticed, is that upon refresh the cursor is always active on the description field now, this feels a little odd.

@joshuatf
Copy link
Contributor Author

Before approving, I was wondering if we could hide the Upload button on the image and video blocks for now? Given they don't work yet (just like the image library).

Good catch! I added an uploadMedia function. Seems to be working well on my end, but could you test to make sure?

Also I wonder if we should increase the spacing between the blocks a little bit? The plus icon does show up, but it is a rather fine line to be hovering over. It's also very hard to notice as it appears GB added a delay, and you have be hovering for close to a second.

Agreed. I'd opt for a follow-up on this if possible since that may require modifying the default block styling and open a new can of worms.

One last issue I noticed, is that upon refresh the cursor is always active on the description field now, this feels a little odd.

I posted about this somewhere, but this is an unfortunate side effect of Gutenberg's block selection. Selecting the block, which we need in order to show the toolbar, also causes Gutenberg to focus the input initially.

We'll either need to open a PR in Gutenberg to address this or come up with a hacky workaround. I have a feeling we might need to do the latter, since this will cause a cascade of required changes in Gutenberg if we change how selection/focus works.

<ShortcutProvider>
<EditorWritingFlow />
<EditorWritingFlow
blocks={ blocksRef.current }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't love passing this down as opposed to getting it from the store, but there's a delay initially when setting blocks in the store that causes the editor to think it's empty when it's not.

louwie17
louwie17 previously approved these changes Oct 26, 2022
Copy link
Contributor

@louwie17 louwie17 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 adding the media upload function, this seemed to test well.

Agreed. I'd opt for a follow-up on this if possible since that may require modifying the default block styling and open a new can of worms.

I am fine with a follow up on the spacing. I just wasn't sure if this is something we specifically set to being narrower, given on P2 it's quite a bit bigger.

I posted about this somewhere, but this is an unfortunate side effect of Gutenberg's block selection. Selecting the block, which we need in order to show the toolbar, also causes Gutenberg to focus the input initially.
We'll either need to open a PR in Gutenberg to address this or come up with a hacky workaround. I have a feeling we might need to do the latter, since this will cause a cascade of required changes in Gutenberg if we change how selection/focus works.

That's unfortunate, I wonder if we set an auto focus to the name field if that will fix it, as that would be a relatively simple fix, although there is a high likely hood that the GB editor triggers it after.

Copy link
Contributor

@louwie17 louwie17 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀 Thanks for the rebase.

@joshuatf joshuatf merged commit e1ebabb into trunk Oct 31, 2022
@joshuatf joshuatf deleted the fix/rich-text-editor-selection branch October 31, 2022 21:36
@github-actions github-actions bot added this to the 7.2.0 milestone Oct 31, 2022
@github-actions
Copy link
Contributor

Hi @joshuatf, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:

  • Add the release: add testing instructions label

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: @woocommerce/components issues related to @woocommerce/components plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants