@wordpress/editor 14.8.2 → 14.8.4
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/editor-interface/index.js +7 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +2 -6
- package/build/components/plugin-sidebar/index.js.map +1 -1
- 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/components/preview-dropdown/index.js +9 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/visual-editor/index.js +6 -6
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/zoom-out-toggle/index.js +17 -5
- package/build/components/zoom-out-toggle/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +7 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +2 -6
- package/build-module/components/plugin-sidebar/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-module/components/preview-dropdown/index.js +9 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +6 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/zoom-out-toggle/index.js +17 -5
- package/build-module/components/zoom-out-toggle/index.js.map +1 -1
- package/build-style/style-rtl.css +2 -2
- package/build-style/style.css +2 -2
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- 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/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/zoom-out-toggle/index.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/components/editor-interface/index.js +6 -4
- package/src/components/plugin-sidebar/index.js +1 -6
- 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/src/components/preview-dropdown/index.js +8 -1
- package/src/components/visual-editor/index.js +8 -6
- package/src/components/zoom-out-toggle/index.js +17 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
7
6
|
import { ComplementaryArea } from '@wordpress/interface';
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -77,12 +76,9 @@ import { store as editorStore } from '../../store';
|
|
|
77
76
|
* ```
|
|
78
77
|
*/
|
|
79
78
|
export default function PluginSidebar( { className, ...props } ) {
|
|
80
|
-
const { postTitle
|
|
79
|
+
const { postTitle } = useSelect( ( select ) => {
|
|
81
80
|
return {
|
|
82
81
|
postTitle: select( editorStore ).getEditedPostAttribute( 'title' ),
|
|
83
|
-
shortcut: select(
|
|
84
|
-
keyboardShortcutsStore
|
|
85
|
-
).getShortcutRepresentation( 'core/editor/toggle-sidebar' ),
|
|
86
82
|
};
|
|
87
83
|
}, [] );
|
|
88
84
|
return (
|
|
@@ -91,7 +87,6 @@ export default function PluginSidebar( { className, ...props } ) {
|
|
|
91
87
|
className="editor-sidebar"
|
|
92
88
|
smallScreenTitle={ postTitle || __( '(no title)' ) }
|
|
93
89
|
scope="core"
|
|
94
|
-
toggleShortcut={ shortcut }
|
|
95
90
|
{ ...props }
|
|
96
91
|
/>
|
|
97
92
|
);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Button } from '@wordpress/components';
|
|
5
|
-
import { Component
|
|
5
|
+
import { Component } from '@wordpress/element';
|
|
6
6
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
7
7
|
import { compose } from '@wordpress/compose';
|
|
8
8
|
|
|
@@ -17,7 +17,6 @@ const noop = () => {};
|
|
|
17
17
|
export class PostPublishButton extends Component {
|
|
18
18
|
constructor( props ) {
|
|
19
19
|
super( props );
|
|
20
|
-
this.buttonNode = createRef();
|
|
21
20
|
|
|
22
21
|
this.createOnClick = this.createOnClick.bind( this );
|
|
23
22
|
this.closeEntitiesSavedStates =
|
|
@@ -28,21 +27,6 @@ export class PostPublishButton extends Component {
|
|
|
28
27
|
};
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
componentDidMount() {
|
|
32
|
-
if ( this.props.focusOnMount ) {
|
|
33
|
-
// This timeout is necessary to make sure the `useEffect` hook of
|
|
34
|
-
// `useFocusReturn` gets the correct element (the button that opens the
|
|
35
|
-
// PostPublishPanel) otherwise it will get this button.
|
|
36
|
-
this.timeoutID = setTimeout( () => {
|
|
37
|
-
this.buttonNode.current.focus();
|
|
38
|
-
}, 0 );
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
componentWillUnmount() {
|
|
43
|
-
clearTimeout( this.timeoutID );
|
|
44
|
-
}
|
|
45
|
-
|
|
46
30
|
createOnClick( callback ) {
|
|
47
31
|
return ( ...args ) => {
|
|
48
32
|
const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
|
|
@@ -182,7 +166,6 @@ export class PostPublishButton extends Component {
|
|
|
182
166
|
return (
|
|
183
167
|
<>
|
|
184
168
|
<Button
|
|
185
|
-
ref={ this.buttonNode }
|
|
186
169
|
{ ...componentProps }
|
|
187
170
|
className={ `${ componentProps.className } editor-post-publish-button__button` }
|
|
188
171
|
size="compact"
|
|
@@ -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>
|
|
@@ -26,6 +26,7 @@ import { ActionItem } from '@wordpress/interface';
|
|
|
26
26
|
* Internal dependencies
|
|
27
27
|
*/
|
|
28
28
|
import { store as editorStore } from '../../store';
|
|
29
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
29
30
|
import PostPreviewButton from '../post-preview-button';
|
|
30
31
|
|
|
31
32
|
export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
@@ -44,6 +45,12 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
44
45
|
};
|
|
45
46
|
}, [] );
|
|
46
47
|
const { setDeviceType } = useDispatch( editorStore );
|
|
48
|
+
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
|
|
49
|
+
|
|
50
|
+
const handleDevicePreviewChange = ( newDeviceType ) => {
|
|
51
|
+
setDeviceType( newDeviceType );
|
|
52
|
+
__unstableSetEditorMode( 'edit' );
|
|
53
|
+
};
|
|
47
54
|
|
|
48
55
|
const isMobile = useViewportMatch( 'medium', '<' );
|
|
49
56
|
if ( isMobile ) {
|
|
@@ -113,7 +120,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
113
120
|
<MenuItemsChoice
|
|
114
121
|
choices={ choices }
|
|
115
122
|
value={ deviceType }
|
|
116
|
-
onSelect={
|
|
123
|
+
onSelect={ handleDevicePreviewChange }
|
|
117
124
|
/>
|
|
118
125
|
</MenuGroup>
|
|
119
126
|
{ isTemplate && (
|
|
@@ -174,17 +174,19 @@ function VisualEditor( {
|
|
|
174
174
|
hasRootPaddingAwareAlignments,
|
|
175
175
|
themeHasDisabledLayoutStyles,
|
|
176
176
|
themeSupportsLayout,
|
|
177
|
-
|
|
177
|
+
isZoomedOut,
|
|
178
178
|
} = useSelect( ( select ) => {
|
|
179
|
-
const { getSettings,
|
|
180
|
-
select( blockEditorStore )
|
|
179
|
+
const { getSettings, isZoomOut: _isZoomOut } = unlock(
|
|
180
|
+
select( blockEditorStore )
|
|
181
|
+
);
|
|
182
|
+
|
|
181
183
|
const _settings = getSettings();
|
|
182
184
|
return {
|
|
183
185
|
themeHasDisabledLayoutStyles: _settings.disableLayoutStyles,
|
|
184
186
|
themeSupportsLayout: _settings.supportsLayout,
|
|
185
187
|
hasRootPaddingAwareAlignments:
|
|
186
188
|
_settings.__experimentalFeatures?.useRootPaddingAwareAlignments,
|
|
187
|
-
|
|
189
|
+
isZoomedOut: _isZoomOut(),
|
|
188
190
|
};
|
|
189
191
|
}, [] );
|
|
190
192
|
|
|
@@ -336,7 +338,7 @@ function VisualEditor( {
|
|
|
336
338
|
] );
|
|
337
339
|
|
|
338
340
|
const zoomOutProps =
|
|
339
|
-
|
|
341
|
+
isZoomedOut && ! isTabletViewport
|
|
340
342
|
? {
|
|
341
343
|
scale: 'default',
|
|
342
344
|
frameSize: '48px',
|
|
@@ -355,7 +357,7 @@ function VisualEditor( {
|
|
|
355
357
|
// Disable resizing in mobile viewport.
|
|
356
358
|
! isMobileViewport &&
|
|
357
359
|
// Dsiable resizing in zoomed-out mode.
|
|
358
|
-
!
|
|
360
|
+
! isZoomedOut;
|
|
359
361
|
const shouldIframe =
|
|
360
362
|
! disableIframe || [ 'Tablet', 'Mobile' ].includes( deviceType );
|
|
361
363
|
|
|
@@ -8,16 +8,27 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
8
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
9
|
import { square as zoomOutIcon } from '@wordpress/icons';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { unlock } from '../../lock-unlock';
|
|
15
|
+
|
|
11
16
|
const ZoomOutToggle = () => {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
|
|
17
|
+
const { isZoomOut } = useSelect( ( select ) => ( {
|
|
18
|
+
isZoomOut: unlock( select( blockEditorStore ) ).isZoomOut(),
|
|
15
19
|
} ) );
|
|
16
20
|
|
|
17
|
-
const { __unstableSetEditorMode } =
|
|
21
|
+
const { resetZoomLevel, setZoomLevel, __unstableSetEditorMode } = unlock(
|
|
22
|
+
useDispatch( blockEditorStore )
|
|
23
|
+
);
|
|
18
24
|
|
|
19
25
|
const handleZoomOut = () => {
|
|
20
|
-
|
|
26
|
+
if ( isZoomOut ) {
|
|
27
|
+
resetZoomLevel();
|
|
28
|
+
} else {
|
|
29
|
+
setZoomLevel( 50 );
|
|
30
|
+
}
|
|
31
|
+
__unstableSetEditorMode( isZoomOut ? 'edit' : 'zoom-out' );
|
|
21
32
|
};
|
|
22
33
|
|
|
23
34
|
return (
|
|
@@ -25,7 +36,7 @@ const ZoomOutToggle = () => {
|
|
|
25
36
|
onClick={ handleZoomOut }
|
|
26
37
|
icon={ zoomOutIcon }
|
|
27
38
|
label={ __( 'Toggle Zoom Out' ) }
|
|
28
|
-
isPressed={
|
|
39
|
+
isPressed={ isZoomOut }
|
|
29
40
|
size="compact"
|
|
30
41
|
/>
|
|
31
42
|
);
|