@wordpress/editor 14.8.3 → 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/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/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-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/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/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
|
@@ -32,6 +32,8 @@ import TextEditor from '../text-editor';
|
|
|
32
32
|
import VisualEditor from '../visual-editor';
|
|
33
33
|
import EditorContentSlotFill from './content-slot-fill';
|
|
34
34
|
|
|
35
|
+
import { unlock } from '../../lock-unlock';
|
|
36
|
+
|
|
35
37
|
const interfaceLabels = {
|
|
36
38
|
/* translators: accessibility text for the editor top bar landmark region. */
|
|
37
39
|
header: __( 'Editor top bar' ),
|
|
@@ -71,12 +73,13 @@ export default function EditorInterface( {
|
|
|
71
73
|
nextShortcut,
|
|
72
74
|
showBlockBreadcrumbs,
|
|
73
75
|
documentLabel,
|
|
74
|
-
|
|
76
|
+
isZoomOut,
|
|
75
77
|
} = useSelect( ( select ) => {
|
|
76
78
|
const { get } = select( preferencesStore );
|
|
77
79
|
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
|
|
78
80
|
const editorSettings = getEditorSettings();
|
|
79
81
|
const postTypeLabel = getPostTypeLabel();
|
|
82
|
+
const { isZoomOut: _isZoomOut } = unlock( select( blockEditorStore ) );
|
|
80
83
|
|
|
81
84
|
return {
|
|
82
85
|
mode: select( editorStore ).getEditorMode(),
|
|
@@ -94,8 +97,7 @@ export default function EditorInterface( {
|
|
|
94
97
|
showBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
|
|
95
98
|
// translators: Default label for the Document in the Block Breadcrumb.
|
|
96
99
|
documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
|
|
97
|
-
|
|
98
|
-
select( blockEditorStore ).__unstableGetEditorMode(),
|
|
100
|
+
isZoomOut: _isZoomOut(),
|
|
99
101
|
};
|
|
100
102
|
}, [] );
|
|
101
103
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
@@ -206,7 +208,7 @@ export default function EditorInterface( {
|
|
|
206
208
|
isLargeViewport &&
|
|
207
209
|
showBlockBreadcrumbs &&
|
|
208
210
|
isRichEditingEnabled &&
|
|
209
|
-
|
|
211
|
+
! isZoomOut &&
|
|
210
212
|
mode === 'visual' && (
|
|
211
213
|
<BlockBreadcrumb rootLabelText={ documentLabel } />
|
|
212
214
|
)
|
|
@@ -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
|
);
|
|
@@ -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
|
);
|