@wordpress/editor 14.24.0 → 14.26.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/build/components/post-author/combobox.js +1 -10
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +11 -2
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +5 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/hooks/media-upload.js +21 -1
- package/build/hooks/media-upload.js.map +1 -1
- package/build/store/selectors.js +20 -0
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +13 -0
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/components/post-author/combobox.js +1 -10
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +12 -3
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +6 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/hooks/media-upload.js +21 -1
- package/build-module/hooks/media-upload.js.map +1 -1
- package/build-module/store/selectors.js +20 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +13 -0
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-types/components/post-author/combobox.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +20 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/components/post-author/combobox.js +1 -10
- package/src/components/post-publish-panel/maybe-tags-panel.js +16 -4
- package/src/components/post-taxonomies/hierarchical-term-selector.js +7 -3
- package/src/hooks/media-upload.js +14 -1
- package/src/store/selectors.js +20 -0
- package/src/utils/media-upload/index.js +17 -0
- package/tsconfig.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.26.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -34,41 +34,41 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "7.25.7",
|
|
37
|
-
"@wordpress/a11y": "^4.
|
|
38
|
-
"@wordpress/api-fetch": "^7.
|
|
39
|
-
"@wordpress/blob": "^4.
|
|
40
|
-
"@wordpress/block-editor": "^14.
|
|
41
|
-
"@wordpress/blocks": "^14.
|
|
42
|
-
"@wordpress/commands": "^1.
|
|
43
|
-
"@wordpress/components": "^29.
|
|
44
|
-
"@wordpress/compose": "^7.
|
|
45
|
-
"@wordpress/core-data": "^7.
|
|
46
|
-
"@wordpress/data": "^10.
|
|
47
|
-
"@wordpress/dataviews": "^4.
|
|
48
|
-
"@wordpress/date": "^5.
|
|
49
|
-
"@wordpress/deprecated": "^4.
|
|
50
|
-
"@wordpress/dom": "^4.
|
|
51
|
-
"@wordpress/element": "^6.
|
|
52
|
-
"@wordpress/fields": "^0.
|
|
53
|
-
"@wordpress/hooks": "^4.
|
|
54
|
-
"@wordpress/html-entities": "^4.
|
|
55
|
-
"@wordpress/i18n": "^5.
|
|
56
|
-
"@wordpress/icons": "^10.
|
|
57
|
-
"@wordpress/interface": "^9.
|
|
58
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/media-utils": "^5.
|
|
61
|
-
"@wordpress/notices": "^5.
|
|
62
|
-
"@wordpress/patterns": "^2.
|
|
63
|
-
"@wordpress/plugins": "^7.
|
|
64
|
-
"@wordpress/preferences": "^4.
|
|
65
|
-
"@wordpress/private-apis": "^1.
|
|
66
|
-
"@wordpress/reusable-blocks": "^5.
|
|
67
|
-
"@wordpress/rich-text": "^7.
|
|
68
|
-
"@wordpress/server-side-render": "^6.
|
|
69
|
-
"@wordpress/url": "^4.
|
|
70
|
-
"@wordpress/warning": "^3.
|
|
71
|
-
"@wordpress/wordcount": "^4.
|
|
37
|
+
"@wordpress/a11y": "^4.26.0",
|
|
38
|
+
"@wordpress/api-fetch": "^7.26.0",
|
|
39
|
+
"@wordpress/blob": "^4.26.0",
|
|
40
|
+
"@wordpress/block-editor": "^14.21.0",
|
|
41
|
+
"@wordpress/blocks": "^14.15.0",
|
|
42
|
+
"@wordpress/commands": "^1.26.0",
|
|
43
|
+
"@wordpress/components": "^29.12.0",
|
|
44
|
+
"@wordpress/compose": "^7.26.0",
|
|
45
|
+
"@wordpress/core-data": "^7.26.0",
|
|
46
|
+
"@wordpress/data": "^10.26.0",
|
|
47
|
+
"@wordpress/dataviews": "^4.22.0",
|
|
48
|
+
"@wordpress/date": "^5.26.0",
|
|
49
|
+
"@wordpress/deprecated": "^4.26.0",
|
|
50
|
+
"@wordpress/dom": "^4.26.0",
|
|
51
|
+
"@wordpress/element": "^6.26.0",
|
|
52
|
+
"@wordpress/fields": "^0.18.0",
|
|
53
|
+
"@wordpress/hooks": "^4.26.0",
|
|
54
|
+
"@wordpress/html-entities": "^4.26.0",
|
|
55
|
+
"@wordpress/i18n": "^5.26.0",
|
|
56
|
+
"@wordpress/icons": "^10.26.0",
|
|
57
|
+
"@wordpress/interface": "^9.11.0",
|
|
58
|
+
"@wordpress/keyboard-shortcuts": "^5.26.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.26.0",
|
|
60
|
+
"@wordpress/media-utils": "^5.26.0",
|
|
61
|
+
"@wordpress/notices": "^5.26.0",
|
|
62
|
+
"@wordpress/patterns": "^2.26.0",
|
|
63
|
+
"@wordpress/plugins": "^7.26.0",
|
|
64
|
+
"@wordpress/preferences": "^4.26.0",
|
|
65
|
+
"@wordpress/private-apis": "^1.26.0",
|
|
66
|
+
"@wordpress/reusable-blocks": "^5.26.0",
|
|
67
|
+
"@wordpress/rich-text": "^7.26.0",
|
|
68
|
+
"@wordpress/server-side-render": "^6.2.0",
|
|
69
|
+
"@wordpress/url": "^4.26.0",
|
|
70
|
+
"@wordpress/warning": "^3.26.0",
|
|
71
|
+
"@wordpress/wordcount": "^4.26.0",
|
|
72
72
|
"change-case": "^4.1.2",
|
|
73
73
|
"client-zip": "^2.4.5",
|
|
74
74
|
"clsx": "^2.1.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "35e26942820d8237771af0c58e45b4303f0497f1"
|
|
92
92
|
}
|
|
@@ -32,15 +32,6 @@ export default function PostAuthorCombobox() {
|
|
|
32
32
|
editPost( { author: postAuthorId } );
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
/**
|
|
36
|
-
* Handle user input.
|
|
37
|
-
*
|
|
38
|
-
* @param {string} inputValue The current value of the input field.
|
|
39
|
-
*/
|
|
40
|
-
const handleKeydown = ( inputValue ) => {
|
|
41
|
-
setFieldValue( inputValue );
|
|
42
|
-
};
|
|
43
|
-
|
|
44
35
|
return (
|
|
45
36
|
<ComboboxControl
|
|
46
37
|
__nextHasNoMarginBottom
|
|
@@ -48,7 +39,7 @@ export default function PostAuthorCombobox() {
|
|
|
48
39
|
label={ __( 'Author' ) }
|
|
49
40
|
options={ authorOptions }
|
|
50
41
|
value={ authorId }
|
|
51
|
-
onFilterValueChange={ debounce(
|
|
42
|
+
onFilterValueChange={ debounce( setFieldValue, 300 ) }
|
|
52
43
|
onChange={ handleSelect }
|
|
53
44
|
allowReset={ false }
|
|
54
45
|
hideLabelFromVision
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { useState } from '@wordpress/element';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
7
|
import { PanelBody } from '@wordpress/components';
|
|
@@ -14,18 +14,30 @@ import FlatTermSelector from '../post-taxonomies/flat-term-selector';
|
|
|
14
14
|
import { store as editorStore } from '../../store';
|
|
15
15
|
|
|
16
16
|
const TagsPanel = () => {
|
|
17
|
+
const tagLabels = useSelect( ( select ) => {
|
|
18
|
+
const taxonomy = select( coreStore ).getTaxonomy( 'post_tag' );
|
|
19
|
+
return taxonomy?.labels;
|
|
20
|
+
}, [] );
|
|
21
|
+
|
|
22
|
+
const addNewItem = tagLabels?.add_new_item ?? __( 'Add tag' );
|
|
23
|
+
const tagLabel = tagLabels?.name ?? __( 'Tags' );
|
|
24
|
+
|
|
17
25
|
const panelBodyTitle = [
|
|
18
26
|
__( 'Suggestion:' ),
|
|
19
27
|
<span className="editor-post-publish-panel__link" key="label">
|
|
20
|
-
{
|
|
28
|
+
{ addNewItem }
|
|
21
29
|
</span>,
|
|
22
30
|
];
|
|
23
31
|
|
|
24
32
|
return (
|
|
25
33
|
<PanelBody initialOpen={ false } title={ panelBodyTitle }>
|
|
26
34
|
<p>
|
|
27
|
-
{
|
|
28
|
-
|
|
35
|
+
{ sprintf(
|
|
36
|
+
// translators: %s is the taxonomy name (e.g., "Tags").
|
|
37
|
+
__(
|
|
38
|
+
'%s help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'
|
|
39
|
+
),
|
|
40
|
+
tagLabel
|
|
29
41
|
) }
|
|
30
42
|
</p>
|
|
31
43
|
<FlatTermSelector slug="post_tag" __nextHasNoMarginBottom />
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
Flex,
|
|
14
14
|
FlexItem,
|
|
15
15
|
SearchControl,
|
|
16
|
+
privateApis as componentsPrivateApis,
|
|
16
17
|
} from '@wordpress/components';
|
|
17
18
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
18
19
|
import { useDebounce } from '@wordpress/compose';
|
|
@@ -25,6 +26,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
25
26
|
*/
|
|
26
27
|
import { buildTermsTree } from '../../utils/terms';
|
|
27
28
|
import { store as editorStore } from '../../store';
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
28
30
|
|
|
29
31
|
/**
|
|
30
32
|
* Module Constants
|
|
@@ -36,11 +38,11 @@ const DEFAULT_QUERY = {
|
|
|
36
38
|
_fields: 'id,name,parent',
|
|
37
39
|
context: 'view',
|
|
38
40
|
};
|
|
39
|
-
|
|
40
41
|
const MIN_TERMS_COUNT_FOR_FILTER = 8;
|
|
41
|
-
|
|
42
42
|
const EMPTY_ARRAY = [];
|
|
43
43
|
|
|
44
|
+
const { normalizeTextString } = unlock( componentsPrivateApis );
|
|
45
|
+
|
|
44
46
|
/**
|
|
45
47
|
* Sort Terms by Selected.
|
|
46
48
|
*
|
|
@@ -132,7 +134,9 @@ export function getFilterMatcher( filterValue ) {
|
|
|
132
134
|
// (i.e. some child matched at some point in the tree) then return it.
|
|
133
135
|
if (
|
|
134
136
|
-1 !==
|
|
135
|
-
term.name
|
|
137
|
+
normalizeTextString( term.name ).indexOf(
|
|
138
|
+
normalizeTextString( filterValue )
|
|
139
|
+
) ||
|
|
136
140
|
term.children.length > 0
|
|
137
141
|
) {
|
|
138
142
|
return term;
|
|
@@ -3,9 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { addFilter } from '@wordpress/hooks';
|
|
5
5
|
import { MediaUpload } from '@wordpress/media-utils';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
|
|
9
|
+
function MediaUploadWithCacheInvalidation( props ) {
|
|
10
|
+
const { invalidateResolutionForStoreSelector } = useDispatch( coreStore );
|
|
11
|
+
const { onClose: originalOnClose, ...rest } = props;
|
|
12
|
+
|
|
13
|
+
const onClose = ( ...onCloseArgs ) => {
|
|
14
|
+
invalidateResolutionForStoreSelector( 'getMediaItems' );
|
|
15
|
+
originalOnClose?.( ...onCloseArgs );
|
|
16
|
+
};
|
|
17
|
+
return <MediaUpload onClose={ onClose } { ...rest } />;
|
|
18
|
+
}
|
|
6
19
|
|
|
7
20
|
addFilter(
|
|
8
21
|
'editor.MediaUpload',
|
|
9
22
|
'core/editor/components/media-upload',
|
|
10
|
-
() =>
|
|
23
|
+
() => MediaUploadWithCacheInvalidation
|
|
11
24
|
);
|
package/src/store/selectors.js
CHANGED
|
@@ -1053,6 +1053,26 @@ export function isPostLocked( state ) {
|
|
|
1053
1053
|
*
|
|
1054
1054
|
* @param {Object} state Global application state.
|
|
1055
1055
|
*
|
|
1056
|
+
* @example
|
|
1057
|
+
* ```jsx
|
|
1058
|
+
* import { __ } from '@wordpress/i18n';
|
|
1059
|
+
* import { store as editorStore } from '@wordpress/editor';
|
|
1060
|
+
* import { useSelect } from '@wordpress/data';
|
|
1061
|
+
*
|
|
1062
|
+
* const ExampleComponent = () => {
|
|
1063
|
+
* const isSavingLocked = useSelect(
|
|
1064
|
+
* ( select ) => select( editorStore ).isPostSavingLocked(),
|
|
1065
|
+
* []
|
|
1066
|
+
* );
|
|
1067
|
+
*
|
|
1068
|
+
* return isSavingLocked ? (
|
|
1069
|
+
* <p>{ __( 'Post saving is locked' ) }</p>
|
|
1070
|
+
* ) : (
|
|
1071
|
+
* <p>{ __( 'Post saving is not locked' ) }</p>
|
|
1072
|
+
* );
|
|
1073
|
+
* };
|
|
1074
|
+
* ```
|
|
1075
|
+
*
|
|
1056
1076
|
* @return {boolean} Is locked.
|
|
1057
1077
|
*/
|
|
1058
1078
|
export function isPostSavingLocked( state ) {
|
|
@@ -7,6 +7,7 @@ import { v4 as uuid } from 'uuid';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { select, dispatch } from '@wordpress/data';
|
|
10
|
+
import { store as coreDataStore } from '@wordpress/core-data';
|
|
10
11
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -40,6 +41,7 @@ export default function mediaUpload( {
|
|
|
40
41
|
onSuccess,
|
|
41
42
|
multiple = true,
|
|
42
43
|
} ) {
|
|
44
|
+
const { receiveEntityRecords } = dispatch( coreDataStore );
|
|
43
45
|
const { getCurrentPost, getEditorSettings } = select( editorStore );
|
|
44
46
|
const {
|
|
45
47
|
lockPostAutosaving,
|
|
@@ -82,6 +84,21 @@ export default function mediaUpload( {
|
|
|
82
84
|
clearSaveLock();
|
|
83
85
|
}
|
|
84
86
|
onFileChange?.( file );
|
|
87
|
+
|
|
88
|
+
// Files are initially received by `onFileChange` as a blob.
|
|
89
|
+
// After that the function is called a second time with the file as an entity.
|
|
90
|
+
// For core-data, we only care about receiving/invalidating entities.
|
|
91
|
+
const entityFiles = file.filter( ( _file ) => _file?.id );
|
|
92
|
+
if ( entityFiles?.length ) {
|
|
93
|
+
const invalidateCache = true;
|
|
94
|
+
receiveEntityRecords(
|
|
95
|
+
'root',
|
|
96
|
+
'media',
|
|
97
|
+
entityFiles,
|
|
98
|
+
undefined,
|
|
99
|
+
invalidateCache
|
|
100
|
+
);
|
|
101
|
+
}
|
|
85
102
|
},
|
|
86
103
|
onSuccess,
|
|
87
104
|
additionalData: {
|