@wordpress/block-editor 7.0.2 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/README.md +45 -1
- package/build/components/autocomplete/index.js +1 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +8 -4
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +61 -14
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-controls/fill.js +2 -2
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-controls/hook.js +3 -3
- package/build/components/block-controls/hook.js.map +1 -1
- package/build/components/block-icon/index.js +5 -1
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-icon/index.native.js +9 -11
- package/build/components/block-icon/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +8 -0
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.js +12 -5
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +4 -3
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +1 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mover/index.js +4 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-mover/index.native.js +4 -4
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-navigation/dropdown.js +0 -1
- package/build/components/block-navigation/dropdown.js.map +1 -1
- package/build/components/block-patterns-list/index.js +1 -8
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -1
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings/container.native.js +5 -2
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +26 -5
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- 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-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -3
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-title/index.js +3 -2
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-tools/block-popover.js +2 -4
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +11 -3
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +22 -57
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +83 -7
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/contrast-checker/index.js +18 -12
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/copy-handler/index.js +9 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/duotone-control/index.js +41 -39
- package/build/components/duotone-control/index.js.map +1 -1
- package/build/components/editor-styles/index.js +9 -3
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +32 -21
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/iframe/index.js +6 -4
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +126 -0
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build/components/image-editor/constants.js +16 -0
- package/build/components/image-editor/constants.js.map +1 -0
- package/build/components/image-editor/context.js +59 -0
- package/build/components/image-editor/context.js.map +1 -0
- package/build/components/image-editor/cropper.js +83 -0
- package/build/components/image-editor/cropper.js.map +1 -0
- package/build/components/image-editor/form-controls.js +36 -0
- package/build/components/image-editor/form-controls.js.map +1 -0
- package/build/components/image-editor/index.js +60 -0
- package/build/components/image-editor/index.js.map +1 -0
- package/build/components/image-editor/rotation-button.js +37 -0
- package/build/components/image-editor/rotation-button.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +84 -0
- package/build/components/image-editor/use-save-image.js.map +1 -0
- package/build/components/image-editor/use-transform-image.js +135 -0
- package/build/components/image-editor/use-transform-image.js.map +1 -0
- package/build/components/image-editor/zoom-dropdown.js +55 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build/components/image-size-control/use-dimension-handler.js +14 -3
- package/build/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build/components/index.js +36 -20
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +2 -2
- package/build/components/index.native.js.map +1 -1
- package/build/components/inner-blocks/button-block-appender.js +11 -1
- package/build/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build/components/inner-blocks/index.js +8 -5
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +4 -3
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/explorer.js +62 -0
- package/build/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js +111 -0
- package/build/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js +78 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build/components/inserter/block-patterns-tab.js +74 -35
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +3 -11
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/index.js +12 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +1 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/library.js +2 -0
- package/build/components/inserter/library.js.map +1 -1
- package/build/components/inserter/menu.js +2 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +11 -15
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/pattern-panel.js +19 -10
- package/build/components/inserter/pattern-panel.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.native.js +5 -6
- package/build/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build/components/inserter/search-results.native.js +6 -11
- package/build/components/inserter/search-results.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +44 -0
- package/build/components/inserter/utils.native.js.map +1 -0
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +78 -0
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build/components/inspector-controls/fill.js +16 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/groups.js +5 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls/slot.js +15 -0
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +9 -6
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/link-control/index.js +93 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/link-preview.js +45 -15
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/link-control/search-input.js +25 -7
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +54 -69
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +102 -76
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +45 -20
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/leaf.js +2 -2
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +13 -54
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.js +29 -20
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +5 -3
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +1 -4
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/observe-typing/index.js +1 -1
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +66 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/format-edit.js +28 -2
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +32 -11
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +41 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +28 -9
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/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-input/index.js +25 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +13 -10
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +48 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +6 -0
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +10 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +13 -10
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/border.js +5 -5
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +5 -2
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +23 -27
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +60 -16
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/font-appearance.js +49 -6
- package/build/hooks/font-appearance.js.map +1 -1
- package/build/hooks/font-family.js +123 -32
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +51 -9
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/gap.js +2 -1
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +10 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +8 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/letter-spacing.js +44 -7
- package/build/hooks/letter-spacing.js.map +1 -1
- package/build/hooks/line-height.js +45 -8
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +43 -0
- package/build/hooks/lock.js.map +1 -0
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +7 -4
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/text-decoration.js +42 -6
- package/build/hooks/text-decoration.js.map +1 -1
- package/build/hooks/text-transform.js +42 -6
- package/build/hooks/text-transform.js.map +1 -1
- package/build/hooks/typography.js +108 -8
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-cached-truthy.js +29 -0
- package/build/hooks/use-cached-truthy.js.map +1 -0
- package/build/index.js +7 -0
- package/build/index.js.map +1 -1
- package/build/layouts/flex.js +160 -34
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +75 -8
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +323 -265
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.native.js +13 -1
- package/build/store/defaults.native.js.map +1 -1
- package/build/store/index.js +1 -3
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +33 -22
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +172 -38
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +10 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +51 -1
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/autocomplete/index.js +2 -2
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +8 -4
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +64 -17
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +25 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-controls/fill.js +2 -2
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-controls/hook.js +3 -3
- package/build-module/components/block-controls/hook.js.map +1 -1
- package/build-module/components/block-icon/index.js +5 -1
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-icon/index.native.js +10 -11
- package/build-module/components/block-icon/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +8 -0
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.js +12 -5
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +4 -3
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +1 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +21 -8
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mover/index.js +4 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +4 -4
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-navigation/dropdown.js +0 -1
- package/build-module/components/block-navigation/dropdown.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +1 -6
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -1
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +6 -3
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +28 -7
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- 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-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -3
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-title/index.js +3 -2
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +3 -5
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +9 -3
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +26 -63
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +84 -7
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +13 -10
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/copy-handler/index.js +9 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/duotone-control/index.js +43 -39
- package/build-module/components/duotone-control/index.js.map +1 -1
- package/build-module/components/editor-styles/index.js +7 -3
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +28 -21
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/iframe/index.js +6 -4
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +115 -0
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -0
- package/build-module/components/image-editor/constants.js +7 -0
- package/build-module/components/image-editor/constants.js.map +1 -0
- package/build-module/components/image-editor/context.js +44 -0
- package/build-module/components/image-editor/context.js.map +1 -0
- package/build-module/components/image-editor/cropper.js +69 -0
- package/build-module/components/image-editor/cropper.js.map +1 -0
- package/build-module/components/image-editor/form-controls.js +26 -0
- package/build-module/components/image-editor/form-controls.js.map +1 -0
- package/build-module/components/image-editor/index.js +37 -0
- package/build-module/components/image-editor/index.js.map +1 -0
- package/build-module/components/image-editor/rotation-button.js +26 -0
- package/build-module/components/image-editor/rotation-button.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +70 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -0
- package/build-module/components/image-editor/use-transform-image.js +127 -0
- package/build-module/components/image-editor/use-transform-image.js.map +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js +43 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -0
- package/build-module/components/image-size-control/use-dimension-handler.js +13 -2
- package/build-module/components/image-size-control/use-dimension-handler.js.map +1 -1
- package/build-module/components/index.js +4 -3
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/button-block-appender.js +10 -1
- package/build-module/components/inner-blocks/button-block-appender.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +9 -6
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +5 -4
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +24 -13
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/build-module/components/inserter/block-patterns-explorer/explorer.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js +92 -0
- package/build-module/components/inserter/block-patterns-explorer/patterns-list.js.map +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +69 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -0
- package/build-module/components/inserter/block-patterns-tab.js +75 -36
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +2 -10
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +4 -7
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/index.js +12 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +1 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/library.js +2 -0
- package/build-module/components/inserter/library.js.map +1 -1
- package/build-module/components/inserter/menu.js +2 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +10 -15
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/pattern-panel.js +21 -13
- package/build-module/components/inserter/pattern-panel.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.native.js +4 -5
- package/build-module/components/inserter/reusable-blocks-tab.native.js.map +1 -1
- package/build-module/components/inserter/search-results.native.js +5 -10
- package/build-module/components/inserter/search-results.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +35 -0
- package/build-module/components/inserter/utils.native.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +67 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -0
- package/build-module/components/inspector-controls/fill.js +16 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +5 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +13 -0
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +9 -6
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/link-control/index.js +93 -35
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +46 -17
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/link-control/search-input.js +24 -7
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +56 -71
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +102 -78
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +48 -23
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/leaf.js +2 -2
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +13 -54
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +29 -20
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +5 -3
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +1 -4
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/observe-typing/index.js +1 -1
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +54 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/format-edit.js +28 -3
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +29 -11
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +41 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +28 -9
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/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-input/index.js +25 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +13 -10
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +3 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +48 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +6 -0
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +10 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +13 -10
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/border.js +5 -5
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +6 -3
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +24 -27
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +59 -16
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/font-appearance.js +45 -6
- package/build-module/hooks/font-appearance.js.map +1 -1
- package/build-module/hooks/font-family.js +117 -33
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +47 -9
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/gap.js +2 -1
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +2 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/letter-spacing.js +40 -7
- package/build-module/hooks/letter-spacing.js.map +1 -1
- package/build-module/hooks/line-height.js +41 -8
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +33 -0
- package/build-module/hooks/lock.js.map +1 -0
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +7 -4
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/text-decoration.js +38 -6
- package/build-module/hooks/text-decoration.js.map +1 -1
- package/build-module/hooks/text-transform.js +38 -6
- package/build-module/hooks/text-transform.js.map +1 -1
- package/build-module/hooks/typography.js +117 -17
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-cached-truthy.js +21 -0
- package/build-module/hooks/use-cached-truthy.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/layouts/flex.js +163 -38
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +74 -8
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +286 -241
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.native.js +12 -1
- package/build-module/store/defaults.native.js.map +1 -1
- package/build-module/store/index.js +1 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +33 -22
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +160 -34
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +48 -1
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +267 -144
- package/build-style/style.css +267 -144
- package/package.json +28 -27
- package/src/components/autocomplete/index.js +5 -2
- package/src/components/block-actions/index.js +9 -5
- package/src/components/block-alignment-control/style.scss +5 -0
- package/src/components/block-alignment-control/test/__snapshots__/index.js.snap +15 -1
- package/src/components/block-alignment-control/test/index.native.js +37 -0
- package/src/components/block-alignment-control/ui.js +98 -27
- package/src/components/block-alignment-control/use-available-alignments.js +31 -10
- package/src/components/block-controls/fill.js +5 -2
- package/src/components/block-controls/hook.js +3 -3
- package/src/components/block-draggable/style.scss +19 -4
- package/src/components/block-icon/index.js +4 -1
- package/src/components/block-icon/index.native.js +10 -16
- package/src/components/block-inspector/index.js +10 -0
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.js +11 -3
- package/src/components/block-list/block.native.js +5 -3
- package/src/components/block-list/index.native.js +1 -1
- package/src/components/block-list/style.scss +15 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +27 -7
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-mover/index.js +4 -4
- package/src/components/block-mover/index.native.js +4 -4
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +10 -6
- package/src/components/block-mover/test/index.native.js +26 -28
- package/src/components/block-navigation/dropdown.js +0 -1
- package/src/components/block-patterns-list/index.js +1 -8
- package/src/components/block-patterns-list/style.scss +22 -12
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/auto.js +1 -1
- package/src/components/block-preview/style.scss +0 -17
- package/src/components/block-settings/container.native.js +7 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +26 -13
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-styles/preview.native.js +2 -2
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-switcher/index.js +7 -3
- package/src/components/block-switcher/test/__snapshots__/index.js.snap +1 -1
- package/src/components/block-switcher/test/index.js +3 -0
- package/src/components/block-title/index.js +5 -2
- package/src/components/block-tools/block-popover.js +3 -5
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/block-types-list/style.scss +0 -3
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +128 -71
- package/src/components/colors/test/utils.js +41 -0
- package/src/components/colors/utils.js +9 -5
- package/src/components/colors-gradients/control.js +70 -110
- package/src/components/colors-gradients/panel-color-gradient-settings.js +79 -7
- package/src/components/colors-gradients/style.scss +10 -18
- package/src/components/colors-gradients/test/control.js +41 -66
- package/src/components/contrast-checker/index.js +14 -10
- package/src/components/copy-handler/index.js +6 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/duotone-control/index.js +49 -41
- package/src/components/duotone-control/style.scss +27 -12
- package/src/components/editor-styles/index.js +7 -4
- package/src/components/font-appearance-control/index.js +41 -33
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/iframe/index.js +4 -4
- package/src/components/image-editor/aspect-ratio-dropdown.js +129 -0
- package/src/components/image-editor/constants.js +6 -0
- package/src/components/image-editor/context.js +56 -0
- package/src/components/image-editor/cropper.js +74 -0
- package/src/components/image-editor/form-controls.js +22 -0
- package/src/components/image-editor/index.js +52 -0
- package/src/components/image-editor/rotation-button.js +24 -0
- package/src/components/image-editor/use-save-image.js +97 -0
- package/src/components/image-editor/use-transform-image.js +162 -0
- package/src/components/image-editor/zoom-dropdown.js +40 -0
- package/src/components/image-size-control/use-dimension-handler.js +18 -1
- package/src/components/index.js +7 -6
- package/src/components/index.native.js +1 -4
- package/src/components/inner-blocks/button-block-appender.js +9 -0
- package/src/components/inner-blocks/index.js +8 -4
- package/src/components/inner-blocks/index.native.js +7 -4
- package/src/components/inner-blocks/use-nested-settings-update.js +26 -11
- package/src/components/inserter/block-patterns-explorer/explorer.js +50 -0
- package/src/components/inserter/block-patterns-explorer/patterns-list.js +122 -0
- package/src/components/inserter/block-patterns-explorer/sidebar.js +73 -0
- package/src/components/inserter/block-patterns-tab.js +107 -73
- package/src/components/inserter/block-types-tab.native.js +3 -15
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +14 -21
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/index.js +15 -3
- package/src/components/inserter/index.native.js +2 -19
- package/src/components/inserter/library.js +2 -0
- package/src/components/inserter/menu.js +4 -1
- package/src/components/inserter/menu.native.js +9 -14
- package/src/components/inserter/pattern-panel.js +33 -16
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/quick-inserter.js +1 -1
- package/src/components/inserter/reusable-blocks-tab.native.js +4 -6
- package/src/components/inserter/search-results.native.js +5 -15
- package/src/components/inserter/style.scss +80 -16
- package/src/components/inserter/test/block-types-tab.native.js +1 -1
- package/src/components/inserter/test/fixtures/index.native.js +12 -0
- package/src/components/inserter/utils.native.js +35 -0
- package/src/components/inserter-list-item/style.scss +4 -2
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +60 -0
- package/src/components/inspector-controls/fill.js +23 -2
- package/src/components/inspector-controls/groups.js +8 -0
- package/src/components/inspector-controls/slot.js +15 -0
- package/src/components/letter-spacing-control/index.js +12 -6
- package/src/components/link-control/README.md +47 -14
- package/src/components/link-control/index.js +102 -31
- package/src/components/link-control/link-preview.js +53 -20
- package/src/components/link-control/search-input.js +21 -7
- package/src/components/link-control/style.scss +66 -19
- package/src/components/link-control/test/index.js +311 -4
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +73 -84
- package/src/components/list-view/branch.js +123 -94
- package/src/components/list-view/index.js +82 -30
- package/src/components/list-view/leaf.js +2 -2
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +70 -33
- package/src/components/list-view/use-list-view-client-ids.js +9 -68
- package/src/components/media-placeholder/index.js +26 -19
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +4 -1
- package/src/components/media-upload/README.md +1 -1
- package/src/components/navigable-toolbar/index.js +1 -4
- package/src/components/observe-typing/index.js +3 -2
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +68 -0
- package/src/components/rich-text/format-edit.js +36 -2
- package/src/components/rich-text/format-toolbar/index.js +25 -6
- package/src/components/rich-text/index.js +12 -8
- package/src/components/rich-text/index.native.js +35 -1
- package/src/components/rich-text/use-paste-handler.js +30 -12
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/components/typewriter/index.js +3 -2
- package/src/components/url-input/index.js +26 -10
- package/src/components/use-moving-animation/index.js +9 -8
- package/src/components/use-on-block-drop/index.js +5 -1
- package/src/components/use-setting/index.js +49 -11
- package/src/components/writing-flow/use-multi-selection.js +6 -0
- package/src/components/writing-flow/use-tab-nav.js +17 -3
- package/src/hooks/align.js +19 -10
- package/src/hooks/anchor.js +2 -2
- package/src/hooks/border.js +8 -11
- package/src/hooks/color-panel.js +4 -1
- package/src/hooks/color.js +7 -4
- package/src/hooks/dimensions.js +48 -59
- package/src/hooks/duotone.js +68 -19
- package/src/hooks/font-appearance.js +38 -7
- package/src/hooks/font-family.js +129 -33
- package/src/hooks/font-size.js +42 -6
- package/src/hooks/gap.js +2 -1
- package/src/hooks/index.js +2 -0
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/layout.scss +8 -0
- package/src/hooks/letter-spacing.js +35 -7
- package/src/hooks/line-height.js +37 -9
- package/src/hooks/lock.js +34 -0
- package/src/hooks/margin.js +1 -1
- package/src/hooks/padding.js +1 -1
- package/src/hooks/style.js +15 -11
- package/src/hooks/text-decoration.js +34 -6
- package/src/hooks/text-transform.js +34 -6
- package/src/hooks/typography.js +165 -15
- package/src/hooks/typography.scss +16 -0
- package/src/hooks/use-cached-truthy.js +20 -0
- package/src/index.js +1 -0
- package/src/layouts/flex.js +179 -50
- package/src/layouts/flow.js +54 -8
- package/src/store/actions.js +239 -377
- package/src/store/defaults.native.js +12 -0
- package/src/store/index.js +1 -2
- package/src/store/reducer.js +54 -18
- package/src/store/selectors.js +173 -47
- package/src/store/test/actions.js +407 -705
- package/src/store/test/reducer.js +22 -54
- package/src/store/test/selectors.js +79 -21
- package/src/style.scss +2 -1
- package/src/utils/index.js +1 -0
- package/src/utils/parse-css-unit-to-px.js +43 -1
- package/src/utils/test/parse-css-unit-to-px.js +148 -165
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/duotone-control/duotone-picker-popover.js +0 -44
- package/build/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build/components/text-decoration-and-transform/index.js +0 -39
- package/build/components/text-decoration-and-transform/index.js.map +0 -1
- package/build/store/controls.js +0 -44
- package/build/store/controls.js.map +0 -1
- package/build-module/components/duotone-control/duotone-picker-popover.js +0 -35
- package/build-module/components/duotone-control/duotone-picker-popover.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/build-module/components/text-decoration-and-transform/index.js +0 -30
- package/build-module/components/text-decoration-and-transform/index.js.map +0 -1
- package/build-module/store/controls.js +0 -32
- package/build-module/store/controls.js.map +0 -1
- package/src/components/duotone-control/duotone-picker-popover.js +0 -36
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
- package/src/components/text-decoration-and-transform/index.js +0 -36
- package/src/components/text-decoration-and-transform/style.scss +0 -3
- package/src/store/controls.js +0 -39
|
@@ -36,10 +36,6 @@ export function FontAppearanceEdit( props ) {
|
|
|
36
36
|
const hasFontStyles = ! useIsFontStyleDisabled( props );
|
|
37
37
|
const hasFontWeights = ! useIsFontWeightDisabled( props );
|
|
38
38
|
|
|
39
|
-
if ( ! hasFontStyles && ! hasFontWeights ) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
39
|
const onChange = ( newStyles ) => {
|
|
44
40
|
setAttributes( {
|
|
45
41
|
style: cleanEmptyObject( {
|
|
@@ -54,7 +50,6 @@ export function FontAppearanceEdit( props ) {
|
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
const fontStyle = style?.typography?.fontStyle;
|
|
57
|
-
|
|
58
53
|
const fontWeight = style?.typography?.fontWeight;
|
|
59
54
|
|
|
60
55
|
return (
|
|
@@ -78,7 +73,7 @@ export function FontAppearanceEdit( props ) {
|
|
|
78
73
|
*/
|
|
79
74
|
export function useIsFontStyleDisabled( { name: blockName } = {} ) {
|
|
80
75
|
const styleSupport = hasBlockSupport( blockName, FONT_STYLE_SUPPORT_KEY );
|
|
81
|
-
const hasFontStyles = useSetting( 'typography.
|
|
76
|
+
const hasFontStyles = useSetting( 'typography.fontStyle' );
|
|
82
77
|
|
|
83
78
|
return ! styleSupport || ! hasFontStyles;
|
|
84
79
|
}
|
|
@@ -94,7 +89,7 @@ export function useIsFontStyleDisabled( { name: blockName } = {} ) {
|
|
|
94
89
|
*/
|
|
95
90
|
export function useIsFontWeightDisabled( { name: blockName } = {} ) {
|
|
96
91
|
const weightSupport = hasBlockSupport( blockName, FONT_WEIGHT_SUPPORT_KEY );
|
|
97
|
-
const hasFontWeights = useSetting( 'typography.
|
|
92
|
+
const hasFontWeights = useSetting( 'typography.fontWeight' );
|
|
98
93
|
|
|
99
94
|
return ! weightSupport || ! hasFontWeights;
|
|
100
95
|
}
|
|
@@ -112,3 +107,39 @@ export function useIsFontAppearanceDisabled( props ) {
|
|
|
112
107
|
|
|
113
108
|
return stylesDisabled && weightsDisabled;
|
|
114
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Checks if there is either a font style or weight value set within the
|
|
113
|
+
* typography styles.
|
|
114
|
+
*
|
|
115
|
+
* @param {Object} props Block props.
|
|
116
|
+
* @return {boolean} Whether or not the block has a font style or weight.
|
|
117
|
+
*/
|
|
118
|
+
export function hasFontAppearanceValue( props ) {
|
|
119
|
+
const { fontStyle, fontWeight } = props.attributes.style?.typography || {};
|
|
120
|
+
return !! fontStyle || !! fontWeight;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Resets the font style and weight block support attributes. This can be used
|
|
125
|
+
* when disabling the font appearance support controls for a block via a
|
|
126
|
+
* progressive discovery panel.
|
|
127
|
+
*
|
|
128
|
+
* @param {Object} props Block props.
|
|
129
|
+
* @param {Object} props.attributes Block's attributes.
|
|
130
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
131
|
+
*/
|
|
132
|
+
export function resetFontAppearance( { attributes = {}, setAttributes } ) {
|
|
133
|
+
const { style } = attributes;
|
|
134
|
+
|
|
135
|
+
setAttributes( {
|
|
136
|
+
style: cleanEmptyObject( {
|
|
137
|
+
...style,
|
|
138
|
+
typography: {
|
|
139
|
+
...style?.typography,
|
|
140
|
+
fontStyle: undefined,
|
|
141
|
+
fontWeight: undefined,
|
|
142
|
+
},
|
|
143
|
+
} ),
|
|
144
|
+
} );
|
|
145
|
+
}
|
package/src/hooks/font-family.js
CHANGED
|
@@ -1,67 +1,123 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
4
|
+
import { find, kebabCase } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
+
import { addFilter } from '@wordpress/hooks';
|
|
9
10
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
11
|
+
import TokenList from '@wordpress/token-list';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Internal dependencies
|
|
13
15
|
*/
|
|
14
|
-
import { cleanEmptyObject } from './utils';
|
|
15
16
|
import useSetting from '../components/use-setting';
|
|
16
17
|
import FontFamilyControl from '../components/font-family';
|
|
17
18
|
|
|
18
19
|
export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Filters registered block settings, extending attributes to include
|
|
23
|
+
* the `fontFamily` attribute.
|
|
24
|
+
*
|
|
25
|
+
* @param {Object} settings Original block settings
|
|
26
|
+
* @return {Object} Filtered block settings
|
|
27
|
+
*/
|
|
28
|
+
function addAttributes( settings ) {
|
|
29
|
+
if ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {
|
|
30
|
+
return settings;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Allow blocks to specify a default value if needed.
|
|
34
|
+
if ( ! settings.attributes.fontFamily ) {
|
|
35
|
+
Object.assign( settings.attributes, {
|
|
36
|
+
fontFamily: {
|
|
37
|
+
type: 'string',
|
|
38
|
+
},
|
|
25
39
|
} );
|
|
26
|
-
if ( fontFamilyObject ) {
|
|
27
|
-
return fontFamilyObject.fontFamily;
|
|
28
|
-
}
|
|
29
40
|
}
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
|
|
42
|
+
return settings;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Override props assigned to save component to inject font family.
|
|
47
|
+
*
|
|
48
|
+
* @param {Object} props Additional props applied to save element
|
|
49
|
+
* @param {Object} blockType Block type
|
|
50
|
+
* @param {Object} attributes Block attributes
|
|
51
|
+
* @return {Object} Filtered props applied to save element
|
|
52
|
+
*/
|
|
53
|
+
function addSaveProps( props, blockType, attributes ) {
|
|
54
|
+
if ( ! hasBlockSupport( blockType, FONT_FAMILY_SUPPORT_KEY ) ) {
|
|
55
|
+
return props;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (
|
|
59
|
+
hasBlockSupport(
|
|
60
|
+
blockType,
|
|
61
|
+
'typography.__experimentalSkipSerialization'
|
|
62
|
+
)
|
|
63
|
+
) {
|
|
64
|
+
return props;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if ( ! attributes?.fontFamily ) {
|
|
68
|
+
return props;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Use TokenList to dedupe classes.
|
|
72
|
+
const classes = new TokenList( props.className );
|
|
73
|
+
classes.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );
|
|
74
|
+
const newClassName = classes.value;
|
|
75
|
+
props.className = newClassName ? newClassName : undefined;
|
|
76
|
+
|
|
77
|
+
return props;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Filters registered block settings to expand the block edit wrapper
|
|
82
|
+
* by applying the desired styles and classnames.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} settings Original block settings.
|
|
85
|
+
*
|
|
86
|
+
* @return {Object} Filtered block settings.
|
|
87
|
+
*/
|
|
88
|
+
function addEditProps( settings ) {
|
|
89
|
+
if ( ! hasBlockSupport( settings, FONT_FAMILY_SUPPORT_KEY ) ) {
|
|
90
|
+
return settings;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const existingGetEditWrapperProps = settings.getEditWrapperProps;
|
|
94
|
+
settings.getEditWrapperProps = ( attributes ) => {
|
|
95
|
+
let props = {};
|
|
96
|
+
if ( existingGetEditWrapperProps ) {
|
|
97
|
+
props = existingGetEditWrapperProps( attributes );
|
|
98
|
+
}
|
|
99
|
+
return addSaveProps( props, settings, attributes );
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
return settings;
|
|
103
|
+
}
|
|
32
104
|
|
|
33
105
|
export function FontFamilyEdit( {
|
|
34
|
-
name,
|
|
35
106
|
setAttributes,
|
|
36
|
-
attributes: {
|
|
107
|
+
attributes: { fontFamily },
|
|
37
108
|
} ) {
|
|
38
109
|
const fontFamilies = useSetting( 'typography.fontFamilies' );
|
|
39
|
-
const isDisable = useIsFontFamilyDisabled( { name } );
|
|
40
|
-
|
|
41
|
-
if ( isDisable ) {
|
|
42
|
-
return null;
|
|
43
|
-
}
|
|
44
110
|
|
|
45
|
-
const value =
|
|
46
|
-
|
|
47
|
-
style.typography?.fontFamily
|
|
48
|
-
);
|
|
111
|
+
const value = find( fontFamilies, ( { slug } ) => fontFamily === slug )
|
|
112
|
+
?.fontFamily;
|
|
49
113
|
|
|
50
114
|
function onChange( newValue ) {
|
|
51
115
|
const predefinedFontFamily = find(
|
|
52
116
|
fontFamilies,
|
|
53
|
-
( { fontFamily } ) =>
|
|
117
|
+
( { fontFamily: f } ) => f === newValue
|
|
54
118
|
);
|
|
55
119
|
setAttributes( {
|
|
56
|
-
|
|
57
|
-
...style,
|
|
58
|
-
typography: {
|
|
59
|
-
...( style.typography || {} ),
|
|
60
|
-
fontFamily: predefinedFontFamily
|
|
61
|
-
? `var:preset|font-family|${ predefinedFontFamily.slug }`
|
|
62
|
-
: newValue || undefined,
|
|
63
|
-
},
|
|
64
|
-
} ),
|
|
120
|
+
fontFamily: predefinedFontFamily?.slug,
|
|
65
121
|
} );
|
|
66
122
|
}
|
|
67
123
|
|
|
@@ -89,3 +145,43 @@ export function useIsFontFamilyDisabled( { name } ) {
|
|
|
89
145
|
! hasBlockSupport( name, FONT_FAMILY_SUPPORT_KEY )
|
|
90
146
|
);
|
|
91
147
|
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Checks if there is a current value set for the font family block support.
|
|
151
|
+
*
|
|
152
|
+
* @param {Object} props Block props.
|
|
153
|
+
* @return {boolean} Whether or not the block has a font family value set.
|
|
154
|
+
*/
|
|
155
|
+
export function hasFontFamilyValue( props ) {
|
|
156
|
+
return !! props.attributes.fontFamily;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Resets the font family block support attribute. This can be used when
|
|
161
|
+
* disabling the font family support controls for a block via a progressive
|
|
162
|
+
* discovery panel.
|
|
163
|
+
*
|
|
164
|
+
* @param {Object} props Block props.
|
|
165
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
166
|
+
*/
|
|
167
|
+
export function resetFontFamily( { setAttributes } ) {
|
|
168
|
+
setAttributes( { fontFamily: undefined } );
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
addFilter(
|
|
172
|
+
'blocks.registerBlockType',
|
|
173
|
+
'core/fontFamily/addAttribute',
|
|
174
|
+
addAttributes
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
addFilter(
|
|
178
|
+
'blocks.getSaveContent.extraProps',
|
|
179
|
+
'core/fontFamily/addSaveProps',
|
|
180
|
+
addSaveProps
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
addFilter(
|
|
184
|
+
'blocks.registerBlockType',
|
|
185
|
+
'core/fontFamily/addEditProps',
|
|
186
|
+
addEditProps
|
|
187
|
+
);
|
package/src/hooks/font-size.js
CHANGED
|
@@ -114,7 +114,6 @@ export function FontSizeEdit( props ) {
|
|
|
114
114
|
attributes: { fontSize, style },
|
|
115
115
|
setAttributes,
|
|
116
116
|
} = props;
|
|
117
|
-
const isDisabled = useIsFontSizeDisabled( props );
|
|
118
117
|
const fontSizes = useSetting( 'typography.fontSizes' );
|
|
119
118
|
|
|
120
119
|
const onChange = ( value ) => {
|
|
@@ -132,10 +131,6 @@ export function FontSizeEdit( props ) {
|
|
|
132
131
|
} );
|
|
133
132
|
};
|
|
134
133
|
|
|
135
|
-
if ( isDisabled ) {
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
134
|
const fontSizeObject = getFontSize(
|
|
140
135
|
fontSizes,
|
|
141
136
|
fontSize,
|
|
@@ -145,7 +140,48 @@ export function FontSizeEdit( props ) {
|
|
|
145
140
|
const fontSizeValue =
|
|
146
141
|
fontSizeObject?.size || style?.typography?.fontSize || fontSize;
|
|
147
142
|
|
|
148
|
-
return
|
|
143
|
+
return (
|
|
144
|
+
<FontSizePicker
|
|
145
|
+
onChange={ onChange }
|
|
146
|
+
value={ fontSizeValue }
|
|
147
|
+
withReset={ false }
|
|
148
|
+
/>
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Checks if there is a current value set for the font size block support.
|
|
154
|
+
*
|
|
155
|
+
* @param {Object} props Block props.
|
|
156
|
+
* @return {boolean} Whether or not the block has a font size value set.
|
|
157
|
+
*/
|
|
158
|
+
export function hasFontSizeValue( props ) {
|
|
159
|
+
const { fontSize, style } = props.attributes;
|
|
160
|
+
return !! fontSize || !! style?.typography?.fontSize;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Resets the font size block support attribute. This can be used when
|
|
165
|
+
* disabling the font size support controls for a block via a progressive
|
|
166
|
+
* discovery panel.
|
|
167
|
+
*
|
|
168
|
+
* @param {Object} props Block props.
|
|
169
|
+
* @param {Object} props.attributes Block's attributes.
|
|
170
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
171
|
+
*/
|
|
172
|
+
export function resetFontSize( { attributes = {}, setAttributes } ) {
|
|
173
|
+
const { style } = attributes;
|
|
174
|
+
|
|
175
|
+
setAttributes( {
|
|
176
|
+
fontSize: undefined,
|
|
177
|
+
style: cleanEmptyObject( {
|
|
178
|
+
...style,
|
|
179
|
+
typography: {
|
|
180
|
+
...style?.typography,
|
|
181
|
+
fontSize: undefined,
|
|
182
|
+
},
|
|
183
|
+
} ),
|
|
184
|
+
} );
|
|
149
185
|
}
|
|
150
186
|
|
|
151
187
|
/**
|
package/src/hooks/gap.js
CHANGED
package/src/hooks/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import './compat';
|
|
5
5
|
import './align';
|
|
6
|
+
import './lock';
|
|
6
7
|
import './anchor';
|
|
7
8
|
import './custom-class-name';
|
|
8
9
|
import './generated-class-name';
|
|
@@ -17,3 +18,4 @@ export { useCustomSides } from './dimensions';
|
|
|
17
18
|
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
18
19
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
19
20
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|
|
21
|
+
export { useCachedTruthy } from './use-cached-truthy';
|
|
@@ -13,3 +13,4 @@ import './font-size';
|
|
|
13
13
|
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
14
14
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
15
15
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|
|
16
|
+
export { useCachedTruthy } from './use-cached-truthy';
|
package/src/hooks/layout.scss
CHANGED
|
@@ -21,3 +21,11 @@
|
|
|
21
21
|
.block-editor-hooks__layout-controls-helptext {
|
|
22
22
|
font-size: $helptext-font-size;
|
|
23
23
|
}
|
|
24
|
+
|
|
25
|
+
.block-editor-hooks__flex-layout-justification-controls,
|
|
26
|
+
.block-editor-hooks__flex-layout-orientation-controls {
|
|
27
|
+
margin-bottom: $grid-unit-15;
|
|
28
|
+
legend {
|
|
29
|
+
margin-bottom: $grid-unit-10;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -29,12 +29,6 @@ export function LetterSpacingEdit( props ) {
|
|
|
29
29
|
setAttributes,
|
|
30
30
|
} = props;
|
|
31
31
|
|
|
32
|
-
const isDisabled = useIsLetterSpacingDisabled( props );
|
|
33
|
-
|
|
34
|
-
if ( isDisabled ) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
32
|
function onChange( newSpacing ) {
|
|
39
33
|
setAttributes( {
|
|
40
34
|
style: cleanEmptyObject( {
|
|
@@ -51,6 +45,7 @@ export function LetterSpacingEdit( props ) {
|
|
|
51
45
|
<LetterSpacingControl
|
|
52
46
|
value={ style?.typography?.letterSpacing }
|
|
53
47
|
onChange={ onChange }
|
|
48
|
+
__unstableInputWidth={ false }
|
|
54
49
|
/>
|
|
55
50
|
);
|
|
56
51
|
}
|
|
@@ -66,7 +61,40 @@ export function useIsLetterSpacingDisabled( { name: blockName } = {} ) {
|
|
|
66
61
|
blockName,
|
|
67
62
|
LETTER_SPACING_SUPPORT_KEY
|
|
68
63
|
);
|
|
69
|
-
const hasLetterSpacing = useSetting( 'typography.
|
|
64
|
+
const hasLetterSpacing = useSetting( 'typography.letterSpacing' );
|
|
70
65
|
|
|
71
66
|
return notSupported || ! hasLetterSpacing;
|
|
72
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Checks if there is a current value set for the letter spacing block support.
|
|
71
|
+
*
|
|
72
|
+
* @param {Object} props Block props.
|
|
73
|
+
* @return {boolean} Whether or not the block has a letter spacing set.
|
|
74
|
+
*/
|
|
75
|
+
export function hasLetterSpacingValue( props ) {
|
|
76
|
+
return !! props.attributes.style?.typography?.letterSpacing;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Resets the letter spacing block support attribute. This can be used when
|
|
81
|
+
* disabling the letter spacing support controls for a block via a progressive
|
|
82
|
+
* discovery panel.
|
|
83
|
+
*
|
|
84
|
+
* @param {Object} props Block props.
|
|
85
|
+
* @param {Object} props.attributes Block's attributes.
|
|
86
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
87
|
+
*/
|
|
88
|
+
export function resetLetterSpacing( { attributes = {}, setAttributes } ) {
|
|
89
|
+
const { style } = attributes;
|
|
90
|
+
|
|
91
|
+
setAttributes( {
|
|
92
|
+
style: cleanEmptyObject( {
|
|
93
|
+
...style,
|
|
94
|
+
typography: {
|
|
95
|
+
...style?.typography,
|
|
96
|
+
letterSpacing: undefined,
|
|
97
|
+
},
|
|
98
|
+
} ),
|
|
99
|
+
} );
|
|
100
|
+
}
|
package/src/hooks/line-height.js
CHANGED
|
@@ -22,12 +22,8 @@ export const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
|
|
|
22
22
|
export function LineHeightEdit( props ) {
|
|
23
23
|
const {
|
|
24
24
|
attributes: { style },
|
|
25
|
+
setAttributes,
|
|
25
26
|
} = props;
|
|
26
|
-
const isDisabled = useIsLineHeightDisabled( props );
|
|
27
|
-
|
|
28
|
-
if ( isDisabled ) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
27
|
|
|
32
28
|
const onChange = ( newLineHeightValue ) => {
|
|
33
29
|
const newStyle = {
|
|
@@ -37,9 +33,8 @@ export function LineHeightEdit( props ) {
|
|
|
37
33
|
lineHeight: newLineHeightValue,
|
|
38
34
|
},
|
|
39
35
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
} );
|
|
36
|
+
|
|
37
|
+
setAttributes( { style: cleanEmptyObject( newStyle ) } );
|
|
43
38
|
};
|
|
44
39
|
return (
|
|
45
40
|
<LineHeightControl
|
|
@@ -56,9 +51,42 @@ export function LineHeightEdit( props ) {
|
|
|
56
51
|
* @return {boolean} Whether setting is disabled.
|
|
57
52
|
*/
|
|
58
53
|
export function useIsLineHeightDisabled( { name: blockName } = {} ) {
|
|
59
|
-
const isDisabled = ! useSetting( 'typography.
|
|
54
|
+
const isDisabled = ! useSetting( 'typography.lineHeight' );
|
|
60
55
|
|
|
61
56
|
return (
|
|
62
57
|
! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled
|
|
63
58
|
);
|
|
64
59
|
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Checks if there is a current value set for the line height block support.
|
|
63
|
+
*
|
|
64
|
+
* @param {Object} props Block props.
|
|
65
|
+
* @return {boolean} Whether or not the block has a line height value set.
|
|
66
|
+
*/
|
|
67
|
+
export function hasLineHeightValue( props ) {
|
|
68
|
+
return !! props.attributes.style?.typography?.lineHeight;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Resets the line height block support attribute. This can be used when
|
|
73
|
+
* disabling the line height support controls for a block via a progressive
|
|
74
|
+
* discovery panel.
|
|
75
|
+
*
|
|
76
|
+
* @param {Object} props Block props.
|
|
77
|
+
* @param {Object} props.attributes Block's attributes.
|
|
78
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
79
|
+
*/
|
|
80
|
+
export function resetLineHeight( { attributes = {}, setAttributes } ) {
|
|
81
|
+
const { style } = attributes;
|
|
82
|
+
|
|
83
|
+
setAttributes( {
|
|
84
|
+
style: cleanEmptyObject( {
|
|
85
|
+
...style,
|
|
86
|
+
typography: {
|
|
87
|
+
...style?.typography,
|
|
88
|
+
lineHeight: undefined,
|
|
89
|
+
},
|
|
90
|
+
} ),
|
|
91
|
+
} );
|
|
92
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { has } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { addFilter } from '@wordpress/hooks';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Filters registered block settings, extending attributes to include `lock`.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} settings Original block settings.
|
|
15
|
+
*
|
|
16
|
+
* @return {Object} Filtered block settings.
|
|
17
|
+
*/
|
|
18
|
+
export function addAttribute( settings ) {
|
|
19
|
+
// allow blocks to specify their own attribute definition with default values if needed.
|
|
20
|
+
if ( has( settings.attributes, [ 'lock', 'type' ] ) ) {
|
|
21
|
+
return settings;
|
|
22
|
+
}
|
|
23
|
+
// Gracefully handle if settings.attributes is undefined.
|
|
24
|
+
settings.attributes = {
|
|
25
|
+
...settings.attributes,
|
|
26
|
+
lock: {
|
|
27
|
+
type: 'object',
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return settings;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
addFilter( 'blocks.registerBlockType', 'core/lock/addAttribute', addAttribute );
|
package/src/hooks/margin.js
CHANGED
|
@@ -73,7 +73,7 @@ export function resetMargin( { attributes = {}, setAttributes } ) {
|
|
|
73
73
|
* @return {boolean} Whether margin setting is disabled.
|
|
74
74
|
*/
|
|
75
75
|
export function useIsMarginDisabled( { name: blockName } = {} ) {
|
|
76
|
-
const isDisabled = ! useSetting( 'spacing.
|
|
76
|
+
const isDisabled = ! useSetting( 'spacing.margin' );
|
|
77
77
|
const isInvalid = ! useIsDimensionsSupportValid( blockName, 'margin' );
|
|
78
78
|
|
|
79
79
|
return ! hasMarginSupport( blockName ) || isDisabled || isInvalid;
|
package/src/hooks/padding.js
CHANGED
|
@@ -73,7 +73,7 @@ export function resetPadding( { attributes = {}, setAttributes } ) {
|
|
|
73
73
|
* @return {boolean} Whether padding setting is disabled.
|
|
74
74
|
*/
|
|
75
75
|
export function useIsPaddingDisabled( { name: blockName } = {} ) {
|
|
76
|
-
const isDisabled = ! useSetting( 'spacing.
|
|
76
|
+
const isDisabled = ! useSetting( 'spacing.padding' );
|
|
77
77
|
const isInvalid = ! useIsDimensionsSupportValid( blockName, 'padding' );
|
|
78
78
|
|
|
79
79
|
return ! hasPaddingSupport( blockName ) || isDisabled || isInvalid;
|
package/src/hooks/style.js
CHANGED
|
@@ -18,6 +18,7 @@ import classnames from 'classnames';
|
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
20
20
|
*/
|
|
21
|
+
import { useContext, createPortal } from '@wordpress/element';
|
|
21
22
|
import { addFilter } from '@wordpress/hooks';
|
|
22
23
|
import {
|
|
23
24
|
getBlockSupport,
|
|
@@ -30,6 +31,7 @@ import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
|
30
31
|
/**
|
|
31
32
|
* Internal dependencies
|
|
32
33
|
*/
|
|
34
|
+
import BlockList from '../components/block-list';
|
|
33
35
|
import { BORDER_SUPPORT_KEY, BorderPanel } from './border';
|
|
34
36
|
import { COLOR_SUPPORT_KEY, ColorEdit } from './color';
|
|
35
37
|
import {
|
|
@@ -109,9 +111,7 @@ function compileElementsStyles( selector, elements = {} ) {
|
|
|
109
111
|
...map(
|
|
110
112
|
elementStyles,
|
|
111
113
|
( value, property ) =>
|
|
112
|
-
`\t${ kebabCase( property ) }: ${ value }
|
|
113
|
-
element === 'link' ? '!important' : ''
|
|
114
|
-
};`
|
|
114
|
+
`\t${ kebabCase( property ) }: ${ value };`
|
|
115
115
|
),
|
|
116
116
|
'}',
|
|
117
117
|
].join( '\n' );
|
|
@@ -264,9 +264,9 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
264
264
|
<>
|
|
265
265
|
{ shouldDisplayControls && (
|
|
266
266
|
<>
|
|
267
|
+
<ColorEdit { ...props } />
|
|
267
268
|
<TypographyPanel { ...props } />
|
|
268
269
|
<BorderPanel { ...props } />
|
|
269
|
-
<ColorEdit { ...props } />
|
|
270
270
|
<DimensionsPanel { ...props } />
|
|
271
271
|
</>
|
|
272
272
|
) }
|
|
@@ -294,16 +294,20 @@ const withElementsStyles = createHigherOrderComponent(
|
|
|
294
294
|
blockElementsContainerIdentifier,
|
|
295
295
|
props.attributes.style?.elements
|
|
296
296
|
);
|
|
297
|
+
const element = useContext( BlockList.__unstableElementContext );
|
|
297
298
|
|
|
298
299
|
return (
|
|
299
300
|
<>
|
|
300
|
-
{ elements &&
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
301
|
+
{ elements &&
|
|
302
|
+
element &&
|
|
303
|
+
createPortal(
|
|
304
|
+
<style
|
|
305
|
+
dangerouslySetInnerHTML={ {
|
|
306
|
+
__html: styles,
|
|
307
|
+
} }
|
|
308
|
+
/>,
|
|
309
|
+
element
|
|
310
|
+
) }
|
|
307
311
|
|
|
308
312
|
<BlockListBlock
|
|
309
313
|
{ ...props }
|
|
@@ -29,11 +29,6 @@ export function TextDecorationEdit( props ) {
|
|
|
29
29
|
attributes: { style },
|
|
30
30
|
setAttributes,
|
|
31
31
|
} = props;
|
|
32
|
-
const isDisabled = useIsTextDecorationDisabled( props );
|
|
33
|
-
|
|
34
|
-
if ( isDisabled ) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
32
|
|
|
38
33
|
function onChange( newDecoration ) {
|
|
39
34
|
setAttributes( {
|
|
@@ -67,7 +62,40 @@ export function useIsTextDecorationDisabled( { name: blockName } = {} ) {
|
|
|
67
62
|
blockName,
|
|
68
63
|
TEXT_DECORATION_SUPPORT_KEY
|
|
69
64
|
);
|
|
70
|
-
const hasTextDecoration = useSetting( 'typography.
|
|
65
|
+
const hasTextDecoration = useSetting( 'typography.textDecoration' );
|
|
71
66
|
|
|
72
67
|
return notSupported || ! hasTextDecoration;
|
|
73
68
|
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Checks if there is a current value set for the text decoration block support.
|
|
72
|
+
*
|
|
73
|
+
* @param {Object} props Block props.
|
|
74
|
+
* @return {boolean} Whether or not the block has a text decoration set.
|
|
75
|
+
*/
|
|
76
|
+
export function hasTextDecorationValue( props ) {
|
|
77
|
+
return !! props.attributes.style?.typography?.textDecoration;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Resets the text decoration block support attribute. This can be used when
|
|
82
|
+
* disabling the text decoration support controls for a block via a progressive
|
|
83
|
+
* discovery panel.
|
|
84
|
+
*
|
|
85
|
+
* @param {Object} props Block props.
|
|
86
|
+
* @param {Object} props.attributes Block's attributes.
|
|
87
|
+
* @param {Object} props.setAttributes Function to set block's attributes.
|
|
88
|
+
*/
|
|
89
|
+
export function resetTextDecoration( { attributes = {}, setAttributes } ) {
|
|
90
|
+
const { style } = attributes;
|
|
91
|
+
|
|
92
|
+
setAttributes( {
|
|
93
|
+
style: cleanEmptyObject( {
|
|
94
|
+
...style,
|
|
95
|
+
typography: {
|
|
96
|
+
...style?.typography,
|
|
97
|
+
textDecoration: undefined,
|
|
98
|
+
},
|
|
99
|
+
} ),
|
|
100
|
+
} );
|
|
101
|
+
}
|