Server IP : 192.158.238.246 / Your IP : 3.19.28.64 Web Server : LiteSpeed System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64 User : jenniferflocom ( 1321) PHP Version : 8.1.32 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/7779/cwd/plugins/code-snippets/js/components/SnippetForm/page/ |
Upload File : |
import { __, _x } from '@wordpress/i18n' import React from 'react' import { createEmptySnippet } from '../../../utils/snippets' import { useSnippetForm } from '../../../hooks/useSnippetForm' const OPTIONS = window.CODE_SNIPPETS_EDIT export const PageHeading: React.FC = () => { const { snippet, updateSnippet, setCurrentNotice } = useSnippetForm() return ( <h1> {snippet.id ? __('Edit Snippet', 'code-snippets') : __('Add New Snippet', 'code-snippets')} {snippet.id ? <>{' '} <a href={window.CODE_SNIPPETS?.urls.addNew} className="page-title-action" onClick={event => { event.preventDefault() updateSnippet(() => createEmptySnippet()) setCurrentNotice(undefined) window.document.title = window.document.title.replace( __('Edit Snippet', 'code-snippets'), __('Add New Snippet', 'code-snippets') ) window.history.replaceState({}, '', window.CODE_SNIPPETS?.urls.addNew) }}> {_x('Add New', 'snippet', 'code-snippets')} </a> </> : null} {OPTIONS?.pageTitleActions && Object.entries(OPTIONS.pageTitleActions).map(([label, url]) => <> <a key={label} href={url} className="page-title-action">{label}</a> {' '} </> )} </h1> ) }