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

Button Block: fix space insertion #14925

Merged
merged 3 commits into from
Apr 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// breaking spaces in between words. If also prevent Firefox from inserting
// a trailing `br` node to visualise any trailing space, causing the element
// to be saved.
white-space: pre-wrap;
white-space: pre-wrap !important;
Copy link
Member

Choose a reason for hiding this comment

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

Safe to say this is !important because it breaks spectacularly when any other style takes precedence?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I would say that this is the only CSS rule required for RichText to work properly. It might even be better to insert it inline? Not sure.


> p:first-child {
margin-top: 0;
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/button/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
.wp-block-button__link {
max-width: 100%;
overflow: hidden;
white-space: nowrap;
ellatrix marked this conversation as resolved.
Show resolved Hide resolved
// Override is allowed here only because the rich text instance in
// a preview is not editable.
// To do: use the `save` function to preview a block transform, not
// the `edit` function.
white-space: nowrap !important;
text-overflow: ellipsis;
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/block-library/src/button/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ $blocks-button__height: 56px;
padding: 12px 24px;
text-align: center;
text-decoration: none;
white-space: normal;
Copy link
Member

Choose a reason for hiding this comment

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

For posterity's sake: I investigated why this was here in the first place. It was introduced in #5662. I verified the change here does not regress #5628.

image

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you!

overflow-wrap: break-word;

&:hover,
Expand Down