| 1 |
// Quick method to hide the title if the template is active |
| 2 |
if (window._wpLoadBlockEditor) { |
| 3 |
const finished = window.wp.data.subscribe(() => { |
| 4 |
const epTemplateSelected = |
| 5 |
window.wp.data |
| 6 |
.select('core/editor') |
| 7 |
.getEditedPostAttribute('template') === |
| 8 |
'editorplus-template.php' |
| 9 |
const title = document.querySelector( |
| 10 |
'.edit-post-visual-editor__post-title-wrapper', |
| 11 |
) |
| 12 |
const wrapper = document.querySelector('.editor-styles-wrapper') |
| 13 |
|
| 14 |
// Too early |
| 15 |
if (!title || !wrapper) return |
| 16 |
|
| 17 |
if (epTemplateSelected) { |
| 18 |
// GB needs to compute the height first |
| 19 |
Promise.resolve().then(() => (title.style.display = 'none')) |
| 20 |
wrapper.style.paddingTop = '0' |
| 21 |
wrapper.style.backgroundColor = '#ffffff' |
| 22 |
} else { |
| 23 |
title.style.removeProperty('display') |
| 24 |
wrapper.style.removeProperty('padding-top') |
| 25 |
wrapper.style.removeProperty('background-color') |
| 26 |
} |
| 27 |
finished() |
| 28 |
}) |
| 29 |
} |
| 30 |
|