@wordpress/editor 13.1.0 → 13.3.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 +4 -0
- package/LICENSE.md +1 -1
- package/build/components/error-boundary/index.js +24 -30
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/media-categories/index.js +237 -0
- package/build/components/media-categories/index.js.map +1 -0
- 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 +1 -0
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-format/index.js +1 -0
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +1 -0
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-slug/index.js +1 -0
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +7 -3
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-template/index.js +8 -4
- package/build/components/post-template/index.js.map +1 -1
- package/build/components/post-url/index.js +1 -0
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/provider/index.js +26 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +21 -14
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +7 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +1 -2
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/table-of-contents/index.js +3 -1
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/experiments.js +20 -0
- package/build/experiments.js.map +1 -0
- package/build/hooks/custom-sources-backwards-compatibility.js +16 -8
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js +2 -7
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +14 -0
- package/build/index.native.js.map +1 -1
- package/build/lockUnlock.js +19 -0
- package/build/lockUnlock.js.map +1 -0
- package/build/store/defaults.js +1 -2
- package/build/store/defaults.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/terms.js +9 -5
- package/build/utils/terms.js.map +1 -1
- package/build-module/components/error-boundary/index.js +24 -30
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/media-categories/index.js +225 -0
- package/build-module/components/media-categories/index.js.map +1 -0
- 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 +1 -0
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -0
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +1 -0
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -0
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +8 -5
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-template/index.js +9 -5
- package/build-module/components/post-template/index.js.map +1 -1
- package/build-module/components/post-url/index.js +1 -0
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/provider/index.js +21 -9
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +20 -12
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +5 -5
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +1 -2
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +3 -1
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/experiments.js +10 -0
- package/build-module/experiments.js.map +1 -0
- package/build-module/hooks/custom-sources-backwards-compatibility.js +17 -9
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js +2 -6
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +1 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/lockUnlock.js +9 -0
- package/build-module/lockUnlock.js.map +1 -0
- package/build-module/store/defaults.js +1 -2
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/selectors.js +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/terms.js +9 -6
- package/build-module/utils/terms.js.map +1 -1
- package/build-style/style-rtl.css +0 -3
- package/build-style/style.css +0 -3
- package/package.json +30 -29
- package/src/components/autosave-monitor/test/index.js +8 -2
- package/src/components/editor-help/test/index.native.js +5 -5
- package/src/components/error-boundary/index.js +24 -37
- package/src/components/media-categories/index.js +247 -0
- package/src/components/page-attributes/parent.js +2 -2
- package/src/components/page-attributes/test/order.js +4 -14
- package/src/components/post-author/select.js +1 -0
- package/src/components/post-format/index.js +1 -0
- package/src/components/post-preview-button/test/index.js +5 -17
- package/src/components/post-publish-button/test/index.js +5 -17
- package/src/components/post-publish-panel/postpublish.js +1 -0
- package/src/components/post-publish-panel/style.scss +1 -5
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +2 -18
- package/src/components/post-saved-state/test/index.js +1 -5
- package/src/components/post-slug/index.js +1 -0
- package/src/components/post-taxonomies/hierarchical-term-selector.js +23 -17
- package/src/components/post-template/index.js +4 -4
- package/src/components/post-url/index.js +1 -0
- package/src/components/provider/index.js +120 -91
- package/src/components/provider/index.native.js +26 -17
- package/src/components/provider/use-block-editor-settings.js +60 -49
- package/src/components/provider/use-block-editor-settings.native.js +1 -2
- package/src/components/table-of-contents/index.js +3 -1
- package/src/components/unsaved-changes-warning/index.js +1 -1
- package/src/experiments.js +10 -0
- package/src/hooks/custom-sources-backwards-compatibility.js +16 -13
- package/src/hooks/default-autocompleters.js +1 -6
- package/src/index.js +1 -0
- package/src/index.native.js +1 -0
- package/src/lockUnlock.js +9 -0
- package/src/store/defaults.js +0 -1
- package/src/store/selectors.js +1 -1
- package/src/utils/terms.js +8 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { mapValues, isEmpty } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -70,18 +70,17 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
|
|
|
70
70
|
attributes={ mergedAttributes }
|
|
71
71
|
setAttributes={ ( nextAttributes ) => {
|
|
72
72
|
const nextMeta = Object.fromEntries(
|
|
73
|
-
Object.entries(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
( value, key ) => metaAttributes[ key ]
|
|
73
|
+
Object.entries( nextAttributes ?? {} )
|
|
74
|
+
.filter(
|
|
75
|
+
// Filter to intersection of keys between the updated
|
|
76
|
+
// attributes and those with an associated meta key.
|
|
77
|
+
( [ key ] ) => key in metaAttributes
|
|
79
78
|
)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
.map( ( [ attributeKey, value ] ) => [
|
|
80
|
+
// Rename the keys to the expected meta key name.
|
|
81
|
+
metaAttributes[ attributeKey ],
|
|
82
|
+
value,
|
|
83
|
+
] )
|
|
85
84
|
);
|
|
86
85
|
|
|
87
86
|
if ( ! isEmpty( nextMeta ) ) {
|
|
@@ -108,7 +107,11 @@ const createWithMetaAttributeSource = ( metaAttributes ) =>
|
|
|
108
107
|
function shimAttributeSource( settings ) {
|
|
109
108
|
/** @type {WPMetaAttributeMapping} */
|
|
110
109
|
const metaAttributes = mapValues(
|
|
111
|
-
|
|
110
|
+
Object.fromEntries(
|
|
111
|
+
Object.entries( settings.attributes ?? {} ).filter(
|
|
112
|
+
( [ , { source } ] ) => source === 'meta'
|
|
113
|
+
)
|
|
114
|
+
),
|
|
112
115
|
'meta'
|
|
113
116
|
);
|
|
114
117
|
if ( ! isEmpty( metaAttributes ) ) {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { clone } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -15,7 +10,7 @@ import { userAutocompleter } from '../components';
|
|
|
15
10
|
|
|
16
11
|
function setDefaultCompleters( completers = [] ) {
|
|
17
12
|
// Provide copies so filters may directly modify them.
|
|
18
|
-
completers.push(
|
|
13
|
+
completers.push( { ...userAutocompleter } );
|
|
19
14
|
|
|
20
15
|
return completers;
|
|
21
16
|
}
|
package/src/index.js
CHANGED
package/src/index.native.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
|
|
5
|
+
export const { lock, unlock } =
|
|
6
|
+
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
7
|
+
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
|
|
8
|
+
'@wordpress/editor'
|
|
9
|
+
);
|
package/src/store/defaults.js
CHANGED
package/src/store/selectors.js
CHANGED
|
@@ -785,7 +785,7 @@ export function isPreviewingPost( state ) {
|
|
|
785
785
|
*
|
|
786
786
|
* @param {Object} state Global application state.
|
|
787
787
|
*
|
|
788
|
-
* @return {string
|
|
788
|
+
* @return {string | undefined} Preview Link.
|
|
789
789
|
*/
|
|
790
790
|
export function getEditedPostPreviewLink( state ) {
|
|
791
791
|
if ( state.saving.pending || isSavingPost( state ) ) {
|
package/src/utils/terms.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { groupBy
|
|
4
|
+
import { groupBy } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* Returns terms in a tree form.
|
|
@@ -39,14 +44,12 @@ export function buildTermsTree( flatTerms ) {
|
|
|
39
44
|
return fillWithChildren( termsByParent[ '0' ] || [] );
|
|
40
45
|
}
|
|
41
46
|
|
|
42
|
-
// Lodash unescape function handles ' but not ' which may be return in some API requests.
|
|
43
47
|
export const unescapeString = ( arg ) => {
|
|
44
|
-
return
|
|
48
|
+
return decodeEntities( arg );
|
|
45
49
|
};
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Returns a term object with name unescaped.
|
|
49
|
-
* The unescape of the name property is done using lodash unescape function.
|
|
50
53
|
*
|
|
51
54
|
* @param {Object} term The term object to unescape.
|
|
52
55
|
*
|
|
@@ -68,5 +71,5 @@ export const unescapeTerm = ( term ) => {
|
|
|
68
71
|
* @return {Object[]} Array of term objects unescaped.
|
|
69
72
|
*/
|
|
70
73
|
export const unescapeTerms = ( terms ) => {
|
|
71
|
-
return
|
|
74
|
+
return ( terms ?? [] ).map( unescapeTerm );
|
|
72
75
|
};
|