@wordpress/editor 14.6.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +37 -0
- package/build/bindings/post-meta.js +10 -8
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-manager/index.js +4 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-bar/index.js +4 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor-history/redo.js +4 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +4 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +3 -5
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +5 -5
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +4 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +57 -0
- package/build/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build/components/post-actions/index.js +5 -8
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +4 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +12 -3
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/index.js +4 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +4 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +12 -3
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +14 -8
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-status/index.js +4 -2
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +4 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/block-theme.js +13 -4
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +4 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-title/index.js +32 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-url/index.js +4 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +26 -14
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +5 -6
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +8 -2
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/start-template-options/index.js +4 -1
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/table-of-contents/index.js +4 -1
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/text-editor/index.js +4 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -6
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/export-pattern.js +2 -0
- package/build/dataviews/actions/export-pattern.js.map +1 -1
- package/build/dataviews/actions/permanently-delete-post.js +2 -0
- package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build/dataviews/actions/reset-post.js +8 -2
- package/build/dataviews/actions/reset-post.js.map +1 -1
- package/build/dataviews/actions/trash-post.js +8 -2
- package/build/dataviews/actions/trash-post.js.map +1 -1
- package/build/dataviews/actions/view-post.js +1 -1
- package/build/dataviews/actions/view-post.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/bindings/post-meta.js +10 -8
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-manager/index.js +4 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-bar/index.js +4 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +4 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +4 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +3 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +5 -5
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +4 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +52 -0
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/index.js +5 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +4 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +12 -3
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +4 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +12 -3
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +14 -8
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-status/index.js +4 -2
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +13 -4
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +4 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-title/index.js +33 -47
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-url/index.js +4 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +26 -14
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +6 -7
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +8 -2
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +4 -1
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +4 -1
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +4 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/export-pattern.js +2 -0
- package/build-module/dataviews/actions/export-pattern.js.map +1 -1
- package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
- package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build-module/dataviews/actions/reset-post.js +8 -2
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- package/build-module/dataviews/actions/trash-post.js +8 -2
- package/build-module/dataviews/actions/trash-post.js.map +1 -1
- package/build-module/dataviews/actions/view-post.js +2 -2
- package/build-module/dataviews/actions/view-post.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +12 -7
- package/build-style/style.css +12 -7
- package/build-types/bindings/post-meta.d.ts +0 -3
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
- package/build-types/components/editor-history/redo.d.ts.map +1 -1
- package/build-types/components/editor-history/undo.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/index.d.ts +1 -0
- package/build-types/components/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/text-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/bindings/post-meta.js +12 -6
- package/src/components/block-manager/index.js +2 -0
- package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
- package/src/components/create-template-part-modal/style.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- package/src/components/editor-history/redo.js +2 -0
- package/src/components/editor-history/undo.js +2 -0
- package/src/components/editor-interface/index.js +2 -4
- package/src/components/error-boundary/index.js +6 -1
- package/src/components/header/style.scss +6 -3
- package/src/components/index.js +1 -0
- package/src/components/inserter-sidebar/index.js +4 -3
- package/src/components/local-autosave-monitor/index.js +6 -6
- package/src/components/page-attributes/parent.js +5 -4
- package/src/components/plugin-preview-menu-item/index.js +52 -0
- package/src/components/post-actions/index.js +8 -14
- package/src/components/post-card-panel/style.scss +1 -1
- package/src/components/post-excerpt/panel.js +2 -0
- package/src/components/post-featured-image/index.js +6 -0
- package/src/components/post-featured-image/style.scss +1 -2
- package/src/components/post-format/index.js +2 -0
- package/src/components/post-last-revision/index.js +2 -0
- package/src/components/post-locked-modal/index.js +14 -2
- package/src/components/post-locked-modal/style.scss +1 -1
- package/src/components/post-publish-panel/index.js +2 -0
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +37 -29
- package/src/components/post-publish-panel/style.scss +3 -1
- package/src/components/post-status/index.js +3 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
- package/src/components/post-taxonomies/most-used-terms.js +2 -0
- package/src/components/post-template/block-theme.js +15 -9
- package/src/components/post-template/classic-theme.js +2 -0
- package/src/components/post-title/index.js +30 -41
- package/src/components/post-url/index.js +2 -0
- package/src/components/preview-dropdown/index.js +28 -20
- package/src/components/provider/use-block-editor-settings.js +5 -5
- package/src/components/resizable-editor/style.scss +2 -2
- package/src/components/save-publish-panels/index.js +4 -0
- package/src/components/start-template-options/index.js +6 -1
- package/src/components/table-of-contents/index.js +2 -0
- package/src/components/text-editor/index.js +2 -0
- package/src/components/visual-editor/index.js +2 -9
- package/src/dataviews/actions/export-pattern.tsx +2 -0
- package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
- package/src/dataviews/actions/reset-post.tsx +4 -0
- package/src/dataviews/actions/trash-post.tsx +4 -0
- package/src/dataviews/actions/view-post.tsx +2 -2
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +3 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -10,9 +10,6 @@ import { store as editorStore } from '../store';
|
|
|
10
10
|
|
|
11
11
|
export default {
|
|
12
12
|
name: 'core/post-meta',
|
|
13
|
-
getPlaceholder( { args } ) {
|
|
14
|
-
return args.key;
|
|
15
|
-
},
|
|
16
13
|
getValues( { registry, context, bindings } ) {
|
|
17
14
|
const meta = registry
|
|
18
15
|
.select( coreDataStore )
|
|
@@ -23,7 +20,9 @@ export default {
|
|
|
23
20
|
)?.meta;
|
|
24
21
|
const newValues = {};
|
|
25
22
|
for ( const [ attributeName, source ] of Object.entries( bindings ) ) {
|
|
26
|
-
|
|
23
|
+
// Use the key if the value is not set.
|
|
24
|
+
newValues[ attributeName ] =
|
|
25
|
+
meta?.[ source.args.key ] || source.args.key;
|
|
27
26
|
}
|
|
28
27
|
return newValues;
|
|
29
28
|
},
|
|
@@ -53,13 +52,20 @@ export default {
|
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
// Check that the custom field is not protected and available in the REST API.
|
|
56
|
-
|
|
55
|
+
// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.
|
|
56
|
+
const fieldValue = select( coreDataStore ).getEntityRecord(
|
|
57
57
|
'postType',
|
|
58
58
|
postType,
|
|
59
59
|
context?.postId
|
|
60
60
|
)?.meta?.[ args.key ];
|
|
61
61
|
|
|
62
|
-
if (
|
|
62
|
+
if ( fieldValue === undefined ) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
// Check that custom fields metabox is not enabled.
|
|
66
|
+
const areCustomFieldsEnabled =
|
|
67
|
+
select( editorStore ).getEditorSettings().enableCustomFields;
|
|
68
|
+
if ( areCustomFieldsEnabled ) {
|
|
63
69
|
return false;
|
|
64
70
|
}
|
|
65
71
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
11
11
|
import { __experimentalText as Text, MenuItem } from '@wordpress/components';
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { __, _x } from '@wordpress/i18n';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
@@ -137,27 +137,23 @@ function TemplateLockContentOnlyMenuItems( { clientId, onClose } ) {
|
|
|
137
137
|
);
|
|
138
138
|
const blockDisplayInformation =
|
|
139
139
|
useBlockDisplayInformation( contentLockingParent );
|
|
140
|
-
|
|
141
|
-
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
142
|
-
const { modifyContentLockBlock, selectBlock } = unlock(
|
|
143
|
-
useDispatch( blockEditorStore )
|
|
144
|
-
);
|
|
145
|
-
|
|
140
|
+
const blockEditorActions = useDispatch( blockEditorStore );
|
|
146
141
|
if ( ! blockDisplayInformation?.title ) {
|
|
147
142
|
return null;
|
|
148
143
|
}
|
|
149
144
|
|
|
145
|
+
const { modifyContentLockBlock } = unlock( blockEditorActions );
|
|
146
|
+
|
|
150
147
|
return (
|
|
151
148
|
<>
|
|
152
149
|
<BlockSettingsMenuFirstItem>
|
|
153
150
|
<MenuItem
|
|
154
151
|
onClick={ () => {
|
|
155
|
-
selectBlock( contentLockingParent );
|
|
156
152
|
modifyContentLockBlock( contentLockingParent );
|
|
157
153
|
onClose();
|
|
158
154
|
} }
|
|
159
155
|
>
|
|
160
|
-
{
|
|
156
|
+
{ _x( 'Unlock', 'Unlock content locked blocks' ) }
|
|
161
157
|
</MenuItem>
|
|
162
158
|
</BlockSettingsMenuFirstItem>
|
|
163
159
|
<Text
|
|
@@ -120,9 +120,9 @@ export default function DocumentBar( props ) {
|
|
|
120
120
|
const title = props.title || entityTitle;
|
|
121
121
|
const icon = props.icon || templateIcon;
|
|
122
122
|
|
|
123
|
-
const
|
|
123
|
+
const mountedRef = useRef( false );
|
|
124
124
|
useEffect( () => {
|
|
125
|
-
|
|
125
|
+
mountedRef.current = true;
|
|
126
126
|
}, [] );
|
|
127
127
|
|
|
128
128
|
return (
|
|
@@ -143,7 +143,7 @@ export default function DocumentBar( props ) {
|
|
|
143
143
|
} }
|
|
144
144
|
size="compact"
|
|
145
145
|
initial={
|
|
146
|
-
|
|
146
|
+
mountedRef.current
|
|
147
147
|
? { opacity: 0, transform: 'translateX(15%)' }
|
|
148
148
|
: false // Don't show entry animation when DocumentBar mounts.
|
|
149
149
|
}
|
|
@@ -170,7 +170,7 @@ export default function DocumentBar( props ) {
|
|
|
170
170
|
// Force entry animation when the back button is added or removed.
|
|
171
171
|
key={ hasBackButton }
|
|
172
172
|
initial={
|
|
173
|
-
|
|
173
|
+
mountedRef.current
|
|
174
174
|
? {
|
|
175
175
|
opacity: 0,
|
|
176
176
|
transform: hasBackButton
|
|
@@ -25,6 +25,8 @@ function EditorHistoryRedo( props, ref ) {
|
|
|
25
25
|
const { redo } = useDispatch( editorStore );
|
|
26
26
|
return (
|
|
27
27
|
<Button
|
|
28
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
29
|
+
__next40pxDefaultSize={ false }
|
|
28
30
|
{ ...props }
|
|
29
31
|
ref={ ref }
|
|
30
32
|
icon={ ! isRTL() ? redoIcon : undoIcon }
|
|
@@ -21,6 +21,8 @@ function EditorHistoryUndo( props, ref ) {
|
|
|
21
21
|
const { undo } = useDispatch( editorStore );
|
|
22
22
|
return (
|
|
23
23
|
<Button
|
|
24
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
25
|
+
__next40pxDefaultSize={ false }
|
|
24
26
|
{ ...props }
|
|
25
27
|
ref={ ref }
|
|
26
28
|
icon={ ! isRTL() ? undoIcon : redoIcon }
|
|
@@ -99,7 +99,6 @@ export default function EditorInterface( {
|
|
|
99
99
|
select( blockEditorStore ).__unstableGetEditorMode(),
|
|
100
100
|
};
|
|
101
101
|
}, [] );
|
|
102
|
-
const isWideViewport = useViewportMatch( 'large' );
|
|
103
102
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
104
103
|
const secondarySidebarLabel = isListViewOpened
|
|
105
104
|
? __( 'Document Overview' )
|
|
@@ -122,11 +121,10 @@ export default function EditorInterface( {
|
|
|
122
121
|
return (
|
|
123
122
|
<InterfaceSkeleton
|
|
124
123
|
enableRegionNavigation={ enableRegionNavigation }
|
|
125
|
-
isDistractionFree={ isDistractionFree
|
|
124
|
+
isDistractionFree={ isDistractionFree }
|
|
126
125
|
className={ clsx( 'editor-editor-interface', className, {
|
|
127
126
|
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
|
|
128
|
-
'is-distraction-free':
|
|
129
|
-
isDistractionFree && isWideViewport && ! isPreviewMode,
|
|
127
|
+
'is-distraction-free': isDistractionFree && ! isPreviewMode,
|
|
130
128
|
} ) }
|
|
131
129
|
labels={ {
|
|
132
130
|
...interfaceLabels,
|
|
@@ -29,7 +29,12 @@ function getContent() {
|
|
|
29
29
|
function CopyButton( { text, children } ) {
|
|
30
30
|
const ref = useCopyToClipboard( text );
|
|
31
31
|
return (
|
|
32
|
-
<Button
|
|
32
|
+
<Button
|
|
33
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
34
|
+
__next40pxDefaultSize={ false }
|
|
35
|
+
variant="secondary"
|
|
36
|
+
ref={ ref }
|
|
37
|
+
>
|
|
33
38
|
{ children }
|
|
34
39
|
</Button>
|
|
35
40
|
);
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
.editor-header__post-preview-button {
|
|
231
|
-
@include break-
|
|
231
|
+
@include break-mobile {
|
|
232
232
|
display: none;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
@@ -240,10 +240,13 @@
|
|
|
240
240
|
|
|
241
241
|
.editor-header {
|
|
242
242
|
background-color: $white;
|
|
243
|
-
border-bottom: 1px solid #e0e0e0;
|
|
244
|
-
position: absolute;
|
|
245
243
|
width: 100%;
|
|
246
244
|
|
|
245
|
+
@include break-medium {
|
|
246
|
+
border-bottom: 1px solid #e0e0e0;
|
|
247
|
+
position: absolute;
|
|
248
|
+
}
|
|
249
|
+
|
|
247
250
|
|
|
248
251
|
// hide some parts
|
|
249
252
|
& > .edit-post-header__settings > .edit-post-header__post-preview-button {
|
package/src/components/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { default as PluginMoreMenuItem } from './plugin-more-menu-item';
|
|
|
32
32
|
export { default as PluginPostPublishPanel } from './plugin-post-publish-panel';
|
|
33
33
|
export { default as PluginPostStatusInfo } from './plugin-post-status-info';
|
|
34
34
|
export { default as PluginPrePublishPanel } from './plugin-pre-publish-panel';
|
|
35
|
+
export { default as PluginPreviewMenuItem } from './plugin-preview-menu-item';
|
|
35
36
|
export { default as PluginSidebar } from './plugin-sidebar';
|
|
36
37
|
export { default as PluginSidebarMoreMenuItem } from './plugin-sidebar-more-menu-item';
|
|
37
38
|
export { default as PostTemplatePanel } from './post-template/panel';
|
|
@@ -38,13 +38,14 @@ export default function InserterSidebar() {
|
|
|
38
38
|
getBlockInsertionPoint,
|
|
39
39
|
getBlockRootClientId,
|
|
40
40
|
__unstableGetEditorMode,
|
|
41
|
-
|
|
42
|
-
} = select( blockEditorStore );
|
|
41
|
+
getSectionRootClientId,
|
|
42
|
+
} = unlock( select( blockEditorStore ) );
|
|
43
43
|
const { get } = select( preferencesStore );
|
|
44
44
|
const { getActiveComplementaryArea } = select( interfaceStore );
|
|
45
45
|
const getBlockSectionRootClientId = () => {
|
|
46
46
|
if ( __unstableGetEditorMode() === 'zoom-out' ) {
|
|
47
|
-
const
|
|
47
|
+
const sectionRootClientId = getSectionRootClientId();
|
|
48
|
+
|
|
48
49
|
if ( sectionRootClientId ) {
|
|
49
50
|
return sectionRootClientId;
|
|
50
51
|
}
|
|
@@ -144,20 +144,20 @@ function useAutosavePurge() {
|
|
|
144
144
|
[]
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
-
const
|
|
148
|
-
const
|
|
147
|
+
const lastIsDirtyRef = useRef( isDirty );
|
|
148
|
+
const lastIsAutosavingRef = useRef( isAutosaving );
|
|
149
149
|
|
|
150
150
|
useEffect( () => {
|
|
151
151
|
if (
|
|
152
152
|
! didError &&
|
|
153
|
-
( (
|
|
154
|
-
(
|
|
153
|
+
( ( lastIsAutosavingRef.current && ! isAutosaving ) ||
|
|
154
|
+
( lastIsDirtyRef.current && ! isDirty ) )
|
|
155
155
|
) {
|
|
156
156
|
localAutosaveClear( postId, isEditedPostNew );
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
lastIsDirtyRef.current = isDirty;
|
|
160
|
+
lastIsAutosavingRef.current = isAutosaving;
|
|
161
161
|
}, [ isDirty, isAutosaving, didError ] );
|
|
162
162
|
|
|
163
163
|
// Once the isEditedPostNew changes from true to false, let's clear the auto-draft autosave.
|
|
@@ -222,10 +222,11 @@ function PostParentToggle( { isOpen, onClick } ) {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
export function ParentRow() {
|
|
225
|
-
const homeUrl = useSelect(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
const homeUrl = useSelect( ( select ) => {
|
|
226
|
+
// Site index.
|
|
227
|
+
return select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
228
|
+
?.home;
|
|
229
|
+
}, [] );
|
|
229
230
|
// Use internal state instead of a ref to make sure that the component
|
|
230
231
|
// re-renders when the popover's anchor updates.
|
|
231
232
|
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { compose } from '@wordpress/compose';
|
|
5
|
+
import { MenuItem } from '@wordpress/components';
|
|
6
|
+
import { withPluginContext } from '@wordpress/plugins';
|
|
7
|
+
import { ActionItem } from '@wordpress/interface';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided.
|
|
11
|
+
* The text within the component appears as the menu item label.
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} props Component properties.
|
|
14
|
+
* @param {string} [props.href] When `href` is provided, the menu item is rendered as an anchor instead of a button. It corresponds to the `href` attribute of the anchor.
|
|
15
|
+
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The icon to be rendered to the left of the menu item label. Can be a Dashicon slug or an SVG WP element.
|
|
16
|
+
* @param {Function} [props.onClick] The callback function to be executed when the user clicks the menu item.
|
|
17
|
+
* @param {...*} [props.other] Any additional props are passed through to the underlying MenuItem component.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* import { __ } from '@wordpress/i18n';
|
|
22
|
+
* import { PluginPreviewMenuItem } from '@wordpress/editor';
|
|
23
|
+
* import { external } from '@wordpress/icons';
|
|
24
|
+
*
|
|
25
|
+
* function onPreviewClick() {
|
|
26
|
+
* // Handle preview action
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* const ExternalPreviewMenuItem = () => (
|
|
30
|
+
* <PreviewDropdownMenuItem
|
|
31
|
+
* icon={ external }
|
|
32
|
+
* onClick={ onPreviewClick }
|
|
33
|
+
* >
|
|
34
|
+
* { __( 'Preview in new tab' ) }
|
|
35
|
+
* </PreviewDropdownMenuItem>
|
|
36
|
+
* );
|
|
37
|
+
* registerPlugin( 'external-preview-menu-item', {
|
|
38
|
+
* render: ExternalPreviewMenuItem,
|
|
39
|
+
* } );
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @return {Component} The rendered menu item component.
|
|
43
|
+
*/
|
|
44
|
+
export default compose(
|
|
45
|
+
withPluginContext( ( context, ownProps ) => {
|
|
46
|
+
return {
|
|
47
|
+
as: ownProps.as ?? MenuItem,
|
|
48
|
+
icon: ownProps.icon || context.icon,
|
|
49
|
+
name: 'core/plugin-preview-menu',
|
|
50
|
+
};
|
|
51
|
+
} )
|
|
52
|
+
)( ActionItem );
|
|
@@ -18,13 +18,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
18
|
import { unlock } from '../../lock-unlock';
|
|
19
19
|
import { usePostActions } from './actions';
|
|
20
20
|
|
|
21
|
-
const {
|
|
22
|
-
DropdownMenuV2: DropdownMenu,
|
|
23
|
-
DropdownMenuGroupV2: DropdownMenuGroup,
|
|
24
|
-
DropdownMenuItemV2: DropdownMenuItem,
|
|
25
|
-
DropdownMenuItemLabelV2: DropdownMenuItemLabel,
|
|
26
|
-
kebabCase,
|
|
27
|
-
} = unlock( componentsPrivateApis );
|
|
21
|
+
const { DropdownMenuV2, kebabCase } = unlock( componentsPrivateApis );
|
|
28
22
|
|
|
29
23
|
export default function PostActions( { postType, postId, onActionPerformed } ) {
|
|
30
24
|
const [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );
|
|
@@ -60,7 +54,7 @@ export default function PostActions( { postType, postId, onActionPerformed } ) {
|
|
|
60
54
|
}, [ allActions, itemWithPermissions ] );
|
|
61
55
|
|
|
62
56
|
return (
|
|
63
|
-
<
|
|
57
|
+
<DropdownMenuV2
|
|
64
58
|
open={ isActionsMenuOpen }
|
|
65
59
|
trigger={
|
|
66
60
|
<Button
|
|
@@ -85,7 +79,7 @@ export default function PostActions( { postType, postId, onActionPerformed } ) {
|
|
|
85
79
|
setIsActionsMenuOpen( false );
|
|
86
80
|
} }
|
|
87
81
|
/>
|
|
88
|
-
</
|
|
82
|
+
</DropdownMenuV2>
|
|
89
83
|
);
|
|
90
84
|
}
|
|
91
85
|
|
|
@@ -99,12 +93,12 @@ function DropdownMenuItemTrigger( { action, onClick, items } ) {
|
|
|
99
93
|
const label =
|
|
100
94
|
typeof action.label === 'string' ? action.label : action.label( items );
|
|
101
95
|
return (
|
|
102
|
-
<
|
|
96
|
+
<DropdownMenuV2.Item
|
|
103
97
|
onClick={ onClick }
|
|
104
98
|
hideOnClick={ ! action.RenderModal }
|
|
105
99
|
>
|
|
106
|
-
<
|
|
107
|
-
</
|
|
100
|
+
<DropdownMenuV2.ItemLabel>{ label }</DropdownMenuV2.ItemLabel>
|
|
101
|
+
</DropdownMenuV2.Item>
|
|
108
102
|
);
|
|
109
103
|
}
|
|
110
104
|
|
|
@@ -151,7 +145,7 @@ function ActionWithModal( { action, item, ActionTrigger, onClose } ) {
|
|
|
151
145
|
// With an added onClose prop.
|
|
152
146
|
function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
|
|
153
147
|
return (
|
|
154
|
-
<
|
|
148
|
+
<DropdownMenuV2.Group>
|
|
155
149
|
{ actions.map( ( action ) => {
|
|
156
150
|
if ( action.RenderModal ) {
|
|
157
151
|
return (
|
|
@@ -173,6 +167,6 @@ function ActionsDropdownMenuGroup( { actions, item, onClose } ) {
|
|
|
173
167
|
/>
|
|
174
168
|
);
|
|
175
169
|
} ) }
|
|
176
|
-
</
|
|
170
|
+
</DropdownMenuV2.Group>
|
|
177
171
|
);
|
|
178
172
|
}
|
|
@@ -198,6 +198,8 @@ function PrivateExcerpt() {
|
|
|
198
198
|
ref={ setPopoverAnchor }
|
|
199
199
|
renderToggle={ ( { onToggle } ) => (
|
|
200
200
|
<Button
|
|
201
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
202
|
+
__next40pxDefaultSize={ false }
|
|
201
203
|
className="editor-post-excerpt__dropdown__trigger"
|
|
202
204
|
onClick={ onToggle }
|
|
203
205
|
variant="link"
|
|
@@ -160,6 +160,8 @@ function PostFeaturedImage( {
|
|
|
160
160
|
render={ ( { open } ) => (
|
|
161
161
|
<div className="editor-post-featured-image__container">
|
|
162
162
|
<Button
|
|
163
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
164
|
+
__next40pxDefaultSize={ false }
|
|
163
165
|
ref={ toggleRef }
|
|
164
166
|
className={
|
|
165
167
|
! featuredImageId
|
|
@@ -200,6 +202,8 @@ function PostFeaturedImage( {
|
|
|
200
202
|
{ !! featuredImageId && (
|
|
201
203
|
<HStack className="editor-post-featured-image__actions">
|
|
202
204
|
<Button
|
|
205
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
206
|
+
__next40pxDefaultSize={ false }
|
|
203
207
|
className="editor-post-featured-image__action"
|
|
204
208
|
onClick={ open }
|
|
205
209
|
aria-haspopup="dialog"
|
|
@@ -207,6 +211,8 @@ function PostFeaturedImage( {
|
|
|
207
211
|
{ __( 'Replace' ) }
|
|
208
212
|
</Button>
|
|
209
213
|
<Button
|
|
214
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
215
|
+
__next40pxDefaultSize={ false }
|
|
210
216
|
className="editor-post-featured-image__action"
|
|
211
217
|
onClick={ () => {
|
|
212
218
|
onRemoveImage();
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
.components-drop-zone__content {
|
|
25
|
-
border-radius: $radius-
|
|
25
|
+
border-radius: $radius-small;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Align text and icons horizontally to avoid clipping when the featured image is not set.
|
|
@@ -65,7 +65,6 @@
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
.editor-post-featured-image__toggle {
|
|
68
|
-
border-radius: $radius-block-ui;
|
|
69
68
|
height: 100%;
|
|
70
69
|
line-height: 20px;
|
|
71
70
|
padding: $grid-unit-10 0;
|
|
@@ -100,6 +100,8 @@ export default function PostFormat() {
|
|
|
100
100
|
{ suggestion && suggestion.id !== postFormat && (
|
|
101
101
|
<p className="editor-post-format__suggestion">
|
|
102
102
|
<Button
|
|
103
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
104
|
+
__next40pxDefaultSize={ false }
|
|
103
105
|
variant="link"
|
|
104
106
|
onClick={ () =>
|
|
105
107
|
onUpdatePostFormat( suggestion.id )
|
|
@@ -178,6 +178,8 @@ export default function PostLockedModal() {
|
|
|
178
178
|
shouldCloseOnClickOutside={ false }
|
|
179
179
|
shouldCloseOnEsc={ false }
|
|
180
180
|
isDismissible={ false }
|
|
181
|
+
// Do not remove this class, as this class is used by third party plugins.
|
|
182
|
+
className="editor-post-locked-modal"
|
|
181
183
|
size="medium"
|
|
182
184
|
>
|
|
183
185
|
<HStack alignment="top" spacing={ 6 }>
|
|
@@ -254,11 +256,21 @@ export default function PostLockedModal() {
|
|
|
254
256
|
justify="flex-end"
|
|
255
257
|
>
|
|
256
258
|
{ ! isTakeover && (
|
|
257
|
-
<Button
|
|
259
|
+
<Button
|
|
260
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
261
|
+
__next40pxDefaultSize={ false }
|
|
262
|
+
variant="tertiary"
|
|
263
|
+
href={ unlockUrl }
|
|
264
|
+
>
|
|
258
265
|
{ __( 'Take over' ) }
|
|
259
266
|
</Button>
|
|
260
267
|
) }
|
|
261
|
-
<Button
|
|
268
|
+
<Button
|
|
269
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
270
|
+
__next40pxDefaultSize={ false }
|
|
271
|
+
variant="primary"
|
|
272
|
+
href={ allPostsUrl }
|
|
273
|
+
>
|
|
262
274
|
{ allPostsLabel }
|
|
263
275
|
</Button>
|
|
264
276
|
</HStack>
|
|
@@ -78,6 +78,8 @@ export class PostPublishPanel extends Component {
|
|
|
78
78
|
<div className="editor-post-publish-panel__header">
|
|
79
79
|
{ isPostPublish ? (
|
|
80
80
|
<Button
|
|
81
|
+
// TODO: Switch to `true` (40px size) if possible
|
|
82
|
+
__next40pxDefaultSize={ false }
|
|
81
83
|
onClick={ onClose }
|
|
82
84
|
icon={ closeSmall }
|
|
83
85
|
label={ __( 'Close panel' ) }
|