@wordpress/block-editor 11.0.0 → 11.1.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 +9 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +55 -4
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +13 -95
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +13 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +21 -26
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +57 -45
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +5 -1
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +21 -7
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +56 -5
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +12 -95
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +13 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +21 -27
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +58 -46
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +5 -1
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +21 -6
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +3 -3
- package/build-style/content.css +3 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +35 -11
- package/build-style/style.css +35 -11
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +77 -4
- package/src/components/block-inspector/style.scss +7 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +8 -103
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +15 -2
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +1 -7
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +30 -25
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +93 -76
- package/src/components/off-canvas-editor/index.js +9 -0
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +13 -6
- package/src/store/selectors.js +2 -3
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -28,6 +28,7 @@ const SetupContent = ( {
|
|
|
28
28
|
activeSlide,
|
|
29
29
|
patterns,
|
|
30
30
|
onBlockPatternSelect,
|
|
31
|
+
showTitles,
|
|
31
32
|
} ) => {
|
|
32
33
|
const composite = useCompositeState();
|
|
33
34
|
const containerClass = 'block-editor-block-pattern-setup__container';
|
|
@@ -67,6 +68,7 @@ const SetupContent = ( {
|
|
|
67
68
|
pattern={ pattern }
|
|
68
69
|
onSelect={ onBlockPatternSelect }
|
|
69
70
|
composite={ composite }
|
|
71
|
+
showTitles={ showTitles }
|
|
70
72
|
/>
|
|
71
73
|
) ) }
|
|
72
74
|
</Composite>
|
|
@@ -74,7 +76,7 @@ const SetupContent = ( {
|
|
|
74
76
|
);
|
|
75
77
|
};
|
|
76
78
|
|
|
77
|
-
function BlockPattern( { pattern, onSelect, composite } ) {
|
|
79
|
+
function BlockPattern( { pattern, onSelect, composite, showTitles } ) {
|
|
78
80
|
const baseClassName = 'block-editor-block-pattern-setup-list';
|
|
79
81
|
const { blocks, description, viewportWidth = 700 } = pattern;
|
|
80
82
|
const descriptionId = useInstanceId(
|
|
@@ -98,12 +100,17 @@ function BlockPattern( { pattern, onSelect, composite } ) {
|
|
|
98
100
|
blocks={ blocks }
|
|
99
101
|
viewportWidth={ viewportWidth }
|
|
100
102
|
/>
|
|
103
|
+
{ showTitles && (
|
|
104
|
+
<div className={ `${ baseClassName }__item-title` }>
|
|
105
|
+
{ pattern.title }
|
|
106
|
+
</div>
|
|
107
|
+
) }
|
|
108
|
+
{ !! description && (
|
|
109
|
+
<VisuallyHidden id={ descriptionId }>
|
|
110
|
+
{ description }
|
|
111
|
+
</VisuallyHidden>
|
|
112
|
+
) }
|
|
101
113
|
</CompositeItem>
|
|
102
|
-
{ !! description && (
|
|
103
|
-
<VisuallyHidden id={ descriptionId }>
|
|
104
|
-
{ description }
|
|
105
|
-
</VisuallyHidden>
|
|
106
|
-
) }
|
|
107
114
|
</div>
|
|
108
115
|
);
|
|
109
116
|
}
|
|
@@ -139,6 +146,7 @@ const BlockPatternSetup = ( {
|
|
|
139
146
|
filterPatternsFn,
|
|
140
147
|
onBlockPatternSelect,
|
|
141
148
|
initialViewMode = VIEWMODES.carousel,
|
|
149
|
+
showTitles = false,
|
|
142
150
|
} ) => {
|
|
143
151
|
const [ viewMode, setViewMode ] = useState( initialViewMode );
|
|
144
152
|
const [ activeSlide, setActiveSlide ] = useState( 0 );
|
|
@@ -165,6 +173,7 @@ const BlockPatternSetup = ( {
|
|
|
165
173
|
activeSlide={ activeSlide }
|
|
166
174
|
patterns={ patterns }
|
|
167
175
|
onBlockPatternSelect={ onPatternSelectCallback }
|
|
176
|
+
showTitles={ showTitles }
|
|
168
177
|
/>
|
|
169
178
|
<SetupToolbar
|
|
170
179
|
viewMode={ viewMode }
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
width: 100%;
|
|
7
7
|
border-radius: $radius-block-ui;
|
|
8
8
|
|
|
9
|
-
// TODO change to check parent.
|
|
10
9
|
&.view-mode-grid {
|
|
10
|
+
padding-top: $grid-unit-05;
|
|
11
|
+
|
|
11
12
|
.block-editor-block-pattern-setup__toolbar {
|
|
12
13
|
justify-content: center;
|
|
13
14
|
}
|
|
@@ -30,10 +31,33 @@
|
|
|
30
31
|
cursor: pointer;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
.block-editor-block-pattern-setup-list__item {
|
|
35
|
+
&:hover .block-editor-block-preview__container {
|
|
36
|
+
box-shadow: 0 0 0 2px var(--wp-admin-theme-color);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&:focus .block-editor-block-preview__container {
|
|
40
|
+
box-shadow: inset 0 0 0 1px $white, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
41
|
+
|
|
42
|
+
// Windows High Contrast mode will show this outline, but not the box-shadow.
|
|
43
|
+
outline: 2px solid transparent;
|
|
44
|
+
}
|
|
45
|
+
&:hover .block-editor-block-pattern-setup-list__item-title,
|
|
46
|
+
&:focus .block-editor-block-pattern-setup-list__item-title {
|
|
47
|
+
color: var(--wp-admin-theme-color);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
33
50
|
.block-editor-block-pattern-setup-list__list-item {
|
|
34
51
|
break-inside: avoid-column;
|
|
35
52
|
margin-bottom: $grid-unit-30;
|
|
36
53
|
|
|
54
|
+
.block-editor-block-pattern-setup-list__item-title {
|
|
55
|
+
padding-top: $grid-unit-10;
|
|
56
|
+
font-size: 12px;
|
|
57
|
+
text-align: center;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
}
|
|
60
|
+
|
|
37
61
|
.block-editor-block-preview__container {
|
|
38
62
|
min-height: 100px;
|
|
39
63
|
border-radius: $radius-block-ui;
|
|
@@ -84,6 +108,7 @@
|
|
|
84
108
|
display: flex;
|
|
85
109
|
flex-direction: column;
|
|
86
110
|
width: 100%;
|
|
111
|
+
height: 100%;
|
|
87
112
|
box-sizing: border-box;
|
|
88
113
|
|
|
89
114
|
.carousel-container {
|
|
@@ -91,6 +116,7 @@
|
|
|
91
116
|
position: relative;
|
|
92
117
|
padding: 0;
|
|
93
118
|
margin: 0;
|
|
119
|
+
height: 100%;
|
|
94
120
|
list-style: none;
|
|
95
121
|
transform-style: preserve-3d;
|
|
96
122
|
* {
|
|
@@ -100,6 +126,8 @@
|
|
|
100
126
|
position: absolute;
|
|
101
127
|
top: 0;
|
|
102
128
|
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
background-color: $white;
|
|
103
131
|
margin: auto;
|
|
104
132
|
padding: 0;
|
|
105
133
|
transition: transform 0.5s, z-index 0.5s;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { ScrollView } from 'react-native';
|
|
5
|
-
import { find } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -35,7 +34,7 @@ function BlockStyles( { clientId, url } ) {
|
|
|
35
34
|
|
|
36
35
|
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
37
36
|
|
|
38
|
-
const renderedStyles = find(
|
|
37
|
+
const renderedStyles = styles?.find( ( style ) => style.isDefault )
|
|
39
38
|
? styles
|
|
40
39
|
: [
|
|
41
40
|
{
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
1
|
/**
|
|
6
2
|
* WordPress dependencies
|
|
7
3
|
*/
|
|
@@ -23,13 +19,15 @@ export function getActiveStyle( styles, className ) {
|
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
const potentialStyleName = style.substring( 9 );
|
|
26
|
-
const activeStyle = find(
|
|
22
|
+
const activeStyle = styles?.find(
|
|
23
|
+
( { name } ) => name === potentialStyleName
|
|
24
|
+
);
|
|
27
25
|
if ( activeStyle ) {
|
|
28
26
|
return activeStyle;
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
return
|
|
30
|
+
return getDefaultStyle( styles );
|
|
33
31
|
}
|
|
34
32
|
|
|
35
33
|
/**
|
|
@@ -88,5 +86,5 @@ export function getRenderedStyles( styles ) {
|
|
|
88
86
|
* @return {Object?} The default style object, if found.
|
|
89
87
|
*/
|
|
90
88
|
export function getDefaultStyle( styles ) {
|
|
91
|
-
return find(
|
|
89
|
+
return styles?.find( ( style ) => style.isDefault );
|
|
92
90
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen, within } from '@testing-library/react';
|
|
4
|
+
import { act, render, screen, within } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -15,7 +15,8 @@ import { copy } from '@wordpress/icons';
|
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
17
|
import { BlockSwitcher, BlockSwitcherDropdownMenu } from '../';
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
jest.useFakeTimers();
|
|
19
20
|
|
|
20
21
|
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
21
22
|
jest.mock( '../../block-title/use-block-display-title', () =>
|
|
@@ -11,31 +11,28 @@ import UngroupButton from '../ungroup-button';
|
|
|
11
11
|
import { store as blockEditorStore } from '../../store';
|
|
12
12
|
|
|
13
13
|
export default function BlockToolbar() {
|
|
14
|
-
const {
|
|
14
|
+
const { isSelected, isValidAndVisual } = useSelect( ( select ) => {
|
|
15
15
|
const { getBlockMode, getSelectedBlockClientIds, isBlockValid } =
|
|
16
16
|
select( blockEditorStore );
|
|
17
17
|
const selectedBlockClientIds = getSelectedBlockClientIds();
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
isSelected: selectedBlockClientIds.length > 0,
|
|
21
|
+
isValidAndVisual:
|
|
22
22
|
selectedBlockClientIds.length === 1
|
|
23
|
-
? isBlockValid( selectedBlockClientIds[ 0 ] )
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
selectedBlockClientIds.length === 1
|
|
27
|
-
? getBlockMode( selectedBlockClientIds[ 0 ] )
|
|
28
|
-
: null,
|
|
23
|
+
? isBlockValid( selectedBlockClientIds[ 0 ] ) &&
|
|
24
|
+
getBlockMode( selectedBlockClientIds[ 0 ] ) === 'visual'
|
|
25
|
+
: false,
|
|
29
26
|
};
|
|
30
27
|
}, [] );
|
|
31
28
|
|
|
32
|
-
if (
|
|
29
|
+
if ( ! isSelected ) {
|
|
33
30
|
return null;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
return (
|
|
37
34
|
<>
|
|
38
|
-
{
|
|
35
|
+
{ isValidAndVisual && (
|
|
39
36
|
<>
|
|
40
37
|
<UngroupButton />
|
|
41
38
|
<BlockControls.Slot group="block" />
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -240,8 +239,7 @@ function wrapperSelector( select ) {
|
|
|
240
239
|
);
|
|
241
240
|
|
|
242
241
|
// Get the clientId of the topmost parent with the capture toolbars setting.
|
|
243
|
-
const capturingClientId = find(
|
|
244
|
-
blockParentsClientIds,
|
|
242
|
+
const capturingClientId = blockParentsClientIds.find(
|
|
245
243
|
( parentClientId ) =>
|
|
246
244
|
parentBlockListSettings[ parentClientId ]
|
|
247
245
|
?.__experimentalCaptureToolbars
|
|
@@ -43,7 +43,11 @@ function BlockVariationPicker( {
|
|
|
43
43
|
<li key={ variation.name }>
|
|
44
44
|
<Button
|
|
45
45
|
variant="secondary"
|
|
46
|
-
icon={
|
|
46
|
+
icon={
|
|
47
|
+
variation.icon && variation.icon.src
|
|
48
|
+
? variation.icon.src
|
|
49
|
+
: variation.icon
|
|
50
|
+
}
|
|
47
51
|
iconSize={ 48 }
|
|
48
52
|
onClick={ () => onSelect( variation ) }
|
|
49
53
|
className="block-editor-block-variation-picker__variation"
|
|
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import { createCustomColorsHOC } from '../with-colors';
|
|
11
11
|
|
|
12
|
+
jest.useFakeTimers();
|
|
13
|
+
|
|
12
14
|
describe( 'createCustomColorsHOC', () => {
|
|
13
15
|
it( 'provides the wrapped component with color values and setter functions as props', () => {
|
|
14
16
|
const withCustomColors = createCustomColorsHOC( [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { kebabCase } from 'lodash';
|
|
5
5
|
import { colord, extend } from 'colord';
|
|
6
6
|
import namesPlugin from 'colord/plugins/names';
|
|
7
7
|
import a11yPlugin from 'colord/plugins/a11y';
|
|
@@ -26,7 +26,9 @@ export const getColorObjectByAttributeValues = (
|
|
|
26
26
|
customColor
|
|
27
27
|
) => {
|
|
28
28
|
if ( definedColor ) {
|
|
29
|
-
const colorObj = find(
|
|
29
|
+
const colorObj = colors?.find(
|
|
30
|
+
( color ) => color.slug === definedColor
|
|
31
|
+
);
|
|
30
32
|
|
|
31
33
|
if ( colorObj ) {
|
|
32
34
|
return colorObj;
|
|
@@ -47,7 +49,7 @@ export const getColorObjectByAttributeValues = (
|
|
|
47
49
|
* Returns undefined if no color object matches this requirement.
|
|
48
50
|
*/
|
|
49
51
|
export const getColorObjectByColorValue = ( colors, colorValue ) => {
|
|
50
|
-
return find(
|
|
52
|
+
return colors?.find( ( color ) => color.color === colorValue );
|
|
51
53
|
};
|
|
52
54
|
|
|
53
55
|
/**
|
|
@@ -45,7 +45,6 @@ function ColorGradientControlInner( {
|
|
|
45
45
|
gradients,
|
|
46
46
|
disableCustomColors,
|
|
47
47
|
disableCustomGradients,
|
|
48
|
-
__experimentalHasMultipleOrigins,
|
|
49
48
|
__experimentalIsRenderedInSidebar,
|
|
50
49
|
className,
|
|
51
50
|
label,
|
|
@@ -80,9 +79,6 @@ function ColorGradientControlInner( {
|
|
|
80
79
|
: onColorChange
|
|
81
80
|
}
|
|
82
81
|
{ ...{ colors, disableCustomColors } }
|
|
83
|
-
__experimentalHasMultipleOrigins={
|
|
84
|
-
__experimentalHasMultipleOrigins
|
|
85
|
-
}
|
|
86
82
|
__experimentalIsRenderedInSidebar={
|
|
87
83
|
__experimentalIsRenderedInSidebar
|
|
88
84
|
}
|
|
@@ -103,9 +99,6 @@ function ColorGradientControlInner( {
|
|
|
103
99
|
: onGradientChange
|
|
104
100
|
}
|
|
105
101
|
{ ...{ gradients, disableCustomGradients } }
|
|
106
|
-
__experimentalHasMultipleOrigins={
|
|
107
|
-
__experimentalHasMultipleOrigins
|
|
108
|
-
}
|
|
109
102
|
__experimentalIsRenderedInSidebar={
|
|
110
103
|
__experimentalIsRenderedInSidebar
|
|
111
104
|
}
|
|
@@ -111,7 +111,6 @@ export default function ColorGradientSettingsDropdown( {
|
|
|
111
111
|
enableAlpha,
|
|
112
112
|
gradients,
|
|
113
113
|
settings,
|
|
114
|
-
__experimentalHasMultipleOrigins,
|
|
115
114
|
__experimentalIsRenderedInSidebar,
|
|
116
115
|
...props
|
|
117
116
|
} ) {
|
|
@@ -140,7 +139,6 @@ export default function ColorGradientSettingsDropdown( {
|
|
|
140
139
|
onColorChange: setting.onColorChange,
|
|
141
140
|
onGradientChange: setting.onGradientChange,
|
|
142
141
|
showTitle: false,
|
|
143
|
-
__experimentalHasMultipleOrigins,
|
|
144
142
|
__experimentalIsRenderedInSidebar,
|
|
145
143
|
...setting,
|
|
146
144
|
};
|
|
@@ -18,9 +18,7 @@ import { useInstanceId } from '@wordpress/compose';
|
|
|
18
18
|
* Internal dependencies
|
|
19
19
|
*/
|
|
20
20
|
import ColorGradientSettingsDropdown from './dropdown';
|
|
21
|
-
import
|
|
22
|
-
import useCommonSingleMultipleSelects from './use-common-single-multiple-selects';
|
|
23
|
-
import useMultipleOriginColorsAndGradients from './use-multiple-origin-colors-and-gradients';
|
|
21
|
+
import useColorsAndGradientsPalettes from './use-multiple-origin-colors-and-gradients';
|
|
24
22
|
|
|
25
23
|
const colorsAndGradientKeys = [
|
|
26
24
|
'colors',
|
|
@@ -39,7 +37,6 @@ export const PanelColorGradientSettingsInner = ( {
|
|
|
39
37
|
settings,
|
|
40
38
|
title,
|
|
41
39
|
showTitle = true,
|
|
42
|
-
__experimentalHasMultipleOrigins,
|
|
43
40
|
__experimentalIsRenderedInSidebar,
|
|
44
41
|
enableAlpha,
|
|
45
42
|
} ) => {
|
|
@@ -100,7 +97,6 @@ export const PanelColorGradientSettingsInner = ( {
|
|
|
100
97
|
gradients,
|
|
101
98
|
disableCustomColors,
|
|
102
99
|
disableCustomGradients,
|
|
103
|
-
__experimentalHasMultipleOrigins,
|
|
104
100
|
__experimentalIsRenderedInSidebar,
|
|
105
101
|
enableAlpha,
|
|
106
102
|
} }
|
|
@@ -114,19 +110,8 @@ export const PanelColorGradientSettingsInner = ( {
|
|
|
114
110
|
);
|
|
115
111
|
};
|
|
116
112
|
|
|
117
|
-
const
|
|
118
|
-
const colorGradientSettings =
|
|
119
|
-
colorGradientSettings.colors = useSetting( 'color.palette' );
|
|
120
|
-
colorGradientSettings.gradients = useSetting( 'color.gradients' );
|
|
121
|
-
return (
|
|
122
|
-
<PanelColorGradientSettingsInner
|
|
123
|
-
{ ...{ ...colorGradientSettings, ...props } }
|
|
124
|
-
/>
|
|
125
|
-
);
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
const PanelColorGradientSettingsMultipleSelect = ( props ) => {
|
|
129
|
-
const colorGradientSettings = useMultipleOriginColorsAndGradients();
|
|
113
|
+
const PanelColorGradientSettingsSelect = ( props ) => {
|
|
114
|
+
const colorGradientSettings = useColorsAndGradientsPalettes();
|
|
130
115
|
return (
|
|
131
116
|
<PanelColorGradientSettingsInner
|
|
132
117
|
{ ...{ ...colorGradientSettings, ...props } }
|
|
@@ -140,10 +125,7 @@ const PanelColorGradientSettings = ( props ) => {
|
|
|
140
125
|
) {
|
|
141
126
|
return <PanelColorGradientSettingsInner { ...props } />;
|
|
142
127
|
}
|
|
143
|
-
|
|
144
|
-
return <PanelColorGradientSettingsMultipleSelect { ...props } />;
|
|
145
|
-
}
|
|
146
|
-
return <PanelColorGradientSettingsSingleSelect { ...props } />;
|
|
128
|
+
return <PanelColorGradientSettingsSelect { ...props } />;
|
|
147
129
|
};
|
|
148
130
|
|
|
149
131
|
export default PanelColorGradientSettings;
|
|
@@ -8,7 +8,6 @@ import { _x } from '@wordpress/i18n';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import useSetting from '../use-setting';
|
|
11
|
-
import useCommonSingleMultipleSelects from './use-common-single-multiple-selects';
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Retrieves color and gradient related settings.
|
|
@@ -19,7 +18,10 @@ import useCommonSingleMultipleSelects from './use-common-single-multiple-selects
|
|
|
19
18
|
* @return {Object} Color and gradient related settings.
|
|
20
19
|
*/
|
|
21
20
|
export default function useMultipleOriginColorsAndGradients() {
|
|
22
|
-
const colorGradientSettings =
|
|
21
|
+
const colorGradientSettings = {
|
|
22
|
+
disableCustomColors: ! useSetting( 'color.custom' ),
|
|
23
|
+
disableCustomGradients: ! useSetting( 'color.customGradient' ),
|
|
24
|
+
};
|
|
23
25
|
const customColors = useSetting( 'color.palette.custom' );
|
|
24
26
|
const themeColors = useSetting( 'color.palette.theme' );
|
|
25
27
|
const defaultColors = useSetting( 'color.palette.default' );
|
|
@@ -7,6 +7,8 @@ import {
|
|
|
7
7
|
pasteHandler,
|
|
8
8
|
store as blocksStore,
|
|
9
9
|
createBlock,
|
|
10
|
+
findTransform,
|
|
11
|
+
getBlockTransforms,
|
|
10
12
|
} from '@wordpress/blocks';
|
|
11
13
|
import {
|
|
12
14
|
documentHasSelection,
|
|
@@ -84,6 +86,7 @@ export function useClipboardHandler() {
|
|
|
84
86
|
__unstableIsSelectionCollapsed,
|
|
85
87
|
__unstableIsSelectionMergeable,
|
|
86
88
|
__unstableGetSelectedBlocksWithPartialSelection,
|
|
89
|
+
canInsertBlockType,
|
|
87
90
|
} = useSelect( blockEditorStore );
|
|
88
91
|
const {
|
|
89
92
|
flashBlock,
|
|
@@ -91,6 +94,7 @@ export function useClipboardHandler() {
|
|
|
91
94
|
replaceBlocks,
|
|
92
95
|
__unstableDeleteSelection,
|
|
93
96
|
__unstableExpandSelection,
|
|
97
|
+
insertBlocks,
|
|
94
98
|
} = useDispatch( blockEditorStore );
|
|
95
99
|
const notifyCopy = useNotifyCopy();
|
|
96
100
|
|
|
@@ -201,13 +205,55 @@ export function useClipboardHandler() {
|
|
|
201
205
|
__experimentalCanUserUseUnfilteredHTML:
|
|
202
206
|
canUserUseUnfilteredHTML,
|
|
203
207
|
} = getSettings();
|
|
204
|
-
const { plainText, html } = getPasteEventData( event );
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
const { plainText, html, files } = getPasteEventData( event );
|
|
209
|
+
let blocks = [];
|
|
210
|
+
|
|
211
|
+
if ( files.length ) {
|
|
212
|
+
const fromTransforms = getBlockTransforms( 'from' );
|
|
213
|
+
blocks = files
|
|
214
|
+
.reduce( ( accumulator, file ) => {
|
|
215
|
+
const transformation = findTransform(
|
|
216
|
+
fromTransforms,
|
|
217
|
+
( transform ) =>
|
|
218
|
+
transform.type === 'files' &&
|
|
219
|
+
transform.isMatch( [ file ] )
|
|
220
|
+
);
|
|
221
|
+
if ( transformation ) {
|
|
222
|
+
accumulator.push(
|
|
223
|
+
transformation.transform( [ file ] )
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
return accumulator;
|
|
227
|
+
}, [] )
|
|
228
|
+
.flat();
|
|
229
|
+
} else {
|
|
230
|
+
blocks = pasteHandler( {
|
|
231
|
+
HTML: html,
|
|
232
|
+
plainText,
|
|
233
|
+
mode: 'BLOCKS',
|
|
234
|
+
canUserUseUnfilteredHTML,
|
|
235
|
+
} );
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if ( selectedBlockClientIds.length === 1 ) {
|
|
239
|
+
const [ selectedBlockClientId ] = selectedBlockClientIds;
|
|
240
|
+
|
|
241
|
+
if (
|
|
242
|
+
blocks.every( ( block ) =>
|
|
243
|
+
canInsertBlockType(
|
|
244
|
+
block.name,
|
|
245
|
+
selectedBlockClientId
|
|
246
|
+
)
|
|
247
|
+
)
|
|
248
|
+
) {
|
|
249
|
+
insertBlocks(
|
|
250
|
+
blocks,
|
|
251
|
+
undefined,
|
|
252
|
+
selectedBlockClientId
|
|
253
|
+
);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
211
257
|
|
|
212
258
|
replaceBlocks(
|
|
213
259
|
selectedBlockClientIds,
|
|
@@ -40,6 +40,7 @@ const DEFAULT_MINIMUM_FONT_SIZE_LIMIT = '14px';
|
|
|
40
40
|
* @param {?string} args.minimumFontSize Minimum font size for any clamp() calculation. Optional.
|
|
41
41
|
* @param {?number} args.scaleFactor A scale factor to determine how fast a font scales within boundaries. Optional.
|
|
42
42
|
* @param {?number} args.minimumFontSizeFactor How much to scale defaultFontSize by to derive minimumFontSize. Optional.
|
|
43
|
+
* @param {?string} args.minimumFontSizeLimit The smallest a calculated font size may be. Optional.
|
|
43
44
|
*
|
|
44
45
|
* @return {string|null} A font-size value using clamp().
|
|
45
46
|
*/
|
|
@@ -51,8 +52,13 @@ export function getComputedFluidTypographyValue( {
|
|
|
51
52
|
maximumViewPortWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH,
|
|
52
53
|
scaleFactor = DEFAULT_SCALE_FACTOR,
|
|
53
54
|
minimumFontSizeFactor = DEFAULT_MINIMUM_FONT_SIZE_FACTOR,
|
|
54
|
-
minimumFontSizeLimit
|
|
55
|
+
minimumFontSizeLimit,
|
|
55
56
|
} ) {
|
|
57
|
+
// Validate incoming settings and set defaults.
|
|
58
|
+
minimumFontSizeLimit = !! getTypographyValueAndUnit( minimumFontSizeLimit )
|
|
59
|
+
? minimumFontSizeLimit
|
|
60
|
+
: DEFAULT_MINIMUM_FONT_SIZE_LIMIT;
|
|
61
|
+
|
|
56
62
|
/*
|
|
57
63
|
* Calculates missing minimumFontSize and maximumFontSize from
|
|
58
64
|
* defaultFontSize if provided.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { kebabCase } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns the font size object based on an array of named font sizes and the namedFontSize and customFontSize values.
|
|
@@ -20,7 +20,9 @@ export const getFontSize = (
|
|
|
20
20
|
customFontSizeAttribute
|
|
21
21
|
) => {
|
|
22
22
|
if ( fontSizeAttribute ) {
|
|
23
|
-
const fontSizeObject = find(
|
|
23
|
+
const fontSizeObject = fontSizes?.find(
|
|
24
|
+
( { slug } ) => slug === fontSizeAttribute
|
|
25
|
+
);
|
|
24
26
|
if ( fontSizeObject ) {
|
|
25
27
|
return fontSizeObject;
|
|
26
28
|
}
|
|
@@ -39,7 +41,7 @@ export const getFontSize = (
|
|
|
39
41
|
* @return {Object} Font size object.
|
|
40
42
|
*/
|
|
41
43
|
export function getFontSizeObjectByValue( fontSizes, value ) {
|
|
42
|
-
const fontSizeObject = find(
|
|
44
|
+
const fontSizeObject = fontSizes?.find( ( { size } ) => size === value );
|
|
43
45
|
if ( fontSizeObject ) {
|
|
44
46
|
return fontSizeObject;
|
|
45
47
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { pickBy } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -107,9 +107,9 @@ export default ( ...fontSizeNames ) => {
|
|
|
107
107
|
customFontSizeAttributeName
|
|
108
108
|
) {
|
|
109
109
|
return ( fontSizeValue ) => {
|
|
110
|
-
const fontSizeObject =
|
|
111
|
-
size
|
|
112
|
-
|
|
110
|
+
const fontSizeObject = this.props.fontSizes?.find(
|
|
111
|
+
( { size } ) => size === Number( fontSizeValue )
|
|
112
|
+
);
|
|
113
113
|
this.props.setAttributes( {
|
|
114
114
|
[ fontSizeAttributeName ]:
|
|
115
115
|
fontSizeObject && fontSizeObject.slug
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -32,7 +27,7 @@ export function __experimentalGetGradientClass( gradientSlug ) {
|
|
|
32
27
|
* @return {string} Gradient value.
|
|
33
28
|
*/
|
|
34
29
|
export function getGradientValueBySlug( gradients, slug ) {
|
|
35
|
-
const gradient = find(
|
|
30
|
+
const gradient = gradients?.find( ( g ) => g.slug === slug );
|
|
36
31
|
return gradient && gradient.gradient;
|
|
37
32
|
}
|
|
38
33
|
|
|
@@ -40,7 +35,7 @@ export function __experimentalGetGradientObjectByGradientValue(
|
|
|
40
35
|
gradients,
|
|
41
36
|
value
|
|
42
37
|
) {
|
|
43
|
-
const gradient = find(
|
|
38
|
+
const gradient = gradients?.find( ( g ) => g.gradient === value );
|
|
44
39
|
return gradient;
|
|
45
40
|
}
|
|
46
41
|
|