@wordpress/block-editor 8.0.16 → 8.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 +2 -0
- package/LICENSE.md +1 -1
- package/README.md +12 -1
- package/build/components/block-caption/index.native.js +14 -3
- package/build/components/block-caption/index.native.js.map +1 -1
- package/build/components/block-edit/index.js +9 -0
- package/build/components/block-edit/index.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -20
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +3 -11
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +2 -1
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-preview/auto.js +10 -2
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +2 -1
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-styles/index.js +110 -134
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/menu-items.js +63 -0
- package/build/components/block-styles/menu-items.js.map +1 -0
- package/build/components/block-styles/preview-panel.js +45 -0
- package/build/components/block-styles/preview-panel.js.map +1 -0
- package/build/components/block-styles/preview.native.js +2 -2
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-styles/use-styles-for-block.js +119 -0
- package/build/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build/components/block-styles/utils.js +39 -0
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +3 -23
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/back-compat.js +2 -1
- package/build/components/block-tools/back-compat.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +5 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-types-list/index.native.js +2 -2
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/button-block-appender/index.js +2 -1
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +88 -0
- package/build/components/colors-gradients/dropdown.js.map +1 -0
- package/build/components/colors-gradients/panel-color-gradient-settings.js +6 -5
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js +6 -3
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/contrast-checker/index.js +34 -9
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +108 -0
- package/build/components/contrast-checker/index.native.js.map +1 -0
- package/build/components/default-block-appender/index.js +16 -19
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +18 -3
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/iframe/index.js +4 -5
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/index.js +18 -9
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +9 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/default-block-appender.js +2 -4
- package/build/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +61 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +5 -3
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +11 -3
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/tabs.native.js +7 -4
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +11 -43
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.native.js +3 -5
- package/build/components/inspector-controls/fill.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/slot.js +1 -3
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +6 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +1 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-item.js +11 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -1
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +18 -5
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +23 -3
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +8 -0
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -0
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +32 -6
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload-progress/index.native.js +2 -1
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/panel-color-settings/index.js +7 -3
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/block-refs-provider.js +4 -1
- package/build/components/provider/block-refs-provider.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.js +1 -1
- package/build/components/rich-text/file-paste-handler.js.map +1 -1
- package/build/components/rich-text/prevent-event-discovery.js +33 -0
- package/build/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +3 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/selection-scroll-into-view/index.js +2 -1
- package/build/components/selection-scroll-into-view/index.js.map +1 -1
- package/build/components/use-display-block-controls/index.native.js +45 -0
- package/build/components/use-display-block-controls/index.native.js.map +1 -0
- package/build/components/use-on-block-drop/index.js +7 -3
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +3 -1
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/hooks/border-color.js +74 -10
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/border-radius.js +47 -0
- package/build/hooks/border-radius.js.map +1 -1
- package/build/hooks/border-style.js +41 -0
- package/build/hooks/border-style.js.map +1 -1
- package/build/hooks/border-width.js +70 -31
- package/build/hooks/border-width.js.map +1 -1
- package/build/hooks/border.js +81 -11
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +4 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color-panel.native.js +77 -0
- package/build/hooks/color-panel.native.js.map +1 -0
- package/build/hooks/color.js +6 -5
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/index.native.js +2 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/layout.native.js +20 -0
- package/build/hooks/layout.native.js.map +1 -0
- package/build/hooks/letter-spacing.js +1 -1
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/typography.js +1 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/store/actions.js +1 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +5 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/defaults.native.js +2 -6
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/selectors.js +10 -5
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-paste-event-data.js +1 -1
- package/build/utils/get-paste-event-data.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +1 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-caption/index.native.js +13 -3
- package/build-module/components/block-caption/index.native.js.map +1 -1
- package/build-module/components/block-edit/index.js +9 -0
- package/build-module/components/block-edit/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -20
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +3 -10
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +2 -1
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-preview/auto.js +10 -2
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -1
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-styles/index.js +112 -133
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +50 -0
- package/build-module/components/block-styles/menu-items.js.map +1 -0
- package/build-module/components/block-styles/preview-panel.js +35 -0
- package/build-module/components/block-styles/preview-panel.js.map +1 -0
- package/build-module/components/block-styles/preview.native.js +2 -2
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-styles/use-styles-for-block.js +107 -0
- package/build-module/components/block-styles/use-styles-for-block.js.map +1 -0
- package/build-module/components/block-styles/utils.js +34 -0
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +3 -21
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/back-compat.js +2 -1
- package/build-module/components/block-tools/back-compat.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +5 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +2 -2
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -1
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +75 -0
- package/build-module/components/colors-gradients/dropdown.js.map +1 -0
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +8 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +7 -4
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +34 -9
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +90 -0
- package/build-module/components/contrast-checker/index.native.js.map +1 -0
- package/build-module/components/default-block-appender/index.js +15 -18
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +17 -3
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/iframe/index.js +4 -5
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/index.js +2 -1
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -0
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/default-block-appender.js +2 -4
- package/build-module/components/inner-blocks/default-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +61 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +2 -2
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +5 -3
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -4
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +7 -4
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +2 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +12 -43
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.native.js +3 -5
- package/build-module/components/inspector-controls/fill.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/slot.js +1 -3
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +6 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +1 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-item.js +11 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -1
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +18 -5
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +22 -3
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -0
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +2 -0
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +32 -6
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +2 -1
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +7 -3
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/block-refs-provider.js +4 -1
- package/build-module/components/provider/block-refs-provider.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.js +1 -1
- package/build-module/components/rich-text/file-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.js +25 -0
- package/build-module/components/rich-text/prevent-event-discovery.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +2 -1
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/selection-scroll-into-view/index.js +2 -1
- package/build-module/components/selection-scroll-into-view/index.js.map +1 -1
- package/build-module/components/use-display-block-controls/index.native.js +34 -0
- package/build-module/components/use-display-block-controls/index.native.js.map +1 -0
- package/build-module/components/use-on-block-drop/index.js +7 -3
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +3 -4
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/hooks/border-color.js +72 -12
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/border-radius.js +42 -0
- package/build-module/hooks/border-radius.js.map +1 -1
- package/build-module/hooks/border-style.js +36 -0
- package/build-module/hooks/border-style.js.map +1 -1
- package/build-module/hooks/border-width.js +66 -32
- package/build-module/hooks/border-width.js.map +1 -1
- package/build-module/hooks/border.js +80 -12
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +4 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color-panel.native.js +62 -0
- package/build-module/hooks/color-panel.native.js.map +1 -0
- package/build-module/hooks/color.js +6 -5
- package/build-module/hooks/color.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/layout.native.js +16 -0
- package/build-module/hooks/layout.native.js.map +1 -0
- package/build-module/hooks/letter-spacing.js +1 -1
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/typography.js +1 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/store/actions.js +1 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +5 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/defaults.native.js +2 -5
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/selectors.js +10 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-paste-event-data.js +1 -1
- package/build-module/utils/get-paste-event-data.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +1 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +226 -181
- package/build-style/style.css +226 -181
- package/package.json +31 -27
- package/src/components/block-caption/index.native.js +22 -4
- package/src/components/block-card/README.md +1 -1
- package/src/components/block-edit/index.js +8 -0
- package/src/components/block-edit/test/edit.native.js +10 -9
- package/src/components/block-inspector/index.js +9 -16
- package/src/components/block-list-appender/index.js +5 -21
- package/src/components/block-media-update-progress/index.native.js +1 -1
- package/src/components/block-media-update-progress/test/index.native.js +136 -93
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +108 -47
- package/src/components/block-mover/test/index.native.js +5 -5
- package/src/components/block-preview/README.md +14 -26
- package/src/components/block-preview/auto.js +7 -2
- package/src/components/block-preview/test/index.js +2 -0
- package/src/components/block-settings/container.native.js +1 -0
- package/src/components/block-styles/index.js +125 -145
- package/src/components/block-styles/menu-items.js +49 -0
- package/src/components/block-styles/preview-panel.js +36 -0
- package/src/components/block-styles/preview.native.js +5 -2
- package/src/components/block-styles/style.scss +59 -51
- package/src/components/block-styles/test/{index.js → utils.js} +60 -1
- package/src/components/block-styles/use-styles-for-block.js +99 -0
- package/src/components/block-styles/utils.js +39 -0
- package/src/components/block-switcher/block-styles-menu.js +3 -38
- package/src/components/block-tools/back-compat.js +1 -0
- package/src/components/block-tools/block-selection-button.js +7 -1
- package/src/components/block-tools/insertion-point.js +10 -1
- package/src/components/block-types-list/index.native.js +5 -2
- package/src/components/border-radius-control/style.scss +1 -1
- package/src/components/border-style-control/style.scss +0 -1
- package/src/components/button-block-appender/index.js +1 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +9 -4
- package/src/components/colors-gradients/dropdown.js +96 -0
- package/src/components/colors-gradients/panel-color-gradient-settings.js +23 -19
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +13 -2
- package/src/components/colors-gradients/style.scss +59 -5
- package/src/components/contrast-checker/README.md +3 -1
- package/src/components/contrast-checker/index.js +48 -20
- package/src/components/contrast-checker/index.native.js +113 -0
- package/src/components/contrast-checker/style.native.scss +26 -0
- package/src/components/contrast-checker/test/index.js +65 -0
- package/src/components/default-block-appender/index.js +17 -24
- package/src/components/default-block-appender/style.scss +4 -0
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +12 -24
- package/src/components/default-block-appender/test/index.js +4 -14
- package/src/components/default-style-picker/index.js +18 -6
- package/src/components/iframe/index.js +7 -3
- package/src/components/index.js +2 -1
- package/src/components/index.native.js +1 -0
- package/src/components/inner-blocks/README.md +2 -0
- package/src/components/inner-blocks/default-block-appender.js +2 -7
- package/src/components/inner-blocks/use-nested-settings-update.js +16 -14
- package/src/components/inserter/index.js +77 -5
- package/src/components/inserter/index.native.js +2 -2
- package/src/components/inserter/library.js +17 -12
- package/src/components/inserter/menu.js +31 -13
- package/src/components/inserter/tabs.native.js +5 -4
- package/src/components/inserter/test/block-types-tab.native.js +9 -10
- package/src/components/inserter/test/index.native.js +3 -7
- package/src/components/inserter/test/reusable-blocks-tab.native.js +8 -10
- package/src/components/inspector-controls/block-support-slot-container.js +3 -1
- package/src/components/inspector-controls/block-support-tools-panel.js +39 -58
- package/src/components/inspector-controls/fill.native.js +4 -3
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls/slot.js +2 -7
- package/src/components/letter-spacing-control/index.js +6 -6
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/link-preview.js +1 -1
- package/src/components/link-control/search-item.js +11 -2
- package/src/components/link-control/search-results.js +1 -0
- package/src/components/link-control/style.scss +2 -1
- package/src/components/link-control/test/index.js +4 -0
- package/src/components/link-control/use-search-handler.js +25 -4
- package/src/components/list-view/block-select-button.js +20 -1
- package/src/components/list-view/block.js +10 -0
- package/src/components/media-placeholder/index.js +2 -0
- package/src/components/media-replace-flow/index.js +35 -5
- package/src/components/media-upload/test/index.native.js +28 -47
- package/src/components/media-upload-progress/index.native.js +1 -0
- package/src/components/media-upload-progress/test/index.native.js +60 -47
- package/src/components/panel-color-settings/index.js +8 -4
- package/src/components/provider/block-refs-provider.js +4 -1
- package/src/components/rich-text/file-paste-handler.js +3 -1
- package/src/components/rich-text/prevent-event-discovery.js +23 -0
- package/src/components/rich-text/use-input-rules.js +2 -1
- package/src/components/selection-scroll-into-view/index.js +1 -0
- package/src/components/url-input/README.md +5 -0
- package/src/components/use-display-block-controls/index.native.js +38 -0
- package/src/components/use-on-block-drop/index.js +7 -3
- package/src/components/writing-flow/test/use-multi-selection.js +36 -0
- package/src/components/writing-flow/use-multi-selection.js +12 -9
- package/src/hooks/border-color.js +69 -9
- package/src/hooks/border-radius.js +32 -0
- package/src/hooks/border-style.js +26 -0
- package/src/hooks/border-width.js +56 -32
- package/src/hooks/border.js +115 -20
- package/src/hooks/border.scss +3 -17
- package/src/hooks/color-panel.js +3 -0
- package/src/hooks/color-panel.native.js +63 -0
- package/src/hooks/color.js +8 -7
- package/src/hooks/dimensions.scss +5 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.native.js +23 -0
- package/src/hooks/letter-spacing.js +1 -1
- package/src/hooks/typography.js +1 -1
- package/src/store/actions.js +1 -2
- package/src/store/defaults.js +2 -0
- package/src/store/defaults.native.js +2 -6
- package/src/store/selectors.js +10 -5
- package/src/style.scss +4 -3
- package/src/utils/get-paste-event-data.js +1 -1
- package/src/utils/parse-css-unit-to-px.js +1 -1
- package/src/utils/test/parse-css-unit-to-px.js +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/use-canvas-click-redirect/index.js +0 -66
- package/build/components/use-canvas-click-redirect/index.js.map +0 -1
- package/build-module/components/use-canvas-click-redirect/index.js +0 -54
- package/build-module/components/use-canvas-click-redirect/index.js.map +0 -1
- package/src/components/use-canvas-click-redirect/index.js +0 -57
|
@@ -5,13 +5,14 @@ import {
|
|
|
5
5
|
__experimentalUnitControl as UnitControl,
|
|
6
6
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
|
-
import {
|
|
8
|
+
import { useState } from '@wordpress/element';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
14
|
import { cleanEmptyObject } from './utils';
|
|
15
|
+
import { removeBorderAttribute } from './border';
|
|
15
16
|
import useSetting from '../components/use-setting';
|
|
16
17
|
|
|
17
18
|
const MIN_BORDER_WIDTH = 0;
|
|
@@ -31,25 +32,12 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
31
32
|
|
|
32
33
|
const { width, color: customBorderColor, style: borderStyle } =
|
|
33
34
|
style?.border || {};
|
|
35
|
+
|
|
36
|
+
// Used to temporarily track previous border color & style selections to be
|
|
37
|
+
// able to restore them when border width changes from zero value.
|
|
34
38
|
const [ styleSelection, setStyleSelection ] = useState();
|
|
35
39
|
const [ colorSelection, setColorSelection ] = useState();
|
|
36
|
-
|
|
37
|
-
// Temporarily track previous border color & style selections to be able to
|
|
38
|
-
// restore them when border width changes from zero value.
|
|
39
|
-
useEffect( () => {
|
|
40
|
-
if ( borderStyle !== 'none' ) {
|
|
41
|
-
setStyleSelection( borderStyle );
|
|
42
|
-
}
|
|
43
|
-
}, [ borderStyle ] );
|
|
44
|
-
|
|
45
|
-
useEffect( () => {
|
|
46
|
-
if ( borderColor || customBorderColor ) {
|
|
47
|
-
setColorSelection( {
|
|
48
|
-
name: !! borderColor ? borderColor : undefined,
|
|
49
|
-
color: !! customBorderColor ? customBorderColor : undefined,
|
|
50
|
-
} );
|
|
51
|
-
}
|
|
52
|
-
}, [ borderColor, customBorderColor ] );
|
|
40
|
+
const [ customColorSelection, setCustomColorSelection ] = useState();
|
|
53
41
|
|
|
54
42
|
const onChange = ( newWidth ) => {
|
|
55
43
|
let newStyle = {
|
|
@@ -64,28 +52,39 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
64
52
|
let borderPaletteColor = borderColor;
|
|
65
53
|
|
|
66
54
|
const hasZeroWidth = parseFloat( newWidth ) === 0;
|
|
55
|
+
const hadPreviousZeroWidth = parseFloat( width ) === 0;
|
|
67
56
|
|
|
68
57
|
// Setting the border width explicitly to zero will also set the
|
|
69
58
|
// border style to `none` and clear border color attributes.
|
|
70
|
-
if ( hasZeroWidth ) {
|
|
59
|
+
if ( hasZeroWidth && ! hadPreviousZeroWidth ) {
|
|
60
|
+
// Before clearing color and style selections, keep track of
|
|
61
|
+
// the current selections so they can be restored when the width
|
|
62
|
+
// changes to a non-zero value.
|
|
63
|
+
setColorSelection( borderColor );
|
|
64
|
+
setCustomColorSelection( customBorderColor );
|
|
65
|
+
setStyleSelection( borderStyle );
|
|
66
|
+
|
|
67
|
+
// Clear style and color attributes.
|
|
71
68
|
borderPaletteColor = undefined;
|
|
72
69
|
newStyle.border.color = undefined;
|
|
73
70
|
newStyle.border.style = 'none';
|
|
74
71
|
}
|
|
75
72
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
73
|
+
if ( ! hasZeroWidth && hadPreviousZeroWidth ) {
|
|
74
|
+
// Restore previous border style selection if width is now not zero and
|
|
75
|
+
// border style was 'none'. This is to support changes to the UI which
|
|
76
|
+
// change the border style UI to a segmented control without a "none"
|
|
77
|
+
// option.
|
|
78
|
+
if ( borderStyle === 'none' ) {
|
|
79
|
+
newStyle.border.style = styleSelection;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Restore previous border color selection if width is no longer zero
|
|
83
|
+
// and current border color is undefined.
|
|
84
|
+
if ( borderColor === undefined ) {
|
|
85
|
+
borderPaletteColor = colorSelection;
|
|
86
|
+
newStyle.border.color = customColorSelection;
|
|
87
|
+
}
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
// If width was reset, clean out undefined styles.
|
|
@@ -113,3 +112,28 @@ export const BorderWidthEdit = ( props ) => {
|
|
|
113
112
|
/>
|
|
114
113
|
);
|
|
115
114
|
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Checks if there is a current value in the border width block support
|
|
118
|
+
* attributes.
|
|
119
|
+
*
|
|
120
|
+
* @param {Object} props Block props.
|
|
121
|
+
* @return {boolean} Whether or not the block has a border width value set.
|
|
122
|
+
*/
|
|
123
|
+
export function hasBorderWidthValue( props ) {
|
|
124
|
+
return !! props.attributes.style?.border?.width;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Resets the border width block support attribute. This can be used when
|
|
129
|
+
* disabling the border width support control for a block via a progressive
|
|
130
|
+
* discovery panel.
|
|
131
|
+
*
|
|
132
|
+
* @param {Object} props Block props.
|
|
133
|
+
* @param {Object} props.attributes Block's attributes.
|
|
134
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
135
|
+
*/
|
|
136
|
+
export function resetBorderWidth( { attributes = {}, setAttributes } ) {
|
|
137
|
+
const { style } = attributes;
|
|
138
|
+
setAttributes( { style: removeBorderAttribute( style, 'width' ) } );
|
|
139
|
+
}
|
package/src/hooks/border.js
CHANGED
|
@@ -2,23 +2,41 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { getBlockSupport } from '@wordpress/blocks';
|
|
5
|
-
import {
|
|
5
|
+
import { __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
6
6
|
import { Platform } from '@wordpress/element';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
|
+
import {
|
|
13
|
+
BorderColorEdit,
|
|
14
|
+
hasBorderColorValue,
|
|
15
|
+
resetBorderColor,
|
|
16
|
+
} from './border-color';
|
|
17
|
+
import {
|
|
18
|
+
BorderRadiusEdit,
|
|
19
|
+
hasBorderRadiusValue,
|
|
20
|
+
resetBorderRadius,
|
|
21
|
+
} from './border-radius';
|
|
22
|
+
import {
|
|
23
|
+
BorderStyleEdit,
|
|
24
|
+
hasBorderStyleValue,
|
|
25
|
+
resetBorderStyle,
|
|
26
|
+
} from './border-style';
|
|
27
|
+
import {
|
|
28
|
+
BorderWidthEdit,
|
|
29
|
+
hasBorderWidthValue,
|
|
30
|
+
resetBorderWidth,
|
|
31
|
+
} from './border-width';
|
|
12
32
|
import InspectorControls from '../components/inspector-controls';
|
|
13
33
|
import useSetting from '../components/use-setting';
|
|
14
|
-
import {
|
|
15
|
-
import { BorderRadiusEdit } from './border-radius';
|
|
16
|
-
import { BorderStyleEdit } from './border-style';
|
|
17
|
-
import { BorderWidthEdit } from './border-width';
|
|
34
|
+
import { cleanEmptyObject } from './utils';
|
|
18
35
|
|
|
19
36
|
export const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
20
37
|
|
|
21
38
|
export function BorderPanel( props ) {
|
|
39
|
+
const { clientId } = props;
|
|
22
40
|
const isDisabled = useIsBorderDisabled( props );
|
|
23
41
|
const isSupported = hasBorderSupport( props.name );
|
|
24
42
|
|
|
@@ -39,22 +57,80 @@ export function BorderPanel( props ) {
|
|
|
39
57
|
return null;
|
|
40
58
|
}
|
|
41
59
|
|
|
60
|
+
const defaultBorderControls = getBlockSupport( props.name, [
|
|
61
|
+
BORDER_SUPPORT_KEY,
|
|
62
|
+
'__experimentalDefaultControls',
|
|
63
|
+
] );
|
|
64
|
+
|
|
65
|
+
const createResetAllFilter = (
|
|
66
|
+
borderAttribute,
|
|
67
|
+
topLevelAttributes = {}
|
|
68
|
+
) => ( newAttributes ) => ( {
|
|
69
|
+
...newAttributes,
|
|
70
|
+
...topLevelAttributes,
|
|
71
|
+
style: {
|
|
72
|
+
...newAttributes.style,
|
|
73
|
+
border: {
|
|
74
|
+
...newAttributes.style?.border,
|
|
75
|
+
[ borderAttribute ]: undefined,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
} );
|
|
79
|
+
|
|
42
80
|
return (
|
|
43
|
-
<InspectorControls>
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
81
|
+
<InspectorControls __experimentalGroup="border">
|
|
82
|
+
{ isWidthSupported && (
|
|
83
|
+
<ToolsPanelItem
|
|
84
|
+
className="single-column"
|
|
85
|
+
hasValue={ () => hasBorderWidthValue( props ) }
|
|
86
|
+
label={ __( 'Width' ) }
|
|
87
|
+
onDeselect={ () => resetBorderWidth( props ) }
|
|
88
|
+
isShownByDefault={ defaultBorderControls?.width }
|
|
89
|
+
resetAllFilter={ createResetAllFilter( 'width' ) }
|
|
90
|
+
panelId={ clientId }
|
|
91
|
+
>
|
|
92
|
+
<BorderWidthEdit { ...props } />
|
|
93
|
+
</ToolsPanelItem>
|
|
94
|
+
) }
|
|
95
|
+
{ isStyleSupported && (
|
|
96
|
+
<ToolsPanelItem
|
|
97
|
+
className="single-column"
|
|
98
|
+
hasValue={ () => hasBorderStyleValue( props ) }
|
|
99
|
+
label={ __( 'Style' ) }
|
|
100
|
+
onDeselect={ () => resetBorderStyle( props ) }
|
|
101
|
+
isShownByDefault={ defaultBorderControls?.style }
|
|
102
|
+
resetAllFilter={ createResetAllFilter( 'style' ) }
|
|
103
|
+
panelId={ clientId }
|
|
104
|
+
>
|
|
105
|
+
<BorderStyleEdit { ...props } />
|
|
106
|
+
</ToolsPanelItem>
|
|
107
|
+
) }
|
|
108
|
+
{ isColorSupported && (
|
|
109
|
+
<ToolsPanelItem
|
|
110
|
+
hasValue={ () => hasBorderColorValue( props ) }
|
|
111
|
+
label={ __( 'Color' ) }
|
|
112
|
+
onDeselect={ () => resetBorderColor( props ) }
|
|
113
|
+
isShownByDefault={ defaultBorderControls?.color }
|
|
114
|
+
resetAllFilter={ createResetAllFilter( 'color', {
|
|
115
|
+
borderColor: undefined,
|
|
116
|
+
} ) }
|
|
117
|
+
panelId={ clientId }
|
|
118
|
+
>
|
|
119
|
+
<BorderColorEdit { ...props } />
|
|
120
|
+
</ToolsPanelItem>
|
|
121
|
+
) }
|
|
122
|
+
{ isRadiusSupported && (
|
|
123
|
+
<ToolsPanelItem
|
|
124
|
+
hasValue={ () => hasBorderRadiusValue( props ) }
|
|
125
|
+
label={ __( 'Radius' ) }
|
|
126
|
+
onDeselect={ () => resetBorderRadius( props ) }
|
|
127
|
+
isShownByDefault={ defaultBorderControls?.radius }
|
|
128
|
+
resetAllFilter={ createResetAllFilter( 'radius' ) }
|
|
129
|
+
panelId={ clientId }
|
|
130
|
+
>
|
|
131
|
+
<BorderRadiusEdit { ...props } />
|
|
132
|
+
</ToolsPanelItem>
|
|
133
|
+
) }
|
|
58
134
|
</InspectorControls>
|
|
59
135
|
);
|
|
60
136
|
}
|
|
@@ -118,3 +194,22 @@ const useIsBorderDisabled = () => {
|
|
|
118
194
|
|
|
119
195
|
return configs.every( Boolean );
|
|
120
196
|
};
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Returns a new style object where the specified border attribute has been
|
|
200
|
+
* removed.
|
|
201
|
+
*
|
|
202
|
+
* @param {Object} style Styles from block attributes.
|
|
203
|
+
* @param {string} attribute The border style attribute to clear.
|
|
204
|
+
*
|
|
205
|
+
* @return {Object} Style object with the specified attribute removed.
|
|
206
|
+
*/
|
|
207
|
+
export function removeBorderAttribute( style, attribute ) {
|
|
208
|
+
return cleanEmptyObject( {
|
|
209
|
+
...style,
|
|
210
|
+
border: {
|
|
211
|
+
...style?.border,
|
|
212
|
+
[ attribute ]: undefined,
|
|
213
|
+
},
|
|
214
|
+
} );
|
|
215
|
+
}
|
package/src/hooks/border.scss
CHANGED
|
@@ -1,19 +1,5 @@
|
|
|
1
|
-
.block-
|
|
2
|
-
.
|
|
3
|
-
|
|
4
|
-
justify-content: space-between;
|
|
5
|
-
|
|
6
|
-
> * {
|
|
7
|
-
width: calc(50% - #{ $grid-unit-10 });
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.components-unit-control-wrapper {
|
|
12
|
-
margin-bottom: $grid-unit-30;
|
|
13
|
-
|
|
14
|
-
&:last-child {
|
|
15
|
-
margin-bottom: $grid-unit-10;
|
|
16
|
-
}
|
|
1
|
+
.border-block-support-panel {
|
|
2
|
+
.single-column {
|
|
3
|
+
grid-column: span 1;
|
|
17
4
|
}
|
|
18
5
|
}
|
|
19
|
-
|
package/src/hooks/color-panel.js
CHANGED
|
@@ -17,6 +17,7 @@ function getComputedStyle( node ) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export default function ColorPanel( {
|
|
20
|
+
enableAlpha = false,
|
|
20
21
|
settings,
|
|
21
22
|
clientId,
|
|
22
23
|
enableContrastChecking = true,
|
|
@@ -60,6 +61,7 @@ export default function ColorPanel( {
|
|
|
60
61
|
initialOpen={ false }
|
|
61
62
|
settings={ settings }
|
|
62
63
|
showTitle={ showTitle }
|
|
64
|
+
enableAlpha={ enableAlpha }
|
|
63
65
|
__experimentalHasMultipleOrigins
|
|
64
66
|
__experimentalIsRenderedInSidebar
|
|
65
67
|
>
|
|
@@ -67,6 +69,7 @@ export default function ColorPanel( {
|
|
|
67
69
|
<ContrastChecker
|
|
68
70
|
backgroundColor={ detectedBackgroundColor }
|
|
69
71
|
textColor={ detectedColor }
|
|
72
|
+
enableAlphaChecker={ enableAlpha }
|
|
70
73
|
/>
|
|
71
74
|
) }
|
|
72
75
|
</PanelColorGradientSettings>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { useEffect, useState } from '@wordpress/element';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useGlobalStyles } from '@wordpress/components';
|
|
8
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import PanelColorGradientSettings from '../components/colors-gradients/panel-color-gradient-settings';
|
|
14
|
+
import ContrastChecker from '../components/contrast-checker';
|
|
15
|
+
import InspectorControls from '../components/inspector-controls';
|
|
16
|
+
|
|
17
|
+
const ColorPanel = ( { settings } ) => {
|
|
18
|
+
const globalStyles = useGlobalStyles();
|
|
19
|
+
|
|
20
|
+
const [ detectedBackgroundColor, setDetectedBackgroundColor ] = useState();
|
|
21
|
+
const [ detectedTextColor, setDetectedTextColor ] = useState();
|
|
22
|
+
|
|
23
|
+
const { baseGlobalStyles } = useSelect( ( select ) => {
|
|
24
|
+
const { getSettings } = select( blockEditorStore );
|
|
25
|
+
return {
|
|
26
|
+
baseGlobalStyles: getSettings()
|
|
27
|
+
?.__experimentalGlobalStylesBaseStyles?.color,
|
|
28
|
+
};
|
|
29
|
+
} );
|
|
30
|
+
|
|
31
|
+
useEffect( () => {
|
|
32
|
+
// The following logic is used to determine current text/background colors:
|
|
33
|
+
// 1. The globalStyles object is queried to determine whether a color has been
|
|
34
|
+
// set via a block's settings.
|
|
35
|
+
// 2. If a block-based theme is in use and no globalStyles exist, the theme's
|
|
36
|
+
// default/base colors are used.
|
|
37
|
+
// 3. If no globalStyles exist and a theme isn't block-based, there is no way
|
|
38
|
+
// to determine the default text/background color and the checker won't run.
|
|
39
|
+
const textColor = globalStyles?.color || baseGlobalStyles?.text;
|
|
40
|
+
const backgroundColor =
|
|
41
|
+
globalStyles?.backgroundColor || baseGlobalStyles?.background;
|
|
42
|
+
|
|
43
|
+
setDetectedTextColor( textColor );
|
|
44
|
+
setDetectedBackgroundColor( backgroundColor );
|
|
45
|
+
}, [ globalStyles, baseGlobalStyles ] );
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<InspectorControls>
|
|
49
|
+
<PanelColorGradientSettings
|
|
50
|
+
title={ __( 'Color' ) }
|
|
51
|
+
initialOpen={ false }
|
|
52
|
+
settings={ settings }
|
|
53
|
+
>
|
|
54
|
+
<ContrastChecker
|
|
55
|
+
backgroundColor={ detectedBackgroundColor }
|
|
56
|
+
textColor={ detectedTextColor }
|
|
57
|
+
/>
|
|
58
|
+
</PanelColorGradientSettings>
|
|
59
|
+
</InspectorControls>
|
|
60
|
+
);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export default ColorPanel;
|
package/src/hooks/color.js
CHANGED
|
@@ -371,18 +371,19 @@ export function ColorEdit( props ) {
|
|
|
371
371
|
props.setAttributes( { style: newStyle } );
|
|
372
372
|
};
|
|
373
373
|
|
|
374
|
+
const enableContrastChecking =
|
|
375
|
+
Platform.OS === 'web' && ! gradient && ! style?.color?.gradient;
|
|
376
|
+
|
|
374
377
|
return (
|
|
375
378
|
<ColorPanel
|
|
376
|
-
enableContrastChecking={
|
|
377
|
-
// Turn on contrast checker for web only since it's not supported on mobile yet.
|
|
378
|
-
Platform.OS === 'web' && ! gradient && ! style?.color?.gradient
|
|
379
|
-
}
|
|
379
|
+
enableContrastChecking={ enableContrastChecking }
|
|
380
380
|
clientId={ props.clientId }
|
|
381
|
+
enableAlpha={ true }
|
|
381
382
|
settings={ [
|
|
382
383
|
...( hasTextColor
|
|
383
384
|
? [
|
|
384
385
|
{
|
|
385
|
-
label: __( 'Text
|
|
386
|
+
label: __( 'Text' ),
|
|
386
387
|
onColorChange: onChangeColor( 'text' ),
|
|
387
388
|
colorValue: getColorObjectByAttributeValues(
|
|
388
389
|
allSolids,
|
|
@@ -395,7 +396,7 @@ export function ColorEdit( props ) {
|
|
|
395
396
|
...( hasBackgroundColor || hasGradientColor
|
|
396
397
|
? [
|
|
397
398
|
{
|
|
398
|
-
label: __( 'Background
|
|
399
|
+
label: __( 'Background' ),
|
|
399
400
|
onColorChange: hasBackgroundColor
|
|
400
401
|
? onChangeColor( 'background' )
|
|
401
402
|
: undefined,
|
|
@@ -414,7 +415,7 @@ export function ColorEdit( props ) {
|
|
|
414
415
|
...( hasLinkColor
|
|
415
416
|
? [
|
|
416
417
|
{
|
|
417
|
-
label: __( 'Link
|
|
418
|
+
label: __( 'Link' ),
|
|
418
419
|
onColorChange: onChangeLinkColor,
|
|
419
420
|
colorValue: getLinkColorFromAttributeValue(
|
|
420
421
|
allSolids,
|
|
@@ -9,6 +9,7 @@ import './generated-class-name';
|
|
|
9
9
|
import './style';
|
|
10
10
|
import './color';
|
|
11
11
|
import './font-size';
|
|
12
|
+
import './layout';
|
|
12
13
|
|
|
13
14
|
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
14
15
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { removeFilter } from '@wordpress/hooks';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import './layout.js';
|
|
10
|
+
|
|
11
|
+
// This filter is removed because layout styles shouldn't be added
|
|
12
|
+
// until layout types are supported in the native version.
|
|
13
|
+
removeFilter(
|
|
14
|
+
'editor.BlockListBlock',
|
|
15
|
+
'core/editor/layout/with-layout-styles'
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
// This filter is removed because the layout controls shouldn't be
|
|
19
|
+
// enabled until layout types are supported in the native version.
|
|
20
|
+
removeFilter(
|
|
21
|
+
'editor.BlockEdit',
|
|
22
|
+
'core/editor/layout/with-inspector-controls'
|
|
23
|
+
);
|
package/src/hooks/typography.js
CHANGED
|
@@ -218,7 +218,7 @@ export function TypographyPanel( props ) {
|
|
|
218
218
|
<ToolsPanelItem
|
|
219
219
|
className="single-column"
|
|
220
220
|
hasValue={ () => hasLetterSpacingValue( props ) }
|
|
221
|
-
label={ __( 'Letter
|
|
221
|
+
label={ __( 'Letter spacing' ) }
|
|
222
222
|
onDeselect={ () => resetLetterSpacing( props ) }
|
|
223
223
|
isShownByDefault={ defaultControls?.letterSpacing }
|
|
224
224
|
resetAllFilter={ createResetAllFilter( 'letterSpacing' ) }
|
package/src/store/actions.js
CHANGED
|
@@ -555,8 +555,7 @@ export const insertBlocks = (
|
|
|
555
555
|
meta = initialPosition;
|
|
556
556
|
initialPosition = 0;
|
|
557
557
|
deprecated( "meta argument in wp.data.dispatch('core/block-editor')", {
|
|
558
|
-
since: '
|
|
559
|
-
plugin: 'Gutenberg',
|
|
558
|
+
since: '5.8',
|
|
560
559
|
hint: 'The meta argument is now the 6th argument of the function',
|
|
561
560
|
} );
|
|
562
561
|
}
|
package/src/store/defaults.js
CHANGED
|
@@ -6,14 +6,10 @@ import {
|
|
|
6
6
|
SETTINGS_DEFAULTS as SETTINGS,
|
|
7
7
|
} from './defaults.js';
|
|
8
8
|
|
|
9
|
-
const fontSizes = SETTINGS.fontSizes.map( ( fontSize ) => {
|
|
10
|
-
fontSize.sizePx = fontSize.size + 'px';
|
|
11
|
-
return fontSize;
|
|
12
|
-
} );
|
|
13
|
-
|
|
14
9
|
const SETTINGS_DEFAULTS = {
|
|
15
10
|
...SETTINGS,
|
|
16
|
-
|
|
11
|
+
// Don't add the default font sizes for standard themes
|
|
12
|
+
fontSizes: undefined,
|
|
17
13
|
// FOR TESTING ONLY - Later, this will come from a REST API
|
|
18
14
|
// eslint-disable-next-line no-undef
|
|
19
15
|
__unstableGalleryWithImageBlocks: __DEV__,
|
package/src/store/selectors.js
CHANGED
|
@@ -890,8 +890,8 @@ export function getBlockOrder( state, rootClientId ) {
|
|
|
890
890
|
* Returns the index at which the block corresponding to the specified client
|
|
891
891
|
* ID occurs within the block order, or `-1` if the block does not exist.
|
|
892
892
|
*
|
|
893
|
-
* @param {Object}
|
|
894
|
-
* @param {string}
|
|
893
|
+
* @param {Object} state Editor state.
|
|
894
|
+
* @param {string} clientId Block client ID.
|
|
895
895
|
*
|
|
896
896
|
* @return {number} Index at which block exists in order.
|
|
897
897
|
*/
|
|
@@ -1844,10 +1844,15 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
1844
1844
|
/**
|
|
1845
1845
|
* Returns the block to be directly inserted by the block appender.
|
|
1846
1846
|
*
|
|
1847
|
-
* @param
|
|
1848
|
-
* @param
|
|
1847
|
+
* @param {Object} state Editor state.
|
|
1848
|
+
* @param {?string} rootClientId Optional root client ID of block list.
|
|
1849
|
+
*
|
|
1850
|
+
* @return {?WPDirectInsertBlock} The block type to be directly inserted.
|
|
1849
1851
|
*
|
|
1850
|
-
* @
|
|
1852
|
+
* @typedef {Object} WPDirectInsertBlock
|
|
1853
|
+
* @property {string} name The type of block.
|
|
1854
|
+
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
1855
|
+
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjecent blocks when inserted.
|
|
1851
1856
|
*/
|
|
1852
1857
|
export const __experimentalGetDirectInsertBlock = createSelector(
|
|
1853
1858
|
( state, rootClientId = null ) => {
|
package/src/style.scss
CHANGED
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
@import "./components/default-block-appender/style.scss";
|
|
33
33
|
@import "./components/duotone-control/style.scss";
|
|
34
34
|
@import "./components/font-appearance-control/style.scss";
|
|
35
|
-
@import "./components/justify-content-control/style.scss";
|
|
36
|
-
@import "./components/link-control/style.scss";
|
|
37
|
-
@import "./components/line-height-control/style.scss";
|
|
38
35
|
@import "./components/image-size-control/style.scss";
|
|
39
36
|
@import "./components/inner-blocks/style.scss";
|
|
40
37
|
@import "./components/inserter-list-item/style.scss";
|
|
38
|
+
@import "./components/justify-content-control/style.scss";
|
|
39
|
+
@import "./components/line-height-control/style.scss";
|
|
40
|
+
@import "./components/link-control/style.scss";
|
|
41
41
|
@import "./components/list-view/style.scss";
|
|
42
42
|
@import "./components/media-replace-flow/style.scss";
|
|
43
43
|
@import "./components/media-placeholder/style.scss";
|
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
@import "./hooks/anchor.scss";
|
|
56
56
|
@import "./hooks/layout.scss";
|
|
57
57
|
@import "./hooks/border.scss";
|
|
58
|
+
@import "./hooks/dimensions.scss";
|
|
58
59
|
@import "./hooks/typography.scss";
|
|
59
60
|
|
|
60
61
|
@import "./components/block-toolbar/style.scss";
|
|
@@ -27,7 +27,7 @@ export function getPasteEventData( { clipboardData } ) {
|
|
|
27
27
|
|
|
28
28
|
const files = getFilesFromDataTransfer(
|
|
29
29
|
clipboardData
|
|
30
|
-
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif)$/.test( type ) );
|
|
30
|
+
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif|webp)$/.test( type ) );
|
|
31
31
|
|
|
32
32
|
// Only process files if no HTML is present.
|
|
33
33
|
// A pasted file may have the URL as plain text.
|
|
@@ -8,7 +8,7 @@ function parseUnit( cssUnit ) {
|
|
|
8
8
|
const match = cssUnit
|
|
9
9
|
?.trim()
|
|
10
10
|
.match(
|
|
11
|
-
/^(0?[-.]?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/
|
|
11
|
+
/^(0?[-.]?\d*\.?\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/
|
|
12
12
|
);
|
|
13
13
|
if ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {
|
|
14
14
|
return { value: parseFloat( cssUnit ), unit: 'px' };
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
getPxFromCssUnit,
|
|
7
7
|
} from '../parse-css-unit-to-px';
|
|
8
8
|
|
|
9
|
+
jest.useRealTimers();
|
|
10
|
+
|
|
9
11
|
describe( 'getPxFromCssUnit', () => {
|
|
10
12
|
// Absolute units
|
|
11
13
|
describe( 'absolute unites should return px values', () => {
|
|
@@ -52,6 +54,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
52
54
|
const testData = [
|
|
53
55
|
[ '2em', '20px' ],
|
|
54
56
|
[ '2rem', '20px' ],
|
|
57
|
+
[ '1.125rem', '11px' ],
|
|
55
58
|
[ '20vw', '20px' ],
|
|
56
59
|
[ '20vh', '40px' ],
|
|
57
60
|
[ '20vmin', '20px' ],
|