@wordpress/editor 12.9.0 → 12.12.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/document-outline/index.js +7 -9
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/editor-help/index.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/error-boundary/index.js +3 -0
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build/components/index.js +61 -9
- 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/order.js +3 -7
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -2
- 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 +5 -8
- 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/label.js +93 -13
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-slug/index.js +8 -13
- 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 +8 -4
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -0
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +3 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-template/index.js +1 -2
- package/build/components/post-template/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-url/check.js +54 -0
- package/build/components/post-url/check.js.map +1 -0
- package/build/components/post-url/index.js +115 -0
- package/build/components/post-url/index.js.map +1 -0
- package/build/components/post-url/label.js +30 -0
- package/build/components/post-url/label.js.map +1 -0
- package/build/components/post-visibility/index.js +10 -11
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +5 -0
- package/build/components/post-visibility/label.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/table-of-contents/panel.js +5 -1
- package/build/components/table-of-contents/panel.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/components/time-to-read/index.js +60 -0
- package/build/components/time-to-read/index.js.map +1 -0
- 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/document-outline/index.js +7 -8
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/editor-help/index.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/error-boundary/index.js +2 -0
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/save-shortcut.js.map +1 -1
- package/build-module/components/index.js +7 -4
- 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/order.js +3 -6
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +3 -3
- 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 +5 -8
- 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/label.js +90 -13
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-slug/index.js +8 -14
- 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 +8 -6
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +1 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +4 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-template/index.js +1 -2
- package/build-module/components/post-template/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-url/check.js +44 -0
- package/build-module/components/post-url/check.js.map +1 -0
- package/build-module/components/post-url/index.js +102 -0
- package/build-module/components/post-url/index.js.map +1 -0
- package/build-module/components/post-url/label.js +18 -0
- package/build-module/components/post-url/label.js.map +1 -0
- 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/post-visibility/label.js +3 -0
- package/build-module/components/post-visibility/label.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/table-of-contents/panel.js +4 -1
- package/build-module/components/table-of-contents/panel.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/components/time-to-read/index.js +50 -0
- package/build-module/components/time-to-read/index.js.map +1 -0
- 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 +3 -3
- 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 +12 -30
- package/build-style/style.css +15 -29
- package/package.json +28 -28
- package/src/components/document-outline/index.js +9 -8
- package/src/components/editor-help/index.native.js +6 -6
- 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/error-boundary/index.js +3 -0
- package/src/components/global-keyboard-shortcuts/save-shortcut.js +2 -3
- package/src/components/index.js +13 -4
- package/src/components/local-autosave-monitor/index.js +39 -38
- package/src/components/page-attributes/order.js +1 -9
- package/src/components/page-attributes/parent.js +6 -10
- 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 +15 -22
- package/src/components/post-format/style.scss +2 -17
- 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/label.js +111 -17
- package/src/components/post-schedule/test/label.js +127 -15
- package/src/components/post-slug/index.js +9 -16
- package/src/components/post-slug/test/index.js +7 -6
- 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 +10 -13
- package/src/components/post-taxonomies/hierarchical-term-selector.js +5 -7
- package/src/components/post-taxonomies/index.js +3 -1
- package/src/components/post-template/index.js +1 -1
- 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-url/check.js +38 -0
- package/src/components/post-url/index.js +122 -0
- package/src/components/post-url/label.js +22 -0
- package/src/components/post-url/style.scss +16 -0
- package/src/components/post-visibility/index.js +11 -17
- package/src/components/post-visibility/label.js +4 -0
- 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/table-of-contents/panel.js +7 -2
- package/src/components/template-validation-notice/index.js +2 -3
- package/src/components/theme-support-check/index.js +2 -2
- package/src/components/time-to-read/index.js +59 -0
- 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 +17 -25
- package/src/store/test/selectors.js +10 -13
- package/src/style.scss +1 -0
- package/src/utils/media-upload/index.js +2 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.12.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,32 +31,32 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^9.
|
|
38
|
-
"@wordpress/blocks": "^11.
|
|
39
|
-
"@wordpress/components": "^19.
|
|
40
|
-
"@wordpress/compose": "^5.
|
|
41
|
-
"@wordpress/core-data": "^4.
|
|
42
|
-
"@wordpress/data": "^6.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/element": "^4.
|
|
46
|
-
"@wordpress/hooks": "^3.
|
|
47
|
-
"@wordpress/html-entities": "^3.
|
|
48
|
-
"@wordpress/i18n": "^4.
|
|
49
|
-
"@wordpress/icons": "^9.
|
|
50
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
51
|
-
"@wordpress/keycodes": "^3.
|
|
52
|
-
"@wordpress/media-utils": "^4.
|
|
53
|
-
"@wordpress/notices": "^3.
|
|
54
|
-
"@wordpress/preferences": "^2.
|
|
55
|
-
"@wordpress/reusable-blocks": "^3.
|
|
56
|
-
"@wordpress/rich-text": "^5.
|
|
57
|
-
"@wordpress/server-side-render": "^3.
|
|
58
|
-
"@wordpress/url": "^3.
|
|
59
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.13.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.10.0",
|
|
36
|
+
"@wordpress/blob": "^3.13.0",
|
|
37
|
+
"@wordpress/block-editor": "^9.5.0",
|
|
38
|
+
"@wordpress/blocks": "^11.12.0",
|
|
39
|
+
"@wordpress/components": "^19.15.0",
|
|
40
|
+
"@wordpress/compose": "^5.11.0",
|
|
41
|
+
"@wordpress/core-data": "^4.11.0",
|
|
42
|
+
"@wordpress/data": "^6.13.0",
|
|
43
|
+
"@wordpress/date": "^4.13.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.13.0",
|
|
45
|
+
"@wordpress/element": "^4.11.0",
|
|
46
|
+
"@wordpress/hooks": "^3.13.0",
|
|
47
|
+
"@wordpress/html-entities": "^3.13.0",
|
|
48
|
+
"@wordpress/i18n": "^4.13.0",
|
|
49
|
+
"@wordpress/icons": "^9.4.0",
|
|
50
|
+
"@wordpress/keyboard-shortcuts": "^3.11.0",
|
|
51
|
+
"@wordpress/keycodes": "^3.13.0",
|
|
52
|
+
"@wordpress/media-utils": "^4.4.0",
|
|
53
|
+
"@wordpress/notices": "^3.13.0",
|
|
54
|
+
"@wordpress/preferences": "^2.5.0",
|
|
55
|
+
"@wordpress/reusable-blocks": "^3.11.0",
|
|
56
|
+
"@wordpress/rich-text": "^5.11.0",
|
|
57
|
+
"@wordpress/server-side-render": "^3.11.0",
|
|
58
|
+
"@wordpress/url": "^3.14.0",
|
|
59
|
+
"@wordpress/wordcount": "^3.13.0",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"lodash": "^4.17.21",
|
|
62
62
|
"memize": "^1.1.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "9d9d33bbdf317a4381b8ca1713e43bb50df653b3"
|
|
74
74
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { countBy, flatMap, get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -50,7 +45,7 @@ const multipleH1Headings = [
|
|
|
50
45
|
* @return {Array} An array of heading blocks enhanced with the properties described above.
|
|
51
46
|
*/
|
|
52
47
|
const computeOutlineHeadings = ( blocks = [] ) => {
|
|
53
|
-
return flatMap(
|
|
48
|
+
return blocks.flatMap( ( block = {} ) => {
|
|
54
49
|
if ( block.name === 'core/heading' ) {
|
|
55
50
|
return {
|
|
56
51
|
...block,
|
|
@@ -83,7 +78,13 @@ export const DocumentOutline = ( {
|
|
|
83
78
|
// Not great but it's the simplest way to locate the title right now.
|
|
84
79
|
const titleNode = document.querySelector( '.editor-post-title__input' );
|
|
85
80
|
const hasTitle = isTitleSupported && title && titleNode;
|
|
86
|
-
const countByLevel =
|
|
81
|
+
const countByLevel = headings.reduce(
|
|
82
|
+
( acc, heading ) => ( {
|
|
83
|
+
...acc,
|
|
84
|
+
[ heading.level ]: ( acc[ heading.level ] || 0 ) + 1,
|
|
85
|
+
} ),
|
|
86
|
+
{}
|
|
87
|
+
);
|
|
87
88
|
const hasMultipleH1 = countByLevel[ 1 ] > 1;
|
|
88
89
|
|
|
89
90
|
return (
|
|
@@ -155,7 +156,7 @@ export default compose(
|
|
|
155
156
|
return {
|
|
156
157
|
title: getEditedPostAttribute( 'title' ),
|
|
157
158
|
blocks: getBlocks(),
|
|
158
|
-
isTitleSupported:
|
|
159
|
+
isTitleSupported: postType?.supports?.title ?? false,
|
|
159
160
|
};
|
|
160
161
|
} )
|
|
161
162
|
)( DocumentOutline );
|
|
@@ -99,9 +99,10 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
99
99
|
</BottomSheet.NavBar>
|
|
100
100
|
<BottomSheetConsumer>
|
|
101
101
|
{ ( { listProps } ) => {
|
|
102
|
-
const contentContainerStyle =
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
const contentContainerStyle =
|
|
103
|
+
StyleSheet.flatten(
|
|
104
|
+
listProps.contentContainerStyle
|
|
105
|
+
);
|
|
105
106
|
return (
|
|
106
107
|
<ScrollView
|
|
107
108
|
{ ...listProps }
|
|
@@ -129,9 +130,8 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
129
130
|
{ label, icon },
|
|
130
131
|
index
|
|
131
132
|
) => {
|
|
132
|
-
const labelSlug =
|
|
133
|
-
label
|
|
134
|
-
);
|
|
133
|
+
const labelSlug =
|
|
134
|
+
kebabCase( label );
|
|
135
135
|
const isLastItem =
|
|
136
136
|
index ===
|
|
137
137
|
HELP_TOPICS.length -
|
|
@@ -57,18 +57,18 @@ export default function EntityRecordItem( {
|
|
|
57
57
|
|
|
58
58
|
const isSelected = useSelect(
|
|
59
59
|
( select ) => {
|
|
60
|
-
const selectedBlockId =
|
|
61
|
-
blockEditorStore
|
|
62
|
-
).getSelectedBlockClientId();
|
|
60
|
+
const selectedBlockId =
|
|
61
|
+
select( blockEditorStore ).getSelectedBlockClientId();
|
|
63
62
|
return selectedBlockId === parentBlockId;
|
|
64
63
|
},
|
|
65
64
|
[ parentBlockId ]
|
|
66
65
|
);
|
|
67
66
|
const isSelectedText = isSelected ? __( 'Selected' ) : __( 'Select' );
|
|
68
67
|
const { selectBlock } = useDispatch( blockEditorStore );
|
|
69
|
-
const selectParentBlock = useCallback(
|
|
70
|
-
parentBlockId,
|
|
71
|
-
|
|
68
|
+
const selectParentBlock = useCallback(
|
|
69
|
+
() => selectBlock( parentBlockId ),
|
|
70
|
+
[ parentBlockId ]
|
|
71
|
+
);
|
|
72
72
|
const selectAndDismiss = useCallback( () => {
|
|
73
73
|
selectBlock( parentBlockId );
|
|
74
74
|
closePanel();
|
|
@@ -39,9 +39,8 @@ const PUBLISH_ON_SAVE_ENTITIES = [
|
|
|
39
39
|
export default function EntitiesSavedStates( { close } ) {
|
|
40
40
|
const saveButtonRef = useRef();
|
|
41
41
|
const { dirtyEntityRecords } = useSelect( ( select ) => {
|
|
42
|
-
const dirtyRecords =
|
|
43
|
-
coreStore
|
|
44
|
-
).__experimentalGetDirtyEntityRecords();
|
|
42
|
+
const dirtyRecords =
|
|
43
|
+
select( coreStore ).__experimentalGetDirtyEntityRecords();
|
|
45
44
|
|
|
46
45
|
// Remove site object and decouple into its edited pieces.
|
|
47
46
|
const dirtyRecordsWithoutSite = dirtyRecords.filter(
|
|
@@ -77,13 +76,11 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
77
76
|
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
78
77
|
} = useDispatch( coreStore );
|
|
79
78
|
|
|
80
|
-
const { __unstableMarkLastChangeAsPersistent } =
|
|
81
|
-
blockEditorStore
|
|
82
|
-
);
|
|
79
|
+
const { __unstableMarkLastChangeAsPersistent } =
|
|
80
|
+
useDispatch( blockEditorStore );
|
|
83
81
|
|
|
84
|
-
const { createSuccessNotice, createErrorNotice } =
|
|
85
|
-
noticesStore
|
|
86
|
-
);
|
|
82
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
83
|
+
useDispatch( noticesStore );
|
|
87
84
|
|
|
88
85
|
// To group entities by type.
|
|
89
86
|
const partitionedSavables = groupBy( dirtyEntityRecords, 'name' );
|
|
@@ -7,6 +7,7 @@ import { Button } from '@wordpress/components';
|
|
|
7
7
|
import { select } from '@wordpress/data';
|
|
8
8
|
import { Warning } from '@wordpress/block-editor';
|
|
9
9
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
10
|
+
import { doAction } from '@wordpress/hooks';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
@@ -36,6 +37,8 @@ class ErrorBoundary extends Component {
|
|
|
36
37
|
|
|
37
38
|
componentDidCatch( error ) {
|
|
38
39
|
this.setState( { error } );
|
|
40
|
+
|
|
41
|
+
doAction( 'editor.ErrorBoundary.errorLogged', error );
|
|
39
42
|
}
|
|
40
43
|
|
|
41
44
|
reboot() {
|
|
@@ -12,9 +12,8 @@ import { store as editorStore } from '../../store';
|
|
|
12
12
|
|
|
13
13
|
function SaveShortcut( { resetBlocksOnSave } ) {
|
|
14
14
|
const { resetEditorBlocks, savePost } = useDispatch( editorStore );
|
|
15
|
-
const { isEditedPostDirty, getPostEdits, isPostSavingLocked } =
|
|
16
|
-
editorStore
|
|
17
|
-
);
|
|
15
|
+
const { isEditedPostDirty, getPostEdits, isPostSavingLocked } =
|
|
16
|
+
useSelect( editorStore );
|
|
18
17
|
|
|
19
18
|
useShortcut( 'core/editor/save', ( event ) => {
|
|
20
19
|
event.preventDefault();
|
package/src/components/index.js
CHANGED
|
@@ -41,23 +41,32 @@ export { default as PostPublishPanel } from './post-publish-panel';
|
|
|
41
41
|
export { default as PostSavedState } from './post-saved-state';
|
|
42
42
|
export { default as PostSchedule } from './post-schedule';
|
|
43
43
|
export { default as PostScheduleCheck } from './post-schedule/check';
|
|
44
|
-
export {
|
|
44
|
+
export {
|
|
45
|
+
default as PostScheduleLabel,
|
|
46
|
+
usePostScheduleLabel,
|
|
47
|
+
} from './post-schedule/label';
|
|
45
48
|
export { default as PostSlug } from './post-slug';
|
|
46
49
|
export { default as PostSlugCheck } from './post-slug/check';
|
|
47
50
|
export { default as PostSticky } from './post-sticky';
|
|
48
51
|
export { default as PostStickyCheck } from './post-sticky/check';
|
|
49
52
|
export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
|
|
50
53
|
export { default as PostTaxonomies } from './post-taxonomies';
|
|
51
|
-
export {
|
|
52
|
-
export {
|
|
54
|
+
export { FlatTermSelector as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
|
|
55
|
+
export { HierarchicalTermSelector as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
|
|
53
56
|
export { default as PostTaxonomiesCheck } from './post-taxonomies/check';
|
|
54
57
|
export { default as PostTextEditor } from './post-text-editor';
|
|
55
58
|
export { default as PostTitle } from './post-title';
|
|
56
59
|
export { default as PostTrash } from './post-trash';
|
|
57
60
|
export { default as PostTrashCheck } from './post-trash/check';
|
|
58
61
|
export { default as PostTypeSupportCheck } from './post-type-support-check';
|
|
62
|
+
export { default as PostURL } from './post-url';
|
|
63
|
+
export { default as PostURLCheck } from './post-url/check';
|
|
64
|
+
export { default as PostURLLabel, usePostURLLabel } from './post-url/label';
|
|
59
65
|
export { default as PostVisibility } from './post-visibility';
|
|
60
|
-
export {
|
|
66
|
+
export {
|
|
67
|
+
default as PostVisibilityLabel,
|
|
68
|
+
usePostVisibilityLabel,
|
|
69
|
+
} from './post-visibility/label';
|
|
61
70
|
export { default as PostVisibilityCheck } from './post-visibility/check';
|
|
62
71
|
export { default as TableOfContents } from './table-of-contents';
|
|
63
72
|
export { default as ThemeSupportCheck } from './theme-support-check';
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { once, uniqueId, omit } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -27,23 +22,30 @@ const requestIdleCallback = window.requestIdleCallback
|
|
|
27
22
|
? window.requestIdleCallback
|
|
28
23
|
: window.requestAnimationFrame;
|
|
29
24
|
|
|
25
|
+
let hasStorageSupport;
|
|
26
|
+
let uniqueId = 0;
|
|
27
|
+
|
|
30
28
|
/**
|
|
31
29
|
* Function which returns true if the current environment supports browser
|
|
32
30
|
* sessionStorage, or false otherwise. The result of this function is cached and
|
|
33
31
|
* reused in subsequent invocations.
|
|
34
32
|
*/
|
|
35
|
-
const hasSessionStorageSupport =
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
33
|
+
const hasSessionStorageSupport = () => {
|
|
34
|
+
if ( typeof hasStorageSupport === 'undefined' ) {
|
|
35
|
+
try {
|
|
36
|
+
// Private Browsing in Safari 10 and earlier will throw an error when
|
|
37
|
+
// attempting to set into sessionStorage. The test here is intentional in
|
|
38
|
+
// causing a thrown error as condition bailing from local autosave.
|
|
39
|
+
window.sessionStorage.setItem( '__wpEditorTestSessionStorage', '' );
|
|
40
|
+
window.sessionStorage.removeItem( '__wpEditorTestSessionStorage' );
|
|
41
|
+
hasStorageSupport = true;
|
|
42
|
+
} catch ( error ) {
|
|
43
|
+
hasStorageSupport = false;
|
|
44
|
+
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
return hasStorageSupport;
|
|
48
|
+
};
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* Custom hook which manages the creation of a notice prompting the user to
|
|
@@ -54,8 +56,8 @@ function useAutosaveNotice() {
|
|
|
54
56
|
( select ) => ( {
|
|
55
57
|
postId: select( editorStore ).getCurrentPostId(),
|
|
56
58
|
isEditedPostNew: select( editorStore ).isEditedPostNew(),
|
|
57
|
-
hasRemoteAutosave:
|
|
58
|
-
.autosave,
|
|
59
|
+
hasRemoteAutosave:
|
|
60
|
+
!! select( editorStore ).getEditorSettings().autosave,
|
|
59
61
|
} ),
|
|
60
62
|
[]
|
|
61
63
|
);
|
|
@@ -98,7 +100,7 @@ function useAutosaveNotice() {
|
|
|
98
100
|
return;
|
|
99
101
|
}
|
|
100
102
|
|
|
101
|
-
const noticeId = uniqueId
|
|
103
|
+
const noticeId = `wpEditorAutosaveRestore${ ++uniqueId }`;
|
|
102
104
|
createWarningNotice(
|
|
103
105
|
__(
|
|
104
106
|
'The backup of this post in your browser is different from the version below.'
|
|
@@ -109,7 +111,11 @@ function useAutosaveNotice() {
|
|
|
109
111
|
{
|
|
110
112
|
label: __( 'Restore the backup' ),
|
|
111
113
|
onClick() {
|
|
112
|
-
|
|
114
|
+
const {
|
|
115
|
+
content: editsContent,
|
|
116
|
+
...editsWithoutContent
|
|
117
|
+
} = edits;
|
|
118
|
+
editPost( editsWithoutContent );
|
|
113
119
|
resetEditorBlocks( parse( edits.content ) );
|
|
114
120
|
removeNotice( noticeId );
|
|
115
121
|
},
|
|
@@ -124,22 +130,17 @@ function useAutosaveNotice() {
|
|
|
124
130
|
* Custom hook which ejects a local autosave after a successful save occurs.
|
|
125
131
|
*/
|
|
126
132
|
function useAutosavePurge() {
|
|
127
|
-
const {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
isAutosaving: select( editorStore ).isAutosavingPost(),
|
|
139
|
-
didError: select( editorStore ).didPostSaveRequestFail(),
|
|
140
|
-
} ),
|
|
141
|
-
[]
|
|
142
|
-
);
|
|
133
|
+
const { postId, isEditedPostNew, isDirty, isAutosaving, didError } =
|
|
134
|
+
useSelect(
|
|
135
|
+
( select ) => ( {
|
|
136
|
+
postId: select( editorStore ).getCurrentPostId(),
|
|
137
|
+
isEditedPostNew: select( editorStore ).isEditedPostNew(),
|
|
138
|
+
isDirty: select( editorStore ).isEditedPostDirty(),
|
|
139
|
+
isAutosaving: select( editorStore ).isAutosavingPost(),
|
|
140
|
+
didError: select( editorStore ).didPostSaveRequestFail(),
|
|
141
|
+
} ),
|
|
142
|
+
[]
|
|
143
|
+
);
|
|
143
144
|
|
|
144
145
|
const lastIsDirty = useRef( isDirty );
|
|
145
146
|
const lastIsAutosaving = useRef( isAutosaving );
|
|
@@ -177,8 +178,8 @@ function LocalAutosaveMonitor() {
|
|
|
177
178
|
|
|
178
179
|
const { localAutosaveInterval } = useSelect(
|
|
179
180
|
( select ) => ( {
|
|
180
|
-
localAutosaveInterval:
|
|
181
|
-
.localAutosaveInterval,
|
|
181
|
+
localAutosaveInterval:
|
|
182
|
+
select( editorStore ).getEditorSettings().localAutosaveInterval,
|
|
182
183
|
} ),
|
|
183
184
|
[]
|
|
184
185
|
);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { invoke } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -24,10 +19,7 @@ export const PageAttributesOrder = ( { onUpdateOrder, order = 0 } ) => {
|
|
|
24
19
|
const setUpdatedOrder = ( value ) => {
|
|
25
20
|
setOrderInput( value );
|
|
26
21
|
const newOrder = Number( value );
|
|
27
|
-
if (
|
|
28
|
-
Number.isInteger( newOrder ) &&
|
|
29
|
-
invoke( value, [ 'trim' ] ) !== ''
|
|
30
|
-
) {
|
|
22
|
+
if ( Number.isInteger( newOrder ) && value.trim?.() !== '' ) {
|
|
31
23
|
onUpdateOrder( Number( value ) );
|
|
32
24
|
}
|
|
33
25
|
};
|
|
@@ -5,9 +5,7 @@ import {
|
|
|
5
5
|
get,
|
|
6
6
|
unescape as unescapeString,
|
|
7
7
|
debounce,
|
|
8
|
-
repeat,
|
|
9
8
|
find,
|
|
10
|
-
flatten,
|
|
11
9
|
deburr,
|
|
12
10
|
} from 'lodash';
|
|
13
11
|
|
|
@@ -52,12 +50,10 @@ export function PageAttributesParent() {
|
|
|
52
50
|
const [ fieldValue, setFieldValue ] = useState( false );
|
|
53
51
|
const { parentPost, parentPostId, items, postType } = useSelect(
|
|
54
52
|
( select ) => {
|
|
55
|
-
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
56
|
-
coreStore
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
editorStore
|
|
60
|
-
);
|
|
53
|
+
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
54
|
+
select( coreStore );
|
|
55
|
+
const { getCurrentPostId, getEditedPostAttribute } =
|
|
56
|
+
select( editorStore );
|
|
61
57
|
const postTypeSlug = getEditedPostAttribute( 'type' );
|
|
62
58
|
const pageId = getEditedPostAttribute( 'parent' );
|
|
63
59
|
const pType = getPostType( postTypeSlug );
|
|
@@ -101,7 +97,7 @@ export function PageAttributesParent() {
|
|
|
101
97
|
{
|
|
102
98
|
value: treeNode.id,
|
|
103
99
|
label:
|
|
104
|
-
|
|
100
|
+
'— '.repeat( level ) + unescapeString( treeNode.name ),
|
|
105
101
|
rawName: treeNode.name,
|
|
106
102
|
},
|
|
107
103
|
...getOptionsFromTree( treeNode.children || [], level + 1 ),
|
|
@@ -113,7 +109,7 @@ export function PageAttributesParent() {
|
|
|
113
109
|
return priorityA >= priorityB ? 1 : -1;
|
|
114
110
|
} );
|
|
115
111
|
|
|
116
|
-
return
|
|
112
|
+
return sortedNodes.flat();
|
|
117
113
|
};
|
|
118
114
|
|
|
119
115
|
let tree = pageItems.map( ( item ) => ( {
|
|
@@ -18,9 +18,8 @@ function PostAuthorSelect() {
|
|
|
18
18
|
const { editPost } = useDispatch( editorStore );
|
|
19
19
|
const { postAuthor, authors } = useSelect( ( select ) => {
|
|
20
20
|
return {
|
|
21
|
-
postAuthor:
|
|
22
|
-
'author'
|
|
23
|
-
),
|
|
21
|
+
postAuthor:
|
|
22
|
+
select( editorStore ).getEditedPostAttribute( 'author' ),
|
|
24
23
|
authors: select( coreStore ).getUsers( AUTHORS_QUERY ),
|
|
25
24
|
};
|
|
26
25
|
}, [] );
|
|
@@ -29,9 +29,10 @@ function PostComments( { commentStatus = 'open', ...props } ) {
|
|
|
29
29
|
export default compose( [
|
|
30
30
|
withSelect( ( select ) => {
|
|
31
31
|
return {
|
|
32
|
-
commentStatus:
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
commentStatus:
|
|
33
|
+
select( editorStore ).getEditedPostAttribute(
|
|
34
|
+
'comment_status'
|
|
35
|
+
),
|
|
35
36
|
};
|
|
36
37
|
} ),
|
|
37
38
|
withDispatch( ( dispatch ) => ( {
|
|
@@ -49,9 +49,8 @@ export default function PostFormat() {
|
|
|
49
49
|
|
|
50
50
|
const { postFormat, suggestedFormat, supportedFormats } = useSelect(
|
|
51
51
|
( select ) => {
|
|
52
|
-
const { getEditedPostAttribute, getSuggestedPostFormat } =
|
|
53
|
-
editorStore
|
|
54
|
-
);
|
|
52
|
+
const { getEditedPostAttribute, getSuggestedPostFormat } =
|
|
53
|
+
select( editorStore );
|
|
55
54
|
const _postFormat = getEditedPostAttribute( 'format' );
|
|
56
55
|
const themeSupports = select( coreStore ).getThemeSupports();
|
|
57
56
|
return {
|
|
@@ -82,24 +81,18 @@ export default function PostFormat() {
|
|
|
82
81
|
return (
|
|
83
82
|
<PostFormatCheck>
|
|
84
83
|
<div className="editor-post-format">
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
id
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
value: format.id,
|
|
96
|
-
} ) ) }
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
84
|
+
<SelectControl
|
|
85
|
+
label={ __( 'Post Format' ) }
|
|
86
|
+
value={ postFormat }
|
|
87
|
+
onChange={ ( format ) => onUpdatePostFormat( format ) }
|
|
88
|
+
id={ postFormatSelectorId }
|
|
89
|
+
options={ formats.map( ( format ) => ( {
|
|
90
|
+
label: format.caption,
|
|
91
|
+
value: format.id,
|
|
92
|
+
} ) ) }
|
|
93
|
+
/>
|
|
100
94
|
{ suggestion && suggestion.id !== postFormat && (
|
|
101
|
-
<
|
|
102
|
-
{ __( 'Suggestion:' ) }{ ' ' }
|
|
95
|
+
<p className="editor-post-format__suggestion">
|
|
103
96
|
<Button
|
|
104
97
|
variant="link"
|
|
105
98
|
onClick={ () =>
|
|
@@ -108,11 +101,11 @@ export default function PostFormat() {
|
|
|
108
101
|
>
|
|
109
102
|
{ sprintf(
|
|
110
103
|
/* translators: %s: post format */
|
|
111
|
-
__( 'Apply format: %s' ),
|
|
104
|
+
__( 'Apply suggested format: %s' ),
|
|
112
105
|
suggestion.caption
|
|
113
106
|
) }
|
|
114
107
|
</Button>
|
|
115
|
-
</
|
|
108
|
+
</p>
|
|
116
109
|
) }
|
|
117
110
|
</div>
|
|
118
111
|
</PostFormatCheck>
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
.editor-post-
|
|
2
|
-
|
|
3
|
-
align-items: stretch;
|
|
4
|
-
width: 100%;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.editor-post-format__content {
|
|
8
|
-
display: inline-flex;
|
|
9
|
-
justify-content: space-between;
|
|
10
|
-
align-items: center;
|
|
11
|
-
width: 100%;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.editor-post-format__suggestion {
|
|
15
|
-
padding: $grid-unit-15 * 0.5;
|
|
16
|
-
text-align: right;
|
|
17
|
-
font-size: $default-font-size;
|
|
1
|
+
[class].editor-post-format__suggestion {
|
|
2
|
+
margin: $grid-unit-05 0 0 0;
|
|
18
3
|
}
|
|
@@ -26,10 +26,8 @@ export function PostLastRevisionCheck( {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export default withSelect( ( select ) => {
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
getCurrentPostRevisionsCount,
|
|
32
|
-
} = select( editorStore );
|
|
29
|
+
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
30
|
+
select( editorStore );
|
|
33
31
|
return {
|
|
34
32
|
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
35
33
|
revisionsCount: getCurrentPostRevisionsCount(),
|
|
@@ -35,10 +35,8 @@ function LastRevision( { lastRevisionId, revisionsCount } ) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export default withSelect( ( select ) => {
|
|
38
|
-
const {
|
|
39
|
-
|
|
40
|
-
getCurrentPostRevisionsCount,
|
|
41
|
-
} = select( editorStore );
|
|
38
|
+
const { getCurrentPostLastRevisionId, getCurrentPostRevisionsCount } =
|
|
39
|
+
select( editorStore );
|
|
42
40
|
return {
|
|
43
41
|
lastRevisionId: getCurrentPostLastRevisionId(),
|
|
44
42
|
revisionsCount: getCurrentPostRevisionsCount(),
|
|
@@ -28,11 +28,8 @@ export function PostPendingStatusCheck( {
|
|
|
28
28
|
|
|
29
29
|
export default compose(
|
|
30
30
|
withSelect( ( select ) => {
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
getCurrentPostType,
|
|
34
|
-
getCurrentPost,
|
|
35
|
-
} = select( editorStore );
|
|
31
|
+
const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
|
|
32
|
+
select( editorStore );
|
|
36
33
|
return {
|
|
37
34
|
hasPublishAction: get(
|
|
38
35
|
getCurrentPost(),
|
|
@@ -29,9 +29,8 @@ function PostPingbacks( { pingStatus = 'open', ...props } ) {
|
|
|
29
29
|
export default compose( [
|
|
30
30
|
withSelect( ( select ) => {
|
|
31
31
|
return {
|
|
32
|
-
pingStatus:
|
|
33
|
-
'ping_status'
|
|
34
|
-
),
|
|
32
|
+
pingStatus:
|
|
33
|
+
select( editorStore ).getEditedPostAttribute( 'ping_status' ),
|
|
35
34
|
};
|
|
36
35
|
} ),
|
|
37
36
|
withDispatch( ( dispatch ) => ( {
|