@wordpress/editor 14.8.1 → 14.8.3
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/build/components/post-publish-button/index.js +0 -15
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +19 -7
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +1 -16
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +20 -8
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-style/style-rtl.css +2 -2
- package/build-style/style.css +2 -2
- package/build-types/components/post-publish-button/index.d.ts +0 -4
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts +4 -0
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/post-publish-button/index.js +1 -18
- package/src/components/post-publish-panel/index.js +22 -8
- package/src/components/post-publish-panel/style.scss +2 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +21 -21
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { Component } from '@wordpress/element';
|
|
5
|
+
import { Component, createRef } from '@wordpress/element';
|
|
6
6
|
import {
|
|
7
7
|
Button,
|
|
8
8
|
Spinner,
|
|
@@ -27,6 +27,20 @@ export class PostPublishPanel extends Component {
|
|
|
27
27
|
constructor() {
|
|
28
28
|
super( ...arguments );
|
|
29
29
|
this.onSubmit = this.onSubmit.bind( this );
|
|
30
|
+
this.cancelButtonNode = createRef();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
componentDidMount() {
|
|
34
|
+
// This timeout is necessary to make sure the `useEffect` hook of
|
|
35
|
+
// `useFocusReturn` gets the correct element (the button that opens the
|
|
36
|
+
// PostPublishPanel) otherwise it will get this button.
|
|
37
|
+
this.timeoutID = setTimeout( () => {
|
|
38
|
+
this.cancelButtonNode.current.focus();
|
|
39
|
+
}, 0 );
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
componentWillUnmount() {
|
|
43
|
+
clearTimeout( this.timeoutID );
|
|
30
44
|
}
|
|
31
45
|
|
|
32
46
|
componentDidUpdate( prevProps ) {
|
|
@@ -85,15 +99,9 @@ export class PostPublishPanel extends Component {
|
|
|
85
99
|
/>
|
|
86
100
|
) : (
|
|
87
101
|
<>
|
|
88
|
-
<div className="editor-post-publish-panel__header-publish-button">
|
|
89
|
-
<PostPublishButton
|
|
90
|
-
focusOnMount
|
|
91
|
-
onSubmit={ this.onSubmit }
|
|
92
|
-
forceIsDirty={ forceIsDirty }
|
|
93
|
-
/>
|
|
94
|
-
</div>
|
|
95
102
|
<div className="editor-post-publish-panel__header-cancel-button">
|
|
96
103
|
<Button
|
|
104
|
+
ref={ this.cancelButtonNode }
|
|
97
105
|
accessibleWhenDisabled
|
|
98
106
|
disabled={ isSavingNonPostEntityChanges }
|
|
99
107
|
onClick={ onClose }
|
|
@@ -103,6 +111,12 @@ export class PostPublishPanel extends Component {
|
|
|
103
111
|
{ __( 'Cancel' ) }
|
|
104
112
|
</Button>
|
|
105
113
|
</div>
|
|
114
|
+
<div className="editor-post-publish-panel__header-publish-button">
|
|
115
|
+
<PostPublishButton
|
|
116
|
+
onSubmit={ this.onSubmit }
|
|
117
|
+
forceIsDirty={ forceIsDirty }
|
|
118
|
+
/>
|
|
119
|
+
</div>
|
|
106
120
|
</>
|
|
107
121
|
) }
|
|
108
122
|
</div>
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.editor-post-publish-panel__header-publish-button {
|
|
71
|
-
padding-
|
|
71
|
+
padding-left: $grid-unit-05;
|
|
72
72
|
justify-content: center;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
.editor-post-publish-panel__header-cancel-button {
|
|
76
|
-
padding-
|
|
76
|
+
padding-right: $grid-unit-05;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
.editor-post-publish-panel__header-published {
|
|
@@ -433,24 +433,24 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
|
|
|
433
433
|
class="editor-post-publish-panel__header"
|
|
434
434
|
>
|
|
435
435
|
<div
|
|
436
|
-
class="editor-post-publish-panel__header-
|
|
436
|
+
class="editor-post-publish-panel__header-cancel-button"
|
|
437
437
|
>
|
|
438
438
|
<button
|
|
439
|
-
|
|
440
|
-
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
439
|
+
class="components-button is-secondary is-compact"
|
|
441
440
|
type="button"
|
|
442
441
|
>
|
|
443
|
-
|
|
442
|
+
Cancel
|
|
444
443
|
</button>
|
|
445
444
|
</div>
|
|
446
445
|
<div
|
|
447
|
-
class="editor-post-publish-panel__header-
|
|
446
|
+
class="editor-post-publish-panel__header-publish-button"
|
|
448
447
|
>
|
|
449
448
|
<button
|
|
450
|
-
|
|
449
|
+
aria-disabled="true"
|
|
450
|
+
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
451
451
|
type="button"
|
|
452
452
|
>
|
|
453
|
-
|
|
453
|
+
Submit for Review
|
|
454
454
|
</button>
|
|
455
455
|
</div>
|
|
456
456
|
</div>
|
|
@@ -586,24 +586,24 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
|
|
|
586
586
|
class="editor-post-publish-panel__header"
|
|
587
587
|
>
|
|
588
588
|
<div
|
|
589
|
-
class="editor-post-publish-panel__header-
|
|
589
|
+
class="editor-post-publish-panel__header-cancel-button"
|
|
590
590
|
>
|
|
591
591
|
<button
|
|
592
|
-
|
|
593
|
-
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
592
|
+
class="components-button is-secondary is-compact"
|
|
594
593
|
type="button"
|
|
595
594
|
>
|
|
596
|
-
|
|
595
|
+
Cancel
|
|
597
596
|
</button>
|
|
598
597
|
</div>
|
|
599
598
|
<div
|
|
600
|
-
class="editor-post-publish-panel__header-
|
|
599
|
+
class="editor-post-publish-panel__header-publish-button"
|
|
601
600
|
>
|
|
602
601
|
<button
|
|
603
|
-
|
|
602
|
+
aria-disabled="true"
|
|
603
|
+
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
604
604
|
type="button"
|
|
605
605
|
>
|
|
606
|
-
|
|
606
|
+
Submit for Review
|
|
607
607
|
</button>
|
|
608
608
|
</div>
|
|
609
609
|
</div>
|
|
@@ -783,24 +783,24 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
783
783
|
class="editor-post-publish-panel__header"
|
|
784
784
|
>
|
|
785
785
|
<div
|
|
786
|
-
class="editor-post-publish-panel__header-
|
|
786
|
+
class="editor-post-publish-panel__header-cancel-button"
|
|
787
787
|
>
|
|
788
788
|
<button
|
|
789
|
-
|
|
790
|
-
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
789
|
+
class="components-button is-secondary is-compact"
|
|
791
790
|
type="button"
|
|
792
791
|
>
|
|
793
|
-
|
|
792
|
+
Cancel
|
|
794
793
|
</button>
|
|
795
794
|
</div>
|
|
796
795
|
<div
|
|
797
|
-
class="editor-post-publish-panel__header-
|
|
796
|
+
class="editor-post-publish-panel__header-publish-button"
|
|
798
797
|
>
|
|
799
798
|
<button
|
|
800
|
-
|
|
799
|
+
aria-disabled="true"
|
|
800
|
+
class="components-button editor-post-publish-button editor-post-publish-button__button is-primary is-compact"
|
|
801
801
|
type="button"
|
|
802
802
|
>
|
|
803
|
-
|
|
803
|
+
Submit for Review
|
|
804
804
|
</button>
|
|
805
805
|
</div>
|
|
806
806
|
</div>
|