Skip to content

Commit

Permalink
Hide Add Title placeholder text in the post title within the preview
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewserong committed Feb 5, 2021
1 parent d7ccfd5 commit fc61a8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,25 +89,28 @@ const BlockLayoutPreview = ( {
* See: https://github.com/WordPress/gutenberg/pull/20609/
*/
useEffect( () => {
if ( ! title ) {
return;
}
// Perform update next render, as the post title input field may not yet be available.
setTimeout( () => {
if ( ! title ) {
return;
}

const previewBody = document.querySelector( `.${ className }` );
const previewBody = document.querySelector( `.${ className }` );

if ( ! previewBody ) {
return;
}
if ( ! previewBody ) {
return;
}

const templateTitle = previewBody.querySelector(
'.editor-post-title .editor-post-title__input'
);
const templateTitle = previewBody.querySelector(
'.editor-post-title .editor-post-title__input'
);

if ( ! templateTitle ) {
return;
}
if ( ! templateTitle ) {
return;
}

templateTitle.value = title;
templateTitle.value = title;
}, 0 );
}, [ recomputeBlockListKey ] );

// Scroll the preview to the top when the blocks change.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@ body.admin-bar:not( .is-fullscreen-mode ) .page-template-modal-screen-overlay {
margin: 0;
}

// Hide page title placeholder.
.editor-post-title__input::placeholder {
color: transparent !important;
}

// Hide inserter/appender.
.block-list-appender,
.block-editor-inserter {
Expand Down

0 comments on commit fc61a8a

Please sign in to comment.