-
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
Add "More" block. #1440
Add "More" block. #1440
Conversation
So this is interesting... the "READ MORE" text is editable. Was this intentional on your part? I'm leaning towards this text not being editable, and letting themes decide the text that goes there. But it's a very intriguing idea. |
I dig the help text in the inspector! ⭐️⭐️⭐️⭐️⭐️ |
@jasmussen it is editable on purpose. WordPress handles it like this: |
Interesting! I did not know that. Then I'd like to redesign it a bit. I'll assign myself this branch and do it in code, if that's okay with you. |
Sure thing. My plan was that the default text is not a placeholder but real text. Not sure it's trivial to get the text a theme has specified, so we may need to present it more abstractly. |
I think this is key to figure out if we actually want to make it editable. What exactly does the "Your custom more text..." do in In case it's a feature we think will stick around, and it already works today, then I totally love the idea that not only can you customize it but do it on a per-post basis. The key thing to think about for the design (you touch on it with the "get the text a theme has specified"), is making the configurability discoverable. If we can't actually read the text that the theme has provided, then we should either go super abstract and perhaps not even show the "Read More" text on the block, but something else entirely. Or maybe we do show that, but only let you customize the read more text in the inspector. Something I think I'll need to sleep on. |
I'm proposing that we leave this as its own block for now and iterate if necessary later. Essentially // <!-- more -->
{
blockName: 'wp:core/more'
}
// <!-- more read on! -->
{
blockName: 'wp:core/more',
attrs: {
customText: 'read on!'
}
} |
Can we somehow enforce that this block only can be used once in a post? Something for a separate PR, but just thinking out loud here. |
@swissspidy ah, yes, definitely. |
I pushed a little polish to this one. Now the text area doesn't span the full width. I also tweaked the description a bit. I can't think of a better way to design this block so input is editable. It's not as discoverable as I'd like it to be, but I think we should get this in and iterate later. Should we add a placeholder? Right now if you delete the text, it's just a dashed line. |
I think so. "Read more" makes sense. Looking at |
* Crop gallery images by default This is a work in progress. Pushing so as to test in IE. * Polish inspector controls generally. This is pending more improvements happening separately in #1440 and #1523. * Make the crop actually work. * Enable crop by default. Props @mtias. * Move to is-cropped classname. * Fix for IE11. * Revert back to object-fit.
blocks/library/more/index.js
Outdated
/> | ||
{ focus && | ||
<InspectorControls key="inspector"> | ||
<p className="editor-block-inspector__description">"More" allows you to break your post into a part shown on index pages, and the subsequent after clicking a "Read More" link.</p> |
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 could use the new <BlockDescription>
element
See #1661. |
c33007f
to
ba5def7
Compare
I pushed some changes here (essentially the |
Text is saved in text, not customText
7d10225
to
e7f04b0
Compare
Codecov Report
@@ Coverage Diff @@
## master #1440 +/- ##
==========================================
+ Coverage 18.82% 18.87% +0.05%
==========================================
Files 129 130 +1
Lines 4197 4207 +10
Branches 716 718 +2
==========================================
+ Hits 790 794 +4
- Misses 2868 2873 +5
- Partials 539 540 +1
Continue to review full report at Codecov.
|
Ok merging. We can iterate in smaller PRs |
It's not invalid in PHP. WordPress doesn't care where in the content |
I haven't followed the discussion closely, and maybe I'm just repeating what someone else said, but what if we put the legacy content in the block body, and upgrade old ones when they're between blocks? <!-- wp:core/more { "text": "some text...", "noTeaser": true } -->
<!--more some text...-->
<!--noteaser-->
<!-- /wp:core/more --> |
@iseulde I'm not really sure. I like your proposal for consistency's sake. Maybe there's an argument for special-casing some "known" types. |
Another way that would be cleaner: make core recognize the |
I agree with @nylen, let's see if we can consolidate all comments under the same syntax. Doesn't make much sense to me to wrap an old comment in new comments, it just adds noise. |
See #983.