Skip to content

Commit

Permalink
Fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Feb 6, 2023
2 parents 2b845f7 + 10ebe6b commit b020ea2
Show file tree
Hide file tree
Showing 76 changed files with 445 additions and 212 deletions.
2 changes: 1 addition & 1 deletion lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ public function get_settings() {
*
* @return string The processed CSS.
*/
public function process_blocks_custom_css( $css, $selector ) {
protected function process_blocks_custom_css( $css, $selector ) {
$processed_css = '';

// Split CSS nested rules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,6 @@ public function get_item_schema() {
'context' => array( 'mobile' ),
),

'__experimentalBlockInspectorAnimation' => array(
'description' => __( 'Whether to enable animation when showing and hiding the block inspector.', 'gutenberg' ),
'type' => 'object',
'context' => array( 'site-editor' ),
),

'alignWide' => array(
'description' => __( 'Enable/Disable Wide/Full Alignments.', 'gutenberg' ),
'type' => 'boolean',
Expand Down
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"npm": ">=6.9.0 <7"
},
"config": {
"IS_GUTENBERG_PLUGIN": true
"IS_GUTENBERG_PLUGIN": true,
"ALLOW_EXPERIMENT_REREGISTRATION": true
},
"dependencies": {
"@wordpress/a11y": "file:packages/a11y",
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"@wordpress/keyboard-shortcuts": "file:../keyboard-shortcuts",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/notices": "file:../notices",
"@wordpress/preferences": "file:../preferences",
"@wordpress/rich-text": "file:../rich-text",
"@wordpress/shortcode": "file:../shortcode",
"@wordpress/style-engine": "file:../style-engine",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
if ( blockType ) {
const globalBlockInspectorAnimationSettings =
select( blockEditorStore ).getSettings()
.__experimentalBlockInspectorAnimation;
.blockInspectorAnimation;
return globalBlockInspectorAnimationSettings?.[
blockType.name
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { store as blockEditorStore } from '../../store';
import BlockPopover from '../block-popover';
import useBlockToolbarPopoverProps from './use-block-toolbar-popover-props';
import Inserter from '../inserter';
import { unlock } from '../../experiments';
import { unlock } from '../../lock-unlock';

function selector( select ) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function ColorGradientControlInner( {
clearable,
showTitle = true,
enableAlpha,
headingLevel,
} ) {
const canChooseAColor =
onColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );
Expand Down Expand Up @@ -84,6 +85,7 @@ function ColorGradientControlInner( {
}
clearable={ clearable }
enableAlpha={ enableAlpha }
headingLevel={ headingLevel }
/>
),
[ TAB_GRADIENT.value ]: (
Expand All @@ -103,6 +105,7 @@ function ColorGradientControlInner( {
__experimentalIsRenderedInSidebar
}
clearable={ clearable }
headingLevel={ headingLevel }
/>
),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* WordPress dependencies
*/
import { Button } from '@wordpress/components';
import { useDispatch, useSelect } from '@wordpress/data';
import { focus } from '@wordpress/dom';
import { useRef } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
import { close } from '@wordpress/icons';
import { store as preferencesStore } from '@wordpress/preferences';

const PREFERENCE_NAME = 'isInspectorControlsTabsHintVisible';

export default function InspectorControlsTabsHint() {
const isInspectorControlsTabsHintVisible = useSelect(
( select ) =>
select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,
[]
);

const ref = useRef();

const { set: setPreference } = useDispatch( preferencesStore );
if ( ! isInspectorControlsTabsHintVisible ) {
return null;
}

return (
<div ref={ ref } className="block-editor-inspector-controls-tabs__hint">
<div className="block-editor-inspector-controls-tabs__hint-content">
{ __(
"Looking for other block settings? They've moved to the styles tab."
) }
</div>
<Button
className="block-editor-inspector-controls-tabs__hint-dismiss"
icon={ close }
iconSize="16"
label={ __( 'Dismiss hint' ) }
onClick={ () => {
// Retain focus when dismissing the element.
const previousElement = focus.tabbable.findPrevious(
ref.current
);
previousElement?.focus();
setPreference( 'core', PREFERENCE_NAME, false );
} }
showTooltip={ false }
/>
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import AdvancedControls from './advanced-controls-panel';
import PositionControls from './position-controls-panel';
import { default as InspectorControls } from '../inspector-controls';
import SettingsTabHint from './settings-tab-hint';

const SettingsTab = ( { showAdvancedControls = false } ) => (
<>
Expand All @@ -14,6 +15,7 @@ const SettingsTab = ( { showAdvancedControls = false } ) => (
<AdvancedControls />
</div>
) }
<SettingsTabHint />
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,23 @@
}
}
}

.block-editor-inspector-controls-tabs__hint {
align-items: top;
background: $gray-100;
border-radius: $radius-block-ui;
color: $gray-900;
display: flex;
flex-direction: row;
margin: $grid-unit-20;
}

.block-editor-inspector-controls-tabs__hint-content {
margin: $grid-unit-15 0 $grid-unit-15 $grid-unit-15;
}

.block-editor-inspector-controls-tabs__hint-dismiss {
// The dismiss button has a lot of empty space through its padding.
// Apply margin to visually align the icon with the top of the text to its left.
margin: $grid-unit-05 $grid-unit-05 $grid-unit-05 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { forwardRef, useEffect, useState } from '@wordpress/element';
/**
* Internal dependencies
*/
import { unlock } from '../../experiments';
import { unlock } from '../../lock-unlock';
import ListViewBlockSelectButton from './block-select-button';
import BlockDraggable from '../block-draggable';
import { store as blockEditorStore } from '../../store';
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/components/provider/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import withRegistryProvider from './with-registry-provider';
import useBlockSync from './use-block-sync';
import { store as blockEditorStore } from '../../store';
import { BlockRefsProvider } from './block-refs-provider';
import { unlock } from '../../experiments';
import { unlock } from '../../lock-unlock';

/** @typedef {import('@wordpress/data').WPDataRegistry} WPDataRegistry */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ export default function useBlockSync( {
previousAreBlocksDifferent = areBlocksDifferent;
} );

return () => unsubscribe();
return () => {
subscribed.current = false;
unsubscribe();
};
}, [ registry, clientId ] );
}
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ function RichTextWrapper(
__unstableEmbedURLOnPaste,
__unstableDisableFormats: disableFormats,
disableLineBreaks,
unstableOnFocus,
__unstableAllowPrefixTransformations,
...props
},
Expand Down Expand Up @@ -449,7 +448,6 @@ function RichTextWrapper(
props.className,
'rich-text'
) }
onFocus={ unstableOnFocus }
onKeyDown={ onKeyDown }
/>
</>
Expand Down
12 changes: 1 addition & 11 deletions packages/block-editor/src/experiments.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
/**
* WordPress dependencies
*/
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';

/**
* Internal dependencies
*/
import * as globalStyles from './components/global-styles';
import { ExperimentalBlockEditorProvider } from './components/provider';
import { lock } from './lock-unlock';
import OffCanvasEditor from './components/off-canvas-editor';

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
'@wordpress/block-editor'
);

/**
* Experimental @wordpress/block-editor APIs.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/dimensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import {
} from './child-layout';
import useSetting from '../components/use-setting';
import { store as blockEditorStore } from '../store';
import { unlock } from '../experiments';
import { unlock } from '../lock-unlock';

export const DIMENSIONS_SUPPORT_KEY = 'dimensions';
export const SPACING_SUPPORT_KEY = 'spacing';
Expand Down
8 changes: 7 additions & 1 deletion packages/block-editor/src/hooks/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import classnames from 'classnames';
*/
import { __, sprintf } from '@wordpress/i18n';
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
import { BaseControl, CustomSelectControl } from '@wordpress/components';
import {
BaseControl,
experiments as componentsExperiments,
} from '@wordpress/components';
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
import { useSelect } from '@wordpress/data';
import {
Expand All @@ -26,8 +29,11 @@ import BlockList from '../components/block-list';
import useSetting from '../components/use-setting';
import InspectorControls from '../components/inspector-controls';
import { cleanEmptyObject } from './utils';
import { unlock } from '../lock-unlock';
import { store as blockEditorStore } from '../store';

const { CustomSelectControl } = unlock( componentsExperiments );

const POSITION_SUPPORT_KEY = 'position';

const OPTION_CLASSNAME =
Expand Down
10 changes: 10 additions & 0 deletions packages/block-editor/src/lock-unlock.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* WordPress dependencies
*/
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';

export const { lock, unlock } =
__dangerousOptInToUnstableAPIsOnlyForCoreModules(
'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',
'@wordpress/block-editor'
);
7 changes: 7 additions & 0 deletions packages/block-editor/src/store/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,13 @@ export const SETTINGS_DEFAULTS = {
__unstableGalleryWithImageBlocks: false,
__unstableIsPreviewMode: false,

// This setting is `private` now with `lock` API.
blockInspectorAnimation: {
'core/navigation': { enterDirection: 'leftToRight' },
'core/navigation-submenu': { enterDirection: 'rightToLeft' },
'core/navigation-link': { enterDirection: 'rightToLeft' },
},

generateAnchors: false,
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
// The setting is only kept for backward compatibility purposes.
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import * as privateActions from './private-actions';
import * as privateSelectors from './private-selectors';
import * as actions from './actions';
import { STORE_NAME } from './constants';
import { unlock } from '../experiments';
import { unlock } from '../lock-unlock';

/**
* Block editor data store configuration.
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/store/private-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { Platform } from '@wordpress/element';
*
* @see https://github.com/WordPress/gutenberg/pull/46131
*/
const privateSettings = [ 'inserterMediaCategories' ];
const privateSettings = [
'inserterMediaCategories',
'blockInspectorAnimation',
];

/**
* Action that updates the block editor settings and
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
{ "path": "../dom" },
{ "path": "../element" },
{ "path": "../escape-html" },
{ "path": "../experiments" },
{ "path": "../hooks" },
{ "path": "../html-entities" },
{ "path": "../i18n" },
Expand Down
13 changes: 7 additions & 6 deletions packages/block-library/src/gallery/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ function block_core_gallery_render( $attributes, $content ) {
}

// Set the CSS variable to the column value, and the `gap` property to the combined gap value.
$gallery_styles = array();
$gallery_styles[] = array(
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
'declarations' => array(
'--wp--style--unstable-gallery-gap' => $gap_column,
'gap' => $gap_value,
$gallery_styles = array(
array(
'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
'declarations' => array(
'--wp--style--unstable-gallery-gap' => $gap_column,
'gap' => $gap_value,
),
),
);

Expand Down
Loading

0 comments on commit b020ea2

Please sign in to comment.