From 42b7b8c11252d27504304d34755d2aa9d055b5b8 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 04:36:38 +0000 Subject: [PATCH] Pattern Creator: Show a prompt to name the pattern at the top of the editor The pattern title sits above the canvas iframe, so it never gets the editor's rich text placeholder styles: a new pattern shows an empty dark band with no hint that it is where the name goes. It also starts flush against the toolbar. Set the editor's title placeholder to "Enter your pattern name", style the placeholder inside the title wrapper as the editor does in the canvas, and add space above the title. Fixes #733. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YBAW4qoeXMBLmmMJxuCC7d --- .../src/components/block-editor/style.scss | 11 +++++++++++ .../plugins/pattern-creator/src/store/selectors.js | 2 ++ .../pattern-creator/src/store/test/selectors.js | 2 ++ 3 files changed, 15 insertions(+) diff --git a/public_html/wp-content/plugins/pattern-creator/src/components/block-editor/style.scss b/public_html/wp-content/plugins/pattern-creator/src/components/block-editor/style.scss index adf20884..a579a6e5 100644 --- a/public_html/wp-content/plugins/pattern-creator/src/components/block-editor/style.scss +++ b/public_html/wp-content/plugins/pattern-creator/src/components/block-editor/style.scss @@ -17,10 +17,21 @@ max-width: 960px; margin-left: auto; margin-right: auto; + padding-top: $grid-unit-30; h1 { color: $white; } + + // The title sits outside the canvas iframe, so it doesn't get the editor's rich text placeholder styles. + [data-rich-text-placeholder] { + pointer-events: none; + } + + [data-rich-text-placeholder]::after { + content: attr(data-rich-text-placeholder); + opacity: 0.62; + } } .pattern-visual-editor > [name="editor-canvas"] { diff --git a/public_html/wp-content/plugins/pattern-creator/src/store/selectors.js b/public_html/wp-content/plugins/pattern-creator/src/store/selectors.js index cc540847..9b12999a 100644 --- a/public_html/wp-content/plugins/pattern-creator/src/store/selectors.js +++ b/public_html/wp-content/plugins/pattern-creator/src/store/selectors.js @@ -9,6 +9,7 @@ import createSelector from 'rememo'; */ import { store as coreStore } from '@wordpress/core-data'; import { createRegistrySelector } from '@wordpress/data'; +import { __ } from '@wordpress/i18n'; import { /* eslint-disable-next-line @wordpress/no-unsafe-wp-apis */ __unstableSerializeAndClean, @@ -66,6 +67,7 @@ export const getSettings = createSelector( ( state, setIsInserterOpen ) => { const settings = { ...state.settings, + titlePlaceholder: __( 'Enter your pattern name', 'wporg-patterns' ), fullscreenMode: true, outlineMode: true, focusMode: isFeatureActive( state, 'focusMode' ), diff --git a/public_html/wp-content/plugins/pattern-creator/src/store/test/selectors.js b/public_html/wp-content/plugins/pattern-creator/src/store/test/selectors.js index baa58dad..c21df005 100644 --- a/public_html/wp-content/plugins/pattern-creator/src/store/test/selectors.js +++ b/public_html/wp-content/plugins/pattern-creator/src/store/test/selectors.js @@ -54,6 +54,7 @@ describe( 'selectors', () => { const state = { settings: {}, preferences: {} }; const setInserterOpened = () => {}; expect( getSettings( state, setInserterOpened ) ).toEqual( { + titlePlaceholder: 'Enter your pattern name', outlineMode: true, focusMode: false, fullscreenMode: true, @@ -78,6 +79,7 @@ describe( 'selectors', () => { const setInserterOpened = () => {}; expect( getSettings( state, setInserterOpened ) ).toEqual( { key: 'value', + titlePlaceholder: 'Enter your pattern name', outlineMode: true, focusMode: true, fullscreenMode: true,