@wordpress/block-editor 14.10.1 → 14.12.0
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/CHANGELOG.md +5 -1
- package/build/components/background-image-control/index.js +0 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +0 -3
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-inspector/index.js +6 -11
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build/components/block-rename/modal.js +36 -11
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-rename/rename-control.js +2 -43
- package/build/components/block-rename/rename-control.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +7 -7
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +2 -2
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +1 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +2 -2
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +1 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +2 -2
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/image-settings-panel.js +2 -2
- package/build/components/global-styles/image-settings-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +3 -3
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +11 -19
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +6 -4
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +1 -1
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-size-control/index.js +2 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/menu.js +13 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +49 -21
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/line-height-control/index.native.js +1 -1
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/index.js +1 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +1 -1
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +5 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/media-placeholder/index.js +1 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/provider/index.js +0 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +2 -2
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +1 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +1 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +44 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +6 -9
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -108
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +39 -0
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +3 -3
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/hooks/contrast-checker.js +41 -22
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +18 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +1 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build/utils/use-notify-copy.js +19 -11
- package/build/utils/use-notify-copy.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +0 -3
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +6 -11
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-handler.js.map +1 -1
- package/build-module/components/block-rename/modal.js +36 -11
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-rename/rename-control.js +2 -43
- package/build-module/components/block-rename/rename-control.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -3
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -7
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +2 -2
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +1 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +2 -2
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +1 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +2 -2
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/image-settings-panel.js +2 -2
- package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +3 -3
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +11 -19
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +6 -4
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +3 -2
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +51 -23
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +1 -1
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +1 -1
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +6 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +1 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/provider/index.js +0 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +2 -2
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +3 -3
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +1 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +1 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +45 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +7 -10
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -104
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +39 -0
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +42 -23
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +18 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +1 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-module/utils/use-notify-copy.js +19 -11
- package/build-module/utils/use-notify-copy.js.map +1 -1
- package/build-style/content-rtl.css +0 -9
- package/build-style/content.css +0 -9
- package/build-style/style-rtl.css +19 -21
- package/build-style/style.css +19 -21
- package/package.json +34 -33
- package/src/components/background-image-control/index.js +0 -1
- package/src/components/block-actions/index.js +0 -3
- package/src/components/block-icon/content.scss +1 -1
- package/src/components/{block-card → block-icon}/stories/index.story.js +16 -26
- package/src/components/block-icon/style.scss +1 -1
- package/src/components/block-inspector/index.js +7 -10
- package/src/components/block-list/use-block-props/use-focus-handler.js +1 -1
- package/src/components/block-preview/style.scss +1 -1
- package/src/components/block-rename/modal.js +40 -12
- package/src/components/block-rename/rename-control.js +1 -53
- package/src/components/block-settings-menu/block-settings-dropdown.js +16 -2
- package/src/components/block-styles/preview.native.js +1 -1
- package/src/components/block-switcher/block-transformations-menu.js +9 -9
- package/src/components/block-switcher/block-variation-transformations.js +2 -2
- package/src/components/block-switcher/index.js +1 -1
- package/src/components/block-switcher/use-transformed-patterns.js +1 -1
- package/src/components/block-toolbar/index.native.js +2 -2
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/colors-gradients/style.scss +1 -0
- package/src/components/colors-gradients/test/control.js +2 -2
- package/src/components/date-format-picker/index.js +1 -1
- package/src/components/duotone-control/style.scss +2 -2
- package/src/components/global-styles/filters-panel.js +4 -2
- package/src/components/global-styles/image-settings-panel.js +2 -2
- package/src/components/global-styles/test/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +3 -3
- package/src/components/grid/grid-visualizer.js +10 -21
- package/src/components/grid/style.scss +1 -0
- package/src/components/grid/utils.js +6 -4
- package/src/components/iframe/get-compatibility-styles.js +1 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/image-size-control/index.js +6 -2
- package/src/components/inner-blocks/README.md +1 -1
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +1 -1
- package/src/components/inserter/menu.js +11 -9
- package/src/components/inserter/reusable-blocks-tab.native.js +1 -1
- package/src/components/inspector-controls-tabs/position-controls-panel.js +62 -27
- package/src/components/line-height-control/index.native.js +1 -1
- package/src/components/link-control/README.md +2 -2
- package/src/components/link-control/index.js +1 -1
- package/src/components/link-control/test/index.js +3 -3
- package/src/components/link-control/use-search-handler.js +1 -1
- package/src/components/list-view/README.md +1 -1
- package/src/components/list-view/block-select-button.js +5 -5
- package/src/components/list-view/style.scss +3 -7
- package/src/components/media-placeholder/content.scss +0 -8
- package/src/components/media-placeholder/index.js +1 -0
- package/src/components/media-placeholder/style.scss +7 -0
- package/src/components/observe-typing/index.js +1 -1
- package/src/components/provider/index.js +0 -1
- package/src/components/provider/use-block-sync.js +2 -2
- package/src/components/resolution-tool/stories/index.story.js +52 -2
- package/src/components/rich-text/README.md +1 -1
- package/src/components/rich-text/event-listeners/input-rules.js +3 -3
- package/src/components/rich-text/native/use-format-types.js +1 -1
- package/src/components/rich-text/use-format-types.js +1 -1
- package/src/components/spacing-sizes-control/README.md +93 -0
- package/src/components/spacing-sizes-control/index.js +44 -1
- package/src/components/spacing-sizes-control/linked-button.js +8 -10
- package/src/components/spacing-sizes-control/test/utils.js +0 -151
- package/src/components/spacing-sizes-control/utils.js +0 -106
- package/src/components/tabbed-sidebar/README.md +24 -13
- package/src/components/tabbed-sidebar/index.js +38 -0
- package/src/components/tabbed-sidebar/stories/index.story.js +104 -0
- package/src/components/typewriter/index.js +1 -1
- package/src/components/unit-control/README.md +1 -1
- package/src/components/unit-control/stories/index.story.js +124 -0
- package/src/components/url-popover/image-url-input-ui.js +3 -3
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/README.md +1 -1
- package/src/components/warning/content.scss +1 -1
- package/src/components/writing-flow/test/index.js +1 -1
- package/src/hooks/color.scss +0 -7
- package/src/hooks/contrast-checker.js +64 -30
- package/src/hooks/custom-class-name.js +2 -1
- package/src/store/actions.js +1 -1
- package/src/store/selectors.js +20 -12
- package/src/store/test/private-selectors.js +1 -1
- package/src/store/test/selectors.js +3 -3
- package/src/style.scss +1 -0
- package/src/utils/test/sorting.js +1 -1
- package/src/utils/transform-styles/index.js +1 -1
- package/src/utils/use-notify-copy.js +51 -43
- package/tsconfig.json +1 -0
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
PanelBody,
|
|
6
5
|
__experimentalUseSlotFills as useSlotFills,
|
|
6
|
+
__experimentalToolsPanel as ToolsPanel,
|
|
7
|
+
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
7
8
|
} from '@wordpress/components';
|
|
8
|
-
import { useSelect } from '@wordpress/data';
|
|
9
|
-
import { useLayoutEffect, useState } from '@wordpress/element';
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -15,40 +15,75 @@ import { __ } from '@wordpress/i18n';
|
|
|
15
15
|
import InspectorControlsGroups from '../inspector-controls/groups';
|
|
16
16
|
import { default as InspectorControls } from '../inspector-controls';
|
|
17
17
|
import { store as blockEditorStore } from '../../store';
|
|
18
|
+
import { useToolsPanelDropdownMenuProps } from '../global-styles/utils';
|
|
19
|
+
import { cleanEmptyObject } from '../../hooks/utils';
|
|
18
20
|
|
|
19
21
|
const PositionControlsPanel = () => {
|
|
20
|
-
const
|
|
22
|
+
const { selectedClientIds, selectedBlocks, hasPositionAttribute } =
|
|
23
|
+
useSelect( ( select ) => {
|
|
24
|
+
const { getBlocksByClientId, getSelectedBlockClientIds } =
|
|
25
|
+
select( blockEditorStore );
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const clientIds = getSelectedBlockClientIds();
|
|
27
|
-
return {
|
|
28
|
-
multiSelectedBlocks: getBlocksByClientId( clientIds ),
|
|
29
|
-
};
|
|
30
|
-
}, [] );
|
|
27
|
+
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
28
|
+
const _selectedBlocks = getBlocksByClientId(
|
|
29
|
+
selectedBlockClientIds
|
|
30
|
+
);
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
setInitialOpen(
|
|
37
|
-
multiSelectedBlocks.some(
|
|
32
|
+
return {
|
|
33
|
+
selectedClientIds: selectedBlockClientIds,
|
|
34
|
+
selectedBlocks: _selectedBlocks,
|
|
35
|
+
hasPositionAttribute: _selectedBlocks?.some(
|
|
38
36
|
( { attributes } ) => !! attributes?.style?.position?.type
|
|
39
|
-
)
|
|
40
|
-
|
|
37
|
+
),
|
|
38
|
+
};
|
|
39
|
+
}, [] );
|
|
40
|
+
|
|
41
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
42
|
+
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
43
|
+
|
|
44
|
+
function resetPosition() {
|
|
45
|
+
if ( ! selectedClientIds?.length || ! selectedBlocks?.length ) {
|
|
46
|
+
return;
|
|
41
47
|
}
|
|
42
|
-
|
|
48
|
+
|
|
49
|
+
const attributesByClientId = Object.fromEntries(
|
|
50
|
+
selectedBlocks?.map( ( { clientId, attributes } ) => [
|
|
51
|
+
clientId,
|
|
52
|
+
{
|
|
53
|
+
style: cleanEmptyObject( {
|
|
54
|
+
...attributes?.style,
|
|
55
|
+
position: {
|
|
56
|
+
...attributes?.style?.position,
|
|
57
|
+
type: undefined,
|
|
58
|
+
top: undefined,
|
|
59
|
+
right: undefined,
|
|
60
|
+
bottom: undefined,
|
|
61
|
+
left: undefined,
|
|
62
|
+
},
|
|
63
|
+
} ),
|
|
64
|
+
},
|
|
65
|
+
] )
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
updateBlockAttributes( selectedClientIds, attributesByClientId, true );
|
|
69
|
+
}
|
|
43
70
|
|
|
44
71
|
return (
|
|
45
|
-
<
|
|
72
|
+
<ToolsPanel
|
|
46
73
|
className="block-editor-block-inspector__position"
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
label={ __( 'Position' ) }
|
|
75
|
+
resetAll={ resetPosition }
|
|
76
|
+
dropdownMenuProps={ dropdownMenuProps }
|
|
49
77
|
>
|
|
50
|
-
<
|
|
51
|
-
|
|
78
|
+
<ToolsPanelItem
|
|
79
|
+
isShownByDefault={ hasPositionAttribute }
|
|
80
|
+
label={ __( 'Position' ) }
|
|
81
|
+
hasValue={ () => hasPositionAttribute }
|
|
82
|
+
onDeselect={ resetPosition }
|
|
83
|
+
>
|
|
84
|
+
<InspectorControls.Slot group="position" />
|
|
85
|
+
</ToolsPanelItem>
|
|
86
|
+
</ToolsPanel>
|
|
52
87
|
);
|
|
53
88
|
};
|
|
54
89
|
|
|
@@ -14,7 +14,7 @@ export default function LineHeightControl( { value: lineHeight, onChange } ) {
|
|
|
14
14
|
return (
|
|
15
15
|
<UnitControl
|
|
16
16
|
label={ __( 'Line Height' ) }
|
|
17
|
-
// Set
|
|
17
|
+
// Set minimum value of 1 since lower values break on Android
|
|
18
18
|
min={ 1 }
|
|
19
19
|
max={ 5 }
|
|
20
20
|
step={ STEP }
|
|
@@ -50,7 +50,7 @@ Consumers who which to take advantage of this functionality should ensure that t
|
|
|
50
50
|
When creating links the `LinkControl` component will handle two kinds of input from users:
|
|
51
51
|
|
|
52
52
|
1. Entity searches - the user may input free-text based search queries for entities retrieved from remote data sources (in the context of WordPress these are post-type entities). For example, a user might search for a `Page` they have just created by name (eg: About) and the UI will return a matching result if found.
|
|
53
|
-
2. Direct entry - the user may also enter any arbitrary URL-like text. This includes full URLs (https://), URL
|
|
53
|
+
2. Direct entry - the user may also enter any arbitrary URL-like text. This includes full URLs (https://), URL fragments (eg: `#myinternallink`), `tel` protocol links (eg: `tel: 0800 1234`) and `mailto` protocol links (eg: `mailto: hello@wordpress.org`).
|
|
54
54
|
|
|
55
55
|
In addition, `<LinkControl>` also allows for on the fly creation of links based on the **current content of the `<input>` element**. When enabled, a default "Create new" search suggestion is appended to all non-URL-like search results.
|
|
56
56
|
|
|
@@ -79,7 +79,7 @@ The resulting default properties of `value` include:
|
|
|
79
79
|
- `title` (`string`, optional): Link title.
|
|
80
80
|
- `opensInNewTab` (`boolean`, optional): Whether link should open in a new browser tab. This value is only assigned when not providing a custom `settings` prop.
|
|
81
81
|
|
|
82
|
-
Note: `<LinkControl>` maintains an internal state tracking temporary user edits to the link `value` prior to submission. To avoid unwanted synchronization of this internal value, it is advised that the `value` prop is
|
|
82
|
+
Note: `<LinkControl>` maintains an internal state tracking temporary user edits to the link `value` prior to submission. To avoid unwanted synchronization of this internal value, it is advised that the `value` prop is stabilized (likely via memozation) before it is passed to the component. This will avoid unwanted loss of any changes users have may made whilst interacting with the control.
|
|
83
83
|
|
|
84
84
|
```jsx
|
|
85
85
|
const memoizedValue = useMemo(
|
|
@@ -265,7 +265,7 @@ function LinkControl( {
|
|
|
265
265
|
|
|
266
266
|
const handleSelectSuggestion = ( updatedValue ) => {
|
|
267
267
|
// Suggestions may contains "settings" values (e.g. `opensInNewTab`)
|
|
268
|
-
// which should not
|
|
268
|
+
// which should not override any existing settings values set by the
|
|
269
269
|
// user. This filters out any settings values from the suggestion.
|
|
270
270
|
const nonSettingsChanges = Object.keys( updatedValue ).reduce(
|
|
271
271
|
( acc, key ) => {
|
|
@@ -31,7 +31,7 @@ const mockFetchSearchSuggestions = jest.fn();
|
|
|
31
31
|
/**
|
|
32
32
|
* The call to the real method `fetchRichUrlData` is wrapped in a promise in order to make it cancellable.
|
|
33
33
|
* Therefore if we pass any value as the mock of `fetchRichUrlData` then ALL of the tests will require
|
|
34
|
-
* addition code to handle the async nature of `fetchRichUrlData`. This is
|
|
34
|
+
* addition code to handle the async nature of `fetchRichUrlData`. This is unnecessary. Instead we default
|
|
35
35
|
* to an undefined value which will ensure that the code under test does not call `fetchRichUrlData`. Only
|
|
36
36
|
* when we are testing the "rich previews" to we update this value with a true mock.
|
|
37
37
|
*/
|
|
@@ -354,7 +354,7 @@ describe( 'Basic rendering', () => {
|
|
|
354
354
|
|
|
355
355
|
it( 'should display human friendly error message if value URL prop is empty when component is forced into no-editing (preview) mode', async () => {
|
|
356
356
|
// Why do we need this test?
|
|
357
|
-
// Occasionally `forceIsEditingLink` is set
|
|
357
|
+
// Occasionally `forceIsEditingLink` is set explicitly to `false` which causes the Link UI to render
|
|
358
358
|
// it's preview even if the `value` has no URL.
|
|
359
359
|
// for an example of this see the usage in the following file whereby forceIsEditingLink is used to start/stop editing mode:
|
|
360
360
|
// https://github.com/WordPress/gutenberg/blob/fa5728771df7cdc86369f7157d6aa763649937a7/packages/format-library/src/link/inline.js#L151.
|
|
@@ -2422,7 +2422,7 @@ describe( 'Controlling link title text', () => {
|
|
|
2422
2422
|
|
|
2423
2423
|
it.each( [
|
|
2424
2424
|
[ '', 'Testing' ],
|
|
2425
|
-
[ '(with leading and
|
|
2425
|
+
[ '(with leading and trailing whitespace)', ' Testing ' ],
|
|
2426
2426
|
[
|
|
2427
2427
|
// Note: link control should always preserve the original value.
|
|
2428
2428
|
// The consumer is responsible for filtering or otherwise handling the value.
|
|
@@ -94,7 +94,7 @@ const handleEntitySearch = async (
|
|
|
94
94
|
return isURLLike( val ) || ! withCreateSuggestion
|
|
95
95
|
? results
|
|
96
96
|
: results.concat( {
|
|
97
|
-
// the `id` prop is intentionally
|
|
97
|
+
// the `id` prop is intentionally omitted here because it
|
|
98
98
|
// is never exposed as part of the component's public API.
|
|
99
99
|
// see: https://github.com/WordPress/gutenberg/pull/19775#discussion_r378931316.
|
|
100
100
|
title: val, // Must match the existing `<input>`s text value.
|
|
@@ -9,6 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import {
|
|
10
10
|
__experimentalHStack as HStack,
|
|
11
11
|
__experimentalTruncate as Truncate,
|
|
12
|
+
privateApis as componentsPrivateApis,
|
|
12
13
|
} from '@wordpress/components';
|
|
13
14
|
import { forwardRef } from '@wordpress/element';
|
|
14
15
|
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
|
|
@@ -25,6 +26,8 @@ import ListViewExpander from './expander';
|
|
|
25
26
|
import { useBlockLock } from '../block-lock';
|
|
26
27
|
import useListViewImages from './use-list-view-images';
|
|
27
28
|
import { store as blockEditorStore } from '../../store';
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
30
|
+
const { Badge } = unlock( componentsPrivateApis );
|
|
28
31
|
|
|
29
32
|
function ListViewBlockSelectButton(
|
|
30
33
|
{
|
|
@@ -117,12 +120,9 @@ function ListViewBlockSelectButton(
|
|
|
117
120
|
</span>
|
|
118
121
|
{ blockInformation?.anchor && (
|
|
119
122
|
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
|
|
120
|
-
<
|
|
121
|
-
className="block-editor-list-view-block-select-button__anchor"
|
|
122
|
-
ellipsizeMode="auto"
|
|
123
|
-
>
|
|
123
|
+
<Badge className="block-editor-list-view-block-select-button__anchor">
|
|
124
124
|
{ blockInformation.anchor }
|
|
125
|
-
</
|
|
125
|
+
</Badge>
|
|
126
126
|
</span>
|
|
127
127
|
) }
|
|
128
128
|
{ isSticky && (
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
|
|
45
45
|
svg {
|
|
46
46
|
fill: currentColor;
|
|
47
|
-
//
|
|
47
|
+
// Optimize for high contrast modes.
|
|
48
48
|
// See also https://blogs.windows.com/msedgedev/2020/09/17/styling-for-windows-high-contrast-with-new-standards-for-forced-colors/.
|
|
49
49
|
@media (forced-colors: active) {
|
|
50
50
|
fill: CanvasText;
|
|
@@ -408,15 +408,11 @@
|
|
|
408
408
|
position: absolute;
|
|
409
409
|
right: 0;
|
|
410
410
|
transform: translateY(-50%);
|
|
411
|
-
background: rgba($black, 0.1);
|
|
412
|
-
border-radius: $radius-x-small;
|
|
413
|
-
padding: 2px 6px;
|
|
414
|
-
max-width: 100%;
|
|
415
|
-
box-sizing: border-box;
|
|
416
411
|
}
|
|
417
412
|
|
|
418
413
|
&.is-selected .block-editor-list-view-block-select-button__anchor {
|
|
419
414
|
background: rgba($black, 0.3);
|
|
415
|
+
color: $white;
|
|
420
416
|
}
|
|
421
417
|
|
|
422
418
|
.block-editor-list-view-block-select-button__lock,
|
|
@@ -484,7 +480,7 @@ $block-navigation-max-indent: 8;
|
|
|
484
480
|
.block-editor-list-view-leaf[aria-level="#{ $i + 1 }"]
|
|
485
481
|
.block-editor-list-view__expander {
|
|
486
482
|
@if $i - 1 >= 0 {
|
|
487
|
-
margin-left: ($grid-unit-30 * $i); //
|
|
483
|
+
margin-left: ($grid-unit-30 * $i); // Effectively centers the expander below the parent's icon.
|
|
488
484
|
} @else {
|
|
489
485
|
margin-left: 0;
|
|
490
486
|
}
|
|
@@ -111,7 +111,7 @@ export function useMouseMoveTypingReset() {
|
|
|
111
111
|
* Sets and removes the `isTyping` flag based on user actions:
|
|
112
112
|
*
|
|
113
113
|
* - Sets the flag if the user types within the given element.
|
|
114
|
-
* - Removes the flag when the user selects some text,
|
|
114
|
+
* - Removes the flag when the user selects some text, focuses a non-text
|
|
115
115
|
* field, presses ESC or TAB, or moves the mouse in the document.
|
|
116
116
|
*/
|
|
117
117
|
export function useTypingObserver() {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { useDispatch } from '@wordpress/data';
|
|
5
5
|
import { useEffect, useMemo } from '@wordpress/element';
|
|
6
6
|
import { SlotFillProvider } from '@wordpress/components';
|
|
7
|
-
//eslint-disable-next-line import/no-extraneous-dependencies -- Experimental package, not published.
|
|
8
7
|
import {
|
|
9
8
|
MediaUploadProvider,
|
|
10
9
|
store as uploadStore,
|
|
@@ -33,7 +33,7 @@ const noop = () => {};
|
|
|
33
33
|
* the template part in the block editor back to the entity and vice-versa.
|
|
34
34
|
*
|
|
35
35
|
* Here are some of its basic functions:
|
|
36
|
-
* -
|
|
36
|
+
* - Initializes the block-editor store for the given clientID to the blocks
|
|
37
37
|
* given via props.
|
|
38
38
|
* - Adds incoming changes (like undo) to the block-editor store.
|
|
39
39
|
* - Adds outgoing changes (like editing content) to the controlling entity,
|
|
@@ -49,7 +49,7 @@ const noop = () => {};
|
|
|
49
49
|
* root controller rather than an inner block
|
|
50
50
|
* controller.
|
|
51
51
|
* @param {Object[]} props.value The control value for the blocks. This value
|
|
52
|
-
* is used to
|
|
52
|
+
* is used to initialize the block-editor store
|
|
53
53
|
* and for resetting the blocks to incoming
|
|
54
54
|
* changes like undo.
|
|
55
55
|
* @param {Object} props.selection The selection state responsible to restore the selection on undo/redo.
|
|
@@ -16,9 +16,59 @@ export default {
|
|
|
16
16
|
title: 'BlockEditor/ResolutionControl',
|
|
17
17
|
component: ResolutionTool,
|
|
18
18
|
tags: [ 'status-private' ],
|
|
19
|
+
parameters: {
|
|
20
|
+
docs: {
|
|
21
|
+
canvas: { sourceState: 'shown' },
|
|
22
|
+
description: {
|
|
23
|
+
component:
|
|
24
|
+
'A control for selecting image resolution with preset size options.',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
19
28
|
argTypes: {
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
value: {
|
|
30
|
+
control: { type: null },
|
|
31
|
+
description: 'Currently selected resolution value.',
|
|
32
|
+
table: { type: { summary: 'string' } },
|
|
33
|
+
},
|
|
34
|
+
onChange: {
|
|
35
|
+
action: 'onChange',
|
|
36
|
+
control: { type: null },
|
|
37
|
+
description: 'Handles change in resolution selection.',
|
|
38
|
+
table: {
|
|
39
|
+
type: { summary: 'function' },
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
options: {
|
|
43
|
+
control: 'object',
|
|
44
|
+
description: 'Array of resolution options to display.',
|
|
45
|
+
table: {
|
|
46
|
+
type: { summary: 'array' },
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
defaultValue: {
|
|
50
|
+
control: 'radio',
|
|
51
|
+
options: [ 'thumbnail', 'medium', 'large', 'full' ],
|
|
52
|
+
description: 'Default resolution value.',
|
|
53
|
+
table: {
|
|
54
|
+
type: { summary: 'string' },
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
isShownByDefault: {
|
|
58
|
+
control: 'boolean',
|
|
59
|
+
description:
|
|
60
|
+
'Whether the control is shown by default in the panel.',
|
|
61
|
+
table: {
|
|
62
|
+
type: { summary: 'boolean' },
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
panelId: {
|
|
66
|
+
control: { type: null },
|
|
67
|
+
description: 'ID of the parent tools panel.',
|
|
68
|
+
table: {
|
|
69
|
+
type: { summary: 'string' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
22
72
|
},
|
|
23
73
|
};
|
|
24
74
|
|
|
@@ -52,7 +52,7 @@ _Optional._ By default, all registered formats are allowed. This setting can be
|
|
|
52
52
|
tagName="h2"
|
|
53
53
|
identifier="content"
|
|
54
54
|
value={ attributes.content }
|
|
55
|
-
allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow
|
|
55
|
+
allowedFormats={ [ 'core/bold', 'core/italic' ] } // Allow the content to be made bold or italic, but do not allow other formatting options
|
|
56
56
|
onChange={ ( content ) => setAttributes( { content } ) }
|
|
57
57
|
placeholder={ __( 'Heading...' ) }
|
|
58
58
|
/>
|
|
@@ -112,12 +112,12 @@ export default ( props ) => ( element ) => {
|
|
|
112
112
|
|
|
113
113
|
const value = getValue();
|
|
114
114
|
const transformed = formatTypes.reduce(
|
|
115
|
-
(
|
|
115
|
+
( accumulator, { __unstableInputRule } ) => {
|
|
116
116
|
if ( __unstableInputRule ) {
|
|
117
|
-
|
|
117
|
+
accumulator = __unstableInputRule( accumulator );
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
return
|
|
120
|
+
return accumulator;
|
|
121
121
|
},
|
|
122
122
|
preventEventDiscovery( value )
|
|
123
123
|
);
|
|
@@ -35,7 +35,7 @@ const interactiveContentTags = new Set( [
|
|
|
35
35
|
* @param {Object} $0 Options
|
|
36
36
|
* @param {string} $0.clientId Block client ID.
|
|
37
37
|
* @param {string} $0.identifier Block attribute.
|
|
38
|
-
* @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive
|
|
38
|
+
* @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not.
|
|
39
39
|
* @param {Array} $0.allowedFormats Allowed formats
|
|
40
40
|
*/
|
|
41
41
|
export function useFormatTypes( {
|
|
@@ -59,7 +59,7 @@ function getPrefixedSelectKeys( selected, prefix ) {
|
|
|
59
59
|
* @param {Object} $0 Options
|
|
60
60
|
* @param {string} $0.clientId Block client ID.
|
|
61
61
|
* @param {string} $0.identifier Block attribute.
|
|
62
|
-
* @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive
|
|
62
|
+
* @param {boolean} $0.withoutInteractiveFormatting Whether to clean the interactive formatting or not.
|
|
63
63
|
* @param {Array} $0.allowedFormats Allowed formats
|
|
64
64
|
*/
|
|
65
65
|
export function useFormatTypes( {
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Spacing Sizes Control
|
|
2
|
+
|
|
3
|
+
The SpacingSizesControl component provides a flexible user interface for controlling spacing values in blocks, allowing users to modify values for different sides. It supports three viewing modes:
|
|
4
|
+
|
|
5
|
+
1. Single: Control one side at a time.
|
|
6
|
+
2. Axial: Control horizontal and vertical sides together.
|
|
7
|
+
3. Custom: Control each side separately.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
import { __experimentalSpacingSizesControl as SpacingSizesControl } from '@wordpress/block-editor';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
14
|
+
|
|
15
|
+
function Example() {
|
|
16
|
+
const [ sides, setSides ] = useState( {
|
|
17
|
+
top: '0px',
|
|
18
|
+
right: '0px',
|
|
19
|
+
bottom: '0px',
|
|
20
|
+
left: '0px',
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<SpacingSizesControl
|
|
25
|
+
values={ sides }
|
|
26
|
+
onChange={ setSides }
|
|
27
|
+
label="Sides"
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Props
|
|
34
|
+
|
|
35
|
+
### `inputProps`
|
|
36
|
+
|
|
37
|
+
- Type: `Object`
|
|
38
|
+
- Required: No
|
|
39
|
+
- Description: Additional props to pass to the input controls.
|
|
40
|
+
|
|
41
|
+
### `label`
|
|
42
|
+
|
|
43
|
+
- Type: `String`
|
|
44
|
+
- Required: Yes
|
|
45
|
+
- Description: Label for the control.
|
|
46
|
+
|
|
47
|
+
### `minimumCustomValue`
|
|
48
|
+
|
|
49
|
+
- Type: `Number`
|
|
50
|
+
- Default: 0
|
|
51
|
+
- Description: Minimum value allowed for custom input.
|
|
52
|
+
|
|
53
|
+
### `onChange`
|
|
54
|
+
|
|
55
|
+
- Type: `Function`
|
|
56
|
+
- Required: Yes
|
|
57
|
+
- Description: Callback function called when spacing values change. Receives an object containing the updated values.
|
|
58
|
+
|
|
59
|
+
### `onMouseOut`
|
|
60
|
+
|
|
61
|
+
- Type: `Function`
|
|
62
|
+
- Required: No
|
|
63
|
+
- Description: Callback function called when mouse leaves the control.
|
|
64
|
+
|
|
65
|
+
### `onMouseOver`
|
|
66
|
+
|
|
67
|
+
- Type: `Function`
|
|
68
|
+
- Required: No
|
|
69
|
+
- Description: Callback function called when mouse enters the control.
|
|
70
|
+
|
|
71
|
+
### `showSideInLabel`
|
|
72
|
+
|
|
73
|
+
- Type: `Boolean`
|
|
74
|
+
- Default: true
|
|
75
|
+
- Description: Whether to show the side (top, right, etc.) in the control label.
|
|
76
|
+
|
|
77
|
+
### `sides`
|
|
78
|
+
|
|
79
|
+
- Type: `Array`
|
|
80
|
+
- Default: ALL_SIDES (top, right, bottom, left)
|
|
81
|
+
- Description: Array of sides that can be controlled.
|
|
82
|
+
|
|
83
|
+
### `useSelect`
|
|
84
|
+
|
|
85
|
+
- Type: `Boolean`
|
|
86
|
+
- Required: No
|
|
87
|
+
- Description: Whether to use a select control for predefined values.
|
|
88
|
+
|
|
89
|
+
### `values`
|
|
90
|
+
|
|
91
|
+
- Type: `Object`
|
|
92
|
+
- Required: No
|
|
93
|
+
- Description: Object containing the current spacing values for each side.
|
|
@@ -12,11 +12,11 @@ import { _x, sprintf } from '@wordpress/i18n';
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
|
+
import useSpacingSizes from './hooks/use-spacing-sizes';
|
|
15
16
|
import AxialInputControls from './input-controls/axial';
|
|
16
17
|
import SeparatedInputControls from './input-controls/separated';
|
|
17
18
|
import SingleInputControl from './input-controls/single';
|
|
18
19
|
import LinkedButton from './linked-button';
|
|
19
|
-
import useSpacingSizes from './hooks/use-spacing-sizes';
|
|
20
20
|
import {
|
|
21
21
|
ALL_SIDES,
|
|
22
22
|
DEFAULT_VALUES,
|
|
@@ -25,6 +25,49 @@ import {
|
|
|
25
25
|
getInitialView,
|
|
26
26
|
} from './utils';
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* A flexible control for managing spacing values in the block editor. Supports single, axial,
|
|
30
|
+
* and separated input controls for different spacing configurations with automatic view selection
|
|
31
|
+
* based on current values and available sides.
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/spacing-sizes-control/README.md
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```jsx
|
|
37
|
+
* import { __experimentalSpacingSizesControl as SpacingSizesControl } from '@wordpress/block-editor';
|
|
38
|
+
* import { useState } from '@wordpress/element';
|
|
39
|
+
*
|
|
40
|
+
* function Example() {
|
|
41
|
+
* const [ sides, setSides ] = useState( {
|
|
42
|
+
* top: '0px',
|
|
43
|
+
* right: '0px',
|
|
44
|
+
* bottom: '0px',
|
|
45
|
+
* left: '0px',
|
|
46
|
+
* } );
|
|
47
|
+
*
|
|
48
|
+
* return (
|
|
49
|
+
* <SpacingSizesControl
|
|
50
|
+
* values={ sides }
|
|
51
|
+
* onChange={ setSides }
|
|
52
|
+
* label="Sides"
|
|
53
|
+
* />
|
|
54
|
+
* );
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @param {Object} props Component props.
|
|
59
|
+
* @param {Object} props.inputProps Additional props for input controls.
|
|
60
|
+
* @param {string} props.label Label for the control.
|
|
61
|
+
* @param {number} props.minimumCustomValue Minimum value for custom input.
|
|
62
|
+
* @param {Function} props.onChange Called when spacing values change.
|
|
63
|
+
* @param {Function} props.onMouseOut Called when mouse leaves the control.
|
|
64
|
+
* @param {Function} props.onMouseOver Called when mouse enters the control.
|
|
65
|
+
* @param {boolean} props.showSideInLabel Show side in control label.
|
|
66
|
+
* @param {Array} props.sides Available sides for control.
|
|
67
|
+
* @param {boolean} props.useSelect Use select control for predefined values.
|
|
68
|
+
* @param {Object} props.values Current spacing values.
|
|
69
|
+
* @return {Element} Spacing sizes control component.
|
|
70
|
+
*/
|
|
28
71
|
export default function SpacingSizesControl( {
|
|
29
72
|
inputProps,
|
|
30
73
|
label: labelProp,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { Button
|
|
4
|
+
import { Button } from '@wordpress/components';
|
|
5
5
|
import { link, linkOff } from '@wordpress/icons';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
|
|
@@ -9,14 +9,12 @@ export default function LinkedButton( { isLinked, ...props } ) {
|
|
|
9
9
|
const label = isLinked ? __( 'Unlink sides' ) : __( 'Link sides' );
|
|
10
10
|
|
|
11
11
|
return (
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/>
|
|
20
|
-
</Tooltip>
|
|
12
|
+
<Button
|
|
13
|
+
{ ...props }
|
|
14
|
+
size="small"
|
|
15
|
+
icon={ isLinked ? link : linkOff }
|
|
16
|
+
iconSize={ 24 }
|
|
17
|
+
label={ label }
|
|
18
|
+
/>
|
|
21
19
|
);
|
|
22
20
|
}
|