Skip to content

Commit 7353218

Browse files
committed
prep build 10/19
2 parents f329719 + bcddcb6 commit 7353218

File tree

114 files changed

+2307
-867
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+2307
-867
lines changed

docs/explanations/architecture/styles.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ When a block that opts in to layout support is rendered, two things are processe
510510

511511
There are currently four layout types in use:
512512

513-
- Default/Flow: Items are stacked vertically. The parent container block is set to `display: flow` and the spacing between children is handled via vertical margins.
513+
- Default/Flow: Items are stacked vertically. The parent container block's display value isn't specified, so that it may use the default value for that HTML element. For most elements that will usually be `block`. The spacing between children is handled via vertical margins.
514514
- Constrained: Items are stacked vertically, using the same spacing logic as the Flow layout. Features constrained widths for child content, outputting widths for standard content size and wide size. Defaults to using global `contentSize` and `wideSize` values set in `settings.layout` in the `theme.json`.
515515
- Flex: Items are displayed using a Flexbox layout. Defaults to a horizontal orientation. Spacing between children is handled via the `gap` CSS property.
516516
- Grid: Items are displayed using a Grid layout. Defaults to an `auto-fill` approach to column generation but can also be set to a fixed number of columns. Spacing between children is handled via the `gap` CSS property.

docs/reference-guides/data/data-core-block-editor.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,39 @@ _Returns_
738738

739739
Returns the currently selected block, or null if there is no selected block.
740740

741+
_Usage_
742+
743+
```js
744+
import { select } from '@wordpress/data';
745+
import { store as blockEditorStore } from '@wordpress/block-editor';
746+
747+
// Set initial active block client ID
748+
let activeBlockClientId = null;
749+
750+
const getActiveBlockData = () => {
751+
const activeBlock = select( blockEditorStore ).getSelectedBlock();
752+
753+
if ( activeBlock && activeBlock.clientId !== activeBlockClientId ) {
754+
activeBlockClientId = activeBlock.clientId;
755+
756+
// Get active block name and attributes
757+
const activeBlockName = activeBlock.name;
758+
const activeBlockAttributes = activeBlock.attributes;
759+
760+
// Log active block name and attributes
761+
console.log( activeBlockName, activeBlockAttributes );
762+
}
763+
};
764+
765+
// Subscribe to changes in the editor
766+
// wp.data.subscribe(() => {
767+
// getActiveBlockData()
768+
// })
769+
770+
// Update active block data on click
771+
// onclick="getActiveBlockData()"
772+
```
773+
741774
_Parameters_
742775

743776
- _state_ `Object`: Global application state.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/block-directory/src/components/downloadable-block-list-item/style.scss

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,7 @@
3838

3939
&.is-installing {
4040
.block-directory-downloadable-block-list-item__author {
41-
border: 0;
42-
clip: rect(1px, 1px, 1px, 1px);
43-
-webkit-clip-path: inset(50%);
44-
clip-path: inset(50%);
45-
height: 1px;
46-
margin: -1px;
47-
overflow: hidden;
48-
padding: 0;
49-
position: absolute;
50-
width: 1px;
51-
word-wrap: normal !important;
41+
display: none;
5242
}
5343
}
5444
}

packages/block-editor/src/components/block-inspector/style.scss

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,3 @@
4646
.block-editor-block-inspector__no-block-tools {
4747
border-top: $border-width solid $gray-300;
4848
}
49-
50-
.block-editor-block-inspector__tab-item {
51-
flex: 1 1 0px;
52-
display: flex;
53-
justify-content: center;
54-
}

packages/block-editor/src/components/block-list/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ function Items( {
181181
__unstableGetVisibleBlocks,
182182
getTemplateLock,
183183
getBlockEditingMode,
184-
__unstableGetEditorMode,
185184
isSectionBlock,
185+
isZoomOut: _isZoomOut,
186186
} = unlock( select( blockEditorStore ) );
187187

188188
const _order = getBlockOrder( rootClientId );
@@ -200,13 +200,13 @@ function Items( {
200200
order: _order,
201201
selectedBlocks: getSelectedBlockClientIds(),
202202
visibleBlocks: __unstableGetVisibleBlocks(),
203-
isZoomOut: __unstableGetEditorMode() === 'zoom-out',
203+
isZoomOut: _isZoomOut(),
204204
shouldRenderAppender:
205205
! isSectionBlock( rootClientId ) &&
206206
getBlockEditingMode( rootClientId ) !== 'disabled' &&
207207
! getTemplateLock( rootClientId ) &&
208208
hasAppender &&
209-
__unstableGetEditorMode() !== 'zoom-out' &&
209+
! _isZoomOut() &&
210210
( hasCustomAppender ||
211211
rootClientId === selectedBlockClientId ||
212212
( ! rootClientId &&

packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useSelect } from '@wordpress/data';
1515
*/
1616
import { isInsideRootBlock } from '../../../utils/dom';
1717
import { store as blockEditorStore } from '../../../store';
18+
import { unlock } from '../../../lock-unlock';
1819

1920
/** @typedef {import('@wordpress/element').RefObject} RefObject */
2021

@@ -28,15 +29,16 @@ import { store as blockEditorStore } from '../../../store';
2829
*/
2930
export function useFocusFirstElement( { clientId, initialPosition } ) {
3031
const ref = useRef();
31-
const { isBlockSelected, isMultiSelecting, __unstableGetEditorMode } =
32-
useSelect( blockEditorStore );
32+
const { isBlockSelected, isMultiSelecting, isZoomOut } = unlock(
33+
useSelect( blockEditorStore )
34+
);
3335

3436
useEffect( () => {
3537
// Check if the block is still selected at the time this effect runs.
3638
if (
3739
! isBlockSelected( clientId ) ||
3840
isMultiSelecting() ||
39-
__unstableGetEditorMode() === 'zoom-out'
41+
isZoomOut()
4042
) {
4143
return;
4244
}

packages/block-editor/src/components/block-list/use-block-props/use-selected-block-event-handlers.js

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,12 @@ import { unlock } from '../../../lock-unlock';
2121
* @param {string} clientId Block client ID.
2222
*/
2323
export function useEventHandlers( { clientId, isSelected } ) {
24-
const {
25-
getBlockRootClientId,
26-
getBlockIndex,
27-
isZoomOut,
28-
__unstableGetEditorMode,
29-
} = unlock( useSelect( blockEditorStore ) );
30-
const {
31-
insertAfterBlock,
32-
removeBlock,
33-
__unstableSetEditorMode,
34-
resetZoomLevel,
35-
} = unlock( useDispatch( blockEditorStore ) );
24+
const { getBlockRootClientId, getBlockIndex, isZoomOut } = unlock(
25+
useSelect( blockEditorStore )
26+
);
27+
const { insertAfterBlock, removeBlock, resetZoomLevel } = unlock(
28+
useDispatch( blockEditorStore )
29+
);
3630

3731
return useRefEffect(
3832
( node ) => {
@@ -66,12 +60,7 @@ export function useEventHandlers( { clientId, isSelected } ) {
6660

6761
event.preventDefault();
6862

69-
if (
70-
keyCode === ENTER &&
71-
__unstableGetEditorMode() === 'zoom-out' &&
72-
isZoomOut()
73-
) {
74-
__unstableSetEditorMode( 'edit' );
63+
if ( keyCode === ENTER && isZoomOut() ) {
7564
resetZoomLevel();
7665
} else if ( keyCode === ENTER ) {
7766
insertAfterBlock( clientId );
@@ -105,8 +94,6 @@ export function useEventHandlers( { clientId, isSelected } ) {
10594
getBlockIndex,
10695
insertAfterBlock,
10796
removeBlock,
108-
__unstableGetEditorMode,
109-
__unstableSetEditorMode,
11097
isZoomOut,
11198
resetZoomLevel,
11299
]

packages/block-editor/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,13 @@ import { unlock } from '../../../lock-unlock';
1414
* Allows Zoom Out mode to be exited by double clicking in the selected block.
1515
*/
1616
export function useZoomOutModeExit() {
17-
const { getSettings, isZoomOut, __unstableGetEditorMode } = unlock(
18-
useSelect( blockEditorStore )
19-
);
20-
21-
const { __unstableSetEditorMode, resetZoomLevel } = unlock(
22-
useDispatch( blockEditorStore )
23-
);
17+
const { getSettings, isZoomOut } = unlock( useSelect( blockEditorStore ) );
18+
const { resetZoomLevel } = unlock( useDispatch( blockEditorStore ) );
2419

2520
return useRefEffect(
2621
( node ) => {
2722
function onDoubleClick( event ) {
28-
// In "compose" mode.
29-
const composeMode =
30-
__unstableGetEditorMode() === 'zoom-out' && isZoomOut();
31-
32-
if ( ! composeMode ) {
23+
if ( ! isZoomOut() ) {
3324
return;
3425
}
3526

@@ -43,7 +34,6 @@ export function useZoomOutModeExit() {
4334
) {
4435
__experimentalSetIsInserterOpened( false );
4536
}
46-
__unstableSetEditorMode( 'edit' );
4737
resetZoomLevel();
4838
}
4939
}
@@ -54,12 +44,6 @@ export function useZoomOutModeExit() {
5444
node.removeEventListener( 'dblclick', onDoubleClick );
5545
};
5646
},
57-
[
58-
getSettings,
59-
__unstableSetEditorMode,
60-
__unstableGetEditorMode,
61-
isZoomOut,
62-
resetZoomLevel,
63-
]
47+
[ getSettings, isZoomOut, resetZoomLevel ]
6448
);
6549
}

packages/block-editor/src/components/block-list/use-in-between-inserter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function useInBetweenInserter() {
1818
const isInBetweenInserterDisabled = useSelect(
1919
( select ) =>
2020
select( blockEditorStore ).getSettings().isDistractionFree ||
21-
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
21+
unlock( select( blockEditorStore ) ).isZoomOut(),
2222
[]
2323
);
2424
const {

packages/block-editor/src/components/block-toolbar/index.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ export function PrivateBlockToolbar( {
6969
hasParentPattern,
7070
hasContentOnlyLocking,
7171
showShuffleButton,
72+
showSlots,
73+
showGroupButtons,
74+
showLockButtons,
7275
} = useSelect( ( select ) => {
7376
const {
7477
getBlockName,
@@ -81,7 +84,7 @@ export function PrivateBlockToolbar( {
8184
getBlockParentsByBlockName,
8285
getTemplateLock,
8386
getParentSectionBlock,
84-
isZoomOutMode,
87+
isZoomOut,
8588
} = unlock( select( blockEditorStore ) );
8689
const selectedBlockClientIds = getSelectedBlockClientIds();
8790
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
@@ -122,7 +125,7 @@ export function PrivateBlockToolbar( {
122125
shouldShowVisualToolbar: isValid && isVisual,
123126
toolbarKey: `${ selectedBlockClientId }${ parentClientId }`,
124127
showParentSelector:
125-
! isZoomOutMode() &&
128+
! isZoomOut() &&
126129
parentBlockType &&
127130
getBlockEditingMode( parentClientId ) !== 'disabled' &&
128131
hasBlockSupport(
@@ -134,7 +137,10 @@ export function PrivateBlockToolbar( {
134137
isUsingBindings: _isUsingBindings,
135138
hasParentPattern: _hasParentPattern,
136139
hasContentOnlyLocking: _hasTemplateLock,
137-
showShuffleButton: isZoomOutMode(),
140+
showShuffleButton: isZoomOut(),
141+
showSlots: ! isZoomOut(),
142+
showGroupButtons: ! isZoomOut(),
143+
showLockButtons: ! isZoomOut(),
138144
};
139145
}, [] );
140146

@@ -195,11 +201,13 @@ export function PrivateBlockToolbar( {
195201
>
196202
<ToolbarGroup className="block-editor-block-toolbar__block-controls">
197203
<BlockSwitcher clientIds={ blockClientIds } />
198-
{ ! isMultiToolbar && isDefaultEditingMode && (
199-
<BlockLockToolbar
200-
clientId={ blockClientId }
201-
/>
202-
) }
204+
{ ! isMultiToolbar &&
205+
isDefaultEditingMode &&
206+
showLockButtons && (
207+
<BlockLockToolbar
208+
clientId={ blockClientId }
209+
/>
210+
) }
203211
<BlockMover
204212
clientIds={ blockClientIds }
205213
hideDragHandle={ hideDragHandle }
@@ -209,7 +217,8 @@ export function PrivateBlockToolbar( {
209217
) }
210218
{ ! hasContentOnlyLocking &&
211219
shouldShowVisualToolbar &&
212-
isMultiToolbar && <BlockGroupToolbar /> }
220+
isMultiToolbar &&
221+
showGroupButtons && <BlockGroupToolbar /> }
213222
{ showShuffleButton && (
214223
<ToolbarGroup>
215224
<Shuffle
@@ -218,7 +227,7 @@ export function PrivateBlockToolbar( {
218227
/>
219228
</ToolbarGroup>
220229
) }
221-
{ shouldShowVisualToolbar && (
230+
{ shouldShowVisualToolbar && showSlots && (
222231
<>
223232
<BlockControls.Slot
224233
group="parent"

packages/block-editor/src/components/block-tools/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,19 @@ function selector( select ) {
3030
getSelectedBlockClientId,
3131
getFirstMultiSelectedBlockClientId,
3232
getSettings,
33-
__unstableGetEditorMode,
3433
isTyping,
3534
isDragging,
35+
isZoomOut,
3636
} = unlock( select( blockEditorStore ) );
3737

3838
const clientId =
3939
getSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();
4040

41-
const editorMode = __unstableGetEditorMode();
42-
4341
return {
4442
clientId,
4543
hasFixedToolbar: getSettings().hasFixedToolbar,
4644
isTyping: isTyping(),
47-
isZoomOutMode: editorMode === 'zoom-out',
45+
isZoomOutMode: isZoomOut(),
4846
isDragging: isDragging(),
4947
};
5048
}

packages/block-editor/src/components/block-tools/insertion-point.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import Inserter from '../inserter';
1818
import { store as blockEditorStore } from '../../store';
1919
import BlockPopoverInbetween from '../block-popover/inbetween';
2020
import BlockDropZonePopover from '../block-popover/drop-zone';
21+
import { unlock } from '../../lock-unlock';
2122

2223
export const InsertionPointOpenRef = createContext();
2324

@@ -47,8 +48,8 @@ function InbetweenInsertionPointPopover( {
4748
getPreviousBlockClientId,
4849
getNextBlockClientId,
4950
getSettings,
50-
__unstableGetEditorMode,
51-
} = select( blockEditorStore );
51+
isZoomOut,
52+
} = unlock( select( blockEditorStore ) );
5253
const insertionPoint = getBlockInsertionPoint();
5354
const order = getBlockOrder( insertionPoint.rootClientId );
5455

@@ -78,7 +79,7 @@ function InbetweenInsertionPointPopover( {
7879
rootClientId: insertionPoint.rootClientId,
7980
isDistractionFree: settings.isDistractionFree,
8081
isInserterShown: insertionPoint?.__unstableWithInserter,
81-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
82+
isZoomOutMode: isZoomOut(),
8283
};
8384
}, [] );
8485
const { getBlockEditingMode } = useSelect( blockEditorStore );

0 commit comments

Comments
 (0)