-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Create separate paragraph and text blocks #1959
Conversation
blocks/library/paragraph/index.js
Outdated
registerBlockType( 'core/paragraph', { | ||
title: __( 'Paragraph' ), | ||
|
||
icon: 'text', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be editor-paragraph
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
editor-paragraph
.
Done in a3562d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well in my testing.
Should we also add the Paragraph block to the quick insert menu, and remember which one of our two text blocks the user has previously chosen? Should this be here or in a separate PR?
I plan to add stats tracking to this feature in a separate PR.
Today @iseulde and I discussed a number of tricky aspects of the behavior of the multi-paragraph text block. Here are a few:
IMO, the significantly improved writing experience offered by the multi-paragraph block is well worth these trade-offs, and as stated in the PR description, we can continue to iterate on these fixes. |
I think this depends on whether we care to keep both paragraph and text blocks. The expectation I had, and reiterated in the original comment, is that we care only to implement both behaviors until we decide which is "best", at which point we eliminate the other. This could relate to your first question about remembering preference, i.e. do we care to go through the effort of implementing this? Of course, there's likely to be a bias toward whichever block is most convenient to access.
It should still be possible to split a block with two Enter presses. In other words, find point at which to break, press Enter twice, and insert Heading between.
We've flip-flopped a bit on this a few times already. I'm still inclined to keep alignment to be a per-block property. Currently it should be the case that applying an alignment affects the entire block. Aligning a single paragraph would need to follow similar instructions to above re: Heading block, or we could create separate behavior to automatically perform this split. Admittedly this was always one of the less obvious flows with the multi-p-per-block approach, but I think the downside was overemphasized in context of the overall feeling and flow of the block behavior (alignment being a less common flow). |
I would like to do this "decide which is 'best'" in an objective and organized way, by collecting usage data. Another option would be to provide a couple of different block types that can reasonably serve as the primary text block, and allow users to pick the default they like best.
This is true. It's something we can (partially) alleviate by making it obvious there is a choice to be made between different possible "text" blocks.
I think yes, as it's something that is quite likely to be useful in a number of other areas.
Currently, yes. If I recall correctly this and related cases were a bit broken the last time we had the multi-paragraph block. |
Closing as superseded by #1989 and subsequent discussions. May want to revisit later. |
Related: #1078 (comment)
Related: #374 (comment)
Slack discussion: https://wordpress.slack.com/archives/C02QB2JS7/p1500483704729747
This pull request seeks to create two separate blocks for text behavior, for the purpose of testing and iterating improvements on each in parallel. The intention is not necessarily that both of these blocks would exist in a merged editor, reflected in lack of effort to reduce duplicate logic between the two implementations.
The text block has been reverted back to the behavior where a single Enter press creates a new paragraph within the same text block. The current behavior (single Enter press creates a line break) is preserved in a separate "Paragraph" block.
Testing instructions:
Verify that single enter and multiple enter behavior matches expectation for Text and Paragraph blocks: