@wordpress/editor 12.7.0 → 12.10.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/local-autosave-monitor/index.js.map +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.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-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 +2 -2
- 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-text-editor/index.js +6 -6
- package/build/components/post-text-editor/index.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 +8 -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 +3 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +18 -10
- 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.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/local-autosave-monitor/index.js.map +1 -1
- 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.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-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 +2 -2
- 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-text-editor/index.js +6 -6
- package/build-module/components/post-text-editor/index.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 +9 -12
- 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 +2 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +19 -11
- 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.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 +9 -17
- package/build-style/style.css +9 -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/test/index.native.js +1 -1
- 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/local-autosave-monitor/index.js +15 -20
- package/src/components/page-attributes/parent.js +4 -6
- 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 +2 -3
- 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-saved-state/style.scss +9 -0
- package/src/components/post-schedule/index.js +6 -13
- package/src/components/post-slug/index.js +2 -3
- package/src/components/post-slug/test/index.js +4 -4
- 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 -10
- package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
- package/src/components/post-text-editor/index.js +5 -6
- package/src/components/post-title/index.js +21 -31
- package/src/components/post-title/index.native.js +10 -16
- package/src/components/post-trash/check.js +2 -3
- package/src/components/post-visibility/index.js +9 -15
- package/src/components/post-visibility/style.scss +0 -17
- package/src/components/provider/index.js +2 -3
- package/src/components/provider/index.native.js +13 -11
- package/src/components/provider/use-block-editor-settings.js +27 -15
- package/src/components/table-of-contents/style.scss +1 -3
- 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 +211 -190
- package/src/store/selectors.js +16 -21
- package/src/store/test/selectors.js +7 -8
- package/src/utils/media-upload/index.js +2 -5
|
@@ -39,9 +39,8 @@ const PostFormatSuggestion = ( {
|
|
|
39
39
|
|
|
40
40
|
export default function PostFormatPanel() {
|
|
41
41
|
const { currentPostFormat, suggestion } = useSelect( ( select ) => {
|
|
42
|
-
const { getEditedPostAttribute, getSuggestedPostFormat } =
|
|
43
|
-
editorStore
|
|
44
|
-
);
|
|
42
|
+
const { getEditedPostAttribute, getSuggestedPostFormat } =
|
|
43
|
+
select( editorStore );
|
|
45
44
|
const supportedFormats = get(
|
|
46
45
|
select( coreStore ).getThemeSupports(),
|
|
47
46
|
[ 'formats' ],
|
|
@@ -163,11 +163,8 @@ class PostPublishPanelPostpublish extends Component {
|
|
|
163
163
|
}
|
|
164
164
|
|
|
165
165
|
export default withSelect( ( select ) => {
|
|
166
|
-
const {
|
|
167
|
-
|
|
168
|
-
getCurrentPost,
|
|
169
|
-
isCurrentPostScheduled,
|
|
170
|
-
} = select( editorStore );
|
|
166
|
+
const { getEditedPostAttribute, getCurrentPost, isCurrentPostScheduled } =
|
|
167
|
+
select( editorStore );
|
|
171
168
|
const { getPostType } = select( coreStore );
|
|
172
169
|
|
|
173
170
|
return {
|
|
@@ -35,9 +35,8 @@ function PostPublishPanelPrepublish( { children } ) {
|
|
|
35
35
|
siteTitle,
|
|
36
36
|
siteHome,
|
|
37
37
|
} = useSelect( ( select ) => {
|
|
38
|
-
const { getCurrentPost, isEditedPostBeingScheduled } =
|
|
39
|
-
editorStore
|
|
40
|
-
);
|
|
38
|
+
const { getCurrentPost, isEditedPostBeingScheduled } =
|
|
39
|
+
select( editorStore );
|
|
41
40
|
const { getEntityRecord, isResolving } = select( coreStore );
|
|
42
41
|
const siteData =
|
|
43
42
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
@@ -33,3 +33,12 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
// Overwrite rules from Button component packages/components/src/button/style.scss
|
|
38
|
+
.editor-post-save-draft.has-text.has-icon svg {
|
|
39
|
+
margin-right: 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:root[dir="rtl"] .editor-post-saved-state.has-text.has-icon {
|
|
43
|
+
justify-content: right;
|
|
44
|
+
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalGetSettings } from '@wordpress/date';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
|
|
7
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -21,7 +21,7 @@ function getDayOfTheMonth( date = new Date(), firstDay = true ) {
|
|
|
21
21
|
).toISOString();
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export default function PostSchedule() {
|
|
24
|
+
export default function PostSchedule( { onClose } ) {
|
|
25
25
|
const { postDate, postType } = useSelect(
|
|
26
26
|
( select ) => ( {
|
|
27
27
|
postDate: select( editorStore ).getEditedPostAttribute( 'date' ),
|
|
@@ -61,7 +61,6 @@ export default function PostSchedule() {
|
|
|
61
61
|
[ eventsByPostType ]
|
|
62
62
|
);
|
|
63
63
|
|
|
64
|
-
const ref = useRef();
|
|
65
64
|
const settings = __experimentalGetSettings();
|
|
66
65
|
|
|
67
66
|
// To know if the current timezone is a 12 hour time with look for "a" in the time format
|
|
@@ -75,20 +74,14 @@ export default function PostSchedule() {
|
|
|
75
74
|
.join( '' ) // Reverse the string and test for "a" not followed by a slash.
|
|
76
75
|
);
|
|
77
76
|
|
|
78
|
-
function onChange( newDate ) {
|
|
79
|
-
onUpdateDate( newDate );
|
|
80
|
-
const { ownerDocument } = ref.current;
|
|
81
|
-
ownerDocument.activeElement.blur();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
77
|
return (
|
|
85
|
-
<
|
|
86
|
-
ref={ ref }
|
|
78
|
+
<PublishDateTimePicker
|
|
87
79
|
currentDate={ postDate }
|
|
88
|
-
onChange={
|
|
80
|
+
onChange={ onUpdateDate }
|
|
89
81
|
is12Hour={ is12HourTime }
|
|
90
82
|
events={ events }
|
|
91
83
|
onMonthPreviewed={ setPreviewedMonth }
|
|
84
|
+
onClose={ onClose }
|
|
92
85
|
/>
|
|
93
86
|
);
|
|
94
87
|
}
|
|
@@ -68,9 +68,8 @@ export class PostSlug extends Component {
|
|
|
68
68
|
|
|
69
69
|
export default compose( [
|
|
70
70
|
withSelect( ( select ) => {
|
|
71
|
-
const { getCurrentPost, getEditedPostAttribute } =
|
|
72
|
-
editorStore
|
|
73
|
-
);
|
|
71
|
+
const { getCurrentPost, getEditedPostAttribute } =
|
|
72
|
+
select( editorStore );
|
|
74
73
|
|
|
75
74
|
const { id } = getCurrentPost();
|
|
76
75
|
return {
|
|
@@ -15,11 +15,11 @@ describe( 'PostSlug', () => {
|
|
|
15
15
|
|
|
16
16
|
wrapper.find( 'input' ).simulate( 'change', {
|
|
17
17
|
target: {
|
|
18
|
-
value: 'single
|
|
18
|
+
value: 'single',
|
|
19
19
|
},
|
|
20
20
|
} );
|
|
21
21
|
|
|
22
|
-
expect( wrapper.state().editedSlug ).toEqual( 'single
|
|
22
|
+
expect( wrapper.state().editedSlug ).toEqual( 'single' );
|
|
23
23
|
} );
|
|
24
24
|
|
|
25
25
|
it( 'should update slug', () => {
|
|
@@ -30,11 +30,11 @@ describe( 'PostSlug', () => {
|
|
|
30
30
|
|
|
31
31
|
wrapper.find( 'input' ).simulate( 'blur', {
|
|
32
32
|
target: {
|
|
33
|
-
value: 'single
|
|
33
|
+
value: 'single',
|
|
34
34
|
},
|
|
35
35
|
} );
|
|
36
36
|
|
|
37
|
-
expect( onUpdateSlug ).toHaveBeenCalledWith( 'single
|
|
37
|
+
expect( onUpdateSlug ).toHaveBeenCalledWith( 'single' );
|
|
38
38
|
} );
|
|
39
39
|
} );
|
|
40
40
|
} );
|
|
@@ -27,9 +27,8 @@ export function PostSticky( { onUpdateSticky, postSticky = false } ) {
|
|
|
27
27
|
export default compose( [
|
|
28
28
|
withSelect( ( select ) => {
|
|
29
29
|
return {
|
|
30
|
-
postSticky:
|
|
31
|
-
'sticky'
|
|
32
|
-
),
|
|
30
|
+
postSticky:
|
|
31
|
+
select( editorStore ).getEditedPostAttribute( 'sticky' ),
|
|
33
32
|
};
|
|
34
33
|
} ),
|
|
35
34
|
withDispatch( ( dispatch ) => {
|
|
@@ -65,11 +65,8 @@ function PostSwitchToDraftButton( {
|
|
|
65
65
|
|
|
66
66
|
export default compose( [
|
|
67
67
|
withSelect( ( select ) => {
|
|
68
|
-
const {
|
|
69
|
-
|
|
70
|
-
isCurrentPostPublished,
|
|
71
|
-
isCurrentPostScheduled,
|
|
72
|
-
} = select( editorStore );
|
|
68
|
+
const { isSavingPost, isCurrentPostPublished, isCurrentPostScheduled } =
|
|
69
|
+
select( editorStore );
|
|
73
70
|
return {
|
|
74
71
|
isSaving: isSavingPost(),
|
|
75
72
|
isPublished: isCurrentPostPublished(),
|
|
@@ -100,14 +100,10 @@ function FlatTermSelector( { slug } ) {
|
|
|
100
100
|
hasResolvedTerms,
|
|
101
101
|
} = useSelect(
|
|
102
102
|
( select ) => {
|
|
103
|
-
const { getCurrentPost, getEditedPostAttribute } =
|
|
104
|
-
editorStore
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
getEntityRecords,
|
|
108
|
-
getTaxonomy,
|
|
109
|
-
hasFinishedResolution,
|
|
110
|
-
} = select( coreStore );
|
|
103
|
+
const { getCurrentPost, getEditedPostAttribute } =
|
|
104
|
+
select( editorStore );
|
|
105
|
+
const { getEntityRecords, getTaxonomy, hasFinishedResolution } =
|
|
106
|
+
select( coreStore );
|
|
111
107
|
const post = getCurrentPost();
|
|
112
108
|
const _taxonomy = getTaxonomy( slug );
|
|
113
109
|
const _termIds = _taxonomy
|
|
@@ -177,7 +173,7 @@ function FlatTermSelector( { slug } ) {
|
|
|
177
173
|
// while core data makes REST API requests.
|
|
178
174
|
useEffect( () => {
|
|
179
175
|
if ( hasResolvedTerms ) {
|
|
180
|
-
const newValues = terms.map( ( term ) =>
|
|
176
|
+
const newValues = ( terms ?? [] ).map( ( term ) =>
|
|
181
177
|
unescapeString( term.name )
|
|
182
178
|
);
|
|
183
179
|
|
|
@@ -202,7 +198,10 @@ function FlatTermSelector( { slug } ) {
|
|
|
202
198
|
}
|
|
203
199
|
|
|
204
200
|
function onChange( termNames ) {
|
|
205
|
-
const availableTerms = [
|
|
201
|
+
const availableTerms = [
|
|
202
|
+
...( terms ?? [] ),
|
|
203
|
+
...( searchResults ?? [] ),
|
|
204
|
+
];
|
|
206
205
|
const uniqueTerms = uniqBy( termNames, ( term ) => term.toLowerCase() );
|
|
207
206
|
const newTermNames = uniqueTerms.filter(
|
|
208
207
|
( termName ) =>
|
|
@@ -173,12 +173,10 @@ function HierarchicalTermSelector( { slug } ) {
|
|
|
173
173
|
taxonomy,
|
|
174
174
|
} = useSelect(
|
|
175
175
|
( select ) => {
|
|
176
|
-
const { getCurrentPost, getEditedPostAttribute } =
|
|
177
|
-
editorStore
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
coreStore
|
|
181
|
-
);
|
|
176
|
+
const { getCurrentPost, getEditedPostAttribute } =
|
|
177
|
+
select( editorStore );
|
|
178
|
+
const { getTaxonomy, getEntityRecords, isResolving } =
|
|
179
|
+
select( coreStore );
|
|
182
180
|
const _taxonomy = getTaxonomy( slug );
|
|
183
181
|
|
|
184
182
|
return {
|
|
@@ -51,6 +51,7 @@ export default function PostTextEditor() {
|
|
|
51
51
|
editPost( { content: newValue } );
|
|
52
52
|
setValue( newValue );
|
|
53
53
|
setIsDirty( true );
|
|
54
|
+
valueRef.current = newValue;
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
/**
|
|
@@ -66,15 +67,13 @@ export default function PostTextEditor() {
|
|
|
66
67
|
}
|
|
67
68
|
};
|
|
68
69
|
|
|
69
|
-
useEffect( () => {
|
|
70
|
-
valueRef.current = value;
|
|
71
|
-
}, [ value ] );
|
|
72
|
-
|
|
73
70
|
// Ensure changes aren't lost when component unmounts.
|
|
74
71
|
useEffect( () => {
|
|
75
72
|
return () => {
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
if ( valueRef.current ) {
|
|
74
|
+
const blocks = parse( valueRef.current );
|
|
75
|
+
resetEditorBlocks( blocks );
|
|
76
|
+
}
|
|
78
77
|
};
|
|
79
78
|
}, [] );
|
|
80
79
|
|
|
@@ -37,37 +37,27 @@ function PostTitle( _, forwardedRef ) {
|
|
|
37
37
|
const ref = useRef();
|
|
38
38
|
const [ isSelected, setIsSelected ] = useState( false );
|
|
39
39
|
const { editPost } = useDispatch( editorStore );
|
|
40
|
-
const {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} = getSettings();
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
isCleanNewPost: _isCleanNewPost(),
|
|
65
|
-
title: getEditedPostAttribute( 'title' ),
|
|
66
|
-
placeholder: titlePlaceholder,
|
|
67
|
-
isFocusMode: focusMode,
|
|
68
|
-
hasFixedToolbar: _hasFixedToolbar,
|
|
69
|
-
};
|
|
70
|
-
}, [] );
|
|
40
|
+
const { insertDefaultBlock, clearSelectedBlock, insertBlocks } =
|
|
41
|
+
useDispatch( blockEditorStore );
|
|
42
|
+
const { isCleanNewPost, title, placeholder, isFocusMode, hasFixedToolbar } =
|
|
43
|
+
useSelect( ( select ) => {
|
|
44
|
+
const { getEditedPostAttribute, isCleanNewPost: _isCleanNewPost } =
|
|
45
|
+
select( editorStore );
|
|
46
|
+
const { getSettings } = select( blockEditorStore );
|
|
47
|
+
const {
|
|
48
|
+
titlePlaceholder,
|
|
49
|
+
focusMode,
|
|
50
|
+
hasFixedToolbar: _hasFixedToolbar,
|
|
51
|
+
} = getSettings();
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
isCleanNewPost: _isCleanNewPost(),
|
|
55
|
+
title: getEditedPostAttribute( 'title' ),
|
|
56
|
+
placeholder: titlePlaceholder,
|
|
57
|
+
isFocusMode: focusMode,
|
|
58
|
+
hasFixedToolbar: _hasFixedToolbar,
|
|
59
|
+
};
|
|
60
|
+
}, [] );
|
|
71
61
|
|
|
72
62
|
useImperativeHandle( forwardedRef, () => ( {
|
|
73
63
|
focus: () => {
|
|
@@ -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( {
|
|
@@ -71,19 +69,15 @@ export default function PostVisibility( { onClose } ) {
|
|
|
71
69
|
|
|
72
70
|
return (
|
|
73
71
|
<>
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
onClick={ onClose }
|
|
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"
|
|
@@ -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(),
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import memize from 'memize';
|
|
5
|
+
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* WordPress dependencies
|
|
@@ -129,9 +130,8 @@ class NativeEditorProvider extends Component {
|
|
|
129
130
|
const blockName = 'core/' + payload.mediaType;
|
|
130
131
|
const newBlock = createBlock( blockName, {
|
|
131
132
|
id: payload.mediaId,
|
|
132
|
-
[ payload.mediaType === 'image'
|
|
133
|
-
|
|
134
|
-
: 'src' ]: payload.mediaUrl,
|
|
133
|
+
[ payload.mediaType === 'image' ? 'url' : 'src' ]:
|
|
134
|
+
payload.mediaUrl,
|
|
135
135
|
} );
|
|
136
136
|
|
|
137
137
|
const indexAfterSelected = this.props.selectedBlockIndex + 1;
|
|
@@ -142,14 +142,16 @@ class NativeEditorProvider extends Component {
|
|
|
142
142
|
}
|
|
143
143
|
);
|
|
144
144
|
|
|
145
|
-
this.subscriptionParentUpdateEditorSettings =
|
|
146
|
-
(
|
|
147
|
-
|
|
148
|
-
|
|
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 ) );
|
|
149
153
|
}
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
);
|
|
154
|
+
);
|
|
153
155
|
|
|
154
156
|
this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(
|
|
155
157
|
( payload ) => {
|
|
@@ -333,7 +335,7 @@ class NativeEditorProvider extends Component {
|
|
|
333
335
|
settings={ editorSettings }
|
|
334
336
|
{ ...props }
|
|
335
337
|
>
|
|
336
|
-
{ children }
|
|
338
|
+
<SafeAreaProvider>{ children }</SafeAreaProvider>
|
|
337
339
|
</EditorProvider>
|
|
338
340
|
<EditorHelpTopics
|
|
339
341
|
isVisible={ this.state.isHelpVisible }
|
|
@@ -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,29 +52,41 @@ 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
|
};
|
|
62
59
|
}, [] );
|
|
63
60
|
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
const settingsBlockPatterns =
|
|
62
|
+
settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
|
|
63
|
+
settings.__experimentalBlockPatterns; // WP 5.9
|
|
64
|
+
const settingsBlockPatternCategories =
|
|
65
|
+
settings.__experimentalAdditionalBlockPatternCategories ?? // WP 6.0
|
|
66
|
+
settings.__experimentalBlockPatternCategories; // WP 5.9
|
|
68
67
|
|
|
69
|
-
const {
|
|
68
|
+
const { restBlockPatterns, restBlockPatternCategories } = useSelect(
|
|
70
69
|
( select ) => ( {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
blockPatternCategories:
|
|
74
|
-
settingsBlockPatternCategories ??
|
|
70
|
+
restBlockPatterns: select( coreStore ).getBlockPatterns(),
|
|
71
|
+
restBlockPatternCategories:
|
|
75
72
|
select( coreStore ).getBlockPatternCategories(),
|
|
76
73
|
} ),
|
|
77
|
-
[
|
|
74
|
+
[]
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const blockPatterns = useMemo(
|
|
78
|
+
() => unionBy( settingsBlockPatterns, restBlockPatterns, 'name' ),
|
|
79
|
+
[ settingsBlockPatterns, restBlockPatterns ]
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const blockPatternCategories = useMemo(
|
|
83
|
+
() =>
|
|
84
|
+
unionBy(
|
|
85
|
+
settingsBlockPatternCategories,
|
|
86
|
+
restBlockPatternCategories,
|
|
87
|
+
'name'
|
|
88
|
+
),
|
|
89
|
+
[ settingsBlockPatternCategories, restBlockPatternCategories ]
|
|
78
90
|
);
|
|
79
91
|
|
|
80
92
|
const { undo } = useDispatch( editorStore );
|
|
@@ -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;
|