@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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
5
|
+
import { moreVertical, check } from '@wordpress/icons';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { useInspectorPopoverPlacement } from './use-inspector-popover-placement';
|
|
12
|
+
|
|
13
|
+
export default function FieldsDropdownMenu( {
|
|
14
|
+
fields,
|
|
15
|
+
visibleFields,
|
|
16
|
+
onToggleField,
|
|
17
|
+
} ) {
|
|
18
|
+
const { popoverProps } = useInspectorPopoverPlacement();
|
|
19
|
+
|
|
20
|
+
if ( ! fields || fields.length === 0 ) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<DropdownMenu
|
|
26
|
+
icon={ moreVertical }
|
|
27
|
+
label={ __( 'Options' ) }
|
|
28
|
+
popoverProps={ popoverProps }
|
|
29
|
+
>
|
|
30
|
+
{ ( { onClose } ) => (
|
|
31
|
+
<MenuGroup label={ __( 'Show / Hide' ) }>
|
|
32
|
+
{ fields.map( ( field ) => {
|
|
33
|
+
const isVisible = visibleFields.includes( field.id );
|
|
34
|
+
return (
|
|
35
|
+
<MenuItem
|
|
36
|
+
key={ field.id }
|
|
37
|
+
isSelected={ isVisible }
|
|
38
|
+
onClick={ () => {
|
|
39
|
+
onToggleField( field.id );
|
|
40
|
+
onClose();
|
|
41
|
+
} }
|
|
42
|
+
role="menuitemcheckbox"
|
|
43
|
+
icon={ isVisible ? check : null }
|
|
44
|
+
>
|
|
45
|
+
{ field.label }
|
|
46
|
+
</MenuItem>
|
|
47
|
+
);
|
|
48
|
+
} ) }
|
|
49
|
+
</MenuGroup>
|
|
50
|
+
) }
|
|
51
|
+
</DropdownMenu>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
4
|
import {
|
|
6
|
-
|
|
5
|
+
store as blocksStore,
|
|
6
|
+
privateApis as blocksPrivateApis,
|
|
7
|
+
} from '@wordpress/blocks';
|
|
8
|
+
import {
|
|
7
9
|
__experimentalHStack as HStack,
|
|
8
10
|
Icon,
|
|
9
11
|
Navigator,
|
|
@@ -11,6 +13,8 @@ import {
|
|
|
11
13
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
12
14
|
import { __ } from '@wordpress/i18n';
|
|
13
15
|
import { arrowLeft, arrowRight } from '@wordpress/icons';
|
|
16
|
+
import { DataForm } from '@wordpress/dataviews';
|
|
17
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* Internal dependencies
|
|
@@ -20,45 +24,153 @@ import { store as blockEditorStore } from '../../store';
|
|
|
20
24
|
import BlockIcon from '../block-icon';
|
|
21
25
|
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
22
26
|
import useBlockDisplayInformation from '../use-block-display-information';
|
|
23
|
-
|
|
27
|
+
const { fieldsKey, formKey } = unlock( blocksPrivateApis );
|
|
28
|
+
import FieldsDropdownMenu from './fields-dropdown-menu';
|
|
24
29
|
|
|
25
30
|
// controls
|
|
26
|
-
import PlainText from './plain-text';
|
|
27
31
|
import RichText from './rich-text';
|
|
28
32
|
import Media from './media';
|
|
29
33
|
import Link from './link';
|
|
30
34
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
Link,
|
|
35
|
+
const CONTROLS = {
|
|
36
|
+
richtext: RichText,
|
|
37
|
+
media: Media,
|
|
38
|
+
link: Link,
|
|
36
39
|
};
|
|
37
40
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} )
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Creates a configured control component that wraps a custom control
|
|
43
|
+
* and passes configuration as props.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} config - The control configuration
|
|
46
|
+
* @param {string} config.control - The control type (key in CONTROLS map)
|
|
47
|
+
* @return {Function} A wrapped control component
|
|
48
|
+
*/
|
|
49
|
+
function createConfiguredControl( config ) {
|
|
50
|
+
const { control, ...controlConfig } = config;
|
|
51
|
+
const ControlComponent = CONTROLS[ control ];
|
|
46
52
|
|
|
47
53
|
if ( ! ControlComponent ) {
|
|
48
|
-
|
|
54
|
+
throw new Error( `Control type "${ control }" not found` );
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
return (
|
|
52
|
-
<ControlComponent
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
return function ConfiguredControl( props ) {
|
|
58
|
+
return <ControlComponent { ...props } config={ controlConfig } />;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Normalize a media value to a canonical structure.
|
|
64
|
+
* Only includes properties that are present in the field's mapping (if provided).
|
|
65
|
+
*
|
|
66
|
+
* @param {Object} value - The mapped value from the block attributes (with canonical keys)
|
|
67
|
+
* @param {Object} fieldDef - Optional field definition containing the mapping
|
|
68
|
+
* @return {Object} Normalized media value with canonical properties
|
|
69
|
+
*/
|
|
70
|
+
function normalizeMediaValue( value, fieldDef ) {
|
|
71
|
+
const defaults = {
|
|
72
|
+
id: null,
|
|
73
|
+
url: '',
|
|
74
|
+
caption: '',
|
|
75
|
+
alt: '',
|
|
76
|
+
type: 'image',
|
|
77
|
+
poster: '',
|
|
78
|
+
featuredImage: false,
|
|
79
|
+
link: '',
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
const result = {};
|
|
83
|
+
|
|
84
|
+
// If there's a mapping, only include properties that are in it
|
|
85
|
+
if ( fieldDef?.mapping ) {
|
|
86
|
+
Object.keys( fieldDef.mapping ).forEach( ( key ) => {
|
|
87
|
+
result[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';
|
|
88
|
+
} );
|
|
89
|
+
return result;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Without mapping, include all default properties
|
|
93
|
+
Object.keys( defaults ).forEach( ( key ) => {
|
|
94
|
+
result[ key ] = value?.[ key ] ?? defaults[ key ];
|
|
95
|
+
} );
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Denormalize a media value from canonical structure back to mapped keys.
|
|
101
|
+
* Only includes properties that are present in the field's mapping.
|
|
102
|
+
*
|
|
103
|
+
* @param {Object} value - The normalized media value
|
|
104
|
+
* @param {Object} fieldDef - The field definition containing the mapping
|
|
105
|
+
* @return {Object} Value with only mapped properties
|
|
106
|
+
*/
|
|
107
|
+
function denormalizeMediaValue( value, fieldDef ) {
|
|
108
|
+
if ( ! fieldDef.mapping ) {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const result = {};
|
|
113
|
+
Object.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {
|
|
114
|
+
if ( key in value ) {
|
|
115
|
+
result[ key ] = value[ key ];
|
|
116
|
+
}
|
|
117
|
+
} );
|
|
118
|
+
return result;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Normalize a link value to a canonical structure.
|
|
123
|
+
* Only includes properties that are present in the field's mapping (if provided).
|
|
124
|
+
*
|
|
125
|
+
* @param {Object} value - The mapped value from the block attributes (with canonical keys)
|
|
126
|
+
* @param {Object} fieldDef - Optional field definition containing the mapping
|
|
127
|
+
* @return {Object} Normalized link value with canonical properties
|
|
128
|
+
*/
|
|
129
|
+
function normalizeLinkValue( value, fieldDef ) {
|
|
130
|
+
const defaults = {
|
|
131
|
+
url: '',
|
|
132
|
+
rel: '',
|
|
133
|
+
linkTarget: '',
|
|
134
|
+
destination: '',
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const result = {};
|
|
138
|
+
|
|
139
|
+
// If there's a mapping, only include properties that are in it
|
|
140
|
+
if ( fieldDef?.mapping ) {
|
|
141
|
+
Object.keys( fieldDef.mapping ).forEach( ( key ) => {
|
|
142
|
+
result[ key ] = value?.[ key ] ?? defaults[ key ] ?? '';
|
|
143
|
+
} );
|
|
144
|
+
return result;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Without mapping, include all default properties
|
|
148
|
+
Object.keys( defaults ).forEach( ( key ) => {
|
|
149
|
+
result[ key ] = value?.[ key ] ?? defaults[ key ];
|
|
150
|
+
} );
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Denormalize a link value from canonical structure back to mapped keys.
|
|
156
|
+
* Only includes properties that are present in the field's mapping.
|
|
157
|
+
*
|
|
158
|
+
* @param {Object} value - The normalized link value
|
|
159
|
+
* @param {Object} fieldDef - The field definition containing the mapping
|
|
160
|
+
* @return {Object} Value with only mapped properties
|
|
161
|
+
*/
|
|
162
|
+
function denormalizeLinkValue( value, fieldDef ) {
|
|
163
|
+
if ( ! fieldDef.mapping ) {
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const result = {};
|
|
168
|
+
Object.entries( fieldDef.mapping ).forEach( ( [ key ] ) => {
|
|
169
|
+
if ( key in value ) {
|
|
170
|
+
result[ key ] = value[ key ];
|
|
171
|
+
}
|
|
172
|
+
} );
|
|
173
|
+
return result;
|
|
62
174
|
}
|
|
63
175
|
|
|
64
176
|
function BlockFields( { clientId } ) {
|
|
@@ -76,40 +188,167 @@ function BlockFields( { clientId } ) {
|
|
|
76
188
|
[ clientId ]
|
|
77
189
|
);
|
|
78
190
|
|
|
191
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
79
192
|
const blockTitle = useBlockDisplayTitle( {
|
|
80
193
|
clientId,
|
|
81
194
|
context: 'list-view',
|
|
82
195
|
} );
|
|
83
196
|
const blockInformation = useBlockDisplayInformation( clientId );
|
|
84
|
-
const popoverPlacementProps = useInspectorPopoverPlacement();
|
|
85
197
|
|
|
86
|
-
|
|
198
|
+
const blockTypeFields = blockType?.[ fieldsKey ];
|
|
199
|
+
|
|
200
|
+
const [ form, setForm ] = useState( () => {
|
|
201
|
+
return blockType?.[ formKey ];
|
|
202
|
+
} );
|
|
203
|
+
|
|
204
|
+
// Build DataForm fields with proper structure
|
|
205
|
+
const dataFormFields = useMemo( () => {
|
|
206
|
+
if ( ! blockTypeFields?.length ) {
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return blockTypeFields.map( ( fieldDef ) => {
|
|
211
|
+
const ControlComponent = CONTROLS[ fieldDef.type ];
|
|
212
|
+
|
|
213
|
+
const defaultValues = {};
|
|
214
|
+
if ( fieldDef.mapping && blockType?.attributes ) {
|
|
215
|
+
Object.entries( fieldDef.mapping ).forEach(
|
|
216
|
+
( [ key, attrKey ] ) => {
|
|
217
|
+
defaultValues[ key ] =
|
|
218
|
+
blockType.attributes[ attrKey ]?.defaultValue ??
|
|
219
|
+
undefined;
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const field = {
|
|
225
|
+
id: fieldDef.id,
|
|
226
|
+
label: fieldDef.label,
|
|
227
|
+
type: fieldDef.type, // Use the field's type; DataForm will use built-in or custom Edit
|
|
228
|
+
config: { ...fieldDef.args, defaultValues },
|
|
229
|
+
hideLabelFromVision: fieldDef.id === 'content',
|
|
230
|
+
// getValue and setValue handle the mapping to block attributes
|
|
231
|
+
getValue: ( { item } ) => {
|
|
232
|
+
if ( fieldDef.mapping ) {
|
|
233
|
+
// Extract mapped properties from the block attributes
|
|
234
|
+
const mappedValue = {};
|
|
235
|
+
Object.entries( fieldDef.mapping ).forEach(
|
|
236
|
+
( [ key, attrKey ] ) => {
|
|
237
|
+
mappedValue[ key ] = item[ attrKey ];
|
|
238
|
+
}
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
// Normalize to canonical structure based on field type
|
|
242
|
+
if ( fieldDef.type === 'media' ) {
|
|
243
|
+
return normalizeMediaValue( mappedValue, fieldDef );
|
|
244
|
+
}
|
|
245
|
+
if ( fieldDef.type === 'link' ) {
|
|
246
|
+
return normalizeLinkValue( mappedValue, fieldDef );
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// For other types, return as-is
|
|
250
|
+
return mappedValue;
|
|
251
|
+
}
|
|
252
|
+
// For simple id-based fields, use the id as the attribute key
|
|
253
|
+
return item[ fieldDef.id ];
|
|
254
|
+
},
|
|
255
|
+
setValue: ( { item, value } ) => {
|
|
256
|
+
if ( fieldDef.mapping ) {
|
|
257
|
+
// Denormalize from canonical structure back to mapped keys
|
|
258
|
+
let denormalizedValue = value;
|
|
259
|
+
if ( fieldDef.type === 'media' ) {
|
|
260
|
+
denormalizedValue = denormalizeMediaValue(
|
|
261
|
+
value,
|
|
262
|
+
fieldDef
|
|
263
|
+
);
|
|
264
|
+
} else if ( fieldDef.type === 'link' ) {
|
|
265
|
+
denormalizedValue = denormalizeLinkValue(
|
|
266
|
+
value,
|
|
267
|
+
fieldDef
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Build an object with all mapped attributes
|
|
272
|
+
const updates = {};
|
|
273
|
+
Object.entries( fieldDef.mapping ).forEach(
|
|
274
|
+
( [ key, attrKey ] ) => {
|
|
275
|
+
// If key is explicitly in value, use it (even if undefined to allow clearing)
|
|
276
|
+
// Otherwise, preserve the old value
|
|
277
|
+
if ( key in denormalizedValue ) {
|
|
278
|
+
updates[ attrKey ] =
|
|
279
|
+
denormalizedValue[ key ];
|
|
280
|
+
} else {
|
|
281
|
+
updates[ attrKey ] = item[ attrKey ];
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
return updates;
|
|
286
|
+
}
|
|
287
|
+
// For simple id-based fields, use the id as the attribute key
|
|
288
|
+
return { [ fieldDef.id ]: value };
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// Only add custom Edit component if one exists for this type
|
|
293
|
+
if ( ControlComponent ) {
|
|
294
|
+
// Use EditConfig pattern: Edit is an object with control type and config props
|
|
295
|
+
field.Edit = createConfiguredControl( {
|
|
296
|
+
control: fieldDef.type,
|
|
297
|
+
clientId,
|
|
298
|
+
fieldDef,
|
|
299
|
+
} );
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return field;
|
|
303
|
+
} );
|
|
304
|
+
}, [ blockTypeFields, blockType?.attributes, clientId ] );
|
|
305
|
+
|
|
306
|
+
const handleToggleField = ( fieldId ) => {
|
|
307
|
+
setForm( ( prev ) => {
|
|
308
|
+
if ( prev.fields?.includes( fieldId ) ) {
|
|
309
|
+
return {
|
|
310
|
+
...prev,
|
|
311
|
+
fields: prev.fields.filter( ( id ) => id !== fieldId ),
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return {
|
|
316
|
+
...prev,
|
|
317
|
+
fields: [ ...( prev.fields || [] ), fieldId ],
|
|
318
|
+
};
|
|
319
|
+
} );
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
if ( ! blockTypeFields?.length ) {
|
|
87
323
|
// TODO - we might still want to show a placeholder for blocks with no fields.
|
|
88
324
|
// for example, a way to select the block.
|
|
89
325
|
return null;
|
|
90
326
|
}
|
|
91
327
|
|
|
92
328
|
return (
|
|
93
|
-
<
|
|
94
|
-
|
|
95
|
-
<HStack spacing={ 1 }>
|
|
96
|
-
<
|
|
97
|
-
|
|
329
|
+
<div className="block-editor-content-only-controls__fields-container">
|
|
330
|
+
<div className="block-editor-content-only-controls__fields-header">
|
|
331
|
+
<HStack spacing={ 1 } justify="space-between" expanded>
|
|
332
|
+
<HStack spacing={ 1 } justify="flex-start">
|
|
333
|
+
<BlockIcon icon={ blockInformation?.icon } />
|
|
334
|
+
<div>{ blockTitle }</div>
|
|
335
|
+
</HStack>
|
|
336
|
+
<FieldsDropdownMenu
|
|
337
|
+
fields={ dataFormFields }
|
|
338
|
+
visibleFields={ form.fields }
|
|
339
|
+
onToggleField={ handleToggleField }
|
|
340
|
+
/>
|
|
98
341
|
</HStack>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
attributeValues={ attributes }
|
|
110
|
-
/>
|
|
111
|
-
) ) }
|
|
112
|
-
</ToolsPanel>
|
|
342
|
+
</div>
|
|
343
|
+
<DataForm
|
|
344
|
+
data={ attributes }
|
|
345
|
+
fields={ dataFormFields }
|
|
346
|
+
form={ form }
|
|
347
|
+
onChange={ ( changes ) => {
|
|
348
|
+
updateBlockAttributes( clientId, changes );
|
|
349
|
+
} }
|
|
350
|
+
/>
|
|
351
|
+
</div>
|
|
113
352
|
);
|
|
114
353
|
}
|
|
115
354
|
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
6
|
Icon,
|
|
7
|
-
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
7
|
__experimentalGrid as Grid,
|
|
9
8
|
Popover,
|
|
10
9
|
} from '@wordpress/components';
|
|
@@ -68,35 +67,21 @@ export function getUpdatedLinkAttributes( {
|
|
|
68
67
|
};
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
export default function Link( {
|
|
72
|
-
clientId,
|
|
73
|
-
control,
|
|
74
|
-
blockType,
|
|
75
|
-
attributeValues,
|
|
76
|
-
updateAttributes,
|
|
77
|
-
} ) {
|
|
70
|
+
export default function Link( { data, field, onChange, config = {} } ) {
|
|
78
71
|
const [ isLinkControlOpen, setIsLinkControlOpen ] = useState( false );
|
|
79
72
|
const { popoverProps } = useInspectorPopoverPlacement( {
|
|
80
73
|
isControl: true,
|
|
81
74
|
} );
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const hrefDefaultValue =
|
|
93
|
-
blockType.attributes[ href ]?.defaultValue ?? undefined;
|
|
94
|
-
const relDefaultValue =
|
|
95
|
-
blockType.attributes[ rel ]?.defaultValue ?? undefined;
|
|
96
|
-
const targetDefaultValue =
|
|
97
|
-
blockType.attributes[ target ]?.defaultValue ?? undefined;
|
|
98
|
-
const destinationDefaultValue =
|
|
99
|
-
blockType.attributes[ destination ]?.defaultValue ?? undefined;
|
|
75
|
+
const { fieldDef } = config;
|
|
76
|
+
const updateAttributes = ( newValue ) => {
|
|
77
|
+
const mappedChanges = field.setValue( { item: data, value: newValue } );
|
|
78
|
+
onChange( mappedChanges );
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const value = field.getValue( { item: data } );
|
|
82
|
+
const url = value?.url;
|
|
83
|
+
const rel = value?.rel || '';
|
|
84
|
+
const target = value?.linkTarget;
|
|
100
85
|
|
|
101
86
|
const opensInNewTab = target === NEW_TAB_TARGET;
|
|
102
87
|
const nofollow = rel === NOFOLLOW_REL;
|
|
@@ -104,25 +89,12 @@ export default function Link( {
|
|
|
104
89
|
// Memoize link value to avoid overriding the LinkControl's internal state.
|
|
105
90
|
// This is a temporary fix. See https://github.com/WordPress/gutenberg/issues/51256.
|
|
106
91
|
const linkValue = useMemo(
|
|
107
|
-
() => ( { url
|
|
108
|
-
[
|
|
92
|
+
() => ( { url, opensInNewTab, nofollow } ),
|
|
93
|
+
[ url, opensInNewTab, nofollow ]
|
|
109
94
|
);
|
|
110
95
|
|
|
111
96
|
return (
|
|
112
|
-
|
|
113
|
-
panelId={ clientId }
|
|
114
|
-
label={ control.label }
|
|
115
|
-
hasValue={ () => !! href }
|
|
116
|
-
onDeselect={ () => {
|
|
117
|
-
updateAttributes( {
|
|
118
|
-
[ hrefKey ]: hrefDefaultValue,
|
|
119
|
-
[ relKey ]: relDefaultValue,
|
|
120
|
-
[ targetKey ]: targetDefaultValue,
|
|
121
|
-
[ destinationKey ]: destinationDefaultValue,
|
|
122
|
-
} );
|
|
123
|
-
} }
|
|
124
|
-
isShownByDefault={ control.shownByDefault }
|
|
125
|
-
>
|
|
97
|
+
<>
|
|
126
98
|
<Button
|
|
127
99
|
__next40pxDefaultSize
|
|
128
100
|
className="block-editor-content-only-controls__link"
|
|
@@ -136,15 +108,15 @@ export default function Link( {
|
|
|
136
108
|
templateColumns="24px 1fr"
|
|
137
109
|
className="block-editor-content-only-controls__link-row"
|
|
138
110
|
>
|
|
139
|
-
{
|
|
111
|
+
{ url && (
|
|
140
112
|
<>
|
|
141
113
|
<Icon icon={ link } size={ 24 } />
|
|
142
114
|
<span className="block-editor-content-only-controls__link-title">
|
|
143
|
-
{
|
|
115
|
+
{ url }
|
|
144
116
|
</span>
|
|
145
117
|
</>
|
|
146
118
|
) }
|
|
147
|
-
{ !
|
|
119
|
+
{ ! url && (
|
|
148
120
|
<>
|
|
149
121
|
<Icon
|
|
150
122
|
icon={ link }
|
|
@@ -173,23 +145,56 @@ export default function Link( {
|
|
|
173
145
|
...newValues,
|
|
174
146
|
} );
|
|
175
147
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
148
|
+
// Build update object dynamically based on what's in the mapping
|
|
149
|
+
const updateValue = { ...value };
|
|
150
|
+
|
|
151
|
+
if ( fieldDef?.mapping ) {
|
|
152
|
+
Object.keys( fieldDef.mapping ).forEach(
|
|
153
|
+
( key ) => {
|
|
154
|
+
if ( key === 'href' || key === 'url' ) {
|
|
155
|
+
updateValue[ key ] =
|
|
156
|
+
updatedAttrs.url;
|
|
157
|
+
} else if ( key === 'rel' ) {
|
|
158
|
+
updateValue[ key ] =
|
|
159
|
+
updatedAttrs.rel;
|
|
160
|
+
} else if (
|
|
161
|
+
key === 'target' ||
|
|
162
|
+
key === 'linkTarget'
|
|
163
|
+
) {
|
|
164
|
+
updateValue[ key ] =
|
|
165
|
+
updatedAttrs.linkTarget;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
updateAttributes( updateValue );
|
|
181
172
|
} }
|
|
182
173
|
onRemove={ () => {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
174
|
+
// Remove all link-related properties based on what's in the mapping
|
|
175
|
+
const removeValue = {};
|
|
176
|
+
|
|
177
|
+
if ( fieldDef?.mapping ) {
|
|
178
|
+
Object.keys( fieldDef.mapping ).forEach(
|
|
179
|
+
( key ) => {
|
|
180
|
+
if (
|
|
181
|
+
key === 'href' ||
|
|
182
|
+
key === 'url' ||
|
|
183
|
+
key === 'rel' ||
|
|
184
|
+
key === 'target' ||
|
|
185
|
+
key === 'linkTarget'
|
|
186
|
+
) {
|
|
187
|
+
removeValue[ key ] = undefined;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
updateAttributes( removeValue );
|
|
189
194
|
} }
|
|
190
195
|
/>
|
|
191
196
|
</Popover>
|
|
192
197
|
) }
|
|
193
|
-
|
|
198
|
+
</>
|
|
194
199
|
);
|
|
195
200
|
}
|