@wordpress/editor 12.0.21 → 12.2.1-next.f435e9e01b.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 +16 -0
- package/LICENSE.md +1 -1
- package/README.md +7 -1
- package/build/components/deprecated.js +5 -5
- package/build/components/deprecated.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +1 -1
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/entities-saved-states/index.js +18 -16
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/index.js +18 -0
- package/build/components/index.js.map +1 -1
- package/build/components/post-format/index.js +6 -4
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +34 -25
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +81 -0
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -0
- package/build/components/post-publish-panel/prepublish.js +3 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +3 -3
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-title/index.native.js +1 -0
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-trash/index.js +1 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-visibility/index.js +30 -14
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/provider/index.native.js +12 -6
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +11 -6
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/actions.js +21 -15
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +12 -39
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils/notice-builder.js +1 -1
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build-module/components/deprecated.js +5 -4
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +1 -1
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +19 -16
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/post-format/index.js +7 -5
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +37 -25
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +66 -0
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -0
- package/build-module/components/post-publish-panel/prepublish.js +2 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +3 -3
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-title/index.native.js +1 -0
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-trash/index.js +1 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-visibility/index.js +31 -15
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +10 -7
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +11 -6
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/actions.js +21 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +10 -35
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +1 -1
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-style/style-rtl.css +9 -27
- package/build-style/style.css +9 -27
- package/package.json +31 -30
- package/src/components/autosave-monitor/test/index.js +1 -1
- package/src/components/deprecated.js +2 -5
- package/src/components/editor-help/add-blocks.native.js +1 -1
- package/src/components/editor-help/index.native.js +1 -1
- package/src/components/entities-saved-states/index.js +21 -15
- package/src/components/entities-saved-states/style.scss +0 -12
- package/src/components/index.js +2 -0
- package/src/components/post-format/index.js +9 -10
- package/src/components/post-locked-modal/index.js +92 -53
- package/src/components/post-locked-modal/style.scss +7 -17
- package/src/components/post-publish-panel/maybe-category-panel.js +88 -0
- package/src/components/post-publish-panel/prepublish.js +2 -0
- package/src/components/post-taxonomies/README.md +25 -1
- package/src/components/post-taxonomies/most-used-terms.js +3 -3
- package/src/components/post-title/index.native.js +1 -0
- package/src/components/post-trash/index.js +1 -1
- package/src/components/post-visibility/index.js +25 -11
- package/src/components/provider/index.native.js +10 -7
- package/src/components/provider/use-block-editor-settings.js +14 -4
- package/src/store/actions.js +18 -23
- package/src/store/selectors.js +9 -40
- package/src/store/test/actions.js +1 -41
- package/src/store/utils/notice-builder.js +1 -1
- package/src/store/utils/test/notice-builder.js +1 -1
package/build-style/style.css
CHANGED
|
@@ -266,16 +266,6 @@
|
|
|
266
266
|
padding-right: 8px;
|
|
267
267
|
height: 61px;
|
|
268
268
|
border-bottom: 1px solid #ddd;
|
|
269
|
-
display: flex;
|
|
270
|
-
align-items: center;
|
|
271
|
-
align-content: space-between;
|
|
272
|
-
}
|
|
273
|
-
.entities-saved-states__panel .entities-saved-states__panel-header .editor-entities-saved-states__save-button {
|
|
274
|
-
margin: auto;
|
|
275
|
-
}
|
|
276
|
-
.entities-saved-states__panel .entities-saved-states__panel-header .components-button.has-icon {
|
|
277
|
-
position: absolute;
|
|
278
|
-
right: 8px;
|
|
279
269
|
}
|
|
280
270
|
.entities-saved-states__panel .entities-saved-states__text-prompt {
|
|
281
271
|
padding: 16px;
|
|
@@ -405,31 +395,23 @@
|
|
|
405
395
|
border-radius: 0;
|
|
406
396
|
}
|
|
407
397
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
padding-top: 10px;
|
|
413
|
-
max-width: 480px;
|
|
414
|
-
}
|
|
415
|
-
.editor-post-locked-modal .components-modal__header {
|
|
416
|
-
height: 36px;
|
|
398
|
+
@media (min-width: 600px) {
|
|
399
|
+
.editor-post-locked-modal {
|
|
400
|
+
max-width: 480px;
|
|
401
|
+
}
|
|
417
402
|
}
|
|
418
403
|
.editor-post-locked-modal .components-modal__content {
|
|
419
|
-
|
|
404
|
+
display: flex;
|
|
420
405
|
}
|
|
421
406
|
|
|
422
407
|
.editor-post-locked-modal__buttons {
|
|
423
|
-
margin-top:
|
|
424
|
-
}
|
|
425
|
-
.editor-post-locked-modal__buttons .components-button {
|
|
426
|
-
margin-right: 5px;
|
|
408
|
+
margin-top: 24px;
|
|
427
409
|
}
|
|
428
410
|
|
|
429
411
|
.editor-post-locked-modal__avatar {
|
|
430
|
-
|
|
431
|
-
margin:
|
|
432
|
-
margin-right:
|
|
412
|
+
border-radius: 2px;
|
|
413
|
+
margin-top: 16px;
|
|
414
|
+
margin-right: 24px;
|
|
433
415
|
}
|
|
434
416
|
|
|
435
417
|
.editor-post-publish-button__button.has-changes-dot::before {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "12.0
|
|
3
|
+
"version": "12.2.1-next.f435e9e01b.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,42 +31,43 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^
|
|
36
|
-
"@wordpress/
|
|
37
|
-
"@wordpress/
|
|
38
|
-
"@wordpress/
|
|
39
|
-
"@wordpress/
|
|
40
|
-
"@wordpress/
|
|
41
|
-
"@wordpress/
|
|
42
|
-
"@wordpress/
|
|
43
|
-
"@wordpress/
|
|
44
|
-
"@wordpress/
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
56
|
-
"@wordpress/
|
|
57
|
-
"@wordpress/
|
|
58
|
-
"@wordpress/
|
|
59
|
-
"@wordpress/server-side-render": "^3.0.20",
|
|
60
|
-
"@wordpress/url": "^3.3.1",
|
|
61
|
-
"@wordpress/wordcount": "^3.2.3",
|
|
34
|
+
"@wordpress/a11y": "^3.3.1-next.f435e9e01b.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.0.1-next.f435e9e01b.0",
|
|
36
|
+
"@wordpress/block-editor": "^8.1.2-next.f435e9e01b.0",
|
|
37
|
+
"@wordpress/blocks": "^11.2.1-next.f435e9e01b.0",
|
|
38
|
+
"@wordpress/components": "^19.4.1-next.f435e9e01b.0",
|
|
39
|
+
"@wordpress/compose": "^5.1.1-next.f435e9e01b.0",
|
|
40
|
+
"@wordpress/core-data": "^4.1.1-next.f435e9e01b.0",
|
|
41
|
+
"@wordpress/data": "^6.2.2-next.f435e9e01b.0",
|
|
42
|
+
"@wordpress/data-controls": "^2.3.1-next.f435e9e01b.0",
|
|
43
|
+
"@wordpress/date": "^4.3.1-next.f435e9e01b.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.3.1-next.f435e9e01b.0",
|
|
45
|
+
"@wordpress/element": "^4.1.1-next.f435e9e01b.0",
|
|
46
|
+
"@wordpress/hooks": "^3.3.1-next.f435e9e01b.0",
|
|
47
|
+
"@wordpress/html-entities": "^3.3.1-next.f435e9e01b.0",
|
|
48
|
+
"@wordpress/i18n": "^4.3.1-next.f435e9e01b.0",
|
|
49
|
+
"@wordpress/icons": "^6.3.1-next.f435e9e01b.0",
|
|
50
|
+
"@wordpress/keyboard-shortcuts": "^3.1.2-next.f435e9e01b.0",
|
|
51
|
+
"@wordpress/keycodes": "^3.3.1-next.f435e9e01b.0",
|
|
52
|
+
"@wordpress/media-utils": "^3.1.1-next.f435e9e01b.0",
|
|
53
|
+
"@wordpress/notices": "^3.3.1-next.f435e9e01b.0",
|
|
54
|
+
"@wordpress/reusable-blocks": "^3.1.2-next.f435e9e01b.0",
|
|
55
|
+
"@wordpress/rich-text": "^5.1.2-next.f435e9e01b.0",
|
|
56
|
+
"@wordpress/server-side-render": "^3.1.1-next.f435e9e01b.0",
|
|
57
|
+
"@wordpress/url": "^3.4.1-next.f435e9e01b.0",
|
|
58
|
+
"@wordpress/wordcount": "^3.3.1-next.f435e9e01b.0",
|
|
62
59
|
"classnames": "^2.3.1",
|
|
63
60
|
"lodash": "^4.17.21",
|
|
64
61
|
"memize": "^1.1.0",
|
|
65
62
|
"react-autosize-textarea": "^7.1.0",
|
|
66
63
|
"rememo": "^3.0.0"
|
|
67
64
|
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"react": "^17.0.0",
|
|
67
|
+
"react-dom": "^17.0.0"
|
|
68
|
+
},
|
|
68
69
|
"publishConfig": {
|
|
69
70
|
"access": "public"
|
|
70
71
|
},
|
|
71
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "14b2846015dfb1b440ce93accdd03842ebe5f1cd"
|
|
72
73
|
}
|
|
@@ -48,7 +48,6 @@ import {
|
|
|
48
48
|
MultiSelectScrollIntoView as RootMultiSelectScrollIntoView,
|
|
49
49
|
NavigableToolbar as RootNavigableToolbar,
|
|
50
50
|
ObserveTyping as RootObserveTyping,
|
|
51
|
-
PreserveScrollInReorder as RootPreserveScrollInReorder,
|
|
52
51
|
SkipToSelectedBlock as RootSkipToSelectedBlock,
|
|
53
52
|
URLInput as RootURLInput,
|
|
54
53
|
URLInputButton as RootURLInputButton,
|
|
@@ -67,6 +66,7 @@ function deprecateComponent( name, Wrapped, staticsToHoist = [] ) {
|
|
|
67
66
|
deprecated( 'wp.editor.' + name, {
|
|
68
67
|
since: '5.3',
|
|
69
68
|
alternative: 'wp.blockEditor.' + name,
|
|
69
|
+
version: '6.2',
|
|
70
70
|
} );
|
|
71
71
|
|
|
72
72
|
return <Wrapped ref={ ref } { ...props } />;
|
|
@@ -87,6 +87,7 @@ function deprecateFunction( name, func ) {
|
|
|
87
87
|
deprecated( 'wp.editor.' + name, {
|
|
88
88
|
since: '5.3',
|
|
89
89
|
alternative: 'wp.blockEditor.' + name,
|
|
90
|
+
version: '6.2',
|
|
90
91
|
} );
|
|
91
92
|
|
|
92
93
|
return func( ...args );
|
|
@@ -222,10 +223,6 @@ export const ObserveTyping = deprecateComponent(
|
|
|
222
223
|
'ObserveTyping',
|
|
223
224
|
RootObserveTyping
|
|
224
225
|
);
|
|
225
|
-
export const PreserveScrollInReorder = deprecateComponent(
|
|
226
|
-
'PreserveScrollInReorder',
|
|
227
|
-
RootPreserveScrollInReorder
|
|
228
|
-
);
|
|
229
226
|
export const SkipToSelectedBlock = deprecateComponent(
|
|
230
227
|
'SkipToSelectedBlock',
|
|
231
228
|
RootSkipToSelectedBlock
|
|
@@ -24,7 +24,7 @@ const AddBlocks = () => {
|
|
|
24
24
|
<View style={ styles.helpDetailContainer }>
|
|
25
25
|
<HelpDetailBodyText
|
|
26
26
|
text={ __(
|
|
27
|
-
'Add a new block at any time by tapping on the + icon in the toolbar on the bottom left.
|
|
27
|
+
'Add a new block at any time by tapping on the + icon in the toolbar on the bottom left.'
|
|
28
28
|
) }
|
|
29
29
|
/>
|
|
30
30
|
<HelpDetailBodyText
|
|
@@ -6,14 +6,13 @@ import { some, groupBy } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { Button } from '@wordpress/components';
|
|
9
|
+
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
12
|
import { useState, useCallback, useRef } from '@wordpress/element';
|
|
13
13
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
14
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
15
15
|
import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
16
|
-
import { close as closeIcon } from '@wordpress/icons';
|
|
17
16
|
import { store as noticesStore } from '@wordpress/notices';
|
|
18
17
|
|
|
19
18
|
/**
|
|
@@ -77,13 +76,15 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
77
76
|
saveEditedEntityRecord,
|
|
78
77
|
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
79
78
|
} = useDispatch( coreStore );
|
|
80
|
-
|
|
81
|
-
noticesStore
|
|
82
|
-
);
|
|
79
|
+
|
|
83
80
|
const { __unstableMarkLastChangeAsPersistent } = useDispatch(
|
|
84
81
|
blockEditorStore
|
|
85
82
|
);
|
|
86
83
|
|
|
84
|
+
const { createSuccessNotice, createErrorNotice } = useDispatch(
|
|
85
|
+
noticesStore
|
|
86
|
+
);
|
|
87
|
+
|
|
87
88
|
// To group entities by type.
|
|
88
89
|
const partitionedSavables = groupBy( dirtyEntityRecords, 'name' );
|
|
89
90
|
|
|
@@ -174,6 +175,8 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
174
175
|
);
|
|
175
176
|
}
|
|
176
177
|
|
|
178
|
+
__unstableMarkLastChangeAsPersistent();
|
|
179
|
+
|
|
177
180
|
Promise.all( pendingSavedRecords )
|
|
178
181
|
.then( ( values ) => {
|
|
179
182
|
if (
|
|
@@ -189,8 +192,6 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
189
192
|
.catch( ( error ) =>
|
|
190
193
|
createErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` )
|
|
191
194
|
);
|
|
192
|
-
|
|
193
|
-
__unstableMarkLastChangeAsPersistent();
|
|
194
195
|
};
|
|
195
196
|
|
|
196
197
|
// Explicitly define this with no argument passed. Using `close` on
|
|
@@ -207,8 +208,10 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
207
208
|
{ ...saveDialogProps }
|
|
208
209
|
className="entities-saved-states__panel"
|
|
209
210
|
>
|
|
210
|
-
<
|
|
211
|
-
<
|
|
211
|
+
<Flex className="entities-saved-states__panel-header" gap={ 2 }>
|
|
212
|
+
<FlexItem
|
|
213
|
+
isBlock
|
|
214
|
+
as={ Button }
|
|
212
215
|
ref={ saveButtonRef }
|
|
213
216
|
variant="primary"
|
|
214
217
|
disabled={
|
|
@@ -220,13 +223,16 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
220
223
|
className="editor-entities-saved-states__save-button"
|
|
221
224
|
>
|
|
222
225
|
{ __( 'Save' ) }
|
|
223
|
-
</
|
|
224
|
-
<
|
|
225
|
-
|
|
226
|
+
</FlexItem>
|
|
227
|
+
<FlexItem
|
|
228
|
+
isBlock
|
|
229
|
+
as={ Button }
|
|
230
|
+
variant="secondary"
|
|
226
231
|
onClick={ dismissPanel }
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
>
|
|
233
|
+
{ __( 'Cancel' ) }
|
|
234
|
+
</FlexItem>
|
|
235
|
+
</Flex>
|
|
230
236
|
|
|
231
237
|
<div className="entities-saved-states__text-prompt">
|
|
232
238
|
<strong>{ __( 'Are you ready to save?' ) }</strong>
|
|
@@ -41,18 +41,6 @@
|
|
|
41
41
|
padding-right: $grid-unit-10;
|
|
42
42
|
height: $header-height + $border-width;
|
|
43
43
|
border-bottom: $border-width solid $gray-300;
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
align-content: space-between;
|
|
47
|
-
|
|
48
|
-
.editor-entities-saved-states__save-button {
|
|
49
|
-
margin: auto;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.components-button.has-icon {
|
|
53
|
-
position: absolute;
|
|
54
|
-
right: $grid-unit-10;
|
|
55
|
-
}
|
|
56
44
|
}
|
|
57
45
|
|
|
58
46
|
.entities-saved-states__text-prompt {
|
package/src/components/index.js
CHANGED
|
@@ -48,6 +48,8 @@ export { default as PostSticky } from './post-sticky';
|
|
|
48
48
|
export { default as PostStickyCheck } from './post-sticky/check';
|
|
49
49
|
export { default as PostSwitchToDraftButton } from './post-switch-to-draft-button';
|
|
50
50
|
export { default as PostTaxonomies } from './post-taxonomies';
|
|
51
|
+
export { default as PostTaxonomiesFlatTermSelector } from './post-taxonomies/flat-term-selector';
|
|
52
|
+
export { default as PostTaxonomiesHierarchicalTermSelector } from './post-taxonomies/hierarchical-term-selector';
|
|
51
53
|
export { default as PostTaxonomiesCheck } from './post-taxonomies/check';
|
|
52
54
|
export { default as PostTextEditor } from './post-text-editor';
|
|
53
55
|
export { default as PostTitle } from './post-title';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find,
|
|
4
|
+
import { find, includes } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -57,20 +57,19 @@ export default function PostFormat() {
|
|
|
57
57
|
return {
|
|
58
58
|
postFormat: _postFormat ?? 'standard',
|
|
59
59
|
suggestedFormat: getSuggestedPostFormat(),
|
|
60
|
-
|
|
61
|
-
// The current format may not be a format supported by the theme.
|
|
62
|
-
supportedFormats: union(
|
|
63
|
-
[ _postFormat ],
|
|
64
|
-
get( themeSupports, [ 'formats' ], [] )
|
|
65
|
-
),
|
|
60
|
+
supportedFormats: themeSupports.formats,
|
|
66
61
|
};
|
|
67
62
|
},
|
|
68
63
|
[]
|
|
69
64
|
);
|
|
70
65
|
|
|
71
|
-
const formats = POST_FORMATS.filter( ( format ) =>
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
const formats = POST_FORMATS.filter( ( format ) => {
|
|
67
|
+
// Ensure current format is always in the set.
|
|
68
|
+
// The current format may not be a format supported by the theme.
|
|
69
|
+
return (
|
|
70
|
+
includes( supportedFormats, format.id ) || postFormat === format.id
|
|
71
|
+
);
|
|
72
|
+
} );
|
|
74
73
|
const suggestion = find(
|
|
75
74
|
formats,
|
|
76
75
|
( format ) => format.id === suggestedFormat
|
|
@@ -7,10 +7,16 @@ import { get } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Modal,
|
|
12
|
+
Button,
|
|
13
|
+
ExternalLink,
|
|
14
|
+
Flex,
|
|
15
|
+
FlexItem,
|
|
16
|
+
} from '@wordpress/components';
|
|
11
17
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
18
|
import { addQueryArgs } from '@wordpress/url';
|
|
13
|
-
import { useEffect } from '@wordpress/element';
|
|
19
|
+
import { useEffect, createInterpolateElement } from '@wordpress/element';
|
|
14
20
|
import { addAction, removeAction } from '@wordpress/hooks';
|
|
15
21
|
import { useInstanceId } from '@wordpress/compose';
|
|
16
22
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -19,7 +25,6 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
19
25
|
* Internal dependencies
|
|
20
26
|
*/
|
|
21
27
|
import { getWPAdminURL } from '../../utils/url';
|
|
22
|
-
import PostPreviewButton from '../post-preview-button';
|
|
23
28
|
import { store as editorStore } from '../../store';
|
|
24
29
|
|
|
25
30
|
export default function PostLockedModal() {
|
|
@@ -34,6 +39,7 @@ export default function PostLockedModal() {
|
|
|
34
39
|
postLockUtils,
|
|
35
40
|
activePostLock,
|
|
36
41
|
postType,
|
|
42
|
+
previewLink,
|
|
37
43
|
} = useSelect( ( select ) => {
|
|
38
44
|
const {
|
|
39
45
|
isPostLocked,
|
|
@@ -42,6 +48,7 @@ export default function PostLockedModal() {
|
|
|
42
48
|
getCurrentPostId,
|
|
43
49
|
getActivePostLock,
|
|
44
50
|
getEditedPostAttribute,
|
|
51
|
+
getEditedPostPreviewLink,
|
|
45
52
|
getEditorSettings,
|
|
46
53
|
} = select( editorStore );
|
|
47
54
|
const { getPostType } = select( coreStore );
|
|
@@ -53,6 +60,7 @@ export default function PostLockedModal() {
|
|
|
53
60
|
postLockUtils: getEditorSettings().postLockUtils,
|
|
54
61
|
activePostLock: getActivePostLock(),
|
|
55
62
|
postType: getPostType( getEditedPostAttribute( 'type' ) ),
|
|
63
|
+
previewLink: getEditedPostPreviewLink(),
|
|
56
64
|
};
|
|
57
65
|
}, [] );
|
|
58
66
|
|
|
@@ -94,7 +102,8 @@ export default function PostLockedModal() {
|
|
|
94
102
|
isLocked: true,
|
|
95
103
|
isTakeover: true,
|
|
96
104
|
user: {
|
|
97
|
-
|
|
105
|
+
name: received.lock_error.name,
|
|
106
|
+
avatar: received.lock_error.avatar_src_2x,
|
|
98
107
|
},
|
|
99
108
|
} );
|
|
100
109
|
} else if ( received.new_lock ) {
|
|
@@ -158,13 +167,13 @@ export default function PostLockedModal() {
|
|
|
158
167
|
const allPostsUrl = getWPAdminURL( 'edit.php', {
|
|
159
168
|
post_type: get( postType, [ 'slug' ] ),
|
|
160
169
|
} );
|
|
161
|
-
const allPostsLabel = __( 'Exit
|
|
170
|
+
const allPostsLabel = __( 'Exit editor' );
|
|
162
171
|
return (
|
|
163
172
|
<Modal
|
|
164
173
|
title={
|
|
165
174
|
isTakeover
|
|
166
|
-
? __( 'Someone else has taken over this post
|
|
167
|
-
: __( 'This post is already being edited
|
|
175
|
+
? __( 'Someone else has taken over this post' )
|
|
176
|
+
: __( 'This post is already being edited' )
|
|
168
177
|
}
|
|
169
178
|
focusOnMount={ true }
|
|
170
179
|
shouldCloseOnClickOutside={ false }
|
|
@@ -177,58 +186,88 @@ export default function PostLockedModal() {
|
|
|
177
186
|
src={ userAvatar }
|
|
178
187
|
alt={ __( 'Avatar' ) }
|
|
179
188
|
className="editor-post-locked-modal__avatar"
|
|
189
|
+
width={ 64 }
|
|
190
|
+
height={ 64 }
|
|
180
191
|
/>
|
|
181
192
|
) }
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
<
|
|
185
|
-
{
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
193
|
+
<div>
|
|
194
|
+
{ !! isTakeover && (
|
|
195
|
+
<p>
|
|
196
|
+
{ createInterpolateElement(
|
|
197
|
+
userDisplayName
|
|
198
|
+
? sprintf(
|
|
199
|
+
/* translators: %s: user's display name */
|
|
200
|
+
__(
|
|
201
|
+
'<strong>%s</strong> now has editing control of this posts (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
202
|
+
),
|
|
203
|
+
userDisplayName
|
|
204
|
+
)
|
|
205
|
+
: __(
|
|
206
|
+
'Another user now has editing control of this post (<PreviewLink />). Don’t worry, your changes up to this moment have been saved.'
|
|
207
|
+
),
|
|
208
|
+
{
|
|
209
|
+
strong: <strong />,
|
|
210
|
+
PreviewLink: (
|
|
211
|
+
<ExternalLink href={ previewLink }>
|
|
212
|
+
{ __( 'preview' ) }
|
|
213
|
+
</ExternalLink>
|
|
214
|
+
),
|
|
215
|
+
}
|
|
216
|
+
) }
|
|
217
|
+
</p>
|
|
218
|
+
) }
|
|
219
|
+
{ ! isTakeover && (
|
|
220
|
+
<>
|
|
221
|
+
<p>
|
|
222
|
+
{ createInterpolateElement(
|
|
223
|
+
userDisplayName
|
|
224
|
+
? sprintf(
|
|
225
|
+
/* translators: %s: user's display name */
|
|
226
|
+
__(
|
|
227
|
+
'<strong>%s</strong> is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
|
|
228
|
+
),
|
|
229
|
+
userDisplayName
|
|
230
|
+
)
|
|
231
|
+
: __(
|
|
232
|
+
'Another user is currently working on this post (<PreviewLink />), which means you cannot make changes, unless you take over.'
|
|
233
|
+
),
|
|
234
|
+
{
|
|
235
|
+
strong: <strong />,
|
|
236
|
+
PreviewLink: (
|
|
237
|
+
<ExternalLink href={ previewLink }>
|
|
238
|
+
{ __( 'preview' ) }
|
|
239
|
+
</ExternalLink>
|
|
190
240
|
),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
241
|
+
}
|
|
242
|
+
) }
|
|
243
|
+
</p>
|
|
244
|
+
<p>
|
|
245
|
+
{ __(
|
|
246
|
+
'If you take over, the other user will lose editing control to the post, but their changes will be saved.'
|
|
247
|
+
) }
|
|
248
|
+
</p>
|
|
249
|
+
</>
|
|
250
|
+
) }
|
|
251
|
+
|
|
252
|
+
<Flex
|
|
253
|
+
className="editor-post-locked-modal__buttons"
|
|
254
|
+
justify="flex-end"
|
|
255
|
+
expanded={ false }
|
|
256
|
+
>
|
|
257
|
+
{ ! isTakeover && (
|
|
258
|
+
<FlexItem>
|
|
259
|
+
<Button variant="tertiary" href={ unlockUrl }>
|
|
260
|
+
{ __( 'Take over' ) }
|
|
261
|
+
</Button>
|
|
262
|
+
</FlexItem>
|
|
263
|
+
) }
|
|
264
|
+
<FlexItem>
|
|
199
265
|
<Button variant="primary" href={ allPostsUrl }>
|
|
200
266
|
{ allPostsLabel }
|
|
201
267
|
</Button>
|
|
202
|
-
</
|
|
203
|
-
</
|
|
204
|
-
|
|
205
|
-
{ ! isTakeover && (
|
|
206
|
-
<div>
|
|
207
|
-
<div>
|
|
208
|
-
{ userDisplayName
|
|
209
|
-
? sprintf(
|
|
210
|
-
/* translators: %s: user's display name */
|
|
211
|
-
__(
|
|
212
|
-
'%s is currently working on this post, which means you cannot make changes, unless you take over.'
|
|
213
|
-
),
|
|
214
|
-
userDisplayName
|
|
215
|
-
)
|
|
216
|
-
: __(
|
|
217
|
-
'Another user is currently working on this post, which means you cannot make changes, unless you take over.'
|
|
218
|
-
) }
|
|
219
|
-
</div>
|
|
220
|
-
|
|
221
|
-
<div className="editor-post-locked-modal__buttons">
|
|
222
|
-
<Button variant="secondary" href={ allPostsUrl }>
|
|
223
|
-
{ allPostsLabel }
|
|
224
|
-
</Button>
|
|
225
|
-
<PostPreviewButton />
|
|
226
|
-
<Button variant="primary" href={ unlockUrl }>
|
|
227
|
-
{ __( 'Take Over' ) }
|
|
228
|
-
</Button>
|
|
229
|
-
</div>
|
|
230
|
-
</div>
|
|
231
|
-
) }
|
|
268
|
+
</FlexItem>
|
|
269
|
+
</Flex>
|
|
270
|
+
</div>
|
|
232
271
|
</Modal>
|
|
233
272
|
);
|
|
234
273
|
}
|
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
.editor-post-locked-modal {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
padding-left: 10px;
|
|
5
|
-
padding-top: 10px;
|
|
6
|
-
max-width: 480px;
|
|
7
|
-
|
|
8
|
-
.components-modal__header {
|
|
9
|
-
height: 36px;
|
|
2
|
+
@include break-small() {
|
|
3
|
+
max-width: $break-mobile;
|
|
10
4
|
}
|
|
11
5
|
|
|
12
6
|
.components-modal__content {
|
|
13
|
-
|
|
7
|
+
display: flex;
|
|
14
8
|
}
|
|
15
9
|
}
|
|
16
10
|
|
|
17
11
|
.editor-post-locked-modal__buttons {
|
|
18
|
-
margin-top:
|
|
19
|
-
|
|
20
|
-
.components-button {
|
|
21
|
-
margin-right: 5px;
|
|
22
|
-
}
|
|
12
|
+
margin-top: $grid-unit-30;
|
|
23
13
|
}
|
|
24
14
|
|
|
25
15
|
.editor-post-locked-modal__avatar {
|
|
26
|
-
|
|
27
|
-
margin:
|
|
28
|
-
margin-right:
|
|
16
|
+
border-radius: $radius-block-ui;
|
|
17
|
+
margin-top: $grid-unit-20;
|
|
18
|
+
margin-right: $grid-unit-30;
|
|
29
19
|
}
|