← All changes
|
js/components/EditMenu/SnippetForm/page/PageHeading.tsx
+29
-27
3.10.0
→
trunk
View file →
| @@ -27,39 +27,41 @@ | ||
| 27 | 27 | const { snippet, updateSnippet, setCurrentNotice } = useSnippetForm() |
| 28 | 28 | |
| 29 | 29 | return ( |
| 30 | 30 | <> |
| 31 | - <h1> | |
| 32 | - {snippet.id | |
| 33 | - ? <> | |
| 34 | - {`${getPageHeading(snippet)} `} | |
| 31 | + <div className="snippets-page-header"> | |
| 32 | + <h1> | |
| 33 | + {snippet.id | |
| 34 | + ? <> | |
| 35 | + {`${getPageHeading(snippet)} `} | |
| 35 | 36 | |
| 36 | - <a | |
| 37 | - href={window.CODE_SNIPPETS?.urls.addNew} | |
| 38 | - className="page-title-action" | |
| 39 | - onClick={event => { | |
| 40 | - event.preventDefault() | |
| 41 | - updateSnippet(({ scope }) => createSnippetObject({ scope })) | |
| 42 | - setCurrentNotice(undefined) | |
| 37 | + <a | |
| 38 | + href={window.CODE_SNIPPETS?.urls.addNew} | |
| 39 | + className="page-title-action" | |
| 40 | + onClick={event => { | |
| 41 | + event.preventDefault() | |
| 42 | + updateSnippet(({ scope }) => createSnippetObject({ scope })) | |
| 43 | + setCurrentNotice(undefined) | |
| 43 | 44 | |
| 44 | - window.document.title = window.document.title | |
| 45 | - .replace(__('Edit Snippet', 'code-snippets'), getAddNewHeading(snippet)) | |
| 46 | - .replace(__('Edit Condition', 'code-snippets'), getAddNewHeading(snippet)) | |
| 45 | + window.document.title = window.document.title | |
| 46 | + .replace(__('Edit Snippet', 'code-snippets'), getAddNewHeading(snippet)) | |
| 47 | + .replace(__('Edit Condition', 'code-snippets'), getAddNewHeading(snippet)) | |
| 47 | 48 | |
| 48 | - window.history.pushState({}, '', window.CODE_SNIPPETS?.urls.addNew) | |
| 49 | - }} | |
| 50 | - > | |
| 51 | - {_x('Add New', 'snippet', 'code-snippets')} | |
| 52 | - </a> | |
| 53 | - </> | |
| 54 | - : getAddNewHeading(snippet)} | |
| 49 | + window.history.pushState({}, '', window.CODE_SNIPPETS?.urls.addNew) | |
| 50 | + }} | |
| 51 | + > | |
| 52 | + {_x('Add New', 'snippet', 'code-snippets')} | |
| 53 | + </a> | |
| 54 | + </> | |
| 55 | + : getAddNewHeading(snippet)} | |
| 55 | 56 | |
| 56 | - {OPTIONS?.pageTitleActions && Object.entries(OPTIONS.pageTitleActions).map(([label, url]) => | |
| 57 | - <> | |
| 58 | - <a key={label} href={url} className="page-title-action">{label}</a>{' '} | |
| 59 | - </> | |
| 60 | - )} | |
| 61 | - </h1> | |
| 57 | + {OPTIONS?.pageTitleActions && Object.entries(OPTIONS.pageTitleActions).map(([label, url]) => | |
| 58 | + <> | |
| 59 | + <a key={label} href={url} className="page-title-action">{label}</a>{' '} | |
| 60 | + </> | |
| 61 | + )} | |
| 62 | + </h1> | |
| 63 | + </div> | |
| 62 | 64 | |
| 63 | 65 | <hr className="wp-header-end" /> |
| 64 | 66 | </> |
| 65 | 67 | ) |