@wordpress/block-editor 15.8.1-next.dc3f6d3c1.0 → 15.9.1-next.6deb34194.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 +2 -0
- package/README.md +12 -0
- package/build/components/block-alignment-matrix-control/index.js +1 -8
- package/build/components/block-alignment-matrix-control/index.js.map +2 -2
- package/build/components/block-bindings/attribute-control.js +172 -0
- package/build/components/block-bindings/attribute-control.js.map +7 -0
- package/build/components/block-bindings/index.js +47 -0
- package/build/components/block-bindings/index.js.map +7 -0
- package/build/components/block-bindings/source-fields-list.js +135 -0
- package/build/components/block-bindings/source-fields-list.js.map +7 -0
- package/build/components/block-bindings/use-block-bindings-utils.js +66 -0
- package/build/components/block-bindings/use-block-bindings-utils.js.map +7 -0
- package/build/components/block-edit/edit.js +1 -3
- package/build/components/block-edit/edit.js.map +2 -2
- package/build/components/block-list/index.js +2 -1
- package/build/components/block-list/index.js.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
- package/build/components/block-lock/modal.js +5 -5
- package/build/components/block-lock/modal.js.map +2 -2
- package/build/components/block-lock/use-block-lock.js +10 -13
- package/build/components/block-lock/use-block-lock.js.map +2 -2
- package/build/components/block-settings-menu-controls/index.js +1 -1
- package/build/components/block-settings-menu-controls/index.js.map +2 -2
- package/build/components/block-styles/preview-panel.js +3 -5
- package/build/components/block-styles/preview-panel.js.map +2 -2
- package/build/components/block-styles/use-styles-for-block.js +2 -2
- package/build/components/block-styles/use-styles-for-block.js.map +2 -2
- package/build/components/block-toolbar/index.js +1 -8
- package/build/components/block-toolbar/index.js.map +3 -3
- package/build/components/block-tools/index.js +56 -45
- package/build/components/block-tools/index.js.map +3 -3
- package/build/components/block-visibility/toolbar.js +1 -1
- package/build/components/block-visibility/toolbar.js.map +1 -1
- package/build/components/content-only-controls/fields-dropdown-menu.js +66 -0
- package/build/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
- package/build/components/content-only-controls/index.js +202 -44
- package/build/components/content-only-controls/index.js.map +3 -3
- package/build/components/content-only-controls/link/index.js +92 -103
- package/build/components/content-only-controls/link/index.js.map +3 -3
- package/build/components/content-only-controls/media/index.js +134 -134
- package/build/components/content-only-controls/media/index.js.map +3 -3
- package/build/components/content-only-controls/rich-text/index.js +66 -74
- package/build/components/content-only-controls/rich-text/index.js.map +3 -3
- package/build/components/dimensions-tool/width-height-tool.js +4 -16
- package/build/components/dimensions-tool/width-height-tool.js.map +3 -3
- package/build/components/font-family/index.js +1 -15
- package/build/components/font-family/index.js.map +2 -2
- package/build/components/global-styles/dimensions-panel.js +35 -2
- package/build/components/global-styles/dimensions-panel.js.map +2 -2
- package/build/components/global-styles/hooks.js +1 -1
- package/build/components/global-styles/hooks.js.map +2 -2
- package/build/components/global-styles/typography-panel.js +1 -2
- package/build/components/global-styles/typography-panel.js.map +2 -2
- package/build/components/image-editor/cropper.js +3 -34
- package/build/components/image-editor/cropper.js.map +3 -3
- package/build/components/image-editor/index.js +9 -3
- package/build/components/image-editor/index.js.map +2 -2
- package/build/components/image-editor/use-transform-image.js +62 -32
- package/build/components/image-editor/use-transform-image.js.map +2 -2
- package/build/components/image-editor/zoom-dropdown.js +2 -2
- package/build/components/image-editor/zoom-dropdown.js.map +2 -2
- package/build/components/index.js +10 -3
- package/build/components/index.js.map +2 -2
- package/build/components/inserter-draggable-blocks/index.js +8 -4
- package/build/components/inserter-draggable-blocks/index.js.map +2 -2
- package/build/components/inspector-controls-tabs/content-tab.js +3 -2
- package/build/components/inspector-controls-tabs/content-tab.js.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
- package/build/components/link-control/index.js +15 -7
- package/build/components/link-control/index.js.map +2 -2
- package/build/components/list-view/block-select-button.js +3 -11
- package/build/components/list-view/block-select-button.js.map +2 -2
- package/build/components/list-view/block.js +9 -7
- package/build/components/list-view/block.js.map +2 -2
- package/build/components/media-placeholder/index.js +17 -4
- package/build/components/media-placeholder/index.js.map +2 -2
- package/build/components/media-placeholder/utils.js +60 -0
- package/build/components/media-placeholder/utils.js.map +7 -0
- package/build/components/media-replace-flow/index.js +20 -3
- package/build/components/media-replace-flow/index.js.map +2 -2
- package/build/components/tool-selector/index.js +46 -0
- package/build/components/tool-selector/index.js.map +7 -0
- package/build/components/use-block-commands/index.js +1 -1
- package/build/components/use-block-commands/index.js.map +2 -2
- package/build/components/use-block-drop-zone/index.js +1 -5
- package/build/components/use-block-drop-zone/index.js.map +2 -2
- package/build/hooks/block-bindings.js +22 -260
- package/build/hooks/block-bindings.js.map +3 -3
- package/build/hooks/dimensions.js +3 -3
- package/build/hooks/dimensions.js.map +2 -2
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +2 -2
- package/build/hooks/utils.js +5 -1
- package/build/hooks/utils.js.map +2 -2
- package/build/layouts/grid.js +23 -28
- package/build/layouts/grid.js.map +2 -2
- package/build/store/private-selectors.js +43 -3
- package/build/store/private-selectors.js.map +2 -2
- package/build/store/reducer.js +2 -1
- package/build/store/reducer.js.map +2 -2
- package/build/store/selectors.js +6 -4
- package/build/store/selectors.js.map +2 -2
- package/build/utils/block-bindings.js +2 -44
- package/build/utils/block-bindings.js.map +3 -3
- package/build/utils/index.js +2 -5
- package/build/utils/index.js.map +2 -2
- package/build-module/components/block-alignment-matrix-control/index.js +1 -8
- package/build-module/components/block-alignment-matrix-control/index.js.map +2 -2
- package/build-module/components/block-bindings/attribute-control.js +150 -0
- package/build-module/components/block-bindings/attribute-control.js.map +7 -0
- package/build-module/components/block-bindings/index.js +10 -0
- package/build-module/components/block-bindings/index.js.map +7 -0
- package/build-module/components/block-bindings/source-fields-list.js +104 -0
- package/build-module/components/block-bindings/source-fields-list.js.map +7 -0
- package/build-module/components/block-bindings/use-block-bindings-utils.js +45 -0
- package/build-module/components/block-bindings/use-block-bindings-utils.js.map +7 -0
- package/build-module/components/block-edit/edit.js +1 -3
- package/build-module/components/block-edit/edit.js.map +2 -2
- package/build-module/components/block-list/index.js +2 -1
- package/build-module/components/block-list/index.js.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js +27 -5
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.js.map +2 -2
- package/build-module/components/block-lock/modal.js +5 -5
- package/build-module/components/block-lock/modal.js.map +2 -2
- package/build-module/components/block-lock/use-block-lock.js +10 -13
- package/build-module/components/block-lock/use-block-lock.js.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.js +1 -1
- package/build-module/components/block-settings-menu-controls/index.js.map +2 -2
- package/build-module/components/block-styles/preview-panel.js +3 -5
- package/build-module/components/block-styles/preview-panel.js.map +2 -2
- package/build-module/components/block-styles/use-styles-for-block.js +2 -2
- package/build-module/components/block-styles/use-styles-for-block.js.map +2 -2
- package/build-module/components/block-toolbar/index.js +1 -8
- package/build-module/components/block-toolbar/index.js.map +2 -2
- package/build-module/components/block-tools/index.js +56 -45
- package/build-module/components/block-tools/index.js.map +2 -2
- package/build-module/components/block-visibility/toolbar.js +1 -1
- package/build-module/components/block-visibility/toolbar.js.map +1 -1
- package/build-module/components/content-only-controls/fields-dropdown-menu.js +45 -0
- package/build-module/components/content-only-controls/fields-dropdown-menu.js.map +7 -0
- package/build-module/components/content-only-controls/index.js +206 -46
- package/build-module/components/content-only-controls/index.js.map +2 -2
- package/build-module/components/content-only-controls/link/index.js +92 -104
- package/build-module/components/content-only-controls/link/index.js.map +2 -2
- package/build-module/components/content-only-controls/media/index.js +134 -135
- package/build-module/components/content-only-controls/media/index.js.map +2 -2
- package/build-module/components/content-only-controls/rich-text/index.js +68 -81
- package/build-module/components/content-only-controls/rich-text/index.js.map +2 -2
- package/build-module/components/dimensions-tool/width-height-tool.js +4 -6
- package/build-module/components/dimensions-tool/width-height-tool.js.map +2 -2
- package/build-module/components/font-family/index.js +1 -15
- package/build-module/components/font-family/index.js.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.js +35 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +2 -2
- package/build-module/components/global-styles/hooks.js +1 -1
- package/build-module/components/global-styles/hooks.js.map +2 -2
- package/build-module/components/global-styles/typography-panel.js +1 -2
- package/build-module/components/global-styles/typography-panel.js.map +2 -2
- package/build-module/components/image-editor/cropper.js +3 -34
- package/build-module/components/image-editor/cropper.js.map +2 -2
- package/build-module/components/image-editor/index.js +9 -3
- package/build-module/components/image-editor/index.js.map +2 -2
- package/build-module/components/image-editor/use-transform-image.js +63 -33
- package/build-module/components/image-editor/use-transform-image.js.map +2 -2
- package/build-module/components/image-editor/zoom-dropdown.js +2 -2
- package/build-module/components/image-editor/zoom-dropdown.js.map +2 -2
- package/build-module/components/index.js +74 -66
- package/build-module/components/index.js.map +2 -2
- package/build-module/components/inserter-draggable-blocks/index.js +8 -4
- package/build-module/components/inserter-draggable-blocks/index.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/content-tab.js +3 -2
- package/build-module/components/inspector-controls-tabs/content-tab.js.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +2 -2
- package/build-module/components/link-control/index.js +16 -8
- package/build-module/components/link-control/index.js.map +2 -2
- package/build-module/components/list-view/block-select-button.js +3 -11
- package/build-module/components/list-view/block-select-button.js.map +2 -2
- package/build-module/components/list-view/block.js +9 -7
- package/build-module/components/list-view/block.js.map +2 -2
- package/build-module/components/media-placeholder/index.js +18 -5
- package/build-module/components/media-placeholder/index.js.map +2 -2
- package/build-module/components/media-placeholder/utils.js +35 -0
- package/build-module/components/media-placeholder/utils.js.map +7 -0
- package/build-module/components/media-replace-flow/index.js +20 -3
- package/build-module/components/media-replace-flow/index.js.map +2 -2
- package/build-module/components/tool-selector/index.js +15 -0
- package/build-module/components/tool-selector/index.js.map +7 -0
- package/build-module/components/use-block-commands/index.js +1 -1
- package/build-module/components/use-block-commands/index.js.map +2 -2
- package/build-module/components/use-block-drop-zone/index.js +1 -5
- package/build-module/components/use-block-drop-zone/index.js.map +2 -2
- package/build-module/hooks/block-bindings.js +27 -270
- package/build-module/hooks/block-bindings.js.map +2 -2
- package/build-module/hooks/dimensions.js +3 -3
- package/build-module/hooks/dimensions.js.map +2 -2
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +2 -2
- package/build-module/hooks/utils.js +5 -1
- package/build-module/hooks/utils.js.map +2 -2
- package/build-module/layouts/grid.js +23 -28
- package/build-module/layouts/grid.js.map +2 -2
- package/build-module/store/private-selectors.js +39 -3
- package/build-module/store/private-selectors.js.map +2 -2
- package/build-module/store/reducer.js +2 -1
- package/build-module/store/reducer.js.map +2 -2
- package/build-module/store/selectors.js +6 -4
- package/build-module/store/selectors.js.map +2 -2
- package/build-module/utils/block-bindings.js +1 -42
- package/build-module/utils/block-bindings.js.map +2 -2
- package/build-module/utils/index.js +1 -3
- package/build-module/utils/index.js.map +2 -2
- package/build-style/content-rtl.css +3 -0
- package/build-style/content.css +3 -0
- package/build-style/style-rtl.css +20 -11
- package/build-style/style.css +20 -11
- package/package.json +39 -39
- package/src/components/block-alignment-matrix-control/index.js +1 -5
- package/src/components/block-bindings/attribute-control.js +174 -0
- package/src/components/block-bindings/index.js +6 -0
- package/src/components/block-bindings/source-fields-list.js +130 -0
- package/src/components/block-bindings/use-block-bindings-utils.js +156 -0
- package/src/components/block-edit/edit.js +1 -3
- package/src/components/block-list/content.scss +5 -0
- package/src/components/block-list/index.js +3 -1
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +34 -3
- package/src/components/block-lock/modal.js +6 -5
- package/src/components/block-lock/use-block-lock.js +10 -14
- package/src/components/block-patterns-list/stories/{index.story.js → index.story.jsx} +3 -1
- package/src/components/block-settings-menu-controls/index.js +1 -1
- package/src/components/block-styles/preview-panel.js +3 -5
- package/src/components/block-styles/use-styles-for-block.js +2 -2
- package/src/components/block-toolbar/index.js +1 -6
- package/src/components/block-toolbar/style.scss +6 -6
- package/src/components/block-tools/index.js +15 -2
- package/src/components/block-tools/style.scss +4 -0
- package/src/components/block-visibility/toolbar.js +1 -1
- package/src/components/content-only-controls/fields-dropdown-menu.js +53 -0
- package/src/components/content-only-controls/index.js +289 -50
- package/src/components/content-only-controls/link/index.js +62 -57
- package/src/components/content-only-controls/media/index.js +177 -156
- package/src/components/content-only-controls/rich-text/index.js +31 -44
- package/src/components/content-only-controls/styles.scss +10 -1
- package/src/components/dimensions-tool/width-height-tool.js +6 -13
- package/src/components/font-family/README.md +0 -9
- package/src/components/font-family/index.js +1 -16
- package/src/components/font-family/stories/{index.story.js → index.story.jsx} +0 -1
- package/src/components/global-styles/dimensions-panel.js +36 -0
- package/src/components/global-styles/hooks.js +1 -1
- package/src/components/global-styles/typography-panel.js +0 -1
- package/src/components/image-editor/cropper.js +3 -32
- package/src/components/image-editor/index.js +34 -29
- package/src/components/image-editor/use-transform-image.js +80 -34
- package/src/components/image-editor/zoom-dropdown.js +2 -2
- package/src/components/index.js +9 -1
- package/src/components/inserter/style.scss +1 -1
- package/src/components/inserter-draggable-blocks/index.js +19 -8
- package/src/components/inspector-controls-tabs/content-tab.js +6 -2
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +1 -5
- package/src/components/link-control/index.js +36 -12
- package/src/components/list-view/block-select-button.js +22 -30
- package/src/components/list-view/block.js +9 -7
- package/src/components/media-placeholder/index.js +20 -5
- package/src/components/media-placeholder/test/get-computed-accept-attribute.js +164 -0
- package/src/components/media-placeholder/utils.js +65 -0
- package/src/components/media-replace-flow/index.js +22 -3
- package/src/components/tool-selector/index.js +19 -0
- package/src/components/use-block-commands/index.js +1 -1
- package/src/components/use-block-drop-zone/index.js +1 -5
- package/src/hooks/block-bindings.js +27 -347
- package/src/hooks/dimensions.js +8 -3
- package/src/hooks/metadata.js +1 -1
- package/src/hooks/test/metadata.js +1 -1
- package/src/hooks/utils.js +4 -0
- package/src/layouts/grid.js +40 -72
- package/src/layouts/test/grid.js +14 -0
- package/src/store/private-selectors.js +123 -6
- package/src/store/reducer.js +3 -0
- package/src/store/selectors.js +6 -4
- package/src/store/test/private-selectors.js +242 -0
- package/src/store/test/reducer.js +17 -7
- package/src/style.scss +0 -1
- package/src/utils/block-bindings.js +0 -157
- package/src/utils/index.js +0 -1
- package/tsconfig.json +2 -0
- package/build/components/block-toolbar/block-name-context.js +0 -30
- package/build/components/block-toolbar/block-name-context.js.map +0 -7
- package/build/components/content-only-controls/plain-text/index.js +0 -68
- package/build/components/content-only-controls/plain-text/index.js.map +0 -7
- package/build-module/components/block-toolbar/block-name-context.js +0 -9
- package/build-module/components/block-toolbar/block-name-context.js.map +0 -7
- package/build-module/components/content-only-controls/plain-text/index.js +0 -50
- package/build-module/components/content-only-controls/plain-text/index.js.map +0 -7
- package/src/components/block-toolbar/block-name-context.js +0 -9
- package/src/components/content-only-controls/plain-text/index.js +0 -49
- package/src/components/font-family/style.scss +0 -7
- /package/src/components/alignment-control/stories/{aliginment-toolbar.story.js → aliginment-toolbar.story.jsx} +0 -0
- /package/src/components/alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-alignment-matrix-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/{utils → components/block-bindings}/test/use-block-bindings-utils.js +0 -0
- /package/src/components/block-draggable/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-heading-level-dropdown/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-mover/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/block-title/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/border-radius-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/date-format-picker/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{aspect-ratio-tool.story.js → aspect-ratio-tool.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{scale-tool.story.js → scale-tool.story.jsx} +0 -0
- /package/src/components/dimensions-tool/stories/{width-height-tool.story.js → width-height-tool.story.jsx} +0 -0
- /package/src/components/height-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/inserter/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/line-height-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/plain-text/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/resolution-tool/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/tabbed-sidebar/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-alignment-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-decoration-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/text-transform-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/unit-control/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/url-popover/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/warning/stories/{index.story.js → index.story.jsx} +0 -0
- /package/src/components/writing-mode-control/stories/{index.story.js → index.story.jsx} +0 -0
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
6
|
Icon,
|
|
7
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
7
|
__experimentalGrid as Grid,
|
|
9
8
|
} from '@wordpress/components';
|
|
10
9
|
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import { useMemo } from '@wordpress/element';
|
|
12
10
|
import { __ } from '@wordpress/i18n';
|
|
13
11
|
import {
|
|
14
12
|
audio as audioIcon,
|
|
@@ -26,9 +24,10 @@ import { useInspectorPopoverPlacement } from '../use-inspector-popover-placement
|
|
|
26
24
|
import { getMediaSelectKey } from '../../../store/private-keys';
|
|
27
25
|
import { store as blockEditorStore } from '../../../store';
|
|
28
26
|
|
|
29
|
-
function MediaThumbnail( {
|
|
30
|
-
const
|
|
31
|
-
const
|
|
27
|
+
function MediaThumbnail( { data, field, attachment } ) {
|
|
28
|
+
const config = field.config || {};
|
|
29
|
+
const { allowedTypes = [], multiple = false } = config;
|
|
30
|
+
|
|
32
31
|
if ( multiple ) {
|
|
33
32
|
return 'todo multiple';
|
|
34
33
|
}
|
|
@@ -50,29 +49,17 @@ function MediaThumbnail( { control, attributeValues, attachment } ) {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
if ( allowedTypes.length === 1 ) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
allowedTypes[ 0 ] === 'image' &&
|
|
56
|
-
mapping.src &&
|
|
57
|
-
attributeValues[ mapping.src ]
|
|
58
|
-
) {
|
|
59
|
-
src = attributeValues[ mapping.src ];
|
|
60
|
-
} else if (
|
|
61
|
-
allowedTypes[ 0 ] === 'video' &&
|
|
62
|
-
mapping.poster &&
|
|
63
|
-
attributeValues[ mapping.poster ]
|
|
64
|
-
) {
|
|
65
|
-
src = attributeValues[ mapping.poster ];
|
|
66
|
-
}
|
|
52
|
+
const value = field.getValue( { item: data } );
|
|
53
|
+
const url = value?.url;
|
|
67
54
|
|
|
68
|
-
if (
|
|
55
|
+
if ( url ) {
|
|
69
56
|
return (
|
|
70
57
|
<img
|
|
71
58
|
className="block-editor-content-only-controls__media-thumbnail"
|
|
72
59
|
alt=""
|
|
73
60
|
width={ 24 }
|
|
74
61
|
height={ 24 }
|
|
75
|
-
src={
|
|
62
|
+
src={ url }
|
|
76
63
|
/>
|
|
77
64
|
);
|
|
78
65
|
}
|
|
@@ -96,29 +83,27 @@ function MediaThumbnail( { control, attributeValues, attachment } ) {
|
|
|
96
83
|
return <Icon icon={ mediaIcon } size={ 24 } />;
|
|
97
84
|
}
|
|
98
85
|
|
|
99
|
-
export default function Media( {
|
|
100
|
-
clientId,
|
|
101
|
-
control,
|
|
102
|
-
blockType,
|
|
103
|
-
attributeValues,
|
|
104
|
-
updateAttributes,
|
|
105
|
-
} ) {
|
|
86
|
+
export default function Media( { data, field, onChange, config = {} } ) {
|
|
106
87
|
const { popoverProps } = useInspectorPopoverPlacement( {
|
|
107
88
|
isControl: true,
|
|
108
89
|
} );
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
const value = field.getValue( { item: data } );
|
|
91
|
+
const { allowedTypes = [], multiple = false } = field.config || {};
|
|
92
|
+
const { fieldDef } = config;
|
|
93
|
+
const updateAttributes = ( newFieldValue ) => {
|
|
94
|
+
const mappedChanges = field.setValue( {
|
|
95
|
+
item: data,
|
|
96
|
+
value: newFieldValue,
|
|
97
|
+
} );
|
|
98
|
+
onChange( mappedChanges );
|
|
99
|
+
};
|
|
116
100
|
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
101
|
+
// Check if featured image is supported by checking if it's in the mapping
|
|
102
|
+
const hasFeaturedImageSupport =
|
|
103
|
+
fieldDef?.mapping && 'featuredImage' in fieldDef.mapping;
|
|
104
|
+
|
|
105
|
+
const id = value?.id;
|
|
106
|
+
const url = value?.url;
|
|
122
107
|
|
|
123
108
|
const attachment = useSelect(
|
|
124
109
|
( select ) => {
|
|
@@ -140,8 +125,8 @@ export default function Media( {
|
|
|
140
125
|
|
|
141
126
|
// TODO - pluralize when multiple.
|
|
142
127
|
let chooseItemLabel;
|
|
143
|
-
if (
|
|
144
|
-
const allowedType =
|
|
128
|
+
if ( allowedTypes.length === 1 ) {
|
|
129
|
+
const allowedType = allowedTypes[ 0 ];
|
|
145
130
|
if ( allowedType === 'image' ) {
|
|
146
131
|
chooseItemLabel = __( 'Choose an image…' );
|
|
147
132
|
} else if ( allowedType === 'video' ) {
|
|
@@ -155,131 +140,167 @@ export default function Media( {
|
|
|
155
140
|
chooseItemLabel = __( 'Choose a media item…' );
|
|
156
141
|
}
|
|
157
142
|
|
|
158
|
-
const defaultValues = useMemo( () => {
|
|
159
|
-
return Object.fromEntries(
|
|
160
|
-
Object.entries( control.mapping ).map( ( [ , attributeKey ] ) => {
|
|
161
|
-
return [
|
|
162
|
-
attributeKey,
|
|
163
|
-
blockType.attributes[ attributeKey ]?.defaultValue ??
|
|
164
|
-
undefined,
|
|
165
|
-
];
|
|
166
|
-
} )
|
|
167
|
-
);
|
|
168
|
-
}, [ blockType.attributes, control.mapping ] );
|
|
169
|
-
|
|
170
143
|
return (
|
|
171
144
|
<MediaUploadCheck>
|
|
172
|
-
<
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
className="block-editor-content-only-controls__media-replace-flow"
|
|
183
|
-
allowedTypes={ control.args.allowedTypes }
|
|
184
|
-
mediaId={ id }
|
|
185
|
-
mediaURL={ src }
|
|
186
|
-
multiple={ control.args.multiple }
|
|
187
|
-
popoverProps={ popoverProps }
|
|
188
|
-
onReset={ () => {
|
|
189
|
-
updateAttributes( defaultValues );
|
|
190
|
-
} }
|
|
191
|
-
useFeaturedImage={ !! useFeaturedImage }
|
|
192
|
-
onToggleFeaturedImage={
|
|
193
|
-
!! featuredImageKey &&
|
|
194
|
-
( () => {
|
|
195
|
-
updateAttributes( {
|
|
196
|
-
...defaultValues,
|
|
197
|
-
[ featuredImageKey ]: ! useFeaturedImage,
|
|
198
|
-
} );
|
|
199
|
-
} )
|
|
200
|
-
}
|
|
201
|
-
onSelect={ ( selectedMedia ) => {
|
|
202
|
-
if ( selectedMedia.id && selectedMedia.url ) {
|
|
203
|
-
const optionalAttributes = {};
|
|
145
|
+
<MediaReplaceFlow
|
|
146
|
+
className="block-editor-content-only-controls__media-replace-flow"
|
|
147
|
+
allowedTypes={ allowedTypes }
|
|
148
|
+
mediaId={ id }
|
|
149
|
+
mediaURL={ url }
|
|
150
|
+
multiple={ multiple }
|
|
151
|
+
popoverProps={ popoverProps }
|
|
152
|
+
onReset={ () => {
|
|
153
|
+
// Build reset value dynamically based on mapping
|
|
154
|
+
const resetValue = {};
|
|
204
155
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
156
|
+
if ( fieldDef?.mapping ) {
|
|
157
|
+
Object.keys( fieldDef.mapping ).forEach( ( key ) => {
|
|
158
|
+
if (
|
|
159
|
+
key === 'id' ||
|
|
160
|
+
key === 'src' ||
|
|
161
|
+
key === 'url'
|
|
162
|
+
) {
|
|
163
|
+
resetValue[ key ] = undefined;
|
|
164
|
+
} else if ( key === 'caption' || key === 'alt' ) {
|
|
165
|
+
resetValue[ key ] = '';
|
|
208
166
|
}
|
|
167
|
+
} );
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Turn off featured image when resetting (only if it's in the mapping)
|
|
171
|
+
if ( hasFeaturedImageSupport ) {
|
|
172
|
+
resetValue.featuredImage = false;
|
|
173
|
+
}
|
|
209
174
|
|
|
175
|
+
// Merge with existing value to preserve other field properties
|
|
176
|
+
updateAttributes( { ...value, ...resetValue } );
|
|
177
|
+
} }
|
|
178
|
+
{ ...( hasFeaturedImageSupport && {
|
|
179
|
+
useFeaturedImage: !! value?.featuredImage,
|
|
180
|
+
onToggleFeaturedImage: () => {
|
|
181
|
+
updateAttributes( {
|
|
182
|
+
...value,
|
|
183
|
+
featuredImage: ! value?.featuredImage,
|
|
184
|
+
} );
|
|
185
|
+
},
|
|
186
|
+
} ) }
|
|
187
|
+
onSelect={ ( selectedMedia ) => {
|
|
188
|
+
if ( selectedMedia.id && selectedMedia.url ) {
|
|
189
|
+
// Determine mediaType from MIME type, not from object type
|
|
190
|
+
let mediaType = 'image'; // default
|
|
191
|
+
if ( selectedMedia.mime_type ) {
|
|
210
192
|
if (
|
|
211
|
-
|
|
212
|
-
! caption &&
|
|
213
|
-
selectedMedia.caption
|
|
193
|
+
selectedMedia.mime_type.startsWith( 'video/' )
|
|
214
194
|
) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
selectedMedia.alt;
|
|
221
|
-
}
|
|
222
|
-
if ( posterKey && selectedMedia.poster ) {
|
|
223
|
-
optionalAttributes[ posterKey ] =
|
|
224
|
-
selectedMedia.poster;
|
|
195
|
+
mediaType = 'video';
|
|
196
|
+
} else if (
|
|
197
|
+
selectedMedia.mime_type.startsWith( 'audio/' )
|
|
198
|
+
) {
|
|
199
|
+
mediaType = 'audio';
|
|
225
200
|
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// Build new value dynamically based on what's in the mapping
|
|
204
|
+
const newValue = {};
|
|
226
205
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
206
|
+
// Iterate over mapping keys and set values for supported properties
|
|
207
|
+
if ( fieldDef?.mapping ) {
|
|
208
|
+
Object.keys( fieldDef.mapping ).forEach(
|
|
209
|
+
( key ) => {
|
|
210
|
+
if ( key === 'id' ) {
|
|
211
|
+
newValue[ key ] = selectedMedia.id;
|
|
212
|
+
} else if (
|
|
213
|
+
key === 'src' ||
|
|
214
|
+
key === 'url'
|
|
215
|
+
) {
|
|
216
|
+
newValue[ key ] = selectedMedia.url;
|
|
217
|
+
} else if ( key === 'type' ) {
|
|
218
|
+
newValue[ key ] = mediaType;
|
|
219
|
+
} else if (
|
|
220
|
+
key === 'link' &&
|
|
221
|
+
selectedMedia.link
|
|
222
|
+
) {
|
|
223
|
+
newValue[ key ] = selectedMedia.link;
|
|
224
|
+
} else if (
|
|
225
|
+
key === 'caption' &&
|
|
226
|
+
! value?.caption &&
|
|
227
|
+
selectedMedia.caption
|
|
228
|
+
) {
|
|
229
|
+
newValue[ key ] = selectedMedia.caption;
|
|
230
|
+
} else if (
|
|
231
|
+
key === 'alt' &&
|
|
232
|
+
! value?.alt &&
|
|
233
|
+
selectedMedia.alt
|
|
234
|
+
) {
|
|
235
|
+
newValue[ key ] = selectedMedia.alt;
|
|
236
|
+
} else if (
|
|
237
|
+
key === 'poster' &&
|
|
238
|
+
selectedMedia.poster
|
|
239
|
+
) {
|
|
240
|
+
newValue[ key ] = selectedMedia.poster;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
);
|
|
232
244
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
245
|
+
|
|
246
|
+
// Turn off featured image when manually selecting media
|
|
247
|
+
if ( hasFeaturedImageSupport ) {
|
|
248
|
+
newValue.featuredImage = false;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Merge with existing value to preserve other field properties
|
|
252
|
+
const finalValue = { ...value, ...newValue };
|
|
253
|
+
updateAttributes( finalValue );
|
|
254
|
+
}
|
|
255
|
+
} }
|
|
256
|
+
renderToggle={ ( buttonProps ) => (
|
|
257
|
+
<Button
|
|
258
|
+
__next40pxDefaultSize
|
|
259
|
+
className="block-editor-content-only-controls__media"
|
|
260
|
+
{ ...buttonProps }
|
|
261
|
+
>
|
|
262
|
+
<Grid
|
|
263
|
+
rowGap={ 0 }
|
|
264
|
+
columnGap={ 8 }
|
|
265
|
+
templateColumns="24px 1fr"
|
|
266
|
+
className="block-editor-content-only-controls__media-row"
|
|
239
267
|
>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
</>
|
|
277
|
-
) }
|
|
278
|
-
</Grid>
|
|
279
|
-
</Button>
|
|
280
|
-
) }
|
|
281
|
-
/>
|
|
282
|
-
</ToolsPanelItem>
|
|
268
|
+
{ url && (
|
|
269
|
+
<>
|
|
270
|
+
<MediaThumbnail
|
|
271
|
+
attachment={ attachment }
|
|
272
|
+
field={ field }
|
|
273
|
+
data={ data }
|
|
274
|
+
/>
|
|
275
|
+
<span className="block-editor-content-only-controls__media-title">
|
|
276
|
+
{
|
|
277
|
+
// TODO - truncate long titles or url smartly (e.g. show filename).
|
|
278
|
+
attachment?.title?.raw &&
|
|
279
|
+
attachment?.title?.raw !== ''
|
|
280
|
+
? attachment?.title?.raw
|
|
281
|
+
: url
|
|
282
|
+
}
|
|
283
|
+
</span>
|
|
284
|
+
</>
|
|
285
|
+
) }
|
|
286
|
+
{ ! url && (
|
|
287
|
+
<>
|
|
288
|
+
<span
|
|
289
|
+
className="block-editor-content-only-controls__media-placeholder"
|
|
290
|
+
style={ {
|
|
291
|
+
width: '24px',
|
|
292
|
+
height: '24px',
|
|
293
|
+
} }
|
|
294
|
+
/>
|
|
295
|
+
<span className="block-editor-content-only-controls__media-title">
|
|
296
|
+
{ chooseItemLabel }
|
|
297
|
+
</span>
|
|
298
|
+
</>
|
|
299
|
+
) }
|
|
300
|
+
</Grid>
|
|
301
|
+
</Button>
|
|
302
|
+
) }
|
|
303
|
+
/>
|
|
283
304
|
</MediaUploadCheck>
|
|
284
305
|
);
|
|
285
306
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
BaseControl,
|
|
6
|
-
useBaseControlProps,
|
|
7
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
|
-
} from '@wordpress/components';
|
|
4
|
+
import { BaseControl, useBaseControlProps } from '@wordpress/components';
|
|
9
5
|
import { useMergeRefs } from '@wordpress/compose';
|
|
10
6
|
import { useRegistry } from '@wordpress/data';
|
|
11
7
|
import { useRef, useState } from '@wordpress/element';
|
|
12
8
|
import {
|
|
13
9
|
__unstableUseRichText as useRichText,
|
|
14
|
-
isEmpty,
|
|
15
10
|
removeFormat,
|
|
16
11
|
} from '@wordpress/rich-text';
|
|
17
12
|
|
|
@@ -25,17 +20,20 @@ import FormatEdit from '../../rich-text/format-edit';
|
|
|
25
20
|
import { keyboardShortcutContext, inputEventContext } from '../../rich-text';
|
|
26
21
|
|
|
27
22
|
export default function RichTextControl( {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
data,
|
|
24
|
+
field,
|
|
25
|
+
hideLabelFromVision,
|
|
26
|
+
onChange,
|
|
27
|
+
config = {},
|
|
33
28
|
} ) {
|
|
34
29
|
const registry = useRegistry();
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const
|
|
38
|
-
|
|
30
|
+
const attrValue = field.getValue( { item: data } );
|
|
31
|
+
const fieldConfig = field.config || {};
|
|
32
|
+
const { clientId } = config;
|
|
33
|
+
const updateAttributes = ( html ) => {
|
|
34
|
+
const mappedChanges = field.setValue( { item: data, value: html } );
|
|
35
|
+
onChange( mappedChanges );
|
|
36
|
+
};
|
|
39
37
|
const [ selection, setSelection ] = useState( {
|
|
40
38
|
start: undefined,
|
|
41
39
|
end: undefined,
|
|
@@ -46,8 +44,8 @@ export default function RichTextControl( {
|
|
|
46
44
|
const keyboardShortcuts = useRef( new Set() );
|
|
47
45
|
|
|
48
46
|
const adjustedAllowedFormats = getAllowedFormats( {
|
|
49
|
-
allowedFormats:
|
|
50
|
-
disableFormats:
|
|
47
|
+
allowedFormats: fieldConfig?.allowedFormats,
|
|
48
|
+
disableFormats: fieldConfig?.disableFormats,
|
|
51
49
|
} );
|
|
52
50
|
|
|
53
51
|
const {
|
|
@@ -58,10 +56,9 @@ export default function RichTextControl( {
|
|
|
58
56
|
dependencies,
|
|
59
57
|
} = useFormatTypes( {
|
|
60
58
|
clientId,
|
|
61
|
-
identifier:
|
|
59
|
+
identifier: field.id,
|
|
62
60
|
allowedFormats: adjustedAllowedFormats,
|
|
63
|
-
withoutInteractiveFormatting:
|
|
64
|
-
control.args?.withoutInteractiveFormatting,
|
|
61
|
+
withoutInteractiveFormatting: fieldConfig?.withoutInteractiveFormatting,
|
|
65
62
|
disableNoneEssentialFormatting: true,
|
|
66
63
|
} );
|
|
67
64
|
|
|
@@ -102,12 +99,12 @@ export default function RichTextControl( {
|
|
|
102
99
|
const {
|
|
103
100
|
value,
|
|
104
101
|
getValue,
|
|
105
|
-
onChange,
|
|
102
|
+
onChange: onRichTextChange,
|
|
106
103
|
ref: richTextRef,
|
|
107
104
|
} = useRichText( {
|
|
108
105
|
value: attrValue,
|
|
109
106
|
onChange( html, { __unstableFormats, __unstableText } ) {
|
|
110
|
-
updateAttributes(
|
|
107
|
+
updateAttributes( html );
|
|
111
108
|
Object.values( changeHandlers ).forEach( ( changeHandler ) => {
|
|
112
109
|
changeHandler( __unstableFormats, __unstableText );
|
|
113
110
|
} );
|
|
@@ -116,9 +113,9 @@ export default function RichTextControl( {
|
|
|
116
113
|
selectionEnd: selection.end,
|
|
117
114
|
onSelectionChange: ( start, end ) => setSelection( { start, end } ),
|
|
118
115
|
__unstableIsSelected: isSelected,
|
|
119
|
-
preserveWhiteSpace: !!
|
|
120
|
-
placeholder:
|
|
121
|
-
__unstableDisableFormats:
|
|
116
|
+
preserveWhiteSpace: !! fieldConfig?.preserveWhiteSpace,
|
|
117
|
+
placeholder: fieldConfig?.placeholder,
|
|
118
|
+
__unstableDisableFormats: fieldConfig?.disableFormats,
|
|
122
119
|
__unstableDependencies: dependencies,
|
|
123
120
|
__unstableAfterParse: addEditorOnlyFormats,
|
|
124
121
|
__unstableBeforeSerialize: removeEditorOnlyFormats,
|
|
@@ -126,29 +123,19 @@ export default function RichTextControl( {
|
|
|
126
123
|
} );
|
|
127
124
|
|
|
128
125
|
const { baseControlProps, controlProps } = useBaseControlProps( {
|
|
129
|
-
hideLabelFromVision:
|
|
130
|
-
label:
|
|
126
|
+
hideLabelFromVision: hideLabelFromVision ?? field.hideLabelFromVision,
|
|
127
|
+
label: field.label,
|
|
131
128
|
} );
|
|
132
129
|
|
|
133
130
|
return (
|
|
134
|
-
|
|
135
|
-
panelId={ clientId }
|
|
136
|
-
label={ control.label }
|
|
137
|
-
hasValue={ () => {
|
|
138
|
-
return value?.text && ! isEmpty( value );
|
|
139
|
-
} }
|
|
140
|
-
onDeselect={ () =>
|
|
141
|
-
updateAttributes( { [ valueKey ]: defaultValue } )
|
|
142
|
-
}
|
|
143
|
-
isShownByDefault={ control.shownByDefault }
|
|
144
|
-
>
|
|
131
|
+
<>
|
|
145
132
|
{ isSelected && (
|
|
146
133
|
<keyboardShortcutContext.Provider value={ keyboardShortcuts }>
|
|
147
134
|
<inputEventContext.Provider value={ inputEvents }>
|
|
148
135
|
<div>
|
|
149
136
|
<FormatEdit
|
|
150
137
|
value={ value }
|
|
151
|
-
onChange={
|
|
138
|
+
onChange={ onRichTextChange }
|
|
152
139
|
onFocus={ onFocus }
|
|
153
140
|
formatTypes={ formatTypes }
|
|
154
141
|
forwardedRef={ anchorRef }
|
|
@@ -162,21 +149,21 @@ export default function RichTextControl( {
|
|
|
162
149
|
<div
|
|
163
150
|
className="block-editor-content-only-controls__rich-text"
|
|
164
151
|
role="textbox"
|
|
165
|
-
aria-multiline={ !
|
|
152
|
+
aria-multiline={ ! fieldConfig?.disableLineBreaks }
|
|
166
153
|
ref={ useMergeRefs( [
|
|
167
154
|
richTextRef,
|
|
168
155
|
useEventListeners( {
|
|
169
156
|
registry,
|
|
170
157
|
getValue,
|
|
171
|
-
onChange,
|
|
158
|
+
onChange: onRichTextChange,
|
|
172
159
|
formatTypes,
|
|
173
160
|
selectionChange: setSelection,
|
|
174
161
|
isSelected,
|
|
175
|
-
disableFormats:
|
|
162
|
+
disableFormats: fieldConfig?.disableFormats,
|
|
176
163
|
value,
|
|
177
164
|
tagName: 'div',
|
|
178
165
|
removeEditorOnlyFormats,
|
|
179
|
-
disableLineBreaks:
|
|
166
|
+
disableLineBreaks: fieldConfig?.disableLineBreaks,
|
|
180
167
|
keyboardShortcuts,
|
|
181
168
|
inputEvents,
|
|
182
169
|
} ),
|
|
@@ -188,6 +175,6 @@ export default function RichTextControl( {
|
|
|
188
175
|
{ ...controlProps }
|
|
189
176
|
/>
|
|
190
177
|
</BaseControl>
|
|
191
|
-
|
|
178
|
+
</>
|
|
192
179
|
);
|
|
193
180
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
.block-editor-content-only-controls__screen {
|
|
8
8
|
&.components-navigator-screen {
|
|
9
|
-
padding: $grid-unit-10 0
|
|
9
|
+
padding: $grid-unit-10 0 $grid-unit-20 0;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// Add border for the entire content controls and remove the similar border
|
|
@@ -33,3 +33,12 @@
|
|
|
33
33
|
.block-editor-content-only-controls__drill-down-button {
|
|
34
34
|
width: 100%;
|
|
35
35
|
}
|
|
36
|
+
|
|
37
|
+
.block-editor-content-only-controls__fields-container {
|
|
38
|
+
padding: 0 $grid-unit-20;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.block-editor-content-only-controls__fields-header {
|
|
42
|
+
padding: $grid-unit-10 0;
|
|
43
|
+
margin-bottom: $grid-unit-05;
|
|
44
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import styled from '@emotion/styled';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -12,10 +7,6 @@ import {
|
|
|
12
7
|
} from '@wordpress/components';
|
|
13
8
|
import { __ } from '@wordpress/i18n';
|
|
14
9
|
|
|
15
|
-
const SingleColumnToolsPanelItem = styled( ToolsPanelItem )`
|
|
16
|
-
grid-column: span 1;
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
10
|
/**
|
|
20
11
|
* @typedef {import('@wordpress/components/build-types/unit-control/types').WPUnitControlUnit} WPUnitControlUnit
|
|
21
12
|
*/
|
|
@@ -72,7 +63,8 @@ export default function WidthHeightTool( {
|
|
|
72
63
|
|
|
73
64
|
return (
|
|
74
65
|
<>
|
|
75
|
-
<
|
|
66
|
+
<ToolsPanelItem
|
|
67
|
+
style={ { gridColumn: 'span 1' } }
|
|
76
68
|
label={ __( 'Width' ) }
|
|
77
69
|
isShownByDefault={ isShownByDefault }
|
|
78
70
|
hasValue={ () => width !== '' }
|
|
@@ -89,8 +81,9 @@ export default function WidthHeightTool( {
|
|
|
89
81
|
onChange={ onDimensionChange( 'width' ) }
|
|
90
82
|
size="__unstable-large"
|
|
91
83
|
/>
|
|
92
|
-
</
|
|
93
|
-
<
|
|
84
|
+
</ToolsPanelItem>
|
|
85
|
+
<ToolsPanelItem
|
|
86
|
+
style={ { gridColumn: 'span 1' } }
|
|
94
87
|
label={ __( 'Height' ) }
|
|
95
88
|
isShownByDefault={ isShownByDefault }
|
|
96
89
|
hasValue={ () => height !== '' }
|
|
@@ -107,7 +100,7 @@ export default function WidthHeightTool( {
|
|
|
107
100
|
onChange={ onDimensionChange( 'height' ) }
|
|
108
101
|
size="__unstable-large"
|
|
109
102
|
/>
|
|
110
|
-
</
|
|
103
|
+
</ToolsPanelItem>
|
|
111
104
|
</>
|
|
112
105
|
);
|
|
113
106
|
}
|
|
@@ -28,7 +28,6 @@ const MyFontFamilyControl = () => {
|
|
|
28
28
|
onChange={ ( newFontFamily ) => {
|
|
29
29
|
setFontFamily( newFontFamily );
|
|
30
30
|
} }
|
|
31
|
-
__nextHasNoMarginBottom
|
|
32
31
|
__next40pxDefaultSize
|
|
33
32
|
/>
|
|
34
33
|
);
|
|
@@ -83,11 +82,3 @@ The rest of the props are passed down to the underlying `<SelectControl />` inst
|
|
|
83
82
|
- Default: `false`
|
|
84
83
|
|
|
85
84
|
Start opting into the larger default height that will become the default size in a future version.
|
|
86
|
-
|
|
87
|
-
#### `__nextHasNoMarginBottom`
|
|
88
|
-
|
|
89
|
-
- Type: `boolean`
|
|
90
|
-
- Required: No
|
|
91
|
-
- Default: `false`
|
|
92
|
-
|
|
93
|
-
Start opting into the new margin-free styles that will become the default in a future version.
|