@wordpress/editor 14.50.0 → 14.51.1-next.v.202607070741.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 +10 -0
- package/build/components/collab-sidebar/format.cjs +83 -0
- package/build/components/collab-sidebar/format.cjs.map +7 -0
- package/build/components/collab-sidebar/hooks.cjs +117 -16
- package/build/components/collab-sidebar/hooks.cjs.map +2 -2
- package/build/components/collab-sidebar/index.cjs +18 -2
- package/build/components/collab-sidebar/index.cjs.map +2 -2
- package/build/components/collab-sidebar/note-highlight-styles.cjs +67 -0
- package/build/components/collab-sidebar/note-highlight-styles.cjs.map +7 -0
- package/build/components/collab-sidebar/utils.cjs +139 -0
- package/build/components/collab-sidebar/utils.cjs.map +2 -2
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs +55 -30
- package/build/components/collaborators-presence/use-collaborator-notifications.cjs.map +2 -2
- package/build/components/commands/index.cjs +99 -3
- package/build/components/commands/index.cjs.map +2 -2
- package/build/components/document-bar/index.cjs +28 -34
- package/build/components/document-bar/index.cjs.map +2 -2
- package/build/components/entities-saved-states/index.cjs +1 -4
- package/build/components/entities-saved-states/index.cjs.map +2 -2
- package/build/components/media-categories/index.cjs +92 -6
- package/build/components/media-categories/index.cjs.map +2 -2
- package/build/components/page-attributes/parent.cjs +0 -1
- package/build/components/page-attributes/parent.cjs.map +2 -2
- package/build/components/post-author/combobox.cjs +0 -1
- package/build/components/post-author/combobox.cjs.map +2 -2
- package/build/components/post-author/select.cjs +0 -1
- package/build/components/post-author/select.cjs.map +2 -2
- package/build/components/post-preview-button/index.cjs +29 -2
- package/build/components/post-preview-button/index.cjs.map +2 -2
- package/build/components/post-publish-panel/maybe-upload-media.cjs +15 -26
- package/build/components/post-publish-panel/maybe-upload-media.cjs.map +3 -3
- package/build/components/post-revisions-preview/revisions-slider.cjs +3 -1
- package/build/components/post-revisions-preview/revisions-slider.cjs.map +2 -2
- package/build/components/post-taxonomies/flat-term-selector.cjs +0 -1
- package/build/components/post-taxonomies/flat-term-selector.cjs.map +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs +0 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.cjs.map +2 -2
- package/build/components/post-template/classic-theme.cjs +0 -1
- package/build/components/post-template/classic-theme.cjs.map +2 -2
- package/build/components/preferences-modal/index.cjs +54 -28
- package/build/components/preferences-modal/index.cjs.map +2 -2
- package/build/components/preview-dropdown/index.cjs +3 -3
- package/build/components/preview-dropdown/index.cjs.map +2 -2
- package/build/components/provider/use-block-editor-settings.cjs +23 -3
- package/build/components/provider/use-block-editor-settings.cjs.map +3 -3
- package/build/components/sidebar/dataform-post-summary.cjs +5 -1
- package/build/components/sidebar/dataform-post-summary.cjs.map +3 -3
- package/build/components/sidebar/index.cjs +29 -38
- package/build/components/sidebar/index.cjs.map +3 -3
- package/build/components/sidebar/post-summary.cjs +0 -13
- package/build/components/sidebar/post-summary.cjs.map +3 -3
- package/build/dataviews/store/private-actions.cjs +24 -19
- package/build/dataviews/store/private-actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +5 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/utils/media-sideload-from-url/index.cjs +63 -0
- package/build/utils/media-sideload-from-url/index.cjs.map +7 -0
- package/build-module/components/collab-sidebar/format.mjs +57 -0
- package/build-module/components/collab-sidebar/format.mjs.map +7 -0
- package/build-module/components/collab-sidebar/hooks.mjs +121 -16
- package/build-module/components/collab-sidebar/hooks.mjs.map +2 -2
- package/build-module/components/collab-sidebar/index.mjs +21 -5
- package/build-module/components/collab-sidebar/index.mjs.map +2 -2
- package/build-module/components/collab-sidebar/note-highlight-styles.mjs +41 -0
- package/build-module/components/collab-sidebar/note-highlight-styles.mjs.map +7 -0
- package/build-module/components/collab-sidebar/utils.mjs +133 -0
- package/build-module/components/collab-sidebar/utils.mjs.map +2 -2
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs +55 -30
- package/build-module/components/collaborators-presence/use-collaborator-notifications.mjs.map +2 -2
- package/build-module/components/commands/index.mjs +99 -3
- package/build-module/components/commands/index.mjs.map +2 -2
- package/build-module/components/document-bar/index.mjs +28 -34
- package/build-module/components/document-bar/index.mjs.map +2 -2
- package/build-module/components/entities-saved-states/index.mjs +1 -4
- package/build-module/components/entities-saved-states/index.mjs.map +2 -2
- package/build-module/components/media-categories/index.mjs +93 -7
- package/build-module/components/media-categories/index.mjs.map +2 -2
- package/build-module/components/page-attributes/parent.mjs +0 -1
- package/build-module/components/page-attributes/parent.mjs.map +2 -2
- package/build-module/components/post-author/combobox.mjs +0 -1
- package/build-module/components/post-author/combobox.mjs.map +2 -2
- package/build-module/components/post-author/select.mjs +0 -1
- package/build-module/components/post-author/select.mjs.map +2 -2
- package/build-module/components/post-preview-button/index.mjs +29 -2
- package/build-module/components/post-preview-button/index.mjs.map +2 -2
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs +19 -27
- package/build-module/components/post-publish-panel/maybe-upload-media.mjs.map +2 -2
- package/build-module/components/post-revisions-preview/revisions-slider.mjs +3 -1
- package/build-module/components/post-revisions-preview/revisions-slider.mjs.map +2 -2
- package/build-module/components/post-taxonomies/flat-term-selector.mjs +0 -1
- package/build-module/components/post-taxonomies/flat-term-selector.mjs.map +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs +0 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.mjs.map +2 -2
- package/build-module/components/post-template/classic-theme.mjs +0 -1
- package/build-module/components/post-template/classic-theme.mjs.map +2 -2
- package/build-module/components/preferences-modal/index.mjs +54 -28
- package/build-module/components/preferences-modal/index.mjs.map +2 -2
- package/build-module/components/preview-dropdown/index.mjs +3 -3
- package/build-module/components/preview-dropdown/index.mjs.map +2 -2
- package/build-module/components/provider/use-block-editor-settings.mjs +23 -3
- package/build-module/components/provider/use-block-editor-settings.mjs.map +2 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs +6 -2
- package/build-module/components/sidebar/dataform-post-summary.mjs.map +2 -2
- package/build-module/components/sidebar/index.mjs +29 -42
- package/build-module/components/sidebar/index.mjs.map +2 -2
- package/build-module/components/sidebar/post-summary.mjs +0 -13
- package/build-module/components/sidebar/post-summary.mjs.map +2 -2
- package/build-module/dataviews/store/private-actions.mjs +26 -19
- package/build-module/dataviews/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +5 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/utils/media-sideload-from-url/index.mjs +32 -0
- package/build-module/utils/media-sideload-from-url/index.mjs.map +7 -0
- package/build-style/style-rtl.css +65 -33
- package/build-style/style.css +65 -33
- package/build-types/components/collab-sidebar/format.d.ts +17 -0
- package/build-types/components/collab-sidebar/format.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/hooks.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/index.d.ts.map +1 -1
- package/build-types/components/collab-sidebar/note-highlight-styles.d.ts +31 -0
- package/build-types/components/collab-sidebar/note-highlight-styles.d.ts.map +1 -0
- package/build-types/components/collab-sidebar/utils.d.ts +82 -2
- package/build-types/components/collab-sidebar/utils.d.ts.map +1 -1
- package/build-types/components/collaborators-presence/use-collaborator-notifications.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/media-categories/index.d.ts +12 -3
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-author/combobox.d.ts.map +1 -1
- package/build-types/components/post-author/select.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-revisions-preview/revisions-slider.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/sidebar/dataform-post-summary.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/media-sideload-from-url/index.d.ts +18 -0
- package/build-types/utils/media-sideload-from-url/index.d.ts.map +1 -0
- package/package.json +48 -46
- package/src/components/collab-sidebar/format.js +72 -0
- package/src/components/collab-sidebar/hooks.js +203 -22
- package/src/components/collab-sidebar/index.js +19 -5
- package/src/components/collab-sidebar/note-highlight-styles.js +83 -0
- package/src/components/collab-sidebar/style.scss +9 -0
- package/src/components/collab-sidebar/test/note-highlight-styles.js +106 -0
- package/src/components/collab-sidebar/test/utils.js +471 -0
- package/src/components/collab-sidebar/utils.js +225 -2
- package/src/components/collaborators-presence/test/use-collaborator-notifications.ts +265 -262
- package/src/components/collaborators-presence/use-collaborator-notifications.ts +70 -34
- package/src/components/commands/index.js +142 -0
- package/src/components/document-bar/index.js +0 -9
- package/src/components/document-bar/style.scss +0 -17
- package/src/components/entities-saved-states/index.js +1 -5
- package/src/components/header/style.scss +7 -3
- package/src/components/media-categories/index.js +160 -6
- package/src/components/media-categories/test/index.js +202 -0
- package/src/components/page-attributes/parent.js +0 -1
- package/src/components/post-author/combobox.js +0 -1
- package/src/components/post-author/select.js +0 -1
- package/src/components/post-preview-button/index.js +68 -2
- package/src/components/post-publish-panel/maybe-upload-media.js +25 -30
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -127
- package/src/components/post-revisions-preview/revisions-slider.js +4 -1
- package/src/components/post-revisions-preview/test/block-diff.js +2 -2
- package/src/components/post-taxonomies/flat-term-selector.js +0 -1
- package/src/components/post-taxonomies/hierarchical-term-selector.js +0 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/preferences-modal/index.js +40 -22
- package/src/components/preferences-modal/test/index.js +83 -0
- package/src/components/preview-dropdown/index.js +3 -3
- package/src/components/provider/use-block-editor-settings.js +42 -1
- package/src/components/sidebar/dataform-post-summary.js +13 -1
- package/src/components/sidebar/index.js +32 -47
- package/src/components/sidebar/post-summary.js +0 -17
- package/src/dataviews/store/private-actions.ts +30 -26
- package/src/store/private-actions.js +6 -2
- package/src/utils/media-sideload-from-url/index.js +54 -0
- package/src/utils/media-sideload-from-url/test/index.js +162 -0
- package/build/components/post-publish-panel/media-util.cjs +0 -72
- package/build/components/post-publish-panel/media-util.cjs.map +0 -7
- package/build-module/components/post-publish-panel/media-util.mjs +0 -46
- package/build-module/components/post-publish-panel/media-util.mjs.map +0 -7
- package/build-types/components/post-publish-panel/media-util.d.ts +0 -20
- package/build-types/components/post-publish-panel/media-util.d.ts.map +0 -1
- package/src/components/post-publish-panel/media-util.js +0 -87
- package/src/components/post-publish-panel/test/media-util.js +0 -118
|
@@ -68,43 +68,75 @@ export function useCollaboratorNotifications(
|
|
|
68
68
|
postId: number | null,
|
|
69
69
|
postType: string | null
|
|
70
70
|
): void {
|
|
71
|
-
const {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
71
|
+
const {
|
|
72
|
+
postStatus,
|
|
73
|
+
isCollaborationEnabled,
|
|
74
|
+
showJoinNotifications,
|
|
75
|
+
showLeaveNotifications,
|
|
76
|
+
showPostSaveNotifications,
|
|
77
|
+
} = useSelect( ( select ) => {
|
|
78
|
+
const {
|
|
79
|
+
getCurrentPostAttribute,
|
|
80
|
+
isCollaborationEnabledForCurrentPost,
|
|
81
|
+
} = unlock( select( editorStore ) );
|
|
82
|
+
// Notification preferences default to enabled when unset.
|
|
83
|
+
const getNotificationPreference = ( name: string ) =>
|
|
84
|
+
select( preferencesStore ).get( 'core', name ) ?? true;
|
|
85
|
+
return {
|
|
86
|
+
postStatus: getCurrentPostAttribute( 'status' ) as
|
|
87
|
+
| string
|
|
88
|
+
| undefined,
|
|
89
|
+
isCollaborationEnabled: isCollaborationEnabledForCurrentPost(),
|
|
90
|
+
showJoinNotifications: getNotificationPreference(
|
|
91
|
+
'showCollaborationJoinNotifications'
|
|
92
|
+
),
|
|
93
|
+
showLeaveNotifications: getNotificationPreference(
|
|
94
|
+
'showCollaborationLeaveNotifications'
|
|
95
|
+
),
|
|
96
|
+
showPostSaveNotifications: getNotificationPreference(
|
|
97
|
+
'showCollaborationPostSaveNotifications'
|
|
98
|
+
),
|
|
99
|
+
};
|
|
100
|
+
}, [] );
|
|
91
101
|
|
|
92
102
|
const { createNotice } = useDispatch( noticesStore );
|
|
93
103
|
|
|
94
|
-
// Pass null when collaboration is disabled or
|
|
104
|
+
// Pass null when collaboration is disabled or a notification type is
|
|
95
105
|
// turned off to prevent the hooks from subscribing to awareness state.
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
const
|
|
106
|
+
const shouldShowJoinNotifications =
|
|
107
|
+
isCollaborationEnabled && showJoinNotifications;
|
|
108
|
+
const shouldShowLeaveNotifications =
|
|
109
|
+
isCollaborationEnabled && showLeaveNotifications;
|
|
110
|
+
const shouldShowPostSaveNotifications =
|
|
111
|
+
isCollaborationEnabled && showPostSaveNotifications;
|
|
112
|
+
// A disabled notification type passes null, which unsubscribes its hook;
|
|
113
|
+
// callback guards handle any events already queued before then.
|
|
114
|
+
const effectiveTarget = (
|
|
115
|
+
shouldShow: boolean
|
|
116
|
+
): [ number | null, string | null ] =>
|
|
117
|
+
shouldShow ? [ postId, postType ] : [ null, null ];
|
|
118
|
+
const [ joinPostId, joinPostType ] = effectiveTarget(
|
|
119
|
+
shouldShowJoinNotifications
|
|
120
|
+
);
|
|
121
|
+
const [ leavePostId, leavePostType ] = effectiveTarget(
|
|
122
|
+
shouldShowLeaveNotifications
|
|
123
|
+
);
|
|
124
|
+
const [ postSavePostId, postSavePostType ] = effectiveTarget(
|
|
125
|
+
shouldShowPostSaveNotifications
|
|
126
|
+
);
|
|
99
127
|
|
|
100
128
|
useOnCollaboratorJoin(
|
|
101
|
-
|
|
102
|
-
|
|
129
|
+
joinPostId,
|
|
130
|
+
joinPostType,
|
|
103
131
|
useCallback(
|
|
104
132
|
(
|
|
105
133
|
collaborator: PostEditorAwarenessState,
|
|
106
134
|
me?: PostEditorAwarenessState
|
|
107
135
|
) => {
|
|
136
|
+
if ( ! shouldShowJoinNotifications ) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
108
140
|
/*
|
|
109
141
|
* Skip collaborators who were present before the current user
|
|
110
142
|
* joined. Their enteredAt is earlier than ours, meaning we're
|
|
@@ -132,15 +164,19 @@ export function useCollaboratorNotifications(
|
|
|
132
164
|
}
|
|
133
165
|
);
|
|
134
166
|
},
|
|
135
|
-
[ createNotice ]
|
|
167
|
+
[ createNotice, shouldShowJoinNotifications ]
|
|
136
168
|
)
|
|
137
169
|
);
|
|
138
170
|
|
|
139
171
|
useOnCollaboratorLeave(
|
|
140
|
-
|
|
141
|
-
|
|
172
|
+
leavePostId,
|
|
173
|
+
leavePostType,
|
|
142
174
|
useCallback(
|
|
143
175
|
( collaborator: PostEditorAwarenessState ) => {
|
|
176
|
+
if ( ! shouldShowLeaveNotifications ) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
144
180
|
void createNotice(
|
|
145
181
|
'info',
|
|
146
182
|
sprintf(
|
|
@@ -155,20 +191,20 @@ export function useCollaboratorNotifications(
|
|
|
155
191
|
}
|
|
156
192
|
);
|
|
157
193
|
},
|
|
158
|
-
[ createNotice ]
|
|
194
|
+
[ createNotice, shouldShowLeaveNotifications ]
|
|
159
195
|
)
|
|
160
196
|
);
|
|
161
197
|
|
|
162
198
|
useOnPostSave(
|
|
163
|
-
|
|
164
|
-
|
|
199
|
+
postSavePostId,
|
|
200
|
+
postSavePostType,
|
|
165
201
|
useCallback(
|
|
166
202
|
(
|
|
167
203
|
saveEvent: PostSaveEvent,
|
|
168
204
|
saver: PostEditorAwarenessState,
|
|
169
205
|
prevEvent: PostSaveEvent | null
|
|
170
206
|
) => {
|
|
171
|
-
if ( ! postStatus ) {
|
|
207
|
+
if ( ! shouldShowPostSaveNotifications || ! postStatus ) {
|
|
172
208
|
return;
|
|
173
209
|
}
|
|
174
210
|
|
|
@@ -197,7 +233,7 @@ export function useCollaboratorNotifications(
|
|
|
197
233
|
isDismissible: false,
|
|
198
234
|
} );
|
|
199
235
|
},
|
|
200
|
-
[ createNotice, postStatus ]
|
|
236
|
+
[ createNotice, postStatus, shouldShowPostSaveNotifications ]
|
|
201
237
|
)
|
|
202
238
|
);
|
|
203
239
|
}
|
|
@@ -41,6 +41,49 @@ import { modalName as patternRenameModalName } from '../pattern-rename-modal';
|
|
|
41
41
|
import { modalName as patternDuplicateModalName } from '../pattern-duplicate-modal';
|
|
42
42
|
import isTemplateRevertable from '../../store/utils/is-template-revertable';
|
|
43
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Returns the command that toggles content-only editing for patterns and template parts.
|
|
46
|
+
* The command is registered both globally for search and contextually for block
|
|
47
|
+
* selection, so keeping it in one place ensures the label and callback stay aligned.
|
|
48
|
+
*
|
|
49
|
+
* @param {Object} options Command options.
|
|
50
|
+
* @param {boolean} options.disableContentOnlyForPatternsAndTemplateParts Whether content-only editing is disabled for patterns and template parts.
|
|
51
|
+
* @param {Function} options.stopEditingContentOnlySection Stops editing the current content-only section before changing the setting.
|
|
52
|
+
* @param {Function} options.updateEditorSettings Updates the editor settings.
|
|
53
|
+
* @return {Object} The command configuration.
|
|
54
|
+
*/
|
|
55
|
+
function getTogglePatternEditingCommand( {
|
|
56
|
+
disableContentOnlyForPatternsAndTemplateParts,
|
|
57
|
+
stopEditingContentOnlySection,
|
|
58
|
+
updateEditorSettings,
|
|
59
|
+
} ) {
|
|
60
|
+
return {
|
|
61
|
+
name: 'core/toggle-pattern-editing',
|
|
62
|
+
label: disableContentOnlyForPatternsAndTemplateParts
|
|
63
|
+
? __( 'Disable editing all patterns' )
|
|
64
|
+
: __( 'Enable editing all patterns' ),
|
|
65
|
+
icon: symbol,
|
|
66
|
+
category: 'command',
|
|
67
|
+
callback: ( { close } ) => {
|
|
68
|
+
const disableContentOnly =
|
|
69
|
+
! disableContentOnlyForPatternsAndTemplateParts;
|
|
70
|
+
stopEditingContentOnlySection();
|
|
71
|
+
updateEditorSettings( {
|
|
72
|
+
disableContentOnlyForUnsyncedPatterns: disableContentOnly,
|
|
73
|
+
disableContentOnlyForTemplateParts: disableContentOnly,
|
|
74
|
+
} );
|
|
75
|
+
close();
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function isPatternOrTemplatePartBlock( blockName, attributes ) {
|
|
81
|
+
return (
|
|
82
|
+
!! attributes?.metadata?.patternName ||
|
|
83
|
+
blockName === 'core/template-part'
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
44
87
|
const getEditorCommandLoader = () =>
|
|
45
88
|
function useEditorCommandLoader() {
|
|
46
89
|
const {
|
|
@@ -54,6 +97,8 @@ const getEditorCommandLoader = () =>
|
|
|
54
97
|
isCodeEditingEnabled,
|
|
55
98
|
isRichEditingEnabled,
|
|
56
99
|
isPublishSidebarEnabled,
|
|
100
|
+
disableContentOnlyForUnsyncedPatterns,
|
|
101
|
+
disableContentOnlyForTemplateParts,
|
|
57
102
|
} = useSelect( ( select ) => {
|
|
58
103
|
const { get } = select( preferencesStore );
|
|
59
104
|
const { isListViewOpened, getCurrentPostType, getEditorSettings } =
|
|
@@ -74,6 +119,11 @@ const getEditorCommandLoader = () =>
|
|
|
74
119
|
isRichEditingEnabled: getEditorSettings().richEditingEnabled,
|
|
75
120
|
isPublishSidebarEnabled:
|
|
76
121
|
select( editorStore ).isPublishSidebarEnabled(),
|
|
122
|
+
disableContentOnlyForUnsyncedPatterns:
|
|
123
|
+
!! getEditorSettings()
|
|
124
|
+
.disableContentOnlyForUnsyncedPatterns,
|
|
125
|
+
disableContentOnlyForTemplateParts:
|
|
126
|
+
!! getEditorSettings().disableContentOnlyForTemplateParts,
|
|
77
127
|
};
|
|
78
128
|
}, [] );
|
|
79
129
|
const { getActiveComplementaryArea } = useSelect( interfaceStore );
|
|
@@ -86,7 +136,12 @@ const getEditorCommandLoader = () =>
|
|
|
86
136
|
toggleDistractionFree,
|
|
87
137
|
toggleSpotlightMode,
|
|
88
138
|
toggleTopToolbar,
|
|
139
|
+
updateEditorSettings,
|
|
89
140
|
} = useDispatch( editorStore );
|
|
141
|
+
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
142
|
+
const { stopEditingContentOnlySection } = unlock(
|
|
143
|
+
useDispatch( blockEditorStore )
|
|
144
|
+
);
|
|
90
145
|
const { openModal, enableComplementaryArea, disableComplementaryArea } =
|
|
91
146
|
useDispatch( interfaceStore );
|
|
92
147
|
const { getCurrentPostId } = useSelect( editorStore );
|
|
@@ -98,6 +153,9 @@ const getEditorCommandLoader = () =>
|
|
|
98
153
|
}
|
|
99
154
|
|
|
100
155
|
const commands = [];
|
|
156
|
+
const disableContentOnlyForPatternsAndTemplateParts =
|
|
157
|
+
disableContentOnlyForUnsyncedPatterns &&
|
|
158
|
+
disableContentOnlyForTemplateParts;
|
|
101
159
|
|
|
102
160
|
commands.push( {
|
|
103
161
|
name: 'core/open-shortcut-help',
|
|
@@ -176,6 +234,14 @@ const getEditorCommandLoader = () =>
|
|
|
176
234
|
},
|
|
177
235
|
} );
|
|
178
236
|
|
|
237
|
+
commands.push(
|
|
238
|
+
getTogglePatternEditingCommand( {
|
|
239
|
+
disableContentOnlyForPatternsAndTemplateParts,
|
|
240
|
+
stopEditingContentOnlySection,
|
|
241
|
+
updateEditorSettings,
|
|
242
|
+
} )
|
|
243
|
+
);
|
|
244
|
+
|
|
179
245
|
if ( allowSwitchEditorMode ) {
|
|
180
246
|
commands.push( {
|
|
181
247
|
name: 'core/toggle-code-editor',
|
|
@@ -290,6 +356,76 @@ const getEditorCommandLoader = () =>
|
|
|
290
356
|
};
|
|
291
357
|
};
|
|
292
358
|
|
|
359
|
+
const getPatternEditingContextualCommands = () =>
|
|
360
|
+
function usePatternEditingContextualCommands( { search } ) {
|
|
361
|
+
const {
|
|
362
|
+
disableContentOnlyForPatternsAndTemplateParts,
|
|
363
|
+
hasPatternOrTemplatePartSelection,
|
|
364
|
+
isPreviewMode,
|
|
365
|
+
} = useSelect( ( select ) => {
|
|
366
|
+
const {
|
|
367
|
+
getBlockAttributes,
|
|
368
|
+
getBlockName,
|
|
369
|
+
getBlockParents,
|
|
370
|
+
getSelectedBlockClientId,
|
|
371
|
+
getSelectedBlockClientIds,
|
|
372
|
+
getSettings,
|
|
373
|
+
} = select( blockEditorStore );
|
|
374
|
+
const { getEditorSettings } = select( editorStore );
|
|
375
|
+
const editorSettings = getEditorSettings();
|
|
376
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
377
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
378
|
+
const clientIdsToCheck =
|
|
379
|
+
selectedBlockClientId && selectedBlockClientIds.length === 1
|
|
380
|
+
? [
|
|
381
|
+
selectedBlockClientId,
|
|
382
|
+
...getBlockParents( selectedBlockClientId, true ),
|
|
383
|
+
]
|
|
384
|
+
: [];
|
|
385
|
+
|
|
386
|
+
return {
|
|
387
|
+
disableContentOnlyForPatternsAndTemplateParts:
|
|
388
|
+
!! editorSettings.disableContentOnlyForUnsyncedPatterns &&
|
|
389
|
+
!! editorSettings.disableContentOnlyForTemplateParts,
|
|
390
|
+
hasPatternOrTemplatePartSelection: clientIdsToCheck.some(
|
|
391
|
+
( clientId ) =>
|
|
392
|
+
isPatternOrTemplatePartBlock(
|
|
393
|
+
getBlockName( clientId ),
|
|
394
|
+
getBlockAttributes( clientId )
|
|
395
|
+
)
|
|
396
|
+
),
|
|
397
|
+
isPreviewMode: getSettings().isPreviewMode,
|
|
398
|
+
};
|
|
399
|
+
}, [] );
|
|
400
|
+
const { updateEditorSettings } = useDispatch( editorStore );
|
|
401
|
+
// eslint-disable-next-line @wordpress/no-unused-vars-before-return
|
|
402
|
+
const { stopEditingContentOnlySection } = unlock(
|
|
403
|
+
useDispatch( blockEditorStore )
|
|
404
|
+
);
|
|
405
|
+
|
|
406
|
+
// Keep the disable command available after full pattern editing is enabled,
|
|
407
|
+
// even when the current selection is no longer inside a pattern or template part.
|
|
408
|
+
if (
|
|
409
|
+
search ||
|
|
410
|
+
( ! hasPatternOrTemplatePartSelection &&
|
|
411
|
+
! disableContentOnlyForPatternsAndTemplateParts ) ||
|
|
412
|
+
isPreviewMode
|
|
413
|
+
) {
|
|
414
|
+
return { isLoading: false, commands: [] };
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return {
|
|
418
|
+
isLoading: false,
|
|
419
|
+
commands: [
|
|
420
|
+
getTogglePatternEditingCommand( {
|
|
421
|
+
disableContentOnlyForPatternsAndTemplateParts,
|
|
422
|
+
stopEditingContentOnlySection,
|
|
423
|
+
updateEditorSettings,
|
|
424
|
+
} ),
|
|
425
|
+
],
|
|
426
|
+
};
|
|
427
|
+
};
|
|
428
|
+
|
|
293
429
|
const getEditedEntityContextualCommands = () =>
|
|
294
430
|
function useEditedEntityContextualCommands() {
|
|
295
431
|
const { postType } = useSelect( ( select ) => {
|
|
@@ -480,6 +616,12 @@ export default function useCommands() {
|
|
|
480
616
|
context: 'entity-edit',
|
|
481
617
|
} );
|
|
482
618
|
|
|
619
|
+
useCommandLoader( {
|
|
620
|
+
name: 'core/editor/pattern-editing-contextual-commands',
|
|
621
|
+
hook: getPatternEditingContextualCommands(),
|
|
622
|
+
context: 'block-selection-edit',
|
|
623
|
+
} );
|
|
624
|
+
|
|
483
625
|
useCommandLoader( {
|
|
484
626
|
name: 'core/editor/page-content-focus',
|
|
485
627
|
hook: getPageContentFocusCommands(),
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
} from '@wordpress/components';
|
|
17
17
|
import { BlockIcon, store as blockEditorStore } from '@wordpress/block-editor';
|
|
18
18
|
import { chevronLeftSmall, chevronRightSmall, layout } from '@wordpress/icons';
|
|
19
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
20
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
21
20
|
import { store as commandsStore } from '@wordpress/commands';
|
|
22
21
|
import { useRef, useEffect } from '@wordpress/element';
|
|
@@ -141,8 +140,6 @@ export default function DocumentBar( props ) {
|
|
|
141
140
|
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
142
141
|
const isReducedMotion = useReducedMotion();
|
|
143
142
|
|
|
144
|
-
const hasShortcut = ! window.__experimentalAdminBarInEditor;
|
|
145
|
-
|
|
146
143
|
const isTemplate = TEMPLATE_POST_TYPES.includes( postType );
|
|
147
144
|
const hasBackButton =
|
|
148
145
|
!! onNavigateToPreviousEntityRecord || !! unlockedPatternInfo;
|
|
@@ -177,7 +174,6 @@ export default function DocumentBar( props ) {
|
|
|
177
174
|
<div
|
|
178
175
|
className={ clsx( 'editor-document-bar', {
|
|
179
176
|
'has-back-button': hasBackButton,
|
|
180
|
-
'has-shortcut': hasShortcut,
|
|
181
177
|
} ) }
|
|
182
178
|
>
|
|
183
179
|
<AnimatePresence>
|
|
@@ -270,11 +266,6 @@ export default function DocumentBar( props ) {
|
|
|
270
266
|
) }
|
|
271
267
|
</WCText>
|
|
272
268
|
</motion.div>
|
|
273
|
-
{ hasShortcut && (
|
|
274
|
-
<span className="editor-document-bar__shortcut">
|
|
275
|
-
{ displayShortcut.primary( 'k' ) }
|
|
276
|
-
</span>
|
|
277
|
-
) }
|
|
278
269
|
</Button>
|
|
279
270
|
) }
|
|
280
271
|
</div>
|
|
@@ -54,13 +54,6 @@
|
|
|
54
54
|
margin: 0 auto;
|
|
55
55
|
max-width: 70%;
|
|
56
56
|
|
|
57
|
-
// Offset the layout based on the width of the ⌘K label. This ensures the title is centrally aligned.
|
|
58
|
-
.editor-document-bar.has-shortcut & {
|
|
59
|
-
@include break-medium() {
|
|
60
|
-
padding-left: $grid-unit-30;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
57
|
h1 {
|
|
65
58
|
display: flex;
|
|
66
59
|
align-items: center;
|
|
@@ -88,16 +81,6 @@
|
|
|
88
81
|
}
|
|
89
82
|
}
|
|
90
83
|
|
|
91
|
-
.editor-document-bar__shortcut {
|
|
92
|
-
color: $gray-800;
|
|
93
|
-
min-width: $grid-unit-30;
|
|
94
|
-
display: none;
|
|
95
|
-
|
|
96
|
-
@include break-medium() {
|
|
97
|
-
display: initial;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
84
|
.editor-document-bar__back.components-button.has-icon.has-text {
|
|
102
85
|
min-width: $button-size;
|
|
103
86
|
flex-shrink: 0;
|
|
@@ -27,10 +27,6 @@ import { useIsDirty } from './hooks/use-is-dirty';
|
|
|
27
27
|
import { store as editorStore } from '../../store';
|
|
28
28
|
import { unlock } from '../../lock-unlock';
|
|
29
29
|
|
|
30
|
-
function identity( values ) {
|
|
31
|
-
return values;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
/**
|
|
35
31
|
* Renders the component for managing saved states of entities.
|
|
36
32
|
*
|
|
@@ -79,7 +75,7 @@ export default function EntitiesSavedStates( {
|
|
|
79
75
|
export function EntitiesSavedStatesExtensible( {
|
|
80
76
|
additionalPrompt = undefined,
|
|
81
77
|
close,
|
|
82
|
-
onSave =
|
|
78
|
+
onSave = undefined,
|
|
83
79
|
saveEnabled: saveEnabledProp = undefined,
|
|
84
80
|
saveLabel = __( 'Save' ),
|
|
85
81
|
renderDialog,
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
background: $white;
|
|
11
11
|
display: grid;
|
|
12
12
|
grid-auto-flow: row;
|
|
13
|
-
grid-template: auto / $
|
|
13
|
+
grid-template: auto / $button-size-compact minmax(0, max-content) minmax(min-content, 1fr) $header-height;
|
|
14
14
|
&:has(> .editor-header__center) {
|
|
15
|
-
grid-template: auto / $
|
|
15
|
+
grid-template: auto / $button-size-compact min-content 1fr min-content $header-height;
|
|
16
16
|
@include break-medium {
|
|
17
|
-
grid-template: auto / $
|
|
17
|
+
grid-template: auto / $button-size-compact minmax(min-content, 2fr) 2.5fr minmax(min-content, 2fr) $header-height;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
@include break-mobile {
|
|
@@ -31,6 +31,10 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.editor-header__back-button {
|
|
35
|
+
padding-left: $grid-unit;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
.editor-header__toolbar {
|
|
35
39
|
grid-column: 1 / 3;
|
|
36
40
|
// When there is no back button or the viewport is <= mobile the margin keeps the content off
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* WordPress dependencies
|
|
11
11
|
*/
|
|
12
12
|
import { __, sprintf, _x } from '@wordpress/i18n';
|
|
13
|
-
import { resolveSelect } from '@wordpress/data';
|
|
13
|
+
import { dispatch, resolveSelect } from '@wordpress/data';
|
|
14
14
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -124,14 +124,16 @@ const getOpenverseCaption = ( item ) => {
|
|
|
124
124
|
return _caption.replace( /\s{2}/g, ' ' );
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
const getCoreMediaQuery = ( query = {} ) => ( {
|
|
128
|
+
...query,
|
|
129
|
+
orderBy: !! query?.search ? 'relevance' : 'date',
|
|
130
|
+
} );
|
|
131
|
+
|
|
127
132
|
const coreMediaFetch = async ( query = {} ) => {
|
|
128
133
|
const mediaItems = await resolveSelect( coreStore ).getEntityRecords(
|
|
129
134
|
'postType',
|
|
130
135
|
'attachment',
|
|
131
|
-
|
|
132
|
-
...query,
|
|
133
|
-
orderBy: !! query?.search ? 'relevance' : 'date',
|
|
134
|
-
}
|
|
136
|
+
getCoreMediaQuery( query )
|
|
135
137
|
);
|
|
136
138
|
return mediaItems.map( ( mediaItem ) => ( {
|
|
137
139
|
...mediaItem,
|
|
@@ -142,6 +144,129 @@ const coreMediaFetch = async ( query = {} ) => {
|
|
|
142
144
|
} ) );
|
|
143
145
|
};
|
|
144
146
|
|
|
147
|
+
const getAttachedImagesQuery = ( postId, query = {} ) => ( {
|
|
148
|
+
...query,
|
|
149
|
+
media_type: 'image',
|
|
150
|
+
parent: postId,
|
|
151
|
+
} );
|
|
152
|
+
|
|
153
|
+
const normalizePostId = ( postId ) => {
|
|
154
|
+
const parsedPostId = typeof postId === 'number' ? postId : Number( postId );
|
|
155
|
+
|
|
156
|
+
return Number.isInteger( parsedPostId ) && parsedPostId > 0
|
|
157
|
+
? parsedPostId
|
|
158
|
+
: undefined;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const saveAttachmentParent = ( attachmentId, postId ) =>
|
|
162
|
+
// `throwOnError` so a failed REST write rejects (rather than being silently
|
|
163
|
+
// swallowed), letting the attach/detach handlers surface an error notice
|
|
164
|
+
// instead of a false success.
|
|
165
|
+
dispatch( coreStore ).saveEntityRecord(
|
|
166
|
+
'postType',
|
|
167
|
+
'attachment',
|
|
168
|
+
{
|
|
169
|
+
id: attachmentId,
|
|
170
|
+
post: postId,
|
|
171
|
+
},
|
|
172
|
+
{ throwOnError: true }
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// A selected media item's coarse type is exposed differently by each picker.
|
|
176
|
+
// The classic media modal puts the media type directly on `type` (e.g. 'image').
|
|
177
|
+
// The DataViews-driven modal passes REST attachment records, where `type` is the
|
|
178
|
+
// *post* type ('attachment') and the media type lives in `media_type`
|
|
179
|
+
// ('image'|'file') / `mime_type`. So the REST fields must be read first, with
|
|
180
|
+
// `type` as the classic-modal fallback — otherwise a REST image reads as
|
|
181
|
+
// 'attachment' and gets gated out.
|
|
182
|
+
const getMediaItemType = ( mediaItem ) =>
|
|
183
|
+
mediaItem?.media_type ||
|
|
184
|
+
mediaItem?.mime_type?.split( '/' )[ 0 ] ||
|
|
185
|
+
mediaItem?.type;
|
|
186
|
+
|
|
187
|
+
// The picker's "Upload files" tab accepts any file type, so the selection can
|
|
188
|
+
// include non-images. Gate to images only: a non-image would be reparented to
|
|
189
|
+
// the post but never appear in the image-filtered grid, and would wrongly count
|
|
190
|
+
// toward the "images attached" notice.
|
|
191
|
+
const getImageAttachmentIds = ( mediaItems ) => [
|
|
192
|
+
...new Set(
|
|
193
|
+
( Array.isArray( mediaItems ) ? mediaItems : [ mediaItems ] )
|
|
194
|
+
.filter(
|
|
195
|
+
( mediaItem ) => getMediaItemType( mediaItem ) === 'image'
|
|
196
|
+
)
|
|
197
|
+
.map( ( mediaItem ) => mediaItem?.id )
|
|
198
|
+
.filter( Boolean )
|
|
199
|
+
),
|
|
200
|
+
];
|
|
201
|
+
|
|
202
|
+
const invalidateAttachedImagesQueries = ( postId, query = {} ) => {
|
|
203
|
+
const { invalidateResolution } = dispatch( coreStore );
|
|
204
|
+
// Invalidate the resolution backing the visible grid so it refetches after
|
|
205
|
+
// an attach/detach and reflects the updated set of attached images. The tab
|
|
206
|
+
// is always shown (via `emptyMessage`), so there's no separate visibility
|
|
207
|
+
// probe to invalidate.
|
|
208
|
+
invalidateResolution( 'getEntityRecords', [
|
|
209
|
+
'postType',
|
|
210
|
+
'attachment',
|
|
211
|
+
getCoreMediaQuery( getAttachedImagesQuery( postId, query ) ),
|
|
212
|
+
] );
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Builds the "Attachments" media category for a given post. It behaves like
|
|
217
|
+
* any other inserter media source (e.g. Openverse): it appears in the tab list
|
|
218
|
+
* and renders through the shared media panel. In addition to `fetch`, it exposes
|
|
219
|
+
* optional `attach`/`detach`/`invalidate` capabilities that the shared panel
|
|
220
|
+
* picks up to offer an "Attach images" button and a per-item "Detach from post"
|
|
221
|
+
* action in the same dropdown Openverse uses for "Report image".
|
|
222
|
+
*
|
|
223
|
+
* @param {number} postId The current post id.
|
|
224
|
+
* @param {string|null} [typeLabel] The post type's singular label to use in copy (e.g. "Page"),
|
|
225
|
+
* or null to fall back to the generic "post".
|
|
226
|
+
* @return {InserterMediaCategory} The Attachments media category.
|
|
227
|
+
*/
|
|
228
|
+
const getAttachedImagesCategory = ( postId, typeLabel ) => ( {
|
|
229
|
+
name: 'attached-images',
|
|
230
|
+
labels: {
|
|
231
|
+
name: __( 'Attached images' ),
|
|
232
|
+
search_items: __( 'Search attachments' ),
|
|
233
|
+
},
|
|
234
|
+
mediaType: 'image',
|
|
235
|
+
// The post type's singular label (e.g. "Page"), threaded through so the
|
|
236
|
+
// shared panel can word its attach/detach copy for the current post type.
|
|
237
|
+
postTypeLabel: typeLabel,
|
|
238
|
+
// Empty-state message. Providing this also keeps the source in the tab list
|
|
239
|
+
// when it has no items, so it stays discoverable and the first image can be
|
|
240
|
+
// attached even with none yet.
|
|
241
|
+
emptyMessage: typeLabel
|
|
242
|
+
? sprintf(
|
|
243
|
+
// translators: %s: Name of the post type e.g: "Page".
|
|
244
|
+
__( 'No images attached to this %s.' ),
|
|
245
|
+
typeLabel
|
|
246
|
+
)
|
|
247
|
+
: __( 'No images attached to this post.' ),
|
|
248
|
+
async fetch( query = {} ) {
|
|
249
|
+
return coreMediaFetch( getAttachedImagesQuery( postId, query ) );
|
|
250
|
+
},
|
|
251
|
+
async attach( mediaItems ) {
|
|
252
|
+
const attachmentIds = getImageAttachmentIds( mediaItems );
|
|
253
|
+
|
|
254
|
+
await Promise.all(
|
|
255
|
+
attachmentIds.map( ( attachmentId ) =>
|
|
256
|
+
saveAttachmentParent( attachmentId, postId )
|
|
257
|
+
)
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
return attachmentIds.length;
|
|
261
|
+
},
|
|
262
|
+
async detach( mediaItem ) {
|
|
263
|
+
await saveAttachmentParent( mediaItem.id, 0 );
|
|
264
|
+
},
|
|
265
|
+
invalidate( query = {} ) {
|
|
266
|
+
invalidateAttachedImagesQueries( postId, query );
|
|
267
|
+
},
|
|
268
|
+
} );
|
|
269
|
+
|
|
145
270
|
/** @type {InserterMediaCategory[]} */
|
|
146
271
|
const inserterMediaCategories = [
|
|
147
272
|
{
|
|
@@ -226,4 +351,33 @@ const inserterMediaCategories = [
|
|
|
226
351
|
},
|
|
227
352
|
];
|
|
228
353
|
|
|
229
|
-
|
|
354
|
+
/**
|
|
355
|
+
* Returns the inserter media categories for a given post. The "Attachments"
|
|
356
|
+
* category is prepended only when editing real, front-end-rendered content
|
|
357
|
+
* (posts, pages, public custom post types). It is omitted for synced patterns,
|
|
358
|
+
* navigation menus and templates, which aren't the entity that actually gets
|
|
359
|
+
* rendered, so attaching media to them is meaningless.
|
|
360
|
+
*
|
|
361
|
+
* @param {number|string} postId The current post id.
|
|
362
|
+
* @param {string} [viewablePostTypeLabel] Singular label of the post type, set only when it is front-end viewable (post, page, public CPT).
|
|
363
|
+
* @return {InserterMediaCategory[]} The inserter media categories.
|
|
364
|
+
*/
|
|
365
|
+
export default function getInserterMediaCategories(
|
|
366
|
+
postId,
|
|
367
|
+
viewablePostTypeLabel
|
|
368
|
+
) {
|
|
369
|
+
const currentPostId = normalizePostId( postId );
|
|
370
|
+
|
|
371
|
+
// A falsy label means either a non-viewable post type (synced pattern,
|
|
372
|
+
// navigation, template) or that the record hasn't resolved yet — in both
|
|
373
|
+
// cases the category is omitted. A numeric id is also required since it
|
|
374
|
+
// backs the attachment `parent` query.
|
|
375
|
+
if ( ! currentPostId || ! viewablePostTypeLabel ) {
|
|
376
|
+
return inserterMediaCategories;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return [
|
|
380
|
+
getAttachedImagesCategory( currentPostId, viewablePostTypeLabel ),
|
|
381
|
+
...inserterMediaCategories,
|
|
382
|
+
];
|
|
383
|
+
}
|