@wordpress/block-editor 12.17.0 → 12.18.1
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 +4 -0
- package/README.md +32 -0
- package/build/components/block-draggable/index.js +11 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-edit/context.js +3 -1
- package/build/components/block-edit/context.js.map +1 -1
- package/build/components/block-edit/index.js +4 -2
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +6 -3
- package/build/components/block-editing-mode/index.js.map +1 -1
- package/build/components/block-inspector/index.js +5 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block.js +4 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +9 -5
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +30 -4
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/private-block-context.js +1 -1
- package/build/components/block-list/private-block-context.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +1 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/toolbar.js +8 -2
- package/build/components/block-lock/toolbar.js.map +1 -1
- package/build/components/block-popover/inbetween.js +15 -3
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +3 -2
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +12 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +119 -90
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +10 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js +2 -1
- package/build/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +7 -1
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/global-styles/border-panel.js +5 -14
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -5
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/effects-panel.js +7 -1
- package/build/components/global-styles/effects-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +11 -8
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +31 -14
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +6 -0
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +99 -0
- package/build/components/iframe/get-compatibility-styles.js.map +1 -0
- package/build/components/iframe/index.js +2 -3
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +16 -2
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +16 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/link-control/link-preview.js +30 -26
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -9
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +3 -1
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +10 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +29 -8
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/drop-indicator.js +100 -32
- package/build/components/list-view/drop-indicator.js.map +1 -1
- package/build/components/list-view/index.js +52 -4
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-block-indexes.js +30 -0
- package/build/components/list-view/use-list-view-block-indexes.js.map +1 -0
- package/build/components/list-view/use-list-view-drop-zone.js +56 -5
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +92 -0
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/provider/index.js +1 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/recursion-provider/index.js +21 -0
- package/build/components/recursion-provider/index.js.map +1 -1
- package/build/components/rich-text/index.js +30 -6
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +9 -9
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +30 -7
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +50 -8
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/hooks/block-hooks.js +5 -14
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/content-lock-ui.js +17 -42
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +71 -1
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/effects.js +66 -0
- package/build/hooks/effects.js.map +1 -0
- package/build/hooks/index.js +17 -4
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +13 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/style.js +9 -2
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +2 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.native.js +2 -2
- package/build/hooks/typography.native.js.map +1 -1
- package/build/hooks/use-bindings-attributes.js +115 -0
- package/build/hooks/use-bindings-attributes.js.map +1 -0
- package/build/hooks/use-shadow-props.js +46 -0
- package/build/hooks/use-shadow-props.js.map +1 -0
- package/build/hooks/utils.js +12 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +10 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +2 -0
- package/build/store/index.js.map +1 -1
- package/build/store/private-actions.js +37 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +60 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +44 -3
- package/build/store/reducer.js.map +1 -1
- package/build/store/resolvers.js +27 -0
- package/build/store/resolvers.js.map +1 -0
- package/build/store/selectors.js +94 -56
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +5 -26
- package/build/store/utils.js.map +1 -1
- package/build/utils/index.js +0 -16
- package/build/utils/index.js.map +1 -1
- package/build/utils/math.js +13 -0
- package/build/utils/math.js.map +1 -1
- package/build/utils/object.js +17 -0
- package/build/utils/object.js.map +1 -1
- package/build/utils/transform-styles/index.js +37 -27
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +11 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-edit/context.js +1 -0
- package/build-module/components/block-edit/context.js.map +1 -1
- package/build-module/components/block-edit/index.js +5 -3
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +7 -4
- package/build-module/components/block-editing-mode/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +5 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block.js +6 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +11 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +31 -5
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/private-block-context.js +1 -1
- package/build-module/components/block-list/private-block-context.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/toolbar.js +8 -2
- package/build-module/components/block-lock/toolbar.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +15 -3
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-preview/auto.js +3 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +3 -2
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +12 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +116 -86
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +10 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js +2 -1
- package/build-module/components/dimensions-tool/aspect-ratio-tool.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +7 -1
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +5 -14
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -5
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/effects-panel.js +7 -1
- package/build-module/components/global-styles/effects-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +11 -8
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +32 -15
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +6 -0
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +93 -0
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -0
- package/build-module/components/iframe/index.js +2 -3
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +1 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +3 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +32 -28
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -8
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +3 -1
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +10 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +30 -9
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/drop-indicator.js +99 -32
- package/build-module/components/list-view/drop-indicator.js.map +1 -1
- package/build-module/components/list-view/index.js +54 -6
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-block-indexes.js +23 -0
- package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -0
- package/build-module/components/list-view/use-list-view-drop-zone.js +58 -7
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +91 -0
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/provider/index.js +1 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/recursion-provider/index.js +17 -0
- package/build-module/components/recursion-provider/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +30 -6
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +9 -9
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +31 -8
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +51 -9
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/hooks/block-hooks.js +5 -14
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +19 -43
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +70 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/effects.js +51 -0
- package/build-module/hooks/effects.js.map +1 -0
- package/build-module/hooks/index.js +5 -3
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/style.js +9 -2
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +2 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.native.js +2 -2
- package/build-module/hooks/typography.native.js.map +1 -1
- package/build-module/hooks/use-bindings-attributes.js +112 -0
- package/build-module/hooks/use-bindings-attributes.js.map +1 -0
- package/build-module/hooks/use-shadow-props.js +39 -0
- package/build-module/hooks/use-shadow-props.js.map +1 -0
- package/build-module/hooks/utils.js +14 -9
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +10 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +2 -0
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-actions.js +35 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +53 -8
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +43 -3
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/resolvers.js +20 -0
- package/build-module/store/resolvers.js.map +1 -0
- package/build-module/store/selectors.js +89 -52
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -23
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/index.js +0 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/math.js +12 -0
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/object.js +16 -0
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +36 -27
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +33 -16
- package/build-style/content.css +33 -16
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +169 -114
- package/build-style/style.css +169 -114
- package/package.json +31 -31
- package/src/components/block-canvas/style.scss +8 -1
- package/src/components/block-draggable/index.js +16 -5
- package/src/components/block-edit/context.js +1 -0
- package/src/components/block-edit/index.js +4 -0
- package/src/components/block-editing-mode/index.js +12 -7
- package/src/components/block-inspector/index.js +5 -2
- package/src/components/block-list/block.js +5 -4
- package/src/components/block-list/block.native.js +13 -3
- package/src/components/block-list/content.scss +34 -5
- package/src/components/block-list/index.js +52 -16
- package/src/components/block-list/private-block-context.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +1 -2
- package/src/components/block-lock/toolbar.js +10 -2
- package/src/components/block-popover/inbetween.js +22 -2
- package/src/components/block-preview/auto.js +3 -3
- package/src/components/block-removal-warning-modal/index.js +3 -2
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -7
- package/src/components/block-switcher/block-transformations-menu.js +18 -1
- package/src/components/block-switcher/index.js +133 -111
- package/src/components/block-switcher/style.scss +6 -4
- package/src/components/block-switcher/test/index.js +113 -230
- package/src/components/block-toolbar/style.scss +22 -18
- package/src/components/block-tools/insertion-point.js +15 -2
- package/src/components/block-tools/style.scss +8 -7
- package/src/components/dimensions-tool/aspect-ratio-tool.js +4 -1
- package/src/components/font-sizes/fluid-utils.js +8 -2
- package/src/components/font-sizes/test/fluid-utils.js +9 -0
- package/src/components/global-styles/border-panel.js +7 -17
- package/src/components/global-styles/dimensions-panel.js +50 -1
- package/src/components/global-styles/effects-panel.js +16 -1
- package/src/components/global-styles/hooks.js +11 -6
- package/src/components/global-styles/typography-panel.js +45 -13
- package/src/components/global-styles/use-global-styles-output.js +6 -0
- package/src/components/iframe/get-compatibility-styles.js +120 -0
- package/src/components/iframe/index.js +2 -3
- package/src/components/index.js +4 -2
- package/src/components/index.native.js +4 -2
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +2 -0
- package/src/components/link-control/link-preview.js +31 -55
- package/src/components/link-control/search-input.js +1 -9
- package/src/components/link-control/style.scss +31 -85
- package/src/components/link-control/test/index.js +2 -1
- package/src/components/list-view/block-contents.js +5 -1
- package/src/components/list-view/block.js +9 -0
- package/src/components/list-view/branch.js +30 -10
- package/src/components/list-view/drop-indicator.js +139 -46
- package/src/components/list-view/index.js +74 -3
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/style.scss +102 -13
- package/src/components/list-view/test/use-list-view-drop-zone.js +4 -0
- package/src/components/list-view/test/utils.js +218 -1
- package/src/components/list-view/use-list-view-block-indexes.js +29 -0
- package/src/components/list-view/use-list-view-drop-zone.js +78 -6
- package/src/components/list-view/utils.js +116 -0
- package/src/components/provider/index.js +3 -1
- package/src/components/recursion-provider/README.md +2 -2
- package/src/components/recursion-provider/index.js +17 -0
- package/src/components/rich-text/index.js +48 -10
- package/src/components/rich-text/native/index.native.js +10 -10
- package/src/components/use-block-drop-zone/index.js +60 -19
- package/src/components/use-block-drop-zone/test/index.js +32 -61
- package/src/components/use-on-block-drop/index.js +92 -11
- package/src/hooks/block-hooks.js +5 -17
- package/src/hooks/content-lock-ui.js +15 -55
- package/src/hooks/dimensions.js +74 -3
- package/src/hooks/effects.js +57 -0
- package/src/hooks/index.js +4 -2
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +12 -0
- package/src/hooks/supports.js +2 -0
- package/src/hooks/test/effects.js +39 -0
- package/src/hooks/typography.native.js +2 -2
- package/src/hooks/use-bindings-attributes.js +148 -0
- package/src/hooks/use-shadow-props.js +37 -0
- package/src/hooks/utils.js +30 -10
- package/src/index.js +2 -0
- package/src/store/actions.js +9 -4
- package/src/store/index.js +2 -0
- package/src/store/private-actions.js +32 -0
- package/src/store/private-selectors.js +78 -21
- package/src/store/reducer.js +49 -2
- package/src/store/resolvers.js +17 -0
- package/src/store/selectors.js +169 -161
- package/src/store/test/registry-selectors.js +431 -0
- package/src/store/test/selectors.js +14 -400
- package/src/store/utils.js +10 -33
- package/src/style.scss +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/math.js +12 -0
- package/src/utils/object.js +16 -0
- package/src/utils/transform-styles/index.js +52 -37
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/iframe/use-compatibility-styles.js +0 -100
- package/build/components/iframe/use-compatibility-styles.js.map +0 -1
- package/build/hooks/custom-fields.js +0 -106
- package/build/hooks/custom-fields.js.map +0 -1
- package/build/utils/block-variation-transforms.js +0 -42
- package/build/utils/block-variation-transforms.js.map +0 -1
- package/build-module/components/iframe/use-compatibility-styles.js +0 -94
- package/build-module/components/iframe/use-compatibility-styles.js.map +0 -1
- package/build-module/hooks/custom-fields.js +0 -99
- package/build-module/hooks/custom-fields.js.map +0 -1
- package/build-module/utils/block-variation-transforms.js +0 -35
- package/build-module/utils/block-variation-transforms.js.map +0 -1
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +0 -116
- package/src/components/contrast-checker/style.scss +0 -3
- package/src/components/iframe/use-compatibility-styles.js +0 -122
- package/src/hooks/custom-fields.js +0 -115
- package/src/utils/block-variation-transforms.js +0 -38
- package/src/utils/test/block-variation-transforms.js +0 -94
|
@@ -27,6 +27,7 @@ import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
|
27
27
|
import SpacingSizesControl from '../spacing-sizes-control';
|
|
28
28
|
import HeightControl from '../height-control';
|
|
29
29
|
import ChildLayoutControl from '../child-layout-control';
|
|
30
|
+
import AspectRatioTool from '../dimensions-tool/aspect-ratio-tool';
|
|
30
31
|
import { cleanEmptyObject } from '../../hooks/utils';
|
|
31
32
|
import { setImmutably } from '../../utils/object';
|
|
32
33
|
|
|
@@ -39,6 +40,7 @@ export function useHasDimensionsPanel( settings ) {
|
|
|
39
40
|
const hasMargin = useHasMargin( settings );
|
|
40
41
|
const hasGap = useHasGap( settings );
|
|
41
42
|
const hasMinHeight = useHasMinHeight( settings );
|
|
43
|
+
const hasAspectRatio = useHasAspectRatio( settings );
|
|
42
44
|
const hasChildLayout = useHasChildLayout( settings );
|
|
43
45
|
|
|
44
46
|
return (
|
|
@@ -49,6 +51,7 @@ export function useHasDimensionsPanel( settings ) {
|
|
|
49
51
|
hasMargin ||
|
|
50
52
|
hasGap ||
|
|
51
53
|
hasMinHeight ||
|
|
54
|
+
hasAspectRatio ||
|
|
52
55
|
hasChildLayout )
|
|
53
56
|
);
|
|
54
57
|
}
|
|
@@ -77,6 +80,10 @@ function useHasMinHeight( settings ) {
|
|
|
77
80
|
return settings?.dimensions?.minHeight;
|
|
78
81
|
}
|
|
79
82
|
|
|
83
|
+
function useHasAspectRatio( settings ) {
|
|
84
|
+
return settings?.dimensions?.aspectRatio;
|
|
85
|
+
}
|
|
86
|
+
|
|
80
87
|
function useHasChildLayout( settings ) {
|
|
81
88
|
const {
|
|
82
89
|
type: parentLayoutType = 'default',
|
|
@@ -192,6 +199,7 @@ const DEFAULT_CONTROLS = {
|
|
|
192
199
|
margin: true,
|
|
193
200
|
blockGap: true,
|
|
194
201
|
minHeight: true,
|
|
202
|
+
aspectRatio: true,
|
|
195
203
|
childLayout: true,
|
|
196
204
|
};
|
|
197
205
|
|
|
@@ -346,8 +354,18 @@ export default function DimensionsPanel( {
|
|
|
346
354
|
const showMinHeightControl = useHasMinHeight( settings );
|
|
347
355
|
const minHeightValue = decodeValue( inheritedValue?.dimensions?.minHeight );
|
|
348
356
|
const setMinHeightValue = ( newValue ) => {
|
|
357
|
+
const tempValue = setImmutably(
|
|
358
|
+
value,
|
|
359
|
+
[ 'dimensions', 'minHeight' ],
|
|
360
|
+
newValue
|
|
361
|
+
);
|
|
362
|
+
// Apply min-height, while removing any applied aspect ratio.
|
|
349
363
|
onChange(
|
|
350
|
-
setImmutably(
|
|
364
|
+
setImmutably(
|
|
365
|
+
tempValue,
|
|
366
|
+
[ 'dimensions', 'aspectRatio' ],
|
|
367
|
+
undefined
|
|
368
|
+
)
|
|
351
369
|
);
|
|
352
370
|
};
|
|
353
371
|
const resetMinHeightValue = () => {
|
|
@@ -355,6 +373,24 @@ export default function DimensionsPanel( {
|
|
|
355
373
|
};
|
|
356
374
|
const hasMinHeightValue = () => !! value?.dimensions?.minHeight;
|
|
357
375
|
|
|
376
|
+
// Aspect Ratio
|
|
377
|
+
const showAspectRatioControl = useHasAspectRatio( settings );
|
|
378
|
+
const aspectRatioValue = decodeValue(
|
|
379
|
+
inheritedValue?.dimensions?.aspectRatio
|
|
380
|
+
);
|
|
381
|
+
const setAspectRatioValue = ( newValue ) => {
|
|
382
|
+
const tempValue = setImmutably(
|
|
383
|
+
value,
|
|
384
|
+
[ 'dimensions', 'aspectRatio' ],
|
|
385
|
+
newValue
|
|
386
|
+
);
|
|
387
|
+
// Apply aspect-ratio, while removing any applied min-height.
|
|
388
|
+
onChange(
|
|
389
|
+
setImmutably( tempValue, [ 'dimensions', 'minHeight' ], undefined )
|
|
390
|
+
);
|
|
391
|
+
};
|
|
392
|
+
const hasAspectRatioValue = () => !! value?.dimensions?.aspectRatio;
|
|
393
|
+
|
|
358
394
|
// Child Layout
|
|
359
395
|
const showChildLayoutControl = useHasChildLayout( settings );
|
|
360
396
|
const childLayout = inheritedValue?.layout;
|
|
@@ -397,6 +433,7 @@ export default function DimensionsPanel( {
|
|
|
397
433
|
dimensions: {
|
|
398
434
|
...previousValue?.dimensions,
|
|
399
435
|
minHeight: undefined,
|
|
436
|
+
aspectRatio: undefined,
|
|
400
437
|
},
|
|
401
438
|
};
|
|
402
439
|
}, [] );
|
|
@@ -617,6 +654,18 @@ export default function DimensionsPanel( {
|
|
|
617
654
|
/>
|
|
618
655
|
</ToolsPanelItem>
|
|
619
656
|
) }
|
|
657
|
+
{ showAspectRatioControl && (
|
|
658
|
+
<AspectRatioTool
|
|
659
|
+
hasValue={ hasAspectRatioValue }
|
|
660
|
+
value={ aspectRatioValue }
|
|
661
|
+
onChange={ setAspectRatioValue }
|
|
662
|
+
panelId={ panelId }
|
|
663
|
+
isShownByDefault={
|
|
664
|
+
defaultControls.aspectRatio ??
|
|
665
|
+
DEFAULT_CONTROLS.aspectRatio
|
|
666
|
+
}
|
|
667
|
+
/>
|
|
668
|
+
) }
|
|
620
669
|
{ showChildLayoutControl && (
|
|
621
670
|
<VStack
|
|
622
671
|
as={ ToolsPanelItem }
|
|
@@ -26,6 +26,7 @@ import { shadow as shadowIcon, Icon, check } from '@wordpress/icons';
|
|
|
26
26
|
/**
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
|
+
import { mergeOrigins } from '../use-settings';
|
|
29
30
|
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
30
31
|
import { setImmutably } from '../../utils/object';
|
|
31
32
|
|
|
@@ -81,8 +82,22 @@ export default function EffectsPanel( {
|
|
|
81
82
|
// Shadow
|
|
82
83
|
const hasShadowEnabled = useHasShadowControl( settings );
|
|
83
84
|
const shadow = decodeValue( inheritedValue?.shadow );
|
|
85
|
+
const shadowPresets = settings?.shadow?.presets;
|
|
86
|
+
const mergedShadowPresets = shadowPresets
|
|
87
|
+
? mergeOrigins( shadowPresets )
|
|
88
|
+
: [];
|
|
84
89
|
const setShadow = ( newValue ) => {
|
|
85
|
-
|
|
90
|
+
const slug = mergedShadowPresets?.find(
|
|
91
|
+
( { shadow: shadowName } ) => shadowName === newValue
|
|
92
|
+
)?.slug;
|
|
93
|
+
|
|
94
|
+
onChange(
|
|
95
|
+
setImmutably(
|
|
96
|
+
value,
|
|
97
|
+
[ 'shadow' ],
|
|
98
|
+
slug ? `var:preset|shadow|${ slug }` : newValue || undefined
|
|
99
|
+
)
|
|
100
|
+
);
|
|
86
101
|
};
|
|
87
102
|
const hasShadow = () => !! value?.shadow;
|
|
88
103
|
const resetShadow = () => setShadow( undefined );
|
|
@@ -49,6 +49,7 @@ const VALID_SETTINGS = [
|
|
|
49
49
|
'color.palette',
|
|
50
50
|
'color.text',
|
|
51
51
|
'custom',
|
|
52
|
+
'dimensions.aspectRatio',
|
|
52
53
|
'dimensions.minHeight',
|
|
53
54
|
'layout.contentSize',
|
|
54
55
|
'layout.definitions',
|
|
@@ -66,6 +67,7 @@ const VALID_SETTINGS = [
|
|
|
66
67
|
'spacing.units',
|
|
67
68
|
'typography.fluid',
|
|
68
69
|
'typography.customFontSize',
|
|
70
|
+
'typography.defaultFontSizes',
|
|
69
71
|
'typography.dropCap',
|
|
70
72
|
'typography.fontFamilies',
|
|
71
73
|
'typography.fontSizes',
|
|
@@ -238,6 +240,7 @@ export function useSettingsForBlockElement(
|
|
|
238
240
|
...updatedSettings.typography,
|
|
239
241
|
fontSizes: {},
|
|
240
242
|
customFontSize: false,
|
|
243
|
+
defaultFontSizes: false,
|
|
241
244
|
};
|
|
242
245
|
}
|
|
243
246
|
|
|
@@ -342,12 +345,14 @@ export function useSettingsForBlockElement(
|
|
|
342
345
|
}
|
|
343
346
|
} );
|
|
344
347
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
348
|
+
[ 'aspectRatio', 'minHeight' ].forEach( ( key ) => {
|
|
349
|
+
if ( ! supportedStyles.includes( key ) ) {
|
|
350
|
+
updatedSettings.dimensions = {
|
|
351
|
+
...updatedSettings.dimensions,
|
|
352
|
+
[ key ]: false,
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
} );
|
|
351
356
|
|
|
352
357
|
[ 'radius', 'color', 'style', 'width' ].forEach( ( key ) => {
|
|
353
358
|
if (
|
|
@@ -22,7 +22,7 @@ import TextTransformControl from '../text-transform-control';
|
|
|
22
22
|
import TextDecorationControl from '../text-decoration-control';
|
|
23
23
|
import WritingModeControl from '../writing-mode-control';
|
|
24
24
|
import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils';
|
|
25
|
-
import { setImmutably } from '../../utils/object';
|
|
25
|
+
import { setImmutably, uniqByProperty } from '../../utils/object';
|
|
26
26
|
|
|
27
27
|
const MIN_TEXT_COLUMNS = 1;
|
|
28
28
|
const MAX_TEXT_COLUMNS = 6;
|
|
@@ -53,7 +53,10 @@ export function useHasTypographyPanel( settings ) {
|
|
|
53
53
|
|
|
54
54
|
function useHasFontSizeControl( settings ) {
|
|
55
55
|
return (
|
|
56
|
-
|
|
56
|
+
( settings?.typography?.defaultFontSizes !== false &&
|
|
57
|
+
settings?.typography?.fontSizes?.default?.length ) ||
|
|
58
|
+
settings?.typography?.fontSizes?.theme?.length ||
|
|
59
|
+
settings?.typography?.fontSizes?.custom?.length ||
|
|
57
60
|
settings?.typography?.customFontSize
|
|
58
61
|
);
|
|
59
62
|
}
|
|
@@ -100,16 +103,45 @@ function useHasTextColumnsControl( settings ) {
|
|
|
100
103
|
return settings?.typography?.textColumns;
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
/**
|
|
107
|
+
* TODO: The reversing and filtering of default font sizes is a hack so the
|
|
108
|
+
* dropdown UI matches what is generated in the global styles CSS stylesheet.
|
|
109
|
+
*
|
|
110
|
+
* This is a temporary solution until #57733 is resolved. At which point,
|
|
111
|
+
* the mergedFontSizes would just need to be the concatenated array of all
|
|
112
|
+
* presets or a custom dropdown with sections for each.
|
|
113
|
+
*
|
|
114
|
+
* @see {@link https://github.com/WordPress/gutenberg/issues/57733}
|
|
115
|
+
*
|
|
116
|
+
* @param {Object} settings The global styles settings.
|
|
117
|
+
*
|
|
118
|
+
* @return {Array} The merged font sizes.
|
|
119
|
+
*/
|
|
120
|
+
function getMergedFontSizes( settings ) {
|
|
121
|
+
// The font size presets are merged in reverse order so that the duplicates
|
|
122
|
+
// that may defined later in the array have higher priority to match the CSS.
|
|
123
|
+
const mergedFontSizesAll = uniqByProperty(
|
|
124
|
+
[
|
|
125
|
+
settings?.typography?.fontSizes?.custom,
|
|
126
|
+
settings?.typography?.fontSizes?.theme,
|
|
127
|
+
settings?.typography?.fontSizes?.default,
|
|
128
|
+
].flatMap( ( presets ) => presets?.toReversed() ?? [] ),
|
|
129
|
+
'slug'
|
|
130
|
+
).reverse();
|
|
131
|
+
|
|
132
|
+
// Default presets exist in the global styles CSS no matter the setting, so
|
|
133
|
+
// filtering them out in the UI has to be done after merging.
|
|
134
|
+
const mergedFontSizes =
|
|
135
|
+
settings?.typography?.defaultFontSizes === false
|
|
136
|
+
? mergedFontSizesAll.filter(
|
|
137
|
+
( { slug } ) =>
|
|
138
|
+
! [ 'small', 'medium', 'large', 'x-large' ].includes(
|
|
139
|
+
slug
|
|
140
|
+
)
|
|
141
|
+
)
|
|
142
|
+
: mergedFontSizesAll;
|
|
143
|
+
|
|
144
|
+
return mergedFontSizes;
|
|
113
145
|
}
|
|
114
146
|
|
|
115
147
|
function TypographyToolsPanel( {
|
|
@@ -185,7 +217,7 @@ export default function TypographyPanel( {
|
|
|
185
217
|
// Font Size
|
|
186
218
|
const hasFontSizeEnabled = useHasFontSizeControl( settings );
|
|
187
219
|
const disableCustomFontSizes = ! settings?.typography?.customFontSize;
|
|
188
|
-
const mergedFontSizes =
|
|
220
|
+
const mergedFontSizes = getMergedFontSizes( settings );
|
|
189
221
|
|
|
190
222
|
const fontSize = decodeValue( inheritedValue?.typography?.fontSize );
|
|
191
223
|
const setFontSize = ( newValue, metadata ) => {
|
|
@@ -434,6 +434,12 @@ export function getStylesDeclarations(
|
|
|
434
434
|
);
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
// For aspect ratio to work, other dimensions rules (and Cover block defaults) must be unset.
|
|
438
|
+
// This ensures that a fixed height does not override the aspect ratio.
|
|
439
|
+
if ( cssProperty === 'aspect-ratio' ) {
|
|
440
|
+
output.push( 'min-height: unset' );
|
|
441
|
+
}
|
|
442
|
+
|
|
437
443
|
output.push( `${ cssProperty }: ${ ruleValue }` );
|
|
438
444
|
} );
|
|
439
445
|
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
let compatibilityStyles = null;
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a list of stylesheets that target the editor canvas. A stylesheet is
|
|
5
|
+
* considered targetting the editor a canvas if it contains the
|
|
6
|
+
* `editor-styles-wrapper`, `wp-block`, or `wp-block-*` class selectors.
|
|
7
|
+
*
|
|
8
|
+
* Ideally, this hook should be removed in the future and styles should be added
|
|
9
|
+
* explicitly as editor styles.
|
|
10
|
+
*/
|
|
11
|
+
export function getCompatibilityStyles() {
|
|
12
|
+
if ( compatibilityStyles ) {
|
|
13
|
+
return compatibilityStyles;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Only memoize the result once on load, since these stylesheets should not
|
|
17
|
+
// change.
|
|
18
|
+
compatibilityStyles = Array.from( document.styleSheets ).reduce(
|
|
19
|
+
( accumulator, styleSheet ) => {
|
|
20
|
+
try {
|
|
21
|
+
// May fail for external styles.
|
|
22
|
+
// eslint-disable-next-line no-unused-expressions
|
|
23
|
+
styleSheet.cssRules;
|
|
24
|
+
} catch ( e ) {
|
|
25
|
+
return accumulator;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const { ownerNode, cssRules } = styleSheet;
|
|
29
|
+
|
|
30
|
+
// Stylesheet is added by another stylesheet. See
|
|
31
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/StyleSheet/ownerNode#notes.
|
|
32
|
+
if ( ownerNode === null ) {
|
|
33
|
+
return accumulator;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if ( ! cssRules ) {
|
|
37
|
+
return accumulator;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Don't try to add the reset styles, which were removed as a dependency
|
|
41
|
+
// from `edit-blocks` for the iframe since we don't need to reset admin
|
|
42
|
+
// styles.
|
|
43
|
+
if ( ownerNode.id === 'wp-reset-editor-styles-css' ) {
|
|
44
|
+
return accumulator;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.
|
|
48
|
+
if ( ! ownerNode.id ) {
|
|
49
|
+
return accumulator;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function matchFromRules( _cssRules ) {
|
|
53
|
+
return Array.from( _cssRules ).find(
|
|
54
|
+
( {
|
|
55
|
+
selectorText,
|
|
56
|
+
conditionText,
|
|
57
|
+
cssRules: __cssRules,
|
|
58
|
+
} ) => {
|
|
59
|
+
// If the rule is conditional then it will not have selector text.
|
|
60
|
+
// Recurse into child CSS ruleset to determine selector eligibility.
|
|
61
|
+
if ( conditionText ) {
|
|
62
|
+
return matchFromRules( __cssRules );
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
selectorText &&
|
|
67
|
+
( selectorText.includes(
|
|
68
|
+
'.editor-styles-wrapper'
|
|
69
|
+
) ||
|
|
70
|
+
selectorText.includes( '.wp-block' ) )
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ( matchFromRules( cssRules ) ) {
|
|
77
|
+
const isInline = ownerNode.tagName === 'STYLE';
|
|
78
|
+
|
|
79
|
+
if ( isInline ) {
|
|
80
|
+
// If the current target is inline,
|
|
81
|
+
// it could be a dependency of an existing stylesheet.
|
|
82
|
+
// Look for that dependency and add it BEFORE the current target.
|
|
83
|
+
const mainStylesCssId = ownerNode.id.replace(
|
|
84
|
+
'-inline-css',
|
|
85
|
+
'-css'
|
|
86
|
+
);
|
|
87
|
+
const mainStylesElement =
|
|
88
|
+
document.getElementById( mainStylesCssId );
|
|
89
|
+
if ( mainStylesElement ) {
|
|
90
|
+
accumulator.push( mainStylesElement.cloneNode( true ) );
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
accumulator.push( ownerNode.cloneNode( true ) );
|
|
95
|
+
|
|
96
|
+
if ( ! isInline ) {
|
|
97
|
+
// If the current target is not inline,
|
|
98
|
+
// we still look for inline styles that could be relevant for the current target.
|
|
99
|
+
// If they exist, add them AFTER the current target.
|
|
100
|
+
const inlineStylesCssId = ownerNode.id.replace(
|
|
101
|
+
'-css',
|
|
102
|
+
'-inline-css'
|
|
103
|
+
);
|
|
104
|
+
const inlineStylesElement =
|
|
105
|
+
document.getElementById( inlineStylesCssId );
|
|
106
|
+
if ( inlineStylesElement ) {
|
|
107
|
+
accumulator.push(
|
|
108
|
+
inlineStylesElement.cloneNode( true )
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return accumulator;
|
|
115
|
+
},
|
|
116
|
+
[]
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
return compatibilityStyles;
|
|
120
|
+
}
|
|
@@ -28,7 +28,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
28
28
|
*/
|
|
29
29
|
import { useBlockSelectionClearer } from '../block-selection-clearer';
|
|
30
30
|
import { useWritingFlow } from '../writing-flow';
|
|
31
|
-
import {
|
|
31
|
+
import { getCompatibilityStyles } from './get-compatibility-styles';
|
|
32
32
|
import { store as blockEditorStore } from '../../store';
|
|
33
33
|
|
|
34
34
|
function bubbleEvent( event, Constructor, frame ) {
|
|
@@ -121,7 +121,6 @@ function Iframe( {
|
|
|
121
121
|
const { styles = '', scripts = '' } = resolvedAssets;
|
|
122
122
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
123
123
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
124
|
-
const compatStyles = useCompatibilityStyles();
|
|
125
124
|
const clearerRef = useBlockSelectionClearer();
|
|
126
125
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
127
126
|
const [ contentResizeListener, { height: contentHeight } ] =
|
|
@@ -156,7 +155,7 @@ function Iframe( {
|
|
|
156
155
|
|
|
157
156
|
contentDocument.dir = ownerDocument.dir;
|
|
158
157
|
|
|
159
|
-
for ( const compatStyle of
|
|
158
|
+
for ( const compatStyle of getCompatibilityStyles() ) {
|
|
160
159
|
if ( contentDocument.getElementById( compatStyle.id ) ) {
|
|
161
160
|
continue;
|
|
162
161
|
}
|
package/src/components/index.js
CHANGED
|
@@ -152,8 +152,10 @@ export { default as WritingFlow } from './writing-flow';
|
|
|
152
152
|
export { default as useBlockDisplayInformation } from './use-block-display-information';
|
|
153
153
|
export { default as __unstableIframe } from './iframe';
|
|
154
154
|
export {
|
|
155
|
-
RecursionProvider
|
|
156
|
-
|
|
155
|
+
RecursionProvider,
|
|
156
|
+
DeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,
|
|
157
|
+
useHasRecursion,
|
|
158
|
+
DeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,
|
|
157
159
|
} from './recursion-provider';
|
|
158
160
|
export { default as __experimentalBlockPatternsList } from './block-patterns-list';
|
|
159
161
|
export { default as __experimentalPublishDateTimePicker } from './publish-date-time-picker';
|
|
@@ -61,8 +61,10 @@ export { default as PanelColorSettings } from './panel-color-settings';
|
|
|
61
61
|
export { default as __experimentalPanelColorGradientSettings } from './colors-gradients/panel-color-gradient-settings';
|
|
62
62
|
export { useSettings, default as useSetting } from './use-settings';
|
|
63
63
|
export {
|
|
64
|
-
RecursionProvider
|
|
65
|
-
|
|
64
|
+
RecursionProvider,
|
|
65
|
+
DeprecatedExperimentalRecursionProvider as __experimentalRecursionProvider,
|
|
66
|
+
useHasRecursion,
|
|
67
|
+
DeprecatedExperimentalUseHasRecursion as __experimentalUseHasRecursion,
|
|
66
68
|
} from './recursion-provider';
|
|
67
69
|
export { default as Warning } from './warning';
|
|
68
70
|
export { default as ContrastChecker } from './contrast-checker';
|
|
@@ -20,6 +20,7 @@ const InspectorControlsTypography = createSlotFill(
|
|
|
20
20
|
);
|
|
21
21
|
const InspectorControlsListView = createSlotFill( 'InspectorControlsListView' );
|
|
22
22
|
const InspectorControlsStyles = createSlotFill( 'InspectorControlsStyles' );
|
|
23
|
+
const InspectorControlsEffects = createSlotFill( 'InspectorControlsEffects' );
|
|
23
24
|
|
|
24
25
|
const groups = {
|
|
25
26
|
default: InspectorControlsDefault,
|
|
@@ -28,6 +29,7 @@ const groups = {
|
|
|
28
29
|
border: InspectorControlsBorder,
|
|
29
30
|
color: InspectorControlsColor,
|
|
30
31
|
dimensions: InspectorControlsDimensions,
|
|
32
|
+
effects: InspectorControlsEffects,
|
|
31
33
|
filter: InspectorControlsFilter,
|
|
32
34
|
list: InspectorControlsListView,
|
|
33
35
|
position: InspectorControlsPosition,
|
|
@@ -46,6 +46,7 @@ const StylesTab = ( { blockName, clientId, hasBlockStyles } ) => {
|
|
|
46
46
|
label={ __( 'Dimensions' ) }
|
|
47
47
|
/>
|
|
48
48
|
<InspectorControls.Slot group="border" label={ __( 'Border' ) } />
|
|
49
|
+
<InspectorControls.Slot group="effects" label={ __( 'Effects' ) } />
|
|
49
50
|
<InspectorControls.Slot group="styles" />
|
|
50
51
|
</>
|
|
51
52
|
);
|
|
@@ -40,6 +40,7 @@ export default function useInspectorControlsTabs( blockName ) {
|
|
|
40
40
|
position: positionGroup,
|
|
41
41
|
styles: stylesGroup,
|
|
42
42
|
typography: typographyGroup,
|
|
43
|
+
effects: effectsGroup,
|
|
43
44
|
} = InspectorControlsGroups;
|
|
44
45
|
|
|
45
46
|
// List View Tab: If there are any fills for the list group add that tab.
|
|
@@ -55,6 +56,7 @@ export default function useInspectorControlsTabs( blockName ) {
|
|
|
55
56
|
...( useSlotFills( dimensionsGroup.Slot.__unstableName ) || [] ),
|
|
56
57
|
...( useSlotFills( stylesGroup.Slot.__unstableName ) || [] ),
|
|
57
58
|
...( useSlotFills( typographyGroup.Slot.__unstableName ) || [] ),
|
|
59
|
+
...( useSlotFills( effectsGroup.Slot.__unstableName ) || [] ),
|
|
58
60
|
];
|
|
59
61
|
const hasStyleFills = styleFills.length;
|
|
60
62
|
|
|
@@ -10,12 +10,15 @@ import { __ } from '@wordpress/i18n';
|
|
|
10
10
|
import {
|
|
11
11
|
Button,
|
|
12
12
|
ExternalLink,
|
|
13
|
-
|
|
13
|
+
__experimentalTruncate as Truncate,
|
|
14
14
|
Tooltip,
|
|
15
15
|
} from '@wordpress/components';
|
|
16
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
16
17
|
import { filterURLForDisplay, safeDecodeURI } from '@wordpress/url';
|
|
17
|
-
import { Icon, globe, info, linkOff, edit } from '@wordpress/icons';
|
|
18
|
+
import { Icon, globe, info, linkOff, edit, copy } from '@wordpress/icons';
|
|
18
19
|
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
20
|
+
import { useDispatch } from '@wordpress/data';
|
|
21
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* Internal dependencies
|
|
@@ -41,7 +44,7 @@ export default function LinkPreview( {
|
|
|
41
44
|
const hasRichData = richData && Object.keys( richData ).length;
|
|
42
45
|
|
|
43
46
|
const displayURL =
|
|
44
|
-
( value && filterURLForDisplay( safeDecodeURI( value.url ),
|
|
47
|
+
( value && filterURLForDisplay( safeDecodeURI( value.url ), 24 ) ) ||
|
|
45
48
|
'';
|
|
46
49
|
|
|
47
50
|
// url can be undefined if the href attribute is unset
|
|
@@ -61,6 +64,14 @@ export default function LinkPreview( {
|
|
|
61
64
|
icon = <Icon icon={ globe } />;
|
|
62
65
|
}
|
|
63
66
|
|
|
67
|
+
const { createNotice } = useDispatch( noticesStore );
|
|
68
|
+
const ref = useCopyToClipboard( value.url, () => {
|
|
69
|
+
createNotice( 'info', __( 'Copied URL to clipboard.' ), {
|
|
70
|
+
isDismissible: true,
|
|
71
|
+
type: 'snackbar',
|
|
72
|
+
} );
|
|
73
|
+
} );
|
|
74
|
+
|
|
64
75
|
return (
|
|
65
76
|
<div
|
|
66
77
|
aria-label={ __( 'Currently selected' ) }
|
|
@@ -88,21 +99,21 @@ export default function LinkPreview( {
|
|
|
88
99
|
<span className="block-editor-link-control__search-item-details">
|
|
89
100
|
{ ! isEmptyURL ? (
|
|
90
101
|
<>
|
|
91
|
-
<Tooltip
|
|
92
|
-
text={ value.url }
|
|
93
|
-
placement="bottom-start"
|
|
94
|
-
>
|
|
102
|
+
<Tooltip text={ value.url }>
|
|
95
103
|
<ExternalLink
|
|
96
104
|
className="block-editor-link-control__search-item-title"
|
|
97
105
|
href={ value.url }
|
|
98
106
|
>
|
|
99
|
-
{
|
|
107
|
+
<Truncate numberOfLines={ 1 }>
|
|
108
|
+
{ displayTitle }
|
|
109
|
+
</Truncate>
|
|
100
110
|
</ExternalLink>
|
|
101
111
|
</Tooltip>
|
|
102
|
-
|
|
103
112
|
{ value?.url && displayTitle !== displayURL && (
|
|
104
113
|
<span className="block-editor-link-control__search-item-info">
|
|
105
|
-
{
|
|
114
|
+
<Truncate numberOfLines={ 1 }>
|
|
115
|
+
{ displayURL }
|
|
116
|
+
</Truncate>
|
|
106
117
|
</span>
|
|
107
118
|
) }
|
|
108
119
|
</>
|
|
@@ -119,7 +130,7 @@ export default function LinkPreview( {
|
|
|
119
130
|
label={ __( 'Edit' ) }
|
|
120
131
|
className="block-editor-link-control__search-item-action"
|
|
121
132
|
onClick={ onEditClick }
|
|
122
|
-
|
|
133
|
+
size="compact"
|
|
123
134
|
/>
|
|
124
135
|
{ hasUnlinkControl && (
|
|
125
136
|
<Button
|
|
@@ -127,54 +138,19 @@ export default function LinkPreview( {
|
|
|
127
138
|
label={ __( 'Unlink' ) }
|
|
128
139
|
className="block-editor-link-control__search-item-action block-editor-link-control__unlink"
|
|
129
140
|
onClick={ onRemove }
|
|
130
|
-
|
|
141
|
+
size="compact"
|
|
131
142
|
/>
|
|
132
143
|
) }
|
|
144
|
+
<Button
|
|
145
|
+
icon={ copy }
|
|
146
|
+
label={ __( 'Copy URL' ) }
|
|
147
|
+
className="block-editor-link-control__search-item-action block-editor-link-control__copy"
|
|
148
|
+
ref={ ref }
|
|
149
|
+
disabled={ isEmptyURL }
|
|
150
|
+
size="compact"
|
|
151
|
+
/>
|
|
133
152
|
<ViewerSlot fillProps={ value } />
|
|
134
153
|
</div>
|
|
135
|
-
|
|
136
|
-
{ !! (
|
|
137
|
-
( hasRichData &&
|
|
138
|
-
( richData?.image || richData?.description ) ) ||
|
|
139
|
-
isFetching
|
|
140
|
-
) && (
|
|
141
|
-
<div className="block-editor-link-control__search-item-bottom">
|
|
142
|
-
{ ( richData?.image || isFetching ) && (
|
|
143
|
-
<div
|
|
144
|
-
aria-hidden={ ! richData?.image }
|
|
145
|
-
className={ classnames(
|
|
146
|
-
'block-editor-link-control__search-item-image',
|
|
147
|
-
{
|
|
148
|
-
'is-placeholder': ! richData?.image,
|
|
149
|
-
}
|
|
150
|
-
) }
|
|
151
|
-
>
|
|
152
|
-
{ richData?.image && (
|
|
153
|
-
<img src={ richData?.image } alt="" />
|
|
154
|
-
) }
|
|
155
|
-
</div>
|
|
156
|
-
) }
|
|
157
|
-
|
|
158
|
-
{ ( richData?.description || isFetching ) && (
|
|
159
|
-
<div
|
|
160
|
-
aria-hidden={ ! richData?.description }
|
|
161
|
-
className={ classnames(
|
|
162
|
-
'block-editor-link-control__search-item-description',
|
|
163
|
-
{
|
|
164
|
-
'is-placeholder': ! richData?.description,
|
|
165
|
-
}
|
|
166
|
-
) }
|
|
167
|
-
>
|
|
168
|
-
{ richData?.description && (
|
|
169
|
-
<Text truncate numberOfLines="2">
|
|
170
|
-
{ richData.description }
|
|
171
|
-
</Text>
|
|
172
|
-
) }
|
|
173
|
-
</div>
|
|
174
|
-
) }
|
|
175
|
-
</div>
|
|
176
|
-
) }
|
|
177
|
-
|
|
178
154
|
{ additionalControls && additionalControls() }
|
|
179
155
|
</div>
|
|
180
156
|
);
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
@@ -119,10 +115,6 @@ const LinkControlSearchInput = forwardRef(
|
|
|
119
115
|
}
|
|
120
116
|
};
|
|
121
117
|
|
|
122
|
-
const inputClasses = classnames( className, {
|
|
123
|
-
// 'has-no-label': ! hideLabelFromVision,
|
|
124
|
-
} );
|
|
125
|
-
|
|
126
118
|
return (
|
|
127
119
|
<div className="block-editor-link-control__search-input-container">
|
|
128
120
|
<URLInput
|
|
@@ -130,7 +122,7 @@ const LinkControlSearchInput = forwardRef(
|
|
|
130
122
|
__nextHasNoMarginBottom
|
|
131
123
|
label={ __( 'Link' ) }
|
|
132
124
|
hideLabelFromVision={ hideLabelFromVision }
|
|
133
|
-
className={
|
|
125
|
+
className={ className }
|
|
134
126
|
value={ value }
|
|
135
127
|
onChange={ onInputChange }
|
|
136
128
|
placeholder={ placeholder ?? __( 'Search or type url' ) }
|