@wordpress/editor 12.8.0 → 12.11.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 +6 -0
- package/build/components/editor-help/help-section-title.native.js +43 -0
- package/build/components/editor-help/help-section-title.native.js.map +1 -0
- package/build/components/editor-help/help-topic-row.native.js +3 -2
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +23 -0
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -0
- package/build/components/editor-help/index.native.js +10 -11
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +14 -2
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +21 -5
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +12 -1
- package/build/components/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +24 -19
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +1 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -2
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +5 -5
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-schedule/index.js +11 -18
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +93 -13
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +7 -4
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-visibility/index.js +10 -11
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +0 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +3 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +1 -1
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/store/actions.js +5 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +4 -8
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +31 -0
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -0
- package/build-module/components/editor-help/help-topic-row.native.js +3 -2
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +13 -0
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -0
- package/build-module/components/editor-help/index.native.js +10 -12
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +15 -3
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +22 -6
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +24 -18
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -1
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +5 -5
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-schedule/index.js +12 -19
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +90 -13
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +7 -4
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +12 -13
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +0 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +4 -2
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +2 -2
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/store/actions.js +5 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +2 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +3 -5
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +1 -17
- package/build-style/style.css +1 -17
- package/package.json +29 -29
- package/src/components/editor-help/help-section-title.native.js +29 -0
- package/src/components/editor-help/help-topic-row.native.js +2 -2
- package/src/components/editor-help/icon-move-blocks.native.js +10 -0
- package/src/components/editor-help/images/drag-and-drop-dark.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-dark@3x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@2x.png +0 -0
- package/src/components/editor-help/images/drag-and-drop-light@3x.png +0 -0
- package/src/components/editor-help/index.native.js +26 -28
- package/src/components/editor-help/move-blocks.native.js +22 -2
- package/src/components/editor-help/style.scss +36 -4
- package/src/components/editor-help/view-sections.native.js +23 -8
- package/src/components/entities-saved-states/entity-record-item.js +6 -6
- package/src/components/entities-saved-states/index.js +6 -9
- package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
- package/src/components/index.js +4 -1
- package/src/components/local-autosave-monitor/index.js +39 -38
- package/src/components/page-attributes/parent.js +5 -8
- package/src/components/post-author/select.js +2 -3
- package/src/components/post-comments/index.js +4 -3
- package/src/components/post-format/index.js +2 -3
- package/src/components/post-last-revision/check.js +2 -4
- package/src/components/post-last-revision/index.js +2 -4
- package/src/components/post-pending-status/check.js +2 -5
- package/src/components/post-pingbacks/index.js +2 -3
- package/src/components/post-publish-button/index.js +7 -8
- package/src/components/post-publish-panel/index.js +2 -3
- package/src/components/post-publish-panel/maybe-category-panel.js +7 -5
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -3
- package/src/components/post-publish-panel/postpublish.js +2 -5
- package/src/components/post-publish-panel/prepublish.js +2 -3
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-schedule/index.js +6 -13
- package/src/components/post-schedule/label.js +111 -17
- package/src/components/post-schedule/test/label.js +127 -15
- package/src/components/post-slug/index.js +2 -3
- package/src/components/post-sticky/index.js +2 -3
- package/src/components/post-switch-to-draft-button/index.js +2 -5
- package/src/components/post-taxonomies/flat-term-selector.js +9 -12
- package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
- package/src/components/post-title/index.js +21 -31
- package/src/components/post-title/index.native.js +10 -16
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-trash/check.js +2 -3
- package/src/components/post-visibility/index.js +11 -17
- package/src/components/post-visibility/style.scss +0 -17
- package/src/components/provider/index.js +2 -3
- package/src/components/provider/index.native.js +12 -17
- package/src/components/provider/use-block-editor-settings.js +4 -8
- package/src/components/template-validation-notice/index.js +2 -3
- package/src/components/theme-support-check/index.js +2 -2
- package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
- package/src/store/actions.js +213 -190
- package/src/store/reducer.js +2 -2
- package/src/store/selectors.js +16 -21
- package/src/store/test/selectors.js +13 -16
- package/src/utils/media-upload/index.js +2 -5
|
@@ -169,19 +169,15 @@ class PostTitle extends Component {
|
|
|
169
169
|
|
|
170
170
|
export default compose(
|
|
171
171
|
withSelect( ( select ) => {
|
|
172
|
-
const { isPostTitleSelected, getEditedPostAttribute } =
|
|
173
|
-
editorStore
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
getSelectedBlockClientId,
|
|
177
|
-
getBlockRootClientId,
|
|
178
|
-
getSettings,
|
|
179
|
-
} = select( blockEditorStore );
|
|
172
|
+
const { isPostTitleSelected, getEditedPostAttribute } =
|
|
173
|
+
select( editorStore );
|
|
174
|
+
const { getSelectedBlockClientId, getBlockRootClientId, getSettings } =
|
|
175
|
+
select( blockEditorStore );
|
|
180
176
|
|
|
181
177
|
const selectedId = getSelectedBlockClientId();
|
|
182
178
|
const selectionIsNested = !! getBlockRootClientId( selectedId );
|
|
183
|
-
const globalStyles =
|
|
184
|
-
?.color;
|
|
179
|
+
const globalStyles =
|
|
180
|
+
getSettings()?.__experimentalGlobalStylesBaseStyles?.color;
|
|
185
181
|
|
|
186
182
|
return {
|
|
187
183
|
postType: getEditedPostAttribute( 'type' ),
|
|
@@ -192,13 +188,11 @@ export default compose(
|
|
|
192
188
|
};
|
|
193
189
|
} ),
|
|
194
190
|
withDispatch( ( dispatch ) => {
|
|
195
|
-
const { undo, redo, togglePostTitleSelection } =
|
|
196
|
-
editorStore
|
|
197
|
-
);
|
|
191
|
+
const { undo, redo, togglePostTitleSelection } =
|
|
192
|
+
dispatch( editorStore );
|
|
198
193
|
|
|
199
|
-
const { clearSelectedBlock, insertDefaultBlock } =
|
|
200
|
-
blockEditorStore
|
|
201
|
-
);
|
|
194
|
+
const { clearSelectedBlock, insertDefaultBlock } =
|
|
195
|
+
dispatch( blockEditorStore );
|
|
202
196
|
|
|
203
197
|
return {
|
|
204
198
|
onEnterPress() {
|
|
@@ -18,9 +18,8 @@ function PostTrashCheck( { isNew, postId, canUserDelete, children } ) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export default withSelect( ( select ) => {
|
|
21
|
-
const { isEditedPostNew, getCurrentPostId, getCurrentPostType } =
|
|
22
|
-
editorStore
|
|
23
|
-
);
|
|
21
|
+
const { isEditedPostNew, getCurrentPostId, getCurrentPostType } =
|
|
22
|
+
select( editorStore );
|
|
24
23
|
const { getPostType, canUser } = select( coreStore );
|
|
25
24
|
const postId = getCurrentPostId();
|
|
26
25
|
const postType = getPostType( getCurrentPostType() );
|
|
@@ -6,11 +6,10 @@ import { useState } from '@wordpress/element';
|
|
|
6
6
|
import {
|
|
7
7
|
VisuallyHidden,
|
|
8
8
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
|
-
Button,
|
|
10
9
|
} from '@wordpress/components';
|
|
11
10
|
import { useInstanceId } from '@wordpress/compose';
|
|
12
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import {
|
|
12
|
+
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -30,9 +29,8 @@ export default function PostVisibility( { onClose } ) {
|
|
|
30
29
|
const { editPost, savePost } = useDispatch( editorStore );
|
|
31
30
|
|
|
32
31
|
const [ hasPassword, setHasPassword ] = useState( !! password );
|
|
33
|
-
const [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] =
|
|
34
|
-
false
|
|
35
|
-
);
|
|
32
|
+
const [ showPrivateConfirmDialog, setShowPrivateConfirmDialog ] =
|
|
33
|
+
useState( false );
|
|
36
34
|
|
|
37
35
|
const setPublic = () => {
|
|
38
36
|
editPost( {
|
|
@@ -70,20 +68,16 @@ export default function PostVisibility( { onClose } ) {
|
|
|
70
68
|
};
|
|
71
69
|
|
|
72
70
|
return (
|
|
73
|
-
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onClick={ onClose }
|
|
71
|
+
<div className="editor-post-visibility">
|
|
72
|
+
<InspectorPopoverHeader
|
|
73
|
+
title={ __( 'Visibility' ) }
|
|
74
|
+
help={ __( 'Control how this post is viewed.' ) }
|
|
75
|
+
onClose={ onClose }
|
|
79
76
|
/>
|
|
80
77
|
<fieldset className="editor-post-visibility__fieldset">
|
|
81
|
-
<
|
|
78
|
+
<VisuallyHidden as="legend">
|
|
82
79
|
{ __( 'Visibility' ) }
|
|
83
|
-
</
|
|
84
|
-
<p className="editor-post-visibility__description">
|
|
85
|
-
{ __( 'Control how this post is viewed.' ) }
|
|
86
|
-
</p>
|
|
80
|
+
</VisuallyHidden>
|
|
87
81
|
<PostVisibilityChoice
|
|
88
82
|
instanceId={ instanceId }
|
|
89
83
|
value="public"
|
|
@@ -134,7 +128,7 @@ export default function PostVisibility( { onClose } ) {
|
|
|
134
128
|
>
|
|
135
129
|
{ __( 'Would you like to privately publish this post now?' ) }
|
|
136
130
|
</ConfirmDialog>
|
|
137
|
-
|
|
131
|
+
</div>
|
|
138
132
|
);
|
|
139
133
|
}
|
|
140
134
|
|
|
@@ -1,21 +1,4 @@
|
|
|
1
|
-
.editor-post-visibility__close {
|
|
2
|
-
position: absolute;
|
|
3
|
-
right: $grid-unit-20;
|
|
4
|
-
top: $grid-unit-20;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
1
|
.editor-post-visibility__fieldset {
|
|
8
|
-
padding: $grid-unit-10;
|
|
9
|
-
|
|
10
|
-
.editor-post-visibility__legend {
|
|
11
|
-
font-weight: 600;
|
|
12
|
-
padding: 1em 0 0 0;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.editor-post-visibility__description {
|
|
16
|
-
margin-top: 0.5em;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
2
|
.editor-post-visibility__radio[type="radio"] {
|
|
20
3
|
@include radio-control;
|
|
21
4
|
margin-top: 2px;
|
|
@@ -34,9 +34,8 @@ function EditorProvider( {
|
|
|
34
34
|
return { postId: post.id, postType: post.type };
|
|
35
35
|
}, [ post.id, post.type ] );
|
|
36
36
|
const { selection, isReady } = useSelect( ( select ) => {
|
|
37
|
-
const { getEditorSelection, __unstableIsEditorReady } =
|
|
38
|
-
editorStore
|
|
39
|
-
);
|
|
37
|
+
const { getEditorSelection, __unstableIsEditorReady } =
|
|
38
|
+
select( editorStore );
|
|
40
39
|
return {
|
|
41
40
|
isReady: __unstableIsEditorReady(),
|
|
42
41
|
selection: getEditorSelection(),
|
|
@@ -130,9 +130,8 @@ class NativeEditorProvider extends Component {
|
|
|
130
130
|
const blockName = 'core/' + payload.mediaType;
|
|
131
131
|
const newBlock = createBlock( blockName, {
|
|
132
132
|
id: payload.mediaId,
|
|
133
|
-
[ payload.mediaType === 'image'
|
|
134
|
-
|
|
135
|
-
: 'src' ]: payload.mediaUrl,
|
|
133
|
+
[ payload.mediaType === 'image' ? 'url' : 'src' ]:
|
|
134
|
+
payload.mediaUrl,
|
|
136
135
|
} );
|
|
137
136
|
|
|
138
137
|
const indexAfterSelected = this.props.selectedBlockIndex + 1;
|
|
@@ -143,14 +142,16 @@ class NativeEditorProvider extends Component {
|
|
|
143
142
|
}
|
|
144
143
|
);
|
|
145
144
|
|
|
146
|
-
this.subscriptionParentUpdateEditorSettings =
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
this.subscriptionParentUpdateEditorSettings =
|
|
146
|
+
subscribeUpdateEditorSettings(
|
|
147
|
+
( { galleryWithImageBlocks, ...editorSettings } ) => {
|
|
148
|
+
if ( typeof galleryWithImageBlocks === 'boolean' ) {
|
|
149
|
+
window.wp.galleryBlockV2Enabled =
|
|
150
|
+
galleryWithImageBlocks;
|
|
151
|
+
}
|
|
152
|
+
updateSettings( this.getThemeColors( editorSettings ) );
|
|
150
153
|
}
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
+
);
|
|
154
155
|
|
|
155
156
|
this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(
|
|
156
157
|
( payload ) => {
|
|
@@ -318,13 +319,7 @@ class NativeEditorProvider extends Component {
|
|
|
318
319
|
}
|
|
319
320
|
|
|
320
321
|
render() {
|
|
321
|
-
const {
|
|
322
|
-
children,
|
|
323
|
-
post, // eslint-disable-line no-unused-vars
|
|
324
|
-
capabilities,
|
|
325
|
-
settings,
|
|
326
|
-
...props
|
|
327
|
-
} = this.props;
|
|
322
|
+
const { children, post, capabilities, settings, ...props } = this.props;
|
|
328
323
|
const editorSettings = this.getEditorSettings( settings, capabilities );
|
|
329
324
|
|
|
330
325
|
return (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { pick,
|
|
4
|
+
import { pick, unionBy } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -52,10 +52,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
52
52
|
{ per_page: -1 }
|
|
53
53
|
)
|
|
54
54
|
: [], // Reusable blocks are fetched in the native version of this hook.
|
|
55
|
-
hasUploadPermissions:
|
|
56
|
-
canUser( 'create', 'media' ),
|
|
57
|
-
true
|
|
58
|
-
),
|
|
55
|
+
hasUploadPermissions: canUser( 'create', 'media' ) ?? true,
|
|
59
56
|
userCanCreatePages: canUser( 'create', 'pages' ),
|
|
60
57
|
pageOnFront: siteSettings?.page_on_front,
|
|
61
58
|
};
|
|
@@ -71,9 +68,8 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
71
68
|
const { restBlockPatterns, restBlockPatternCategories } = useSelect(
|
|
72
69
|
( select ) => ( {
|
|
73
70
|
restBlockPatterns: select( coreStore ).getBlockPatterns(),
|
|
74
|
-
restBlockPatternCategories:
|
|
75
|
-
coreStore
|
|
76
|
-
).getBlockPatternCategories(),
|
|
71
|
+
restBlockPatternCategories:
|
|
72
|
+
select( coreStore ).getBlockPatternCategories(),
|
|
77
73
|
} ),
|
|
78
74
|
[]
|
|
79
75
|
);
|
|
@@ -53,9 +53,8 @@ export default compose( [
|
|
|
53
53
|
isValid: select( blockEditorStore ).isValidTemplate(),
|
|
54
54
|
} ) ),
|
|
55
55
|
withDispatch( ( dispatch ) => {
|
|
56
|
-
const { setTemplateValidity, synchronizeTemplate } =
|
|
57
|
-
blockEditorStore
|
|
58
|
-
);
|
|
56
|
+
const { setTemplateValidity, synchronizeTemplate } =
|
|
57
|
+
dispatch( blockEditorStore );
|
|
59
58
|
return {
|
|
60
59
|
resetTemplateValidity: () => setTemplateValidity( true ),
|
|
61
60
|
synchronizeTemplate,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { castArray, includes,
|
|
4
|
+
import { castArray, includes, get, some } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -26,7 +26,7 @@ export function ThemeSupportCheck( {
|
|
|
26
26
|
// In the latter case, we need to verify `postType` exists
|
|
27
27
|
// within `supported`. If `postType` isn't passed, then the check
|
|
28
28
|
// should fail.
|
|
29
|
-
if ( 'post-thumbnails' === key && isArray( supported ) ) {
|
|
29
|
+
if ( 'post-thumbnails' === key && Array.isArray( supported ) ) {
|
|
30
30
|
return includes( supported, postType );
|
|
31
31
|
}
|
|
32
32
|
return supported;
|
|
@@ -42,55 +42,56 @@ import { store as editorStore } from '../store';
|
|
|
42
42
|
*/
|
|
43
43
|
const createWithMetaAttributeSource = ( metaAttributes ) =>
|
|
44
44
|
createHigherOrderComponent(
|
|
45
|
-
( BlockEdit ) =>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
( BlockEdit ) =>
|
|
46
|
+
( { attributes, setAttributes, ...props } ) => {
|
|
47
|
+
const postType = useSelect(
|
|
48
|
+
( select ) => select( editorStore ).getCurrentPostType(),
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
51
|
+
const [ meta, setMeta ] = useEntityProp(
|
|
52
|
+
'postType',
|
|
53
|
+
postType,
|
|
54
|
+
'meta'
|
|
55
|
+
);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
const mergedAttributes = useMemo(
|
|
58
|
+
() => ( {
|
|
59
|
+
...attributes,
|
|
60
|
+
...mapValues(
|
|
61
|
+
metaAttributes,
|
|
62
|
+
( metaKey ) => meta[ metaKey ]
|
|
63
|
+
),
|
|
64
|
+
} ),
|
|
65
|
+
[ attributes, meta ]
|
|
66
|
+
);
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
68
|
+
return (
|
|
69
|
+
<BlockEdit
|
|
70
|
+
attributes={ mergedAttributes }
|
|
71
|
+
setAttributes={ ( nextAttributes ) => {
|
|
72
|
+
const nextMeta = mapKeys(
|
|
73
|
+
// Filter to intersection of keys between the updated
|
|
74
|
+
// attributes and those with an associated meta key.
|
|
75
|
+
pickBy(
|
|
76
|
+
nextAttributes,
|
|
77
|
+
( value, key ) => metaAttributes[ key ]
|
|
78
|
+
),
|
|
78
79
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
// Rename the keys to the expected meta key name.
|
|
81
|
+
( value, attributeKey ) =>
|
|
82
|
+
metaAttributes[ attributeKey ]
|
|
83
|
+
);
|
|
83
84
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
if ( ! isEmpty( nextMeta ) ) {
|
|
86
|
+
setMeta( nextMeta );
|
|
87
|
+
}
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
setAttributes( nextAttributes );
|
|
90
|
+
} }
|
|
91
|
+
{ ...props }
|
|
92
|
+
/>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
94
95
|
'withMetaAttributeSource'
|
|
95
96
|
);
|
|
96
97
|
|