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

Improved rich text placeholder #16733

Merged
merged 4 commits into from
Jul 26, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Use is-selected instead of :focus
  • Loading branch information
ellatrix committed Jul 26, 2019
commit 69cb29dc186186656eb3bfd5221e94ac6f8ddf75
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ class RichTextWrapper extends Component {
onSelectionChange={ onSelectionChange }
tagName={ tagName }
wrapperClassName={ classnames( wrapperClasses, wrapperClassName ) }
className={ classnames( classes, className ) }
className={ classnames( classes, className, { 'is-selected': originalIsSelected } ) }
placeholder={ placeholder }
allowedFormats={ adjustedAllowedFormats }
withoutInteractiveFormatting={ withoutInteractiveFormatting }
Expand Down
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 @@ -43,7 +43,7 @@
}

// Could be unset for individual rich text instances.
&:focus [data-rich-text-placeholder]::after {
&.is-selected [data-rich-text-placeholder]::after {
display: none;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/paragraph/editor.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Specific to the empty paragraph placeholder:
// when shown on mobile and in nested contexts, one or more icons show up on the right.
// This padding makes sure it doesn't overlap text.
.block-editor-rich-text__editable.wp-block-paragraph:not(:focus) [data-rich-text-placeholder]::after {
.block-editor-rich-text__editable.wp-block-paragraph:not(.is-selected) [data-rich-text-placeholder]::after {
display: inline-block;
padding-right: $icon-button-size * 3;

Expand Down