-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Rich text updates #1625
Rich text updates #1625
Conversation
.left { | ||
text-align: left; | ||
} | ||
|
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.
Although this isn't required (text-align: left;
) being the default value, it might be used for other elements and for instances where we'd need to override an existing text-align
value.
{%- for block in section.blocks -%} | ||
{%- case block.type -%} | ||
{%- when 'heading' -%} | ||
<h2 class="rich-text__heading rte {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>{{ block.settings.heading }}</h2> |
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.
I'll need to update the h2
so that it doesn't include <p>
tags for the richtext, to prevent this:
Either of the following works but I'll need to confirm if its the solution we want to go with for rich text headings:
<h2 class="rich-text__heading rte {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>{{ block.settings.heading | replace: '<p>', '<span>' | replace: '</p>', '</span>' }}</h2>
Or
<h2 class="rich-text__heading rte {{ block.settings.heading_size }}" {{ block.shopify_attributes }}>{{ block.settings.heading | replace: 'p>', 'span>' }}</h2>
Confirmed with: https://validator.w3.org/nu/#textarea
{%- if block.settings.button_label != blank -%} | ||
<div class="rich-text__button"> | ||
<a{% if block.settings.button_link == blank %} role="link" aria-disabled="true"{% else %} href="{{ block.settings.button_link }}"{% endif %} class="button{% if block.settings.button_style_secondary %} button--secondary{% else %} button--primary{% endif %}" {{ block.shopify_attributes }}> | ||
{{ block.settings.button_label | escape }} | ||
</a> | ||
</div> | ||
{%- endif -%} |
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.
The {%- if block.settings.button_label != blank -%}
conditional was added to prevent this: #1615.
Additionally, I added a <div>
to make sure button blocks are placed on new lines instead of inline.
@@ -53,7 +53,7 @@ | |||
"heading": { | |||
"type": "heading", | |||
"settings": { | |||
"heading": "Talk about your brand", | |||
"heading": "<p>Talk about your brand</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.
Related: https://github.com/Shopify/dawn/pull/1625/files#r852183418
p
tags must be used to wrap the default
richtext. It will result in an error if it's not:
shopify-cli
11:12:21 ERROR » update templates/index.json:
Setting 'heading' is invalid. All top level nodes must be '<p>' tags
Code editor
The ability to have a setting to set up a position (top left, top top, top right, left middle…) is very very common for many sections, and having this as a select cause lot of duplication of wording. i think this may be a new built in setting that Shopify could add, with nice visual icons to convey the different position. We (theme developers) should be able to exclude some choices. this setting type could also be used for text positioning (left, venter, right). what do you think ? :) |
Hey @bakura10, Regarding the extra positional settings, this would definitely add more flexibility and similarity between some of our sections but unfortunately, I don't think it will be added to the rich text section, at least not for this iteration. I will record your feedback/suggestion - thanks so much! |
Draft PR
Rich text updates - UX feedback
cc: @wiktoriaswiecicka
Why are these changes introduced?
Related: #1460
What approach did you take?
Section level settings
Block level settings and additions
text
torichtext
to allow merchants to use bold, italic, links, dynamic source, and underlineOther considerations
Range slider widths will need to be explored further / section parity etc.
Demo links
Questions
Section settings
Extra large heading size
Caption block
Block limit removal
Presets