@wordpress/editor 12.9.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 +2 -0
- 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/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-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.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-visibility/index.js +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.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +3 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +1 -1
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- 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/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/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-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.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +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.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +4 -2
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +2 -2
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- 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 +0 -16
- package/build-style/style.css +0 -16
- package/package.json +28 -28
- 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/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-slug/index.js +2 -3
- package/src/components/post-sticky/index.js +2 -3
- package/src/components/post-switch-to-draft-button/index.js +2 -5
- package/src/components/post-taxonomies/flat-term-selector.js +4 -8
- package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -6
- package/src/components/post-title/index.js +21 -31
- package/src/components/post-title/index.native.js +10 -16
- package/src/components/post-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 +11 -10
- package/src/components/provider/use-block-editor-settings.js +4 -8
- package/src/components/template-validation-notice/index.js +2 -3
- package/src/components/theme-support-check/index.js +2 -2
- package/src/hooks/custom-sources-backwards-compatibility.js +45 -44
- package/src/store/actions.js +211 -190
- package/src/store/selectors.js +12 -19
- package/src/store/test/selectors.js +2 -3
- package/src/utils/media-upload/index.js +2 -5
|
@@ -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' );
|
|
@@ -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();
|
|
@@ -54,8 +54,8 @@ function useAutosaveNotice() {
|
|
|
54
54
|
( select ) => ( {
|
|
55
55
|
postId: select( editorStore ).getCurrentPostId(),
|
|
56
56
|
isEditedPostNew: select( editorStore ).isEditedPostNew(),
|
|
57
|
-
hasRemoteAutosave:
|
|
58
|
-
.autosave,
|
|
57
|
+
hasRemoteAutosave:
|
|
58
|
+
!! select( editorStore ).getEditorSettings().autosave,
|
|
59
59
|
} ),
|
|
60
60
|
[]
|
|
61
61
|
);
|
|
@@ -124,22 +124,17 @@ function useAutosaveNotice() {
|
|
|
124
124
|
* Custom hook which ejects a local autosave after a successful save occurs.
|
|
125
125
|
*/
|
|
126
126
|
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
|
-
);
|
|
127
|
+
const { postId, isEditedPostNew, isDirty, isAutosaving, didError } =
|
|
128
|
+
useSelect(
|
|
129
|
+
( select ) => ( {
|
|
130
|
+
postId: select( editorStore ).getCurrentPostId(),
|
|
131
|
+
isEditedPostNew: select( editorStore ).isEditedPostNew(),
|
|
132
|
+
isDirty: select( editorStore ).isEditedPostDirty(),
|
|
133
|
+
isAutosaving: select( editorStore ).isAutosavingPost(),
|
|
134
|
+
didError: select( editorStore ).didPostSaveRequestFail(),
|
|
135
|
+
} ),
|
|
136
|
+
[]
|
|
137
|
+
);
|
|
143
138
|
|
|
144
139
|
const lastIsDirty = useRef( isDirty );
|
|
145
140
|
const lastIsAutosaving = useRef( isAutosaving );
|
|
@@ -177,8 +172,8 @@ function LocalAutosaveMonitor() {
|
|
|
177
172
|
|
|
178
173
|
const { localAutosaveInterval } = useSelect(
|
|
179
174
|
( select ) => ( {
|
|
180
|
-
localAutosaveInterval:
|
|
181
|
-
.localAutosaveInterval,
|
|
175
|
+
localAutosaveInterval:
|
|
176
|
+
select( editorStore ).getEditorSettings().localAutosaveInterval,
|
|
182
177
|
} ),
|
|
183
178
|
[]
|
|
184
179
|
);
|
|
@@ -52,12 +52,10 @@ export function PageAttributesParent() {
|
|
|
52
52
|
const [ fieldValue, setFieldValue ] = useState( false );
|
|
53
53
|
const { parentPost, parentPostId, items, postType } = useSelect(
|
|
54
54
|
( select ) => {
|
|
55
|
-
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
56
|
-
coreStore
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
editorStore
|
|
60
|
-
);
|
|
55
|
+
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
56
|
+
select( coreStore );
|
|
57
|
+
const { getCurrentPostId, getEditedPostAttribute } =
|
|
58
|
+
select( editorStore );
|
|
61
59
|
const postTypeSlug = getEditedPostAttribute( 'type' );
|
|
62
60
|
const pageId = getEditedPostAttribute( 'parent' );
|
|
63
61
|
const pType = getPostType( postTypeSlug );
|
|
@@ -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 {
|
|
@@ -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 ) => ( {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get, some } from 'lodash';
|
|
5
5
|
import classnames from 'classnames';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -19,15 +19,16 @@ import { __ } from '@wordpress/i18n';
|
|
|
19
19
|
import PublishButtonLabel from './label';
|
|
20
20
|
import { store as editorStore } from '../../store';
|
|
21
21
|
|
|
22
|
+
const noop = () => {};
|
|
23
|
+
|
|
22
24
|
export class PostPublishButton extends Component {
|
|
23
25
|
constructor( props ) {
|
|
24
26
|
super( props );
|
|
25
27
|
this.buttonNode = createRef();
|
|
26
28
|
|
|
27
29
|
this.createOnClick = this.createOnClick.bind( this );
|
|
28
|
-
this.closeEntitiesSavedStates =
|
|
29
|
-
this
|
|
30
|
-
);
|
|
30
|
+
this.closeEntitiesSavedStates =
|
|
31
|
+
this.closeEntitiesSavedStates.bind( this );
|
|
31
32
|
|
|
32
33
|
this.state = {
|
|
33
34
|
entitiesSavedStatesCallback: false,
|
|
@@ -41,10 +42,8 @@ export class PostPublishButton extends Component {
|
|
|
41
42
|
|
|
42
43
|
createOnClick( callback ) {
|
|
43
44
|
return ( ...args ) => {
|
|
44
|
-
const {
|
|
45
|
-
|
|
46
|
-
setEntitiesSavedStatesCallback,
|
|
47
|
-
} = this.props;
|
|
45
|
+
const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
|
|
46
|
+
this.props;
|
|
48
47
|
// If a post with non-post entities is published, but the user
|
|
49
48
|
// elects to not save changes to the non-post entities, those
|
|
50
49
|
// entities will still be dirty when the Publish button is clicked.
|
|
@@ -167,9 +167,8 @@ export default compose( [
|
|
|
167
167
|
};
|
|
168
168
|
} ),
|
|
169
169
|
withDispatch( ( dispatch, { isPublishSidebarEnabled } ) => {
|
|
170
|
-
const { disablePublishSidebar, enablePublishSidebar } =
|
|
171
|
-
editorStore
|
|
172
|
-
);
|
|
170
|
+
const { disablePublishSidebar, enablePublishSidebar } =
|
|
171
|
+
dispatch( editorStore );
|
|
173
172
|
return {
|
|
174
173
|
onTogglePublishSidebar: () => {
|
|
175
174
|
if ( isPublishSidebarEnabled ) {
|
|
@@ -21,9 +21,8 @@ import { store as editorStore } from '../../store';
|
|
|
21
21
|
function MaybeCategoryPanel() {
|
|
22
22
|
const hasNoCategory = useSelect( ( select ) => {
|
|
23
23
|
const postType = select( editorStore ).getCurrentPostType();
|
|
24
|
-
const categoriesTaxonomy =
|
|
25
|
-
'category'
|
|
26
|
-
);
|
|
24
|
+
const categoriesTaxonomy =
|
|
25
|
+
select( coreStore ).getTaxonomy( 'category' );
|
|
27
26
|
const defaultCategorySlug = 'uncategorized';
|
|
28
27
|
const defaultCategory = select( coreStore ).getEntityRecords(
|
|
29
28
|
'taxonomy',
|
|
@@ -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 ) || {};
|
|
@@ -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 {
|
|
@@ -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
|
|
@@ -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 {
|
|
@@ -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(),
|
|
@@ -130,9 +130,8 @@ class NativeEditorProvider extends Component {
|
|
|
130
130
|
const blockName = 'core/' + payload.mediaType;
|
|
131
131
|
const newBlock = createBlock( blockName, {
|
|
132
132
|
id: payload.mediaId,
|
|
133
|
-
[ payload.mediaType === 'image'
|
|
134
|
-
|
|
135
|
-
: 'src' ]: payload.mediaUrl,
|
|
133
|
+
[ payload.mediaType === 'image' ? 'url' : 'src' ]:
|
|
134
|
+
payload.mediaUrl,
|
|
136
135
|
} );
|
|
137
136
|
|
|
138
137
|
const indexAfterSelected = this.props.selectedBlockIndex + 1;
|
|
@@ -143,14 +142,16 @@ class NativeEditorProvider extends Component {
|
|
|
143
142
|
}
|
|
144
143
|
);
|
|
145
144
|
|
|
146
|
-
this.subscriptionParentUpdateEditorSettings =
|
|
147
|
-
(
|
|
148
|
-
|
|
149
|
-
|
|
145
|
+
this.subscriptionParentUpdateEditorSettings =
|
|
146
|
+
subscribeUpdateEditorSettings(
|
|
147
|
+
( { galleryWithImageBlocks, ...editorSettings } ) => {
|
|
148
|
+
if ( typeof galleryWithImageBlocks === 'boolean' ) {
|
|
149
|
+
window.wp.galleryBlockV2Enabled =
|
|
150
|
+
galleryWithImageBlocks;
|
|
151
|
+
}
|
|
152
|
+
updateSettings( this.getThemeColors( editorSettings ) );
|
|
150
153
|
}
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
+
);
|
|
154
155
|
|
|
155
156
|
this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(
|
|
156
157
|
( payload ) => {
|