Skip to content

Commit 9b5af4b

Browse files
committed
Move tag editor to below description editor.
1 parent 82205b3 commit 9b5af4b

File tree

6 files changed

+17
-14
lines changed

6 files changed

+17
-14
lines changed

src/css/edit.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,15 @@
4343
}
4444
}
4545

46+
.components-form-token-field__input-container {
47+
background: #fff;
48+
border-color: #c3c4c7;
49+
50+
> .components-flex {
51+
padding: 12px;
52+
}
53+
}
54+
4655
#titlediv,
4756
.snippet-type-container {
4857
margin-block-end: 24px;

src/js/components/EditorSidebar/EditorSidebar.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { ActivationSwitch } from './controls/ActivationSwitch'
1616
import { DeleteButton } from './actions/DeleteButton'
1717
import { PriorityInput } from './controls/PriorityInput'
1818
import { RTLControl } from './controls/RTLControl'
19-
import { TagsInput } from './controls/TagsInput'
2019

2120
export interface EditorSidebarProps {
2221
setIsUpgradeDialogOpen: Dispatch<SetStateAction<boolean>>
@@ -41,8 +40,6 @@ export const EditorSidebar: React.FC<EditorSidebarProps> = ({ setIsUpgradeDialog
4140
<ShortcodeInfo />
4241
<PriorityInput />
4342

44-
{window.CODE_SNIPPETS_EDIT?.tagOptions.enabled ? <TagsInput /> : null}
45-
4643
{snippet.id
4744
? <div className="row-actions visible inline-form-field">
4845
<ExportButtons />

src/js/components/EditorSidebar/actions/ShortcodeInfo.tsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,7 @@ const ModalContent = () => {
104104

105105
<p className="shortcode-tag-wrapper">
106106
<code className="shortcode-tag">{shortcodeTag}</code>
107-
108-
<CopyToClipboardButton
109-
primary
110-
title={__('Copy shortcode to clipboard', 'code-snippets')}
111-
text={shortcodeTag}
112-
/>
107+
<CopyToClipboardButton primary text={shortcodeTag} />
113108
</p>
114109

115110
<p>
@@ -136,7 +131,7 @@ export const ShortcodeInfo: React.FC = () => {
136131
? <div className="inline-form-field">
137132
<h4>{__('Shortcode', 'code-snippets')}</h4>
138133
<Button onClick={() => setIsModalOpen(true)} disabled={isReadOnly}>
139-
{__('Use Shortcode', 'code-snippets')}
134+
{__('See Options', 'code-snippets')}
140135
</Button>
141136

142137
{isModalOpen

src/js/components/SnippetForm/SnippetForm.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { ConfirmDialog } from '../common/ConfirmDialog'
1212
import { UpsellDialog } from '../common/UpsellDialog'
1313
import { EditorSidebar } from '../EditorSidebar'
1414
import { UpsellBanner } from '../common/UpsellBanner'
15+
import { TagsEditor } from './fields/TagsEditor'
1516
import { CodeEditor } from './fields/CodeEditor'
1617
import { DescriptionEditor } from './fields/DescriptionEditor'
1718
import { NameInput } from './fields/NameInput'
@@ -165,6 +166,7 @@ const EditFormWrap: React.FC = () => {
165166
<div className="snippet-form-lower">
166167
<UpsellBanner />
167168
<DescriptionEditor />
169+
<TagsEditor />
168170
</div>
169171

170172
<EditorSidebar setIsUpgradeDialogOpen={setIsUpgradeDialogOpen} />

src/js/components/SnippetForm/fields/SnippetLocationInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const SnippetLocationInput: React.FC = () => {
4949
return isCondition(snippet)
5050
? null
5151
: <div className="block-form-field">
52-
<h4><label htmlFor="snippet-location">{__('Snippet location', 'code-snippets')}</label></h4>
52+
<h4><label htmlFor="snippet-location">{__('Location', 'code-snippets')}</label></h4>
5353
<Select
5454
inputId="snippet-location"
5555
className="code-snippets-select"

src/js/components/EditorSidebar/controls/TagsInput.tsx renamed to src/js/components/SnippetForm/fields/TagsEditor.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import React from 'react'
2-
import { __, _x } from '@wordpress/i18n'
2+
import { __ } from '@wordpress/i18n'
33
import { FormTokenField } from '@wordpress/components'
44
import { useSnippetForm } from '../../../hooks/useSnippetForm'
55

66
const options = window.CODE_SNIPPETS_EDIT?.tagOptions
77

8-
export const TagsInput: React.FC = () => {
8+
export const TagsEditor: React.FC = () => {
99
const { snippet, setSnippet, isReadOnly } = useSnippetForm()
1010

1111
return options?.enabled
1212
? <div className="snippet-tags-container">
13-
<h4><label htmlFor="components-form-token-input-0">{__('Tags', 'code-snippets')}</label></h4>
13+
<h3><label htmlFor="components-form-token-input-0">{__('Snippet Tags', 'code-snippets')}</label></h3>
1414

1515
<FormTokenField
1616
label=""

0 commit comments

Comments
 (0)