Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
5682b92
Page view: Add link field control
gigitux Sep 10, 2024
98c65ea
Drag and Drop: When dragging a mix of video, audio, and image blocks,…
andrewserong Sep 11, 2024
da8f874
Disallow setting grid block rows/columns to zero (#65217)
talldan Sep 11, 2024
ec58c51
Image: Adds the block controls for uploading image. (#64320)
vipul0425 Sep 11, 2024
6a60081
Fix resizing to max width in classic themes (#64819)
kevin940726 Sep 11, 2024
2f939a7
Fix image block crash (#65222)
t-hamano Sep 11, 2024
e820a6c
Merge branch 'add/@wordpress-fields' of github.com:gigitux/gutenberg …
gigitux Sep 11, 2024
20ca80f
DatePicker: better hover/focus styles (#65117)
ciampo Sep 11, 2024
5daa582
Navigator Screen: warn if path doesn't follow a URL-like scheme (#65231)
ciampo Sep 11, 2024
3d5dacd
Populate block context with inherited post type from template slug (#…
SantosGuillamot Sep 11, 2024
b276647
Remove Warning and add notice for Navigation (#63921)
AKSHAT2802 Sep 11, 2024
f8a19eb
Build: Prepare build for more script modules (#65064)
sirreal Sep 11, 2024
30def0b
Merge branch 'add/@wordpress-fields' of github.com:gigitux/gutenberg …
gigitux Sep 11, 2024
0855668
move slug field control to @wordpress/fields package
gigitux Sep 11, 2024
0c0e605
Add @wordpress/fields package (#65230)
gigitux Sep 11, 2024
e1ad8c2
Improve Tabs indicator animation and related utils (#64926)
DaniGuardiola Sep 11, 2024
f1aa523
Fix Content Only Toolbar icon focus style (#64940)
jeryj Sep 11, 2024
a15a93d
Remove colons from control labels (#65205)
mirka Sep 11, 2024
8a7df39
Fix: Moving the last page item to the the trash causes a crash. (#65236)
jorgefilipecosta Sep 11, 2024
8a74d31
Normalize block inspector controls spacing (#64526)
mirka Sep 11, 2024
d5ab90a
Bump plugin version to 19.2.0
gutenbergplugin Sep 11, 2024
e9d31c2
Update Changelog for 19.2.0
gutenbergplugin Sep 11, 2024
f073eb1
Add the spacing for horizontal and vertical for block gap on buttons …
hbhalodia Sep 12, 2024
f1403c4
Plugin: Remove 'function_exists' checks for methods with 'gutenberg' …
Mamaduka Sep 12, 2024
d649865
Scripts: Update stylelint dependency and the default config (#64828)
mikeybinns Sep 12, 2024
0e671a2
Show top level sections in List View in Zoom Out mode (#65202)
getdave Sep 12, 2024
394288f
Add __next40pxDefaultSize for files in editor 4 (#65140)
AKSHAT2802 Sep 12, 2024
a76c475
Close inserter on exiting Zoom Out to edit (#65194)
getdave Sep 12, 2024
1a60dff
Make `wordpress/fields` a private package (#65269)
oandregal Sep 12, 2024
9bdfebf
Build Plugin: Simplify and improve zip contents (#65232)
sirreal Sep 12, 2024
bc60075
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux Sep 12, 2024
f88e629
A11y: Add Script Module (#65101)
sirreal Sep 12, 2024
92661e7
Build Tooling: Correctly generate PHP files for server-side rendering…
t-hamano Sep 12, 2024
297e9ca
Form Input: Don't use `flex-direction: row-reverse` for checkbox fiel…
t-hamano Sep 12, 2024
33bdcbc
Remove babel from script-modules build (#65279)
sirreal Sep 12, 2024
3368298
Switch from UglifyJS to Terser to build the polyfill script (#65278)
jsnajdr Sep 12, 2024
0cbc7be
Fix typo in Slot Fills documentation (#65275)
greenworld Sep 12, 2024
a18d831
Add props for buttons in editor 2 (#65083)
AKSHAT2802 Sep 12, 2024
4c31695
Update: Remove unused css selectors. (#65276)
jorgefilipecosta Sep 12, 2024
67fe7b0
Add Zoom Out toggle to editor header when experiment enabled (#65183)
getdave Sep 12, 2024
eba5eb7
Block Bindings: Try gap 0 on attribute items. (#65277)
cbravobernal Sep 12, 2024
d329bfb
[Fields] Migrate store and actions from editor package to fields pack…
gigitux Sep 12, 2024
fb4ba26
Align popover alt variant styling with block toolbar (#65263)
jameskoster Sep 12, 2024
6d32f4f
BoxControl: Fix critical error when null value is passed (#65287)
t-hamano Sep 12, 2024
a895274
Add props for buttons in editor 1 (#65068)
AKSHAT2802 Sep 12, 2024
1664022
Grid: In RTL languages, the resize handles point in the opposite dire…
rohitmathur-7 Sep 13, 2024
632d8d6
Spacing control: Replace sides dropdwon with link button (#65193)
madhusudhand Sep 13, 2024
33e2fad
Styleling config: Fix stylelint config missing files for npm (#65313)
mikeybinns Sep 13, 2024
dfc28b0
Patterns: Change deprecated social icons for standard in e2e (#65312)
cbravobernal Sep 13, 2024
12660ca
DataViews: improve UX of bundled views for Pages (#65295)
oandregal Sep 13, 2024
b0abc74
Split content view with meta boxes (#64351)
stokesman Sep 13, 2024
9e88d86
Update minimum required version in PHP. (#65301)
peterwilsoncc Sep 13, 2024
257d26a
DimensionsPanel: Apply 40px default size to UI when no spacing preset…
t-hamano Sep 13, 2024
8a815ee
DataViews: Use Dropdown for views config dialog (#65314)
ntsekouras Sep 13, 2024
e102033
Block Editor: Use static access for selector in 'useZoomOutModeExit' …
Mamaduka Sep 13, 2024
1df91fb
Add: Typography styling support to the navigation submenu block. (#65…
jorgefilipecosta Sep 13, 2024
b10ca39
Editor: Use hooks instead of HoC in `BlockManager` (#65349)
t-hamano Sep 14, 2024
9f79666
Global Styles: refactor site background controls and move site global…
ramonjd Sep 16, 2024
45d33f0
Query loop / Post template: Enable post format filter (#64167)
carolinan Sep 16, 2024
ea0ea78
Put Replace in own group to give it borders (#64849)
jeryj Sep 16, 2024
d9e3075
Pass the comments query paged arg to functions (#63698)
SantosGuillamot Sep 16, 2024
38e74db
Add JSDoc block for getSectionRootClientId in block editor package (#…
colorful-tones Sep 16, 2024
4ca78cd
Fix Tabs styling in Font Library modal (#65330)
mirka Sep 16, 2024
c80fc61
Fix: Button: Replace remaining 40px default size violation [Edit Site…
hbhalodia Sep 16, 2024
edd4148
Convert EmbedPreview component to functional component (#51325)
louwie17 Sep 16, 2024
e2d7722
Update Card radius (#65053)
jameskoster Sep 16, 2024
2ac16e0
Docs: Update the content of the API version 3 section in the Block AP…
t-hamano Sep 16, 2024
c0e3ad8
Bump the react-native group across 1 directory with 2 updates (#65321)
dependabot[bot] Sep 16, 2024
788bb9e
DocumentBar: replace icon with post type label (#65170)
creativecoder Sep 17, 2024
46d898e
Global Styles: Update REST controller override method and backport ch…
Mamaduka Sep 17, 2024
d32a5b6
BoxControl: Add lint rule for 40px size prop usage (#65341)
mirka Sep 17, 2024
5b037d7
ButtonGroup: Fix story to show what the component does (#65336)
mirka Sep 17, 2024
1a23ed6
Image cropping: skip making an API request if there are no changes to…
andrewserong Sep 17, 2024
f82bc32
Add __next40pxDefaultSize for files in editor 3 (#65139)
AKSHAT2802 Sep 17, 2024
3a2f74f
Rename edit-post__fade-in-animation and unify keyframe definitions (#…
ciampo Sep 17, 2024
524516d
Add __next40pxDefaultSize for edit-widgets files (#65367)
dhruvang21 Sep 17, 2024
d95c35d
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/link-…
gigitux Sep 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Zoom Out toggle to editor header when experiment enabled (WordPre…
…ss#65183)

* Add toggle when experiment active

* Add new square icon

* Use new icon

* Remove zoom out desktop 50% from device preview dropdown

* Fix console error for stroke-width to strokeWidth

---------

Co-authored-by: Jerry Jones <jones.jeremydavid@gmail.com>
Co-authored-by: getdave <get_dave@git.wordpress.org>
Co-authored-by: jeryj <jeryj@git.wordpress.org>
Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: richtabor <richtabor@git.wordpress.org>
  • Loading branch information
6 people authored Sep 12, 2024
commit 67fe7b00f49d77baccf58ba1ac4105b93396ee0a
9 changes: 9 additions & 0 deletions packages/editor/src/components/header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import PostPublishButtonOrToggle from '../post-publish-button/post-publish-butto
import PostSavedState from '../post-saved-state';
import PostViewLink from '../post-view-link';
import PreviewDropdown from '../preview-dropdown';
import ZoomOutToggle from '../zoom-out-toggle';
import { store as editorStore } from '../../store';

const toolbarVariations = {
Expand All @@ -48,6 +49,9 @@ function Header( {
title,
icon,
} ) {
const zoomOutExperimentEnabled =
window.__experimentalEnableZoomOutExperiment;

const isWideViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );
Expand Down Expand Up @@ -142,9 +146,13 @@ function Header( {
forceIsAutosaveable={ forceIsDirty }
/>
<PostViewLink />

{ zoomOutExperimentEnabled && <ZoomOutToggle /> }

{ ( isWideViewport || ! showIconLabels ) && (
<PinnedItems.Slot scope="core" />
) }

{ ! customSaveButton && (
<PostPublishButtonOrToggle
forceIsDirty={ forceIsDirty }
Expand All @@ -153,6 +161,7 @@ function Header( {
}
/>
) }

{ customSaveButton }
<MoreMenu />
</motion.div>
Expand Down
110 changes: 26 additions & 84 deletions packages/editor/src/components/preview-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ import { __ } from '@wordpress/i18n';
import { desktop, mobile, tablet, external } from '@wordpress/icons';
import { useSelect, useDispatch } from '@wordpress/data';
import { store as coreStore } from '@wordpress/core-data';
import { useEffect, useRef } from '@wordpress/element';
import { store as preferencesStore } from '@wordpress/preferences';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { ActionItem } from '@wordpress/interface';

/**
Expand All @@ -31,49 +29,21 @@ import { store as editorStore } from '../../store';
import PostPreviewButton from '../post-preview-button';

export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
const {
deviceType,
editorMode,
homeUrl,
isTemplate,
isViewable,
showIconLabels,
} = useSelect( ( select ) => {
const { getDeviceType, getCurrentPostType } = select( editorStore );
const { getEntityRecord, getPostType } = select( coreStore );
const { get } = select( preferencesStore );
const { __unstableGetEditorMode } = select( blockEditorStore );
const _currentPostType = getCurrentPostType();
return {
deviceType: getDeviceType(),
editorMode: __unstableGetEditorMode(),
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
isTemplate: _currentPostType === 'wp_template',
isViewable: getPostType( _currentPostType )?.viewable ?? false,
showIconLabels: get( 'core', 'showIconLabels' ),
};
}, [] );
const { deviceType, homeUrl, isTemplate, isViewable, showIconLabels } =
useSelect( ( select ) => {
const { getDeviceType, getCurrentPostType } = select( editorStore );
const { getEntityRecord, getPostType } = select( coreStore );
const { get } = select( preferencesStore );
const _currentPostType = getCurrentPostType();
return {
deviceType: getDeviceType(),
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
isTemplate: _currentPostType === 'wp_template',
isViewable: getPostType( _currentPostType )?.viewable ?? false,
showIconLabels: get( 'core', 'showIconLabels' ),
};
}, [] );
const { setDeviceType } = useDispatch( editorStore );
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );

/**
* Save the original editing mode in a ref to restore it when we exit zoom out.
*/
const originalEditingModeRef = useRef( editorMode );
useEffect( () => {
if ( editorMode !== 'zoom-out' ) {
originalEditingModeRef.current = editorMode;
}

return () => {
if (
editorMode === 'zoom-out' &&
editorMode !== originalEditingModeRef.current
) {
__unstableSetEditorMode( originalEditingModeRef.current );
}
};
}, [ editorMode, __unstableSetEditorMode ] );

const isMobile = useViewportMatch( 'medium', '<' );
if ( isMobile ) {
Expand Down Expand Up @@ -112,44 +82,17 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
label: __( 'Desktop' ),
icon: desktop,
},
{
value: 'Tablet',
label: __( 'Tablet' ),
icon: tablet,
},
{
value: 'Mobile',
label: __( 'Mobile' ),
icon: mobile,
},
];
if ( window.__experimentalEnableZoomOutExperiment ) {
choices.push( {
value: 'ZoomOut',
label: __( 'Desktop (50%)' ),
icon: desktop,
} );
}
choices.push( {
value: 'Tablet',
label: __( 'Tablet' ),
icon: tablet,
} );
choices.push( {
value: 'Mobile',
label: __( 'Mobile' ),
icon: mobile,
} );

const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;

/**
* Handles the selection of a device type.
*
* @param {string} value The device type.
*/
const onSelect = ( value ) => {
let newEditorMode = originalEditingModeRef.current;

if ( value === 'ZoomOut' ) {
newEditorMode = 'zoom-out';
setDeviceType( 'Desktop' );
} else {
setDeviceType( value );
}

__unstableSetEditorMode( newEditorMode );
};

return (
<DropdownMenu
Expand All @@ -161,7 +104,6 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
toggleProps={ toggleProps }
menuProps={ menuProps }
icon={ deviceIcons[ deviceType.toLowerCase() ] }
text={ editorMode === 'zoom-out' ? __( '50%' ) : undefined }
label={ __( 'View' ) }
disableOpenOnArrowDown={ disabled }
>
Expand All @@ -170,8 +112,8 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
<MenuGroup>
<MenuItemsChoice
choices={ choices }
value={ previewValue }
onSelect={ onSelect }
value={ deviceType }
onSelect={ setDeviceType }
/>
</MenuGroup>
{ isTemplate && (
Expand Down
34 changes: 34 additions & 0 deletions packages/editor/src/components/zoom-out-toggle/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* WordPress dependencies
*/
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

import { useDispatch, useSelect } from '@wordpress/data';
import { store as blockEditorStore } from '@wordpress/block-editor';
import { square as zoomOutIcon } from '@wordpress/icons';

const ZoomOutToggle = () => {
const { isZoomOutMode } = useSelect( ( select ) => ( {
isZoomOutMode:
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
} ) );

const { __unstableSetEditorMode } = useDispatch( blockEditorStore );

const handleZoomOut = () => {
__unstableSetEditorMode( isZoomOutMode ? 'edit' : 'zoom-out' );
};

return (
<Button
onClick={ handleZoomOut }
icon={ zoomOutIcon }
label={ __( 'Toggle Zoom Out' ) }
isPressed={ isZoomOutMode }
size="compact"
/>
);
};

export default ZoomOutToggle;
1 change: 1 addition & 0 deletions packages/icons/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export { default as store } from './library/store';
export { default as stretchFullWidth } from './library/stretch-full-width';
export { default as styles } from './library/styles';
export { default as shipping } from './library/shipping';
export { default as square } from './library/square';
export { default as stretchWide } from './library/stretch-wide';
export { default as subscript } from './library/subscript';
export { default as superscript } from './library/superscript';
Expand Down
18 changes: 18 additions & 0 deletions packages/icons/src/library/square.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/primitives';

const square = (
<SVG xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">
<Path
fill="none"
d="M5.75 12.75V18.25H11.25M12.75 5.75H18.25V11.25"
stroke="currentColor"
strokeWidth="1.5"
strokeLinecap="square"
/>
</SVG>
);

export default square;