Skip to content

Commit

Permalink
Rich Text: Add missing keep placeholder on focus prop.
Browse files Browse the repository at this point in the history
  • Loading branch information
epiqueras committed Sep 14, 2019
1 parent 53f2aea commit f9dafd2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ class RichTextWrapper extends Component {
didAutomaticChange,
undo,
placeholder,
keepPlaceholderOnFocus,
// eslint-disable-next-line no-unused-vars
allowedFormats,
withoutInteractiveFormatting,
Expand Down Expand Up @@ -383,7 +384,10 @@ class RichTextWrapper extends Component {
selectionEnd={ selectionEnd }
onSelectionChange={ onSelectionChange }
tagName={ tagName }
className={ classnames( classes, className, { 'is-selected': originalIsSelected } ) }
className={ classnames( classes, className, {
'is-selected': originalIsSelected,
'keep-placeholder-on-focus': keepPlaceholderOnFocus,
} ) }
placeholder={ placeholder }
allowedFormats={ adjustedAllowedFormats }
withoutInteractiveFormatting={ withoutInteractiveFormatting }
Expand Down
10 changes: 8 additions & 2 deletions packages/block-editor/src/components/rich-text/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@
}

// Could be unset for individual rich text instances.
&.is-selected [data-rich-text-placeholder]::after {
display: none;
&.is-selected {
&.keep-placeholder-on-focus [data-rich-text-placeholder] {
pointer-events: none;
}

&:not(.keep-placeholder-on-focus) [data-rich-text-placeholder]::after {
display: none;
}
}
}

Expand Down

0 comments on commit f9dafd2

Please sign in to comment.