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

Optional modal for editor fields #93

Merged
merged 29 commits into from
Sep 10, 2021
Merged

Optional modal for editor fields #93

merged 29 commits into from
Sep 10, 2021

Conversation

kienstra
Copy link
Contributor

@kienstra kienstra commented Aug 31, 2021

Changes

  • On clicking the <ServerSideRender>, this will show the block form in a <Modal>.

Feature Walkthrough (updated September 24)

  1. composer i && npm i && npm run dev
  2. /wp-admin > Custom Blocks > Add New
  3. Check 'Open block fields in a modal…' (it's unchecked by default): modal-here
  4. Add a field
  5. Publish the block
  6. Create a new post
  7. Add the block you created to that post
  8. Click the block:
    clicking-the-block
  9. Expected: A modal opens: the-example-modal

@kienstra
Copy link
Contributor Author

kienstra commented Sep 1, 2021

Hi @RobStino,
What do you think about how the block form looks in the modal?

block-form-in-the-modal

It's basically the same styling as in the block editor.

This still isn't ideal, even if it worked.
It's opaque why this needs to click escape.

# ack
.ackrc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not related to this PR, but some of these ignores aren't needed.

"phpcs"
],
"lint-fix": [
"phpcbf"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might as well run phpcbf and phpcs from within Composer, instead of running them like ./vendor/bin/phpcbf

Also, correct some JSDoc headings.
Those were from copypasta.
>
{ __( 'Upload', 'genesis-custom-blocks' ) }
</FormFileUpload>
<MediaUploadCheck>
<MediaUpload
gallery={ false }
multiple={ false }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are default props, so no need to pass them

@kienstra kienstra marked this pull request as ready for review September 6, 2021 21:23
This removed the Inspector styling,
and it wasn't showing.
Remove an extra class,
as the first class is for the same element.
@kienstra kienstra requested a review from RobStino September 7, 2021 02:53
Just slightly modified from Phil's idea.
This should make it much clearer what
the checkbox does.
Before, it was using block.label,
which didn't exist.
Also, import the Block definition
to prevent this.
@kienstra
Copy link
Contributor Author

kienstra commented Sep 7, 2021

Thanks to Phil's idea, this now shows the block's name as the title of the <Modal>:
the-block-name

@kienstra
Copy link
Contributor Author

kienstra commented Sep 7, 2021

Thanks to Phil for his idea of new <label> text:
an-example-label

@johnstonphilip
Copy link

Working well for me here!

@johnstonphilip
Copy link

I wish that when I changed a field in the modal that it would reflect in the background imediately instead of showing a reloading icon spinner for a second. But that's not really a blocker.

@kienstra
Copy link
Contributor Author

kienstra commented Sep 7, 2021

I wish that when I changed a field in the modal that it would reflect in the background imediately instead of showing a reloading icon spinner for a second.

Yeah, that's poor UX. Maybe the post you shared about rendering the template in the editor could help.

It'd probably have dangerouslySetInnerHTML.

It will fail if
the query fails, anyway.
@kienstra
Copy link
Contributor Author

kienstra commented Sep 7, 2021

@johnstonphilip, thanks a lot for your great ideas and for testing this!

@mikemcalister
Copy link

Really like this improvement, Ryan! Worked well in my testing.

@kienstra
Copy link
Contributor Author

kienstra commented Sep 7, 2021

@mikemcalister,
Thanks a lot! Really appreciate your testing and expertise.

@kienstra kienstra merged commit 3b74d78 into develop Sep 10, 2021
@kienstra kienstra deleted the add/editor-modal branch September 10, 2021 15:30
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.

3 participants