Skip to content

Commit

Permalink
Merge branch 'WordPress:trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
Anuj-Rathore24 authored Jun 13, 2024
2 parents 7b9338f + fe8fe40 commit c85d02e
Show file tree
Hide file tree
Showing 11 changed files with 190 additions and 161 deletions.
12 changes: 8 additions & 4 deletions bin/packages/build-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const postcss = require( 'postcss' );
*/
const getBabelConfig = require( './get-babel-config' );

const isDev = process.env.NODE_ENV === 'development';

/**
* Path to packages directory.
*
Expand All @@ -27,10 +29,12 @@ const PACKAGES_DIR = path
*
* @type {Object}
*/
const JS_ENVIRONMENTS = {
main: 'build',
module: 'build-module',
};
const JS_ENVIRONMENTS = isDev
? { module: 'build-module' }
: {
main: 'build',
module: 'build-module',
};

/**
* Promisified fs.readFile.
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@
"build:plugin-zip": "bash ./bin/build-plugin-zip.sh",
"clean:package-types": "tsc --build --clean && rimraf \"./packages/*/build-types\"",
"clean:packages": "rimraf \"./packages/*/@(build|build-module|build-style)\"",
"dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"",
"dev": "cross-env NODE_ENV=development npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"",
"dev:packages": "cross-env NODE_ENV=development concurrently \"node ./bin/packages/watch.js\" \"tsc --build --watch\"",
"distclean": "git clean --force -d -X",
"docs:api-ref": "node ./bin/api-docs/update-api-docs.js",
"docs:blocks": "node ./bin/api-docs/gen-block-lib-list.js",
Expand Down
28 changes: 6 additions & 22 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ import { store as blockEditorStore } from '../../store';
import __unstableBlockNameContext from './block-name-context';
import NavigableToolbar from '../navigable-toolbar';
import Shuffle from './shuffle';
import PatternOverridesToolbarIndicator from '../pattern-overrides-toolbar-indicator';
import { useHasBlockToolbar } from './use-has-block-toolbar';
import { canBindBlock } from '../../hooks/use-bindings-attributes';

/**
* Renders the block toolbar.
*
Expand All @@ -62,18 +61,15 @@ export function PrivateBlockToolbar( {
blockClientIds,
isDefaultEditingMode,
blockType,
blockName,
toolbarKey,
shouldShowVisualToolbar,
showParentSelector,
isUsingBindings,
hasParentPattern,
} = useSelect( ( select ) => {
const {
getBlockName,
getBlockMode,
getBlockParents,
getBlockParentsByBlockName,
getSelectedBlockClientIds,
isBlockValid,
getBlockRootClientId,
Expand All @@ -96,18 +92,14 @@ export function PrivateBlockToolbar( {
const isVisual = selectedBlockClientIds.every(
( id ) => getBlockMode( id ) === 'visual'
);
const bindings = getBlockAttributes( selectedBlockClientId )?.metadata
?.bindings;
const parentPatternClientId = getBlockParentsByBlockName(
selectedBlockClientId,
'core/block',
true
)[ 0 ];
const _isUsingBindings = selectedBlockClientIds.every(
( clientId ) =>
!! getBlockAttributes( clientId )?.metadata?.bindings
);
return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
isDefaultEditingMode: _isDefaultEditingMode,
blockName: _blockName,
blockType: selectedBlockClientId && getBlockType( _blockName ),
shouldShowVisualToolbar: isValid && isVisual,
rootClientId: blockRootClientId,
Expand All @@ -122,8 +114,7 @@ export function PrivateBlockToolbar( {
) &&
selectedBlockClientIds.length === 1 &&
_isDefaultEditingMode,
isUsingBindings: !! bindings,
hasParentPattern: !! parentPatternClientId,
isUsingBindings: _isUsingBindings,
};
}, [] );

Expand Down Expand Up @@ -176,13 +167,6 @@ export function PrivateBlockToolbar( {
{ ! isMultiToolbar &&
isLargeViewport &&
isDefaultEditingMode && <BlockParentSelector /> }
{ isUsingBindings &&
hasParentPattern &&
canBindBlock( blockName ) && (
<PatternOverridesToolbarIndicator
clientIds={ blockClientIds }
/>
) }
{ ( shouldShowVisualToolbar || isMultiToolbar ) &&
( isDefaultEditingMode || isSynced ) && (
<div
Expand Down

This file was deleted.

This file was deleted.

2 changes: 2 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { PrivateBlockPopover } from './components/block-popover';
import { PrivateInserterLibrary } from './components/inserter/library';
import { PrivatePublishDateTimePicker } from './components/publish-date-time-picker';
import useSpacingSizes from './components/spacing-sizes-control/hooks/use-spacing-sizes';
import useBlockDisplayTitle from './components/block-title/use-block-display-title';

/**
* Private @wordpress/block-editor APIs.
Expand Down Expand Up @@ -86,4 +87,5 @@ lock( privateApis, {
PrivateBlockPopover,
PrivatePublishDateTimePicker,
useSpacingSizes,
useBlockDisplayTitle,
} );
1 change: 0 additions & 1 deletion packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "./autocompleters/style.scss";
@import "./components/block-alignment-control/style.scss";
@import "./components/pattern-overrides-toolbar-indicator/style.scss";
@import "./components/block-canvas/style.scss";
@import "./components/block-icon/style.scss";
@import "./components/block-inspector/style.scss";
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/hooks/pattern-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { unlock } from '../lock-unlock';
const {
PatternOverridesControls,
ResetOverridesControl,
PatternOverridesBlockControls,
PATTERN_TYPES,
PARTIAL_SYNCING_SUPPORTED_BLOCKS,
PATTERN_SYNC_TYPES,
Expand All @@ -43,6 +44,7 @@ const withPatternOverrideControls = createHigherOrderComponent(
{ props.isSelected && isSupportedBlock && (
<ControlsWithStoreSubscription { ...props } />
) }
{ isSupportedBlock && <PatternOverridesBlockControls /> }
</>
);
}
Expand Down
Loading

0 comments on commit c85d02e

Please sign in to comment.