@wordpress/block-editor 14.10.0 → 14.11.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 +3 -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/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/reusable-blocks-tab.native.js +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.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/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/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +5 -5
- 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/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/reusable-blocks-tab.native.js +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.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/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/store/actions.js +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +5 -5
- 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 +18 -21
- package/build-style/style.css +18 -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/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/reusable-blocks-tab.native.js +1 -1
- 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/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/store/actions.js +1 -1
- package/src/store/selectors.js +5 -5
- 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
|
@@ -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( {
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# TabbedSidebar
|
|
2
2
|
|
|
3
|
-
The `
|
|
3
|
+
The `TabbedSidebar` component is used to create secondary panels in the editor with tabbed navigation.
|
|
4
4
|
|
|
5
5
|
## Development guidelines
|
|
6
6
|
|
|
7
|
-
This acts as a wrapper for the `Tabs` component,
|
|
7
|
+
This acts as a wrapper for the `Tabs` component, adding conventions that can be shared between all secondary panels, including:
|
|
8
8
|
|
|
9
9
|
- A close button
|
|
10
10
|
- Tabs that fill the panel
|
|
11
|
-
- Custom
|
|
11
|
+
- Custom scrollbars
|
|
12
12
|
|
|
13
13
|
### Usage
|
|
14
14
|
|
|
15
|
-
Renders a block alignment toolbar with alignments options.
|
|
16
|
-
|
|
17
15
|
```jsx
|
|
18
|
-
import { TabbedSidebar } from '@wordpress/
|
|
16
|
+
import { TabbedSidebar } from '@wordpress/block-editor';
|
|
19
17
|
|
|
20
18
|
const MyTabbedSidebar = () => (
|
|
21
19
|
<TabbedSidebar
|
|
@@ -23,7 +21,7 @@ const MyTabbedSidebar = () => (
|
|
|
23
21
|
{
|
|
24
22
|
name: 'slug-1',
|
|
25
23
|
title: _x( 'Title 1', 'context' ),
|
|
26
|
-
panel: <PanelContents
|
|
24
|
+
panel: <PanelContents />,
|
|
27
25
|
panelRef: useRef('an-optional-ref'),
|
|
28
26
|
},
|
|
29
27
|
{
|
|
@@ -35,6 +33,8 @@ const MyTabbedSidebar = () => (
|
|
|
35
33
|
onClose={ onClickCloseButton }
|
|
36
34
|
onSelect={ onSelectTab }
|
|
37
35
|
defaultTabId="slug-1"
|
|
36
|
+
selectedTab="slug-1"
|
|
37
|
+
closeButtonLabel="Close sidebar"
|
|
38
38
|
ref={ tabsRef }
|
|
39
39
|
/>
|
|
40
40
|
);
|
|
@@ -47,30 +47,41 @@ const MyTabbedSidebar = () => (
|
|
|
47
47
|
- **Type:** `String`
|
|
48
48
|
- **Default:** `undefined`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
The ID of the tab to be selected by default when the component renders.
|
|
51
51
|
|
|
52
52
|
### `onClose`
|
|
53
53
|
|
|
54
54
|
- **Type:** `Function`
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
Function called when the close button is clicked.
|
|
57
57
|
|
|
58
58
|
### `onSelect`
|
|
59
59
|
|
|
60
60
|
- **Type:** `Function`
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
Function called when a tab is selected. Receives the selected tab's ID as an argument.
|
|
63
63
|
|
|
64
64
|
### `selectedTab`
|
|
65
65
|
|
|
66
66
|
- **Type:** `String`
|
|
67
67
|
- **Default:** `undefined`
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
The ID of the currently selected tab.
|
|
70
70
|
|
|
71
71
|
### `tabs`
|
|
72
72
|
|
|
73
73
|
- **Type:** `Array`
|
|
74
74
|
- **Default:** `undefined`
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
Array of tab objects. Each tab should have:
|
|
77
|
+
|
|
78
|
+
- `name` (string): Unique identifier for the tab
|
|
79
|
+
- `title` (string): Display title for the tab
|
|
80
|
+
- `panel` (React.Node): Content to display in the tab panel
|
|
81
|
+
- `panelRef` (React.Ref, optional): Reference to the tab panel element
|
|
82
|
+
|
|
83
|
+
#### `closeButtonLabel`
|
|
84
|
+
|
|
85
|
+
- **Type:** `String`
|
|
86
|
+
|
|
87
|
+
Accessibility label for the close button.
|
|
@@ -15,6 +15,44 @@ import { unlock } from '../../lock-unlock';
|
|
|
15
15
|
|
|
16
16
|
const { Tabs } = unlock( componentsPrivateApis );
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* A component that creates a tabbed sidebar with a close button.
|
|
20
|
+
*
|
|
21
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/tabbed-sidebar/README.md
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* function MyTabbedSidebar() {
|
|
26
|
+
* return (
|
|
27
|
+
* <TabbedSidebar
|
|
28
|
+
* tabs={ [
|
|
29
|
+
* {
|
|
30
|
+
* name: 'tab1',
|
|
31
|
+
* title: 'Settings',
|
|
32
|
+
* panel: <PanelContents />,
|
|
33
|
+
* }
|
|
34
|
+
* ] }
|
|
35
|
+
* onClose={ () => {} }
|
|
36
|
+
* onSelect={ () => {} }
|
|
37
|
+
* defaultTabId="tab1"
|
|
38
|
+
* selectedTab="tab1"
|
|
39
|
+
* closeButtonLabel="Close sidebar"
|
|
40
|
+
* />
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} props Component props.
|
|
46
|
+
* @param {string} [props.defaultTabId] The ID of the tab to be selected by default when the component renders.
|
|
47
|
+
* @param {Function} props.onClose Function called when the close button is clicked.
|
|
48
|
+
* @param {Function} props.onSelect Function called when a tab is selected. Receives the selected tab's ID as an argument.
|
|
49
|
+
* @param {string} props.selectedTab The ID of the currently selected tab.
|
|
50
|
+
* @param {Array} props.tabs Array of tab objects. Each tab should have: name (string), title (string),
|
|
51
|
+
* panel (React.Node), and optionally panelRef (React.Ref).
|
|
52
|
+
* @param {string} props.closeButtonLabel Accessibility label for the close button.
|
|
53
|
+
* @param {Object} ref Forward ref to the tabs list element.
|
|
54
|
+
* @return {Element} The tabbed sidebar component.
|
|
55
|
+
*/
|
|
18
56
|
function TabbedSidebar(
|
|
19
57
|
{ defaultTabId, onClose, onSelect, selectedTab, tabs, closeButtonLabel },
|
|
20
58
|
ref
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import TabbedSidebar from '../';
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'BlockEditor/TabbedSidebar',
|
|
13
|
+
component: TabbedSidebar,
|
|
14
|
+
tags: [ 'status-private' ],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
canvas: { sourceState: 'shown' },
|
|
18
|
+
description: {
|
|
19
|
+
component:
|
|
20
|
+
'A component that creates a tabbed sidebar with a close button.',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
argTypes: {
|
|
25
|
+
defaultTabId: {
|
|
26
|
+
control: { type: null },
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'string' },
|
|
29
|
+
},
|
|
30
|
+
description:
|
|
31
|
+
'The ID of the tab to be selected by default when the component renders.',
|
|
32
|
+
},
|
|
33
|
+
onClose: {
|
|
34
|
+
action: 'onClose',
|
|
35
|
+
control: { type: null },
|
|
36
|
+
table: {
|
|
37
|
+
type: { summary: 'function' },
|
|
38
|
+
},
|
|
39
|
+
description: 'Function called when the close button is clicked.',
|
|
40
|
+
},
|
|
41
|
+
onSelect: {
|
|
42
|
+
action: 'onSelect',
|
|
43
|
+
control: { type: null },
|
|
44
|
+
table: {
|
|
45
|
+
type: { summary: 'function' },
|
|
46
|
+
},
|
|
47
|
+
description:
|
|
48
|
+
"Function called when a tab is selected. Receives the selected tab's ID as an argument.",
|
|
49
|
+
},
|
|
50
|
+
selectedTab: {
|
|
51
|
+
control: { type: null },
|
|
52
|
+
table: {
|
|
53
|
+
type: { summary: 'string' },
|
|
54
|
+
},
|
|
55
|
+
description: 'The ID of the currently selected tab.',
|
|
56
|
+
},
|
|
57
|
+
tabs: {
|
|
58
|
+
control: { type: 'array' },
|
|
59
|
+
table: {
|
|
60
|
+
type: { summary: 'array' },
|
|
61
|
+
},
|
|
62
|
+
description:
|
|
63
|
+
'Array of tab objects. Each tab should have: name (string), title (string), panel (React.Node), and optionally panelRef (React.Ref).',
|
|
64
|
+
},
|
|
65
|
+
closeButtonLabel: {
|
|
66
|
+
control: { type: 'text' },
|
|
67
|
+
table: {
|
|
68
|
+
type: { summary: 'string' },
|
|
69
|
+
},
|
|
70
|
+
description: 'Accessibility label for the close button.',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export default meta;
|
|
76
|
+
|
|
77
|
+
const DEMO_TABS = [
|
|
78
|
+
{ name: 'tab1', title: 'Settings' },
|
|
79
|
+
{ name: 'tab2', title: 'Styles' },
|
|
80
|
+
{ name: 'tab3', title: 'Advanced' },
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
export const Default = {
|
|
84
|
+
render: function Template( { onSelect, onClose, ...args } ) {
|
|
85
|
+
const [ selectedTab, setSelectedTab ] = useState();
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<TabbedSidebar
|
|
89
|
+
{ ...args }
|
|
90
|
+
selectedTab={ selectedTab }
|
|
91
|
+
onSelect={ ( ...changeArgs ) => {
|
|
92
|
+
onSelect( ...changeArgs );
|
|
93
|
+
setSelectedTab( ...changeArgs );
|
|
94
|
+
} }
|
|
95
|
+
onClose={ onClose }
|
|
96
|
+
/>
|
|
97
|
+
);
|
|
98
|
+
},
|
|
99
|
+
args: {
|
|
100
|
+
tabs: DEMO_TABS,
|
|
101
|
+
defaultTabId: 'tab1',
|
|
102
|
+
closeButtonLabel: 'Close Sidebar',
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -193,7 +193,7 @@ export function useTypewriter() {
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
/**
|
|
196
|
-
* Checks if the current situation is
|
|
196
|
+
* Checks if the current situation is eligible for scroll:
|
|
197
197
|
* - There should be one and only one block selected.
|
|
198
198
|
* - The component must contain the selection.
|
|
199
199
|
* - The active element must be contenteditable.
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useState } from '@wordpress/element';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import UnitControl from '../';
|
|
10
|
+
|
|
11
|
+
const meta = {
|
|
12
|
+
title: 'BlockEditor/UnitControl',
|
|
13
|
+
component: UnitControl,
|
|
14
|
+
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
canvas: { sourceState: 'shown' },
|
|
17
|
+
description: {
|
|
18
|
+
component:
|
|
19
|
+
'UnitControl allows the user to set a numeric quantity as well as a unit.',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
argTypes: {
|
|
24
|
+
onChange: {
|
|
25
|
+
action: 'onChange',
|
|
26
|
+
description: 'Callback function when the value changes.',
|
|
27
|
+
table: {
|
|
28
|
+
type: { summary: 'function' },
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
onUnitChange: {
|
|
32
|
+
action: 'onUnitChange',
|
|
33
|
+
description: 'Callback function when the unit changes.',
|
|
34
|
+
table: {
|
|
35
|
+
type: { summary: 'function' },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
labelPosition: {
|
|
39
|
+
control: 'radio',
|
|
40
|
+
options: [ 'top', 'side', 'bottom', 'edge' ],
|
|
41
|
+
description: 'The position of the label.',
|
|
42
|
+
table: {
|
|
43
|
+
type: { summary: 'string' },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
label: {
|
|
47
|
+
control: 'text',
|
|
48
|
+
description: 'The label for the control.',
|
|
49
|
+
table: {
|
|
50
|
+
type: { summary: 'string' },
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
value: {
|
|
54
|
+
control: { type: null },
|
|
55
|
+
description: 'The value of the control.',
|
|
56
|
+
table: {
|
|
57
|
+
type: { summary: 'string' },
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
size: {
|
|
61
|
+
control: 'radio',
|
|
62
|
+
options: [ 'default', 'small' ],
|
|
63
|
+
description: 'The size of the control.',
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: 'string' },
|
|
66
|
+
defaultValue: { summary: 'default' },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
disabled: {
|
|
70
|
+
control: 'boolean',
|
|
71
|
+
description: 'Whether the control is disabled.',
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: 'boolean' },
|
|
74
|
+
defaultValue: { summary: false },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
disableUnits: {
|
|
78
|
+
control: 'boolean',
|
|
79
|
+
description: 'If true, the unit select is hidden.',
|
|
80
|
+
table: {
|
|
81
|
+
type: { summary: 'boolean' },
|
|
82
|
+
defaultValue: { summary: false },
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
isPressEnterToChange: {
|
|
86
|
+
control: 'boolean',
|
|
87
|
+
description:
|
|
88
|
+
'If true, the ENTER key press is required to trigger onChange. Change is also triggered on blur.',
|
|
89
|
+
table: {
|
|
90
|
+
type: { summary: 'boolean' },
|
|
91
|
+
defaultValue: { summary: false },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
isUnitSelectTabbable: {
|
|
95
|
+
control: 'boolean',
|
|
96
|
+
description: 'Determines if the unit select is tabbable.',
|
|
97
|
+
table: {
|
|
98
|
+
type: { summary: 'boolean' },
|
|
99
|
+
defaultValue: { summary: true },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export default meta;
|
|
106
|
+
|
|
107
|
+
export const Default = {
|
|
108
|
+
render: function Template( { onChange, ...args } ) {
|
|
109
|
+
const [ value, setValue ] = useState();
|
|
110
|
+
return (
|
|
111
|
+
<UnitControl
|
|
112
|
+
{ ...args }
|
|
113
|
+
value={ value }
|
|
114
|
+
onChange={ ( ...changeArgs ) => {
|
|
115
|
+
onChange( ...changeArgs );
|
|
116
|
+
setValue( ...changeArgs );
|
|
117
|
+
} }
|
|
118
|
+
/>
|
|
119
|
+
);
|
|
120
|
+
},
|
|
121
|
+
args: {
|
|
122
|
+
label: 'Label',
|
|
123
|
+
},
|
|
124
|
+
};
|
|
@@ -265,14 +265,14 @@ const ImageURLInputUI = ( {
|
|
|
265
265
|
<div className="block-editor-url-popover__expand-on-click">
|
|
266
266
|
<Icon icon={ fullscreen } />
|
|
267
267
|
<div className="text">
|
|
268
|
-
<p>{ __( '
|
|
268
|
+
<p>{ __( 'Enlarge on click' ) }</p>
|
|
269
269
|
<p className="description">
|
|
270
270
|
{ __( 'Scales the image with a lightbox effect' ) }
|
|
271
271
|
</p>
|
|
272
272
|
</div>
|
|
273
273
|
<Button
|
|
274
274
|
icon={ linkOff }
|
|
275
|
-
label={ __( 'Disable
|
|
275
|
+
label={ __( 'Disable enlarge on click' ) }
|
|
276
276
|
onClick={ () => {
|
|
277
277
|
onSetLightbox?.( false );
|
|
278
278
|
} }
|
|
@@ -372,7 +372,7 @@ const ImageURLInputUI = ( {
|
|
|
372
372
|
stopEditLink();
|
|
373
373
|
} }
|
|
374
374
|
>
|
|
375
|
-
{ __( '
|
|
375
|
+
{ __( 'Enlarge on click' ) }
|
|
376
376
|
</MenuItem>
|
|
377
377
|
) }
|
|
378
378
|
</NavigableMenu>
|
|
@@ -89,7 +89,7 @@ const getTransformCommands = () =>
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
// Simple block
|
|
92
|
+
// Simple block transformation based on the `Block Transforms` API.
|
|
93
93
|
function onBlockTransform( name ) {
|
|
94
94
|
const newBlocks = switchToBlockType( blocks, name );
|
|
95
95
|
replaceBlocks( clientIds, newBlocks );
|
|
@@ -96,7 +96,7 @@ function useMovingAnimation( { triggerAnimationOnChange, clientId } ) {
|
|
|
96
96
|
// motion, if the user is typing (insertion by Enter), or if the block
|
|
97
97
|
// count exceeds the threshold (insertion caused all the blocks that
|
|
98
98
|
// follow to animate).
|
|
99
|
-
// To do: consider
|
|
99
|
+
// To do: consider enabling the _moving_ animation even for large
|
|
100
100
|
// posts, while only disabling the _insertion_ animation?
|
|
101
101
|
const disableAnimation =
|
|
102
102
|
window.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||
|