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

Feature parity between FSE Blocks and regular blocks #21087

Closed
12 tasks done
mtias opened this issue Mar 23, 2020 · 20 comments
Closed
12 tasks done

Feature parity between FSE Blocks and regular blocks #21087

mtias opened this issue Mar 23, 2020 · 20 comments
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Needs Design Feedback Needs general design feedback.

Comments

@mtias
Copy link
Member

mtias commented Mar 23, 2020

We have several new full site editing blocks that we need to match feature-wise with what regular blocks offer:


@mtias mtias added [Feature] Blocks Overall functionality of blocks Needs Design Feedback Needs general design feedback. [Feature] Full Site Editing [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Mar 23, 2020
@aduth
Copy link
Member

aduth commented Mar 23, 2020

For technical implementation, I'd wondered if it might be something to implement as deferring to the implementation of another block. We have some of the pieces of this, e.g. <BlockEdit />.

But in most of these cases, is it really much more than <RichText />, with a particular configuration? It would be nice if we could leverage components for the shared baseline. The main unknown at this point would be in implementing common attributes, which I think could be addressed as part of proposals of #15450.

Ideally then, the implementation for either the "Site Title" or "Heading" blocks could look something like:

function edit() {
    useTextAlignment();
    useTextColor();
    // useHeadingLevel(); // ???

    return <RichText { /* ... */ } />;
}

(For demonstration only, not a finished API)

@youknowriad
Copy link
Contributor

youknowriad commented Mar 23, 2020

@aduth Personally, I'm leaning more towards expanding the approach used in #21021 to all these customizations which is close to the proposal above with a bit less flexibility (support keys) but more capabilities, touching any part of the block registration/filters.

the missing piece is whether we can have something like the "save props" filter on the server to automatically augment the frontend output.

@aduth
Copy link
Member

aduth commented Mar 23, 2020

@youknowriad Yeah, in the context of this issue, I'm not so much concerned about the specific API for reusing common behaviors, but more to the point that we don't need "Site Title" block to be aware of a "Heading" block if each can be mostly recreated with relative ease by opting in to a combination of common components and block functionality.

In fact, I'm not much of a fan of using React hooks for this, since one of the requirements of this extensibility is in assigning new attributes to a block type, which is something which should be possible to be made known to the server-side.

@MichaelArestad MichaelArestad added Needs Design Needs design efforts. and removed Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. labels Mar 24, 2020
@MichaelArestad
Copy link
Contributor

Does this need design feedback here or can we provide feedback on individual PRs?

@mtias
Copy link
Member Author

mtias commented Mar 24, 2020

We need to map out what tools make sense for each.

@karmatosed
Copy link
Member

I took a quick look at this to try and surface out what we could have on each block.

Default parity

Both the heading and paragraph block have the following:

Align: left/centre/right, Text styling: bold, italic, Link, Inline code, Inline image, Strikethrough, Text color.

There are also extra options for:

Hide Block Settings, Duplicate, Insert Before, Insert After, Edit as HTML, Add to Reusable blocks, Group, Remove Block.

FSE blocks

I would say the following should exist across all:

Align: left/centre/right, Text styling: bold, italic, Text color

The ones I am not as sure about would be:

Link, Inline code, Inline image, Strikethrough

The options probably should exist across all, but I could see an argument for trimming some of those.

@karmatosed karmatosed added the Needs Design Feedback Needs general design feedback. label Mar 30, 2020
@mtias
Copy link
Member Author

mtias commented Mar 30, 2020

There's a lot of those that don't make sense for the site / post blocks in the context of FSE. All the inline formatting tools, for example, don't make sense because the text is not selectable — only block level changes would apply.

@karmatosed
Copy link
Member

karmatosed commented Mar 30, 2020

In light of removing any inline my recommendations then would be:

Align: left/centre/right alone.

I do wonder about text color changing it all, but that can be later.

Options wise I would trim down to maybe just remove block as a starting point.

@dwolfe
Copy link

dwolfe commented Mar 30, 2020

I touched on this in my most recent update on the placeholder blocks issue.

My thinking was very close to your original list, @mtias, with the exception of Tags and Categories - would those be lists?

@oandregal
Copy link
Member

I've added these blocks in #22700 to keep track of the work related to style attributes.

@apeatling
Copy link
Contributor

apeatling commented Jun 2, 2020

@karmatosed @mtias I'm starting with the Site Title block. Changing this to use RichText component instead of PlainText allows the block to support the standard tooling:

Screen Shot 2020-06-02 at 10 19 59 AM

Reading above I'm unclear on what the decision is for support. The text in this block is selectable and editable so reducing to alignment only seems limiting.

@apeatling
Copy link
Contributor

apeatling commented Jun 2, 2020

The issue with supporting these formatting options for something like Site Title is WordPress escapes the entities so you get this on the front end:

Screen Shot 2020-06-02 at 10 28 57 AM

I think we're able to support text alignment via classNames in the wrapper, and also support the changing of the tag used for the title. @mtias mentioned not exposing this in the UI to start.

@mtias
Copy link
Member Author

mtias commented Jun 3, 2020

Yes, we cannot use rich text here. We can support block-level color tools and font-sizes, though.

@noahtallen
Copy link
Member

Align: left/centre/right alone.

Which alignments and options should be supported for the post-content block?

@MichaelArestad
Copy link
Contributor

Yes, we cannot use rich text here. We can support block-level color tools and font-sizes, though.

What is the reasoning here? Is this a temporary limitation?

@noahtallen
Copy link
Member

What is the reasoning here

Rich text stores hardcoded HTML entities inline. So the content of the site title might look like <b>Here is my <i>title!</i></b>. This works fine when rendered in HTML, but the site title is used in a lot of other places. Anything that tries to access the site title would now need to understand and know about those HTML entities, which would be a breaking change. Theoretically, it's possible for anyone to handle the situation by stripping out all the HTML entities after we access the site title, but you'd have to do that everywhere you access it. (Which means it would break 3rd party code.)

One way around it might be to wrap the entire site title in bold or italics. So the content of the site title is Here is my title!, and the site title block allows you to say that the whole thing is bold or italics, and then it render <b><i>Here is my title</i></b> without actually storing those HTML entities in the database. (in the same way the other block-level attributes work.)

@Copons
Copy link
Contributor

Copons commented Jul 13, 2020

Just FYI I've updated the issue:

  • Checked "Site Title → Heading"; as far as I can see there are no outstanding features left to update.
  • Added Site Tagline Block #23788 to "Site Tagline → Paragraph".

Should we add the experimental colors, font size, line height to all FSE blocks?
(Colors might not make sense everywhere though, or might be more involved than just add a support property, e.g. for "linked elements", like the Post Title or Comment Count)

@MichaelArestad
Copy link
Contributor

Should we add the experimental colors, font size, line height to all FSE blocks?

It makes sense for a few blocks like Site Title, Description, tags, categories, etc. Blocks that a user won't have design control of elsewhere.

@Copons
Copy link
Contributor

Copons commented Aug 26, 2020

With the merge of #24091 we've checked all items for this tracking issue! 🎉
FSE blocks should, can, and will be updated and improved over time, but I'm going to close this issue for now, since the basic requiremens are all complete.
Thanks y'all for the great work!

@Copons Copons closed this as completed Aug 26, 2020
@mtias
Copy link
Member Author

mtias commented Aug 26, 2020

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Blocks Overall functionality of blocks [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Needs Design Feedback Needs general design feedback.
Projects
None yet
Development

No branches or pull requests

10 participants