@wordpress/block-editor 11.0.0 → 11.2.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 +16 -1
- package/LICENSE.md +1 -1
- package/README.md +2 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-actions/index.js +9 -0
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +58 -5
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +14 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-preview/auto.js +1 -4
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +3 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +43 -10
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-style-picker/index.js +1 -0
- package/build/components/default-style-picker/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +14 -12
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/iframe/index.js +48 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +98 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-size-control/index.js +1 -0
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +6 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +4 -4
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +16 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +8 -5
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/menu.js +11 -5
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +6 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +4 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inspector-controls/groups.js +3 -1
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +3 -1
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -0
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +3 -44
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/block-contents.js +38 -5
- package/build/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +51 -57
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +12 -5
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-enter.js +4 -5
- package/build/components/rich-text/use-enter.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/url-input/button.js +1 -0
- package/build/components/url-input/button.js.map +1 -1
- package/build/components/url-input/index.js +15 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/url-popover/link-editor.js +1 -0
- package/build/components/url-popover/link-editor.js.map +1 -1
- package/build/components/use-paste-styles/index.js +188 -0
- package/build/components/use-paste-styles/index.js.map +1 -0
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +22 -29
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/metadata.js +1 -1
- package/build/hooks/metadata.js.map +1 -1
- package/build/hooks/position.js +376 -0
- package/build/hooks/position.js.map +1 -0
- package/build/hooks/supports.js +328 -0
- package/build/hooks/supports.js.map +1 -0
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +27 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +9 -7
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-actions/index.js +6 -0
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +58 -6
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -18
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +14 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -4
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +42 -11
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-style-picker/index.js +1 -0
- package/build-module/components/default-style-picker/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +14 -11
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/iframe/index.js +46 -102
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +90 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-size-control/index.js +1 -0
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +6 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +4 -4
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +16 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +8 -5
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/menu.js +11 -5
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +6 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +4 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +3 -1
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +33 -0
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +2 -1
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +4 -11
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -0
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +5 -44
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-contents.js +37 -7
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +54 -60
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +12 -5
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-enter.js +4 -5
- package/build-module/components/rich-text/use-enter.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/url-input/button.js +1 -0
- package/build-module/components/url-input/button.js.map +1 -1
- package/build-module/components/url-input/index.js +14 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/url-popover/link-editor.js +1 -0
- package/build-module/components/url-popover/link-editor.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +174 -0
- package/build-module/components/use-paste-styles/index.js.map +1 -0
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +22 -29
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/metadata.js +1 -1
- package/build-module/hooks/metadata.js.map +1 -1
- package/build-module/hooks/position.js +337 -0
- package/build-module/hooks/position.js.map +1 -0
- package/build-module/hooks/supports.js +257 -0
- package/build-module/hooks/supports.js.map +1 -0
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +27 -8
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +9 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-style/content-rtl.css +60 -3
- package/build-style/content.css +60 -3
- package/build-style/default-editor-styles-rtl.css +3 -3
- package/build-style/default-editor-styles.css +3 -3
- package/build-style/style-rtl.css +62 -69
- package/build-style/style.css +62 -69
- package/package.json +29 -29
- package/src/components/alignment-control/test/index.js +2 -0
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-actions/index.js +5 -0
- package/src/components/block-alignment-control/test/index.js +2 -0
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +79 -4
- package/src/components/block-inspector/style.scss +7 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +18 -22
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -0
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +15 -6
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-preview/auto.js +2 -4
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -0
- package/src/components/block-styles/index.js +4 -1
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +3 -2
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/use-block-toolbar-popover-props.js +68 -12
- package/src/components/block-variation-picker/index.js +5 -1
- package/src/components/block-vertical-alignment-control/test/index.js +2 -0
- package/src/components/button-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/default-style-picker/index.js +1 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +36 -36
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/iframe/index.js +60 -122
- package/src/components/iframe/use-compatibility-styles.js +101 -0
- package/src/components/image-size-control/index.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/inner-blocks/index.js +4 -2
- package/src/components/inserter/block-patterns-tab.js +7 -4
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +61 -43
- package/src/components/inserter/media-tab/hooks.js +5 -4
- package/src/components/inserter/menu.js +8 -4
- package/src/components/inserter/quick-inserter.js +3 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +2 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +117 -0
- package/src/components/inserter/test/index.native.js +255 -1
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/position-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +2 -0
- package/src/components/inspector-controls-tabs/style.scss +15 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -8
- package/src/components/link-control/search-input.js +1 -0
- package/src/components/link-control/style.scss +1 -0
- package/src/components/link-control/test/index.js +18 -4
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/style.scss +14 -10
- package/src/components/media-replace-flow/test/index.js +2 -0
- package/src/components/off-canvas-editor/appender.js +4 -49
- package/src/components/off-canvas-editor/block-contents.js +84 -23
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +90 -105
- package/src/components/off-canvas-editor/index.js +21 -2
- package/src/components/off-canvas-editor/style.scss +5 -1
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/provider/index.js +4 -1
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/index.js +1 -0
- package/src/components/rich-text/use-enter.js +4 -4
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/url-input/README.md +5 -0
- package/src/components/url-input/button.js +1 -0
- package/src/components/url-input/index.js +15 -1
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/link-editor.js +1 -0
- package/src/components/url-popover/test/index.js +21 -5
- package/src/components/use-paste-styles/index.js +230 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/components/writing-flow/use-arrow-nav.js +20 -28
- package/src/content.scss +1 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/index.js +1 -0
- package/src/hooks/metadata.js +1 -2
- package/src/hooks/position.js +375 -0
- package/src/hooks/position.scss +18 -0
- package/src/hooks/supports.js +302 -0
- package/src/hooks/test/__snapshots__/align.native.js.snap +73 -0
- package/src/hooks/test/align.native.js +133 -0
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +20 -8
- package/src/store/selectors.js +7 -8
- package/src/store/test/reducer.js +45 -3
- package/src/store/test/selectors.js +12 -9
- package/src/style.scss +2 -1
- package/src/utils/pasting.js +3 -9
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hasBackgroundColorSupport = exports.hasAlignWideSupport = exports.hasAlignSupport = exports.getLayoutSupport = exports.getFontSizeSupport = exports.getFontFamilySupport = exports.getCustomClassNameSupport = exports.getColorSupport = exports.getBorderSupport = exports.getAlignWideSupport = exports.getAlignSupport = void 0;
|
|
7
|
+
exports.hasBorderSupport = hasBorderSupport;
|
|
8
|
+
exports.hasTextColorSupport = exports.hasStyleSupport = exports.hasLinkColorSupport = exports.hasLayoutSupport = exports.hasGradientSupport = exports.hasFontSizeSupport = exports.hasFontFamilySupport = exports.hasCustomClassNameSupport = exports.hasColorSupport = void 0;
|
|
9
|
+
|
|
10
|
+
var _blocks = require("@wordpress/blocks");
|
|
11
|
+
|
|
12
|
+
var _element = require("@wordpress/element");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* WordPress dependencies
|
|
16
|
+
*/
|
|
17
|
+
const ALIGN_SUPPORT_KEY = 'align';
|
|
18
|
+
const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
|
|
19
|
+
const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
20
|
+
const COLOR_SUPPORT_KEY = 'color';
|
|
21
|
+
const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
|
|
22
|
+
const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
23
|
+
const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
|
|
24
|
+
const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
|
|
25
|
+
/**
|
|
26
|
+
* Key within block settings' support array indicating support for font style.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
30
|
+
/**
|
|
31
|
+
* Key within block settings' support array indicating support for font weight.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
35
|
+
/**
|
|
36
|
+
* Key within block settings' supports array indicating support for text
|
|
37
|
+
* decorations e.g. settings found in `block.json`.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
41
|
+
/**
|
|
42
|
+
* Key within block settings' supports array indicating support for text
|
|
43
|
+
* transforms e.g. settings found in `block.json`.
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
47
|
+
/**
|
|
48
|
+
* Key within block settings' supports array indicating support for letter-spacing
|
|
49
|
+
* e.g. settings found in `block.json`.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
53
|
+
const LAYOUT_SUPPORT_KEY = '__experimentalLayout';
|
|
54
|
+
const TYPOGRAPHY_SUPPORT_KEYS = [LINE_HEIGHT_SUPPORT_KEY, FONT_SIZE_SUPPORT_KEY, FONT_STYLE_SUPPORT_KEY, FONT_WEIGHT_SUPPORT_KEY, FONT_FAMILY_SUPPORT_KEY, TEXT_DECORATION_SUPPORT_KEY, TEXT_TRANSFORM_SUPPORT_KEY, LETTER_SPACING_SUPPORT_KEY];
|
|
55
|
+
const SPACING_SUPPORT_KEY = 'spacing';
|
|
56
|
+
const styleSupportKeys = [...TYPOGRAPHY_SUPPORT_KEYS, BORDER_SUPPORT_KEY, COLOR_SUPPORT_KEY, SPACING_SUPPORT_KEY];
|
|
57
|
+
/**
|
|
58
|
+
* Returns true if the block defines support for align.
|
|
59
|
+
*
|
|
60
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
61
|
+
* @return {boolean} Whether the block supports the feature.
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
const hasAlignSupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY);
|
|
65
|
+
/**
|
|
66
|
+
* Returns the block support value for align, if defined.
|
|
67
|
+
*
|
|
68
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
69
|
+
* @return {unknown} The block support value.
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
exports.hasAlignSupport = hasAlignSupport;
|
|
74
|
+
|
|
75
|
+
const getAlignSupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, ALIGN_SUPPORT_KEY);
|
|
76
|
+
/**
|
|
77
|
+
* Returns true if the block defines support for align wide.
|
|
78
|
+
*
|
|
79
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
80
|
+
* @return {boolean} Whether the block supports the feature.
|
|
81
|
+
*/
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
exports.getAlignSupport = getAlignSupport;
|
|
85
|
+
|
|
86
|
+
const hasAlignWideSupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
|
|
87
|
+
/**
|
|
88
|
+
* Returns the block support value for align wide, if defined.
|
|
89
|
+
*
|
|
90
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
91
|
+
* @return {unknown} The block support value.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
exports.hasAlignWideSupport = hasAlignWideSupport;
|
|
96
|
+
|
|
97
|
+
const getAlignWideSupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, ALIGN_WIDE_SUPPORT_KEY);
|
|
98
|
+
/**
|
|
99
|
+
* Determine whether there is block support for border properties.
|
|
100
|
+
*
|
|
101
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
102
|
+
* @param {string} feature Border feature to check support for.
|
|
103
|
+
*
|
|
104
|
+
* @return {boolean} Whether there is support.
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
exports.getAlignWideSupport = getAlignWideSupport;
|
|
109
|
+
|
|
110
|
+
function hasBorderSupport(nameOrType) {
|
|
111
|
+
let feature = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'any';
|
|
112
|
+
|
|
113
|
+
if (_element.Platform.OS !== 'web') {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const support = (0, _blocks.getBlockSupport)(nameOrType, BORDER_SUPPORT_KEY);
|
|
118
|
+
|
|
119
|
+
if (support === true) {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (feature === 'any') {
|
|
124
|
+
return !!(support !== null && support !== void 0 && support.color || support !== null && support !== void 0 && support.radius || support !== null && support !== void 0 && support.width || support !== null && support !== void 0 && support.style);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return !!(support !== null && support !== void 0 && support[feature]);
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get block support for border properties.
|
|
131
|
+
*
|
|
132
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
133
|
+
* @param {string} feature Border feature to get.
|
|
134
|
+
*
|
|
135
|
+
* @return {unknown} The block support.
|
|
136
|
+
*/
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
const getBorderSupport = (nameOrType, feature) => (0, _blocks.getBlockSupport)(nameOrType, [BORDER_SUPPORT_KEY, feature]);
|
|
140
|
+
/**
|
|
141
|
+
* Returns true if the block defines support for color.
|
|
142
|
+
*
|
|
143
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
144
|
+
* @return {boolean} Whether the block supports the feature.
|
|
145
|
+
*/
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
exports.getBorderSupport = getBorderSupport;
|
|
149
|
+
|
|
150
|
+
const hasColorSupport = nameOrType => {
|
|
151
|
+
const colorSupport = (0, _blocks.getBlockSupport)(nameOrType, COLOR_SUPPORT_KEY);
|
|
152
|
+
return colorSupport && (colorSupport.link === true || colorSupport.gradient === true || colorSupport.background !== false || colorSupport.text !== false);
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Returns true if the block defines support for link color.
|
|
156
|
+
*
|
|
157
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
158
|
+
* @return {boolean} Whether the block supports the feature.
|
|
159
|
+
*/
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
exports.hasColorSupport = hasColorSupport;
|
|
163
|
+
|
|
164
|
+
const hasLinkColorSupport = nameOrType => {
|
|
165
|
+
if (_element.Platform.OS !== 'web') {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const colorSupport = (0, _blocks.getBlockSupport)(nameOrType, COLOR_SUPPORT_KEY);
|
|
170
|
+
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.link;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Returns true if the block defines support for gradient color.
|
|
174
|
+
*
|
|
175
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
176
|
+
* @return {boolean} Whether the block supports the feature.
|
|
177
|
+
*/
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
exports.hasLinkColorSupport = hasLinkColorSupport;
|
|
181
|
+
|
|
182
|
+
const hasGradientSupport = nameOrType => {
|
|
183
|
+
const colorSupport = (0, _blocks.getBlockSupport)(nameOrType, COLOR_SUPPORT_KEY);
|
|
184
|
+
return colorSupport !== null && typeof colorSupport === 'object' && !!colorSupport.gradients;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Returns true if the block defines support for background color.
|
|
188
|
+
*
|
|
189
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
190
|
+
* @return {boolean} Whether the block supports the feature.
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
exports.hasGradientSupport = hasGradientSupport;
|
|
195
|
+
|
|
196
|
+
const hasBackgroundColorSupport = nameOrType => {
|
|
197
|
+
const colorSupport = (0, _blocks.getBlockSupport)(nameOrType, COLOR_SUPPORT_KEY);
|
|
198
|
+
return colorSupport && colorSupport.background !== false;
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Returns true if the block defines support for background color.
|
|
202
|
+
*
|
|
203
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
204
|
+
* @return {boolean} Whether the block supports the feature.
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
exports.hasBackgroundColorSupport = hasBackgroundColorSupport;
|
|
209
|
+
|
|
210
|
+
const hasTextColorSupport = nameOrType => {
|
|
211
|
+
const colorSupport = (0, _blocks.getBlockSupport)(nameOrType, COLOR_SUPPORT_KEY);
|
|
212
|
+
return colorSupport && colorSupport.text !== false;
|
|
213
|
+
};
|
|
214
|
+
/**
|
|
215
|
+
* Get block support for color properties.
|
|
216
|
+
*
|
|
217
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
218
|
+
* @param {string} feature Color feature to get.
|
|
219
|
+
*
|
|
220
|
+
* @return {unknown} The block support.
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
exports.hasTextColorSupport = hasTextColorSupport;
|
|
225
|
+
|
|
226
|
+
const getColorSupport = (nameOrType, feature) => (0, _blocks.getBlockSupport)(nameOrType, [COLOR_SUPPORT_KEY, feature]);
|
|
227
|
+
/**
|
|
228
|
+
* Returns true if the block defines support for custom class name.
|
|
229
|
+
*
|
|
230
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
231
|
+
* @return {boolean} Whether the block supports the feature.
|
|
232
|
+
*/
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
exports.getColorSupport = getColorSupport;
|
|
236
|
+
|
|
237
|
+
const hasCustomClassNameSupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
|
|
238
|
+
/**
|
|
239
|
+
* Returns the block support value for custom class name, if defined.
|
|
240
|
+
*
|
|
241
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
242
|
+
* @return {unknown} The block support value.
|
|
243
|
+
*/
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
exports.hasCustomClassNameSupport = hasCustomClassNameSupport;
|
|
247
|
+
|
|
248
|
+
const getCustomClassNameSupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true);
|
|
249
|
+
/**
|
|
250
|
+
* Returns true if the block defines support for font family.
|
|
251
|
+
*
|
|
252
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
253
|
+
* @return {boolean} Whether the block supports the feature.
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
exports.getCustomClassNameSupport = getCustomClassNameSupport;
|
|
258
|
+
|
|
259
|
+
const hasFontFamilySupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, FONT_FAMILY_SUPPORT_KEY);
|
|
260
|
+
/**
|
|
261
|
+
* Returns the block support value for font family, if defined.
|
|
262
|
+
*
|
|
263
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
264
|
+
* @return {unknown} The block support value.
|
|
265
|
+
*/
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
exports.hasFontFamilySupport = hasFontFamilySupport;
|
|
269
|
+
|
|
270
|
+
const getFontFamilySupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, FONT_FAMILY_SUPPORT_KEY);
|
|
271
|
+
/**
|
|
272
|
+
* Returns true if the block defines support for font size.
|
|
273
|
+
*
|
|
274
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
275
|
+
* @return {boolean} Whether the block supports the feature.
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
exports.getFontFamilySupport = getFontFamilySupport;
|
|
280
|
+
|
|
281
|
+
const hasFontSizeSupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, FONT_SIZE_SUPPORT_KEY);
|
|
282
|
+
/**
|
|
283
|
+
* Returns the block support value for font size, if defined.
|
|
284
|
+
*
|
|
285
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
286
|
+
* @return {unknown} The block support value.
|
|
287
|
+
*/
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
exports.hasFontSizeSupport = hasFontSizeSupport;
|
|
291
|
+
|
|
292
|
+
const getFontSizeSupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, FONT_SIZE_SUPPORT_KEY);
|
|
293
|
+
/**
|
|
294
|
+
* Returns true if the block defines support for layout.
|
|
295
|
+
*
|
|
296
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
297
|
+
* @return {boolean} Whether the block supports the feature.
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
exports.getFontSizeSupport = getFontSizeSupport;
|
|
302
|
+
|
|
303
|
+
const hasLayoutSupport = nameOrType => (0, _blocks.hasBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY);
|
|
304
|
+
/**
|
|
305
|
+
* Returns the block support value for layout, if defined.
|
|
306
|
+
*
|
|
307
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
308
|
+
* @return {unknown} The block support value.
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
exports.hasLayoutSupport = hasLayoutSupport;
|
|
313
|
+
|
|
314
|
+
const getLayoutSupport = nameOrType => (0, _blocks.getBlockSupport)(nameOrType, LAYOUT_SUPPORT_KEY);
|
|
315
|
+
/**
|
|
316
|
+
* Returns true if the block defines support for style.
|
|
317
|
+
*
|
|
318
|
+
* @param {string|Object} nameOrType Block name or type object.
|
|
319
|
+
* @return {boolean} Whether the block supports the feature.
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
exports.getLayoutSupport = getLayoutSupport;
|
|
324
|
+
|
|
325
|
+
const hasStyleSupport = nameOrType => styleSupportKeys.some(key => (0, _blocks.hasBlockSupport)(nameOrType, key));
|
|
326
|
+
|
|
327
|
+
exports.hasStyleSupport = hasStyleSupport;
|
|
328
|
+
//# sourceMappingURL=supports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/supports.js"],"names":["ALIGN_SUPPORT_KEY","ALIGN_WIDE_SUPPORT_KEY","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","CUSTOM_CLASS_NAME_SUPPORT_KEY","FONT_FAMILY_SUPPORT_KEY","FONT_SIZE_SUPPORT_KEY","LINE_HEIGHT_SUPPORT_KEY","FONT_STYLE_SUPPORT_KEY","FONT_WEIGHT_SUPPORT_KEY","TEXT_DECORATION_SUPPORT_KEY","TEXT_TRANSFORM_SUPPORT_KEY","LETTER_SPACING_SUPPORT_KEY","LAYOUT_SUPPORT_KEY","TYPOGRAPHY_SUPPORT_KEYS","SPACING_SUPPORT_KEY","styleSupportKeys","hasAlignSupport","nameOrType","getAlignSupport","hasAlignWideSupport","getAlignWideSupport","hasBorderSupport","feature","Platform","OS","support","color","radius","width","style","getBorderSupport","hasColorSupport","colorSupport","link","gradient","background","text","hasLinkColorSupport","hasGradientSupport","gradients","hasBackgroundColorSupport","hasTextColorSupport","getColorSupport","hasCustomClassNameSupport","getCustomClassNameSupport","hasFontFamilySupport","getFontFamilySupport","hasFontSizeSupport","getFontSizeSupport","hasLayoutSupport","getLayoutSupport","hasStyleSupport","some","key"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA,MAAMA,iBAAiB,GAAG,OAA1B;AACA,MAAMC,sBAAsB,GAAG,WAA/B;AACA,MAAMC,kBAAkB,GAAG,sBAA3B;AACA,MAAMC,iBAAiB,GAAG,OAA1B;AACA,MAAMC,6BAA6B,GAAG,iBAAtC;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA,MAAMC,qBAAqB,GAAG,qBAA9B;AACA,MAAMC,uBAAuB,GAAG,uBAAhC;AACA;AACA;AACA;;AACA,MAAMC,sBAAsB,GAAG,oCAA/B;AACA;AACA;AACA;;AACA,MAAMC,uBAAuB,GAAG,qCAAhC;AACA;AACA;AACA;AACA;;AACA,MAAMC,2BAA2B,GAAG,yCAApC;AACA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA;AACA;AACA;AACA;;AACA,MAAMC,0BAA0B,GAAG,wCAAnC;AACA,MAAMC,kBAAkB,GAAG,sBAA3B;AACA,MAAMC,uBAAuB,GAAG,CAC/BP,uBAD+B,EAE/BD,qBAF+B,EAG/BE,sBAH+B,EAI/BC,uBAJ+B,EAK/BJ,uBAL+B,EAM/BK,2BAN+B,EAO/BC,0BAP+B,EAQ/BC,0BAR+B,CAAhC;AAUA,MAAMG,mBAAmB,GAAG,SAA5B;AACA,MAAMC,gBAAgB,GAAG,CACxB,GAAGF,uBADqB,EAExBZ,kBAFwB,EAGxBC,iBAHwB,EAIxBY,mBAJwB,CAAzB;AAOA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAME,eAAe,GAAKC,UAAF,IAC9B,6BAAiBA,UAAjB,EAA6BlB,iBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMmB,eAAe,GAAKD,UAAF,IAC9B,6BAAiBA,UAAjB,EAA6BlB,iBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMoB,mBAAmB,GAAKF,UAAF,IAClC,6BAAiBA,UAAjB,EAA6BjB,sBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMoB,mBAAmB,GAAKH,UAAF,IAClC,6BAAiBA,UAAjB,EAA6BjB,sBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,SAASqB,gBAAT,CAA2BJ,UAA3B,EAAyD;AAAA,MAAlBK,OAAkB,uEAAR,KAAQ;;AAC/D,MAAKC,kBAASC,EAAT,KAAgB,KAArB,EAA6B;AAC5B,WAAO,KAAP;AACA;;AAED,QAAMC,OAAO,GAAG,6BAAiBR,UAAjB,EAA6BhB,kBAA7B,CAAhB;;AAEA,MAAKwB,OAAO,KAAK,IAAjB,EAAwB;AACvB,WAAO,IAAP;AACA;;AAED,MAAKH,OAAO,KAAK,KAAjB,EAAyB;AACxB,WAAO,CAAC,EACPG,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAEC,KAAT,IACAD,OADA,aACAA,OADA,eACAA,OAAO,CAAEE,MADT,IAEAF,OAFA,aAEAA,OAFA,eAEAA,OAAO,CAAEG,KAFT,IAGAH,OAHA,aAGAA,OAHA,eAGAA,OAAO,CAAEI,KAJF,CAAR;AAMA;;AAED,SAAO,CAAC,EAAEJ,OAAF,aAAEA,OAAF,eAAEA,OAAO,CAAIH,OAAJ,CAAT,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMQ,gBAAgB,GAAG,CAAEb,UAAF,EAAcK,OAAd,KAC/B,6BAAiBL,UAAjB,EAA6B,CAAEhB,kBAAF,EAAsBqB,OAAtB,CAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMS,eAAe,GAAKd,UAAF,IAAkB;AAChD,QAAMe,YAAY,GAAG,6BAAiBf,UAAjB,EAA6Bf,iBAA7B,CAArB;AACA,SACC8B,YAAY,KACVA,YAAY,CAACC,IAAb,KAAsB,IAAtB,IACDD,YAAY,CAACE,QAAb,KAA0B,IADzB,IAEDF,YAAY,CAACG,UAAb,KAA4B,KAF3B,IAGDH,YAAY,CAACI,IAAb,KAAsB,KAJX,CADb;AAOA,CATM;AAWP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,mBAAmB,GAAKpB,UAAF,IAAkB;AACpD,MAAKM,kBAASC,EAAT,KAAgB,KAArB,EAA6B;AAC5B,WAAO,KAAP;AACA;;AAED,QAAMQ,YAAY,GAAG,6BAAiBf,UAAjB,EAA6Bf,iBAA7B,CAArB;AAEA,SACC8B,YAAY,KAAK,IAAjB,IACA,OAAOA,YAAP,KAAwB,QADxB,IAEA,CAAC,CAAEA,YAAY,CAACC,IAHjB;AAKA,CAZM;AAcP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMK,kBAAkB,GAAKrB,UAAF,IAAkB;AACnD,QAAMe,YAAY,GAAG,6BAAiBf,UAAjB,EAA6Bf,iBAA7B,CAArB;AAEA,SACC8B,YAAY,KAAK,IAAjB,IACA,OAAOA,YAAP,KAAwB,QADxB,IAEA,CAAC,CAAEA,YAAY,CAACO,SAHjB;AAKA,CARM;AAUP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMC,yBAAyB,GAAKvB,UAAF,IAAkB;AAC1D,QAAMe,YAAY,GAAG,6BAAiBf,UAAjB,EAA6Bf,iBAA7B,CAArB;AAEA,SAAO8B,YAAY,IAAIA,YAAY,CAACG,UAAb,KAA4B,KAAnD;AACA,CAJM;AAMP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMM,mBAAmB,GAAKxB,UAAF,IAAkB;AACpD,QAAMe,YAAY,GAAG,6BAAiBf,UAAjB,EAA6Bf,iBAA7B,CAArB;AAEA,SAAO8B,YAAY,IAAIA,YAAY,CAACI,IAAb,KAAsB,KAA7C;AACA,CAJM;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMM,eAAe,GAAG,CAAEzB,UAAF,EAAcK,OAAd,KAC9B,6BAAiBL,UAAjB,EAA6B,CAAEf,iBAAF,EAAqBoB,OAArB,CAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMqB,yBAAyB,GAAK1B,UAAF,IACxC,6BAAiBA,UAAjB,EAA6Bd,6BAA7B,EAA4D,IAA5D,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMyC,yBAAyB,GAAK3B,UAAF,IACxC,6BAAiBA,UAAjB,EAA6Bd,6BAA7B,EAA4D,IAA5D,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM0C,oBAAoB,GAAK5B,UAAF,IACnC,6BAAiBA,UAAjB,EAA6Bb,uBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM0C,oBAAoB,GAAK7B,UAAF,IACnC,6BAAiBA,UAAjB,EAA6Bb,uBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM2C,kBAAkB,GAAK9B,UAAF,IACjC,6BAAiBA,UAAjB,EAA6BZ,qBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM2C,kBAAkB,GAAK/B,UAAF,IACjC,6BAAiBA,UAAjB,EAA6BZ,qBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAM4C,gBAAgB,GAAKhC,UAAF,IAC/B,6BAAiBA,UAAjB,EAA6BL,kBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMsC,gBAAgB,GAAKjC,UAAF,IAC/B,6BAAiBA,UAAjB,EAA6BL,kBAA7B,CADM;AAGP;AACA;AACA;AACA;AACA;AACA;;;;;AACO,MAAMuC,eAAe,GAAKlC,UAAF,IAC9BF,gBAAgB,CAACqC,IAAjB,CAAyBC,GAAF,IAAW,6BAAiBpC,UAAjB,EAA6BoC,GAA7B,CAAlC,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\nconst ALIGN_SUPPORT_KEY = 'align';\nconst ALIGN_WIDE_SUPPORT_KEY = 'alignWide';\nconst BORDER_SUPPORT_KEY = '__experimentalBorder';\nconst COLOR_SUPPORT_KEY = 'color';\nconst CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';\nconst FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';\nconst FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';\nconst LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n/**\n * Key within block settings' support array indicating support for font style.\n */\nconst FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';\n/**\n * Key within block settings' support array indicating support for font weight.\n */\nconst FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';\n/**\n * Key within block settings' supports array indicating support for text\n * decorations e.g. settings found in `block.json`.\n */\nconst TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';\n/**\n * Key within block settings' supports array indicating support for text\n * transforms e.g. settings found in `block.json`.\n */\nconst TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';\n/**\n * Key within block settings' supports array indicating support for letter-spacing\n * e.g. settings found in `block.json`.\n */\nconst LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';\nconst LAYOUT_SUPPORT_KEY = '__experimentalLayout';\nconst TYPOGRAPHY_SUPPORT_KEYS = [\n\tLINE_HEIGHT_SUPPORT_KEY,\n\tFONT_SIZE_SUPPORT_KEY,\n\tFONT_STYLE_SUPPORT_KEY,\n\tFONT_WEIGHT_SUPPORT_KEY,\n\tFONT_FAMILY_SUPPORT_KEY,\n\tTEXT_DECORATION_SUPPORT_KEY,\n\tTEXT_TRANSFORM_SUPPORT_KEY,\n\tLETTER_SPACING_SUPPORT_KEY,\n];\nconst SPACING_SUPPORT_KEY = 'spacing';\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\n/**\n * Returns true if the block defines support for align.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for align wide.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasAlignWideSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for align wide, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getAlignWideSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, ALIGN_WIDE_SUPPORT_KEY );\n\n/**\n * Determine whether there is block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to check support for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBorderSupport( nameOrType, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( nameOrType, BORDER_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn !! (\n\t\t\tsupport?.color ||\n\t\t\tsupport?.radius ||\n\t\t\tsupport?.width ||\n\t\t\tsupport?.style\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Get block support for border properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Border feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getBorderSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ BORDER_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\treturn (\n\t\tcolorSupport &&\n\t\t( colorSupport.link === true ||\n\t\t\tcolorSupport.gradient === true ||\n\t\t\tcolorSupport.background !== false ||\n\t\t\tcolorSupport.text !== false )\n\t);\n};\n\n/**\n * Returns true if the block defines support for link color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLinkColorSupport = ( nameOrType ) => {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.link\n\t);\n};\n\n/**\n * Returns true if the block defines support for gradient color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasGradientSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn (\n\t\tcolorSupport !== null &&\n\t\ttypeof colorSupport === 'object' &&\n\t\t!! colorSupport.gradients\n\t);\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasBackgroundColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.background !== false;\n};\n\n/**\n * Returns true if the block defines support for background color.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasTextColorSupport = ( nameOrType ) => {\n\tconst colorSupport = getBlockSupport( nameOrType, COLOR_SUPPORT_KEY );\n\n\treturn colorSupport && colorSupport.text !== false;\n};\n\n/**\n * Get block support for color properties.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @param {string} feature Color feature to get.\n *\n * @return {unknown} The block support.\n */\nexport const getColorSupport = ( nameOrType, feature ) =>\n\tgetBlockSupport( nameOrType, [ COLOR_SUPPORT_KEY, feature ] );\n\n/**\n * Returns true if the block defines support for custom class name.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasCustomClassNameSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns the block support value for custom class name, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getCustomClassNameSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, CUSTOM_CLASS_NAME_SUPPORT_KEY, true );\n\n/**\n * Returns true if the block defines support for font family.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontFamilySupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font family, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontFamilySupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_FAMILY_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for font size.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasFontSizeSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns the block support value for font size, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getFontSizeSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, FONT_SIZE_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for layout.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasLayoutSupport = ( nameOrType ) =>\n\thasBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns the block support value for layout, if defined.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {unknown} The block support value.\n */\nexport const getLayoutSupport = ( nameOrType ) =>\n\tgetBlockSupport( nameOrType, LAYOUT_SUPPORT_KEY );\n\n/**\n * Returns true if the block defines support for style.\n *\n * @param {string|Object} nameOrType Block name or type object.\n * @return {boolean} Whether the block supports the feature.\n */\nexport const hasStyleSupport = ( nameOrType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( nameOrType, key ) );\n"]}
|
|
@@ -32,23 +32,26 @@ var _fluidUtils = require("../components/font-sizes/fluid-utils");
|
|
|
32
32
|
* Provides the CSS class names and inline styles for a block's typography support
|
|
33
33
|
* attributes.
|
|
34
34
|
*
|
|
35
|
-
* @param {Object}
|
|
36
|
-
* @param {boolean}
|
|
35
|
+
* @param {Object} attributes Block attributes.
|
|
36
|
+
* @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,
|
|
37
|
+
* otherwise an object containing theme fluid typography settings.
|
|
37
38
|
*
|
|
38
39
|
* @return {Object} Typography block support derived CSS classes & styles.
|
|
39
40
|
*/
|
|
40
|
-
function getTypographyClassesAndStyles(attributes,
|
|
41
|
+
function getTypographyClassesAndStyles(attributes, fluidTypographySettings) {
|
|
41
42
|
var _attributes$style;
|
|
42
43
|
|
|
43
44
|
let typographyStyles = (attributes === null || attributes === void 0 ? void 0 : (_attributes$style = attributes.style) === null || _attributes$style === void 0 ? void 0 : _attributes$style.typography) || {};
|
|
44
45
|
|
|
45
|
-
if (
|
|
46
|
-
var _attributes$style2, _attributes$style2$ty;
|
|
46
|
+
if (!!fluidTypographySettings && (true === fluidTypographySettings || Object.keys(fluidTypographySettings).length !== 0)) {
|
|
47
|
+
var _attributes$style2, _attributes$style2$ty, _attributes$style3, _attributes$style3$ty;
|
|
47
48
|
|
|
49
|
+
const newFontSize = (0, _fluidUtils.getComputedFluidTypographyValue)({
|
|
50
|
+
fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize,
|
|
51
|
+
minimumFontSizeLimit: fluidTypographySettings === null || fluidTypographySettings === void 0 ? void 0 : fluidTypographySettings.minFontSize
|
|
52
|
+
}) || (attributes === null || attributes === void 0 ? void 0 : (_attributes$style3 = attributes.style) === null || _attributes$style3 === void 0 ? void 0 : (_attributes$style3$ty = _attributes$style3.typography) === null || _attributes$style3$ty === void 0 ? void 0 : _attributes$style3$ty.fontSize);
|
|
48
53
|
typographyStyles = { ...typographyStyles,
|
|
49
|
-
fontSize:
|
|
50
|
-
fontSize: attributes === null || attributes === void 0 ? void 0 : (_attributes$style2 = attributes.style) === null || _attributes$style2 === void 0 ? void 0 : (_attributes$style2$ty = _attributes$style2.typography) === null || _attributes$style2$ty === void 0 ? void 0 : _attributes$style2$ty.fontSize
|
|
51
|
-
})
|
|
54
|
+
fontSize: newFontSize
|
|
52
55
|
};
|
|
53
56
|
}
|
|
54
57
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["getTypographyClassesAndStyles","attributes","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-typography-props.js"],"names":["getTypographyClassesAndStyles","attributes","fluidTypographySettings","typographyStyles","style","typography","Object","keys","length","newFontSize","fontSize","minimumFontSizeLimit","minFontSize","fontFamilyClassName","fontFamily","className"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAXA;AACA;AACA;;AAIA;AACA;AACA;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,6BAAT,CACNC,UADM,EAENC,uBAFM,EAGL;AAAA;;AACD,MAAIC,gBAAgB,GAAG,CAAAF,UAAU,SAAV,IAAAA,UAAU,WAAV,iCAAAA,UAAU,CAAEG,KAAZ,wEAAmBC,UAAnB,KAAiC,EAAxD;;AAEA,MACC,CAAC,CAAEH,uBAAH,KACE,SAASA,uBAAT,IACDI,MAAM,CAACC,IAAP,CAAaL,uBAAb,EAAuCM,MAAvC,KAAkD,CAFnD,CADD,EAIE;AAAA;;AACD,UAAMC,WAAW,GAChB,iDAAiC;AAChCC,MAAAA,QAAQ,EAAET,UAAF,aAAEA,UAAF,6CAAEA,UAAU,CAAEG,KAAd,gFAAE,mBAAmBC,UAArB,0DAAE,sBAA+BK,QADT;AAEhCC,MAAAA,oBAAoB,EAAET,uBAAF,aAAEA,uBAAF,uBAAEA,uBAAuB,CAAEU;AAFf,KAAjC,MAGOX,UAHP,aAGOA,UAHP,6CAGOA,UAAU,CAAEG,KAHnB,gFAGO,mBAAmBC,UAH1B,0DAGO,sBAA+BK,QAHtC,CADD;AAKAP,IAAAA,gBAAgB,GAAG,EAClB,GAAGA,gBADe;AAElBO,MAAAA,QAAQ,EAAED;AAFQ,KAAnB;AAIA;;AAED,QAAML,KAAK,GAAG,4BAAiB;AAAEC,IAAAA,UAAU,EAAEF;AAAd,GAAjB,CAAd;AACA,QAAMU,mBAAmB,GAAG,CAAC,EAAEZ,UAAF,aAAEA,UAAF,eAAEA,UAAU,CAAEa,UAAd,CAAD,GACxB,OAAO,uBAAWb,UAAU,CAACa,UAAtB,CAAoC,cADnB,GAEzB,EAFH;AAIA,QAAMC,SAAS,GAAG,yBACjBF,mBADiB,EAEjB,iCAAkBZ,UAAlB,aAAkBA,UAAlB,uBAAkBA,UAAU,CAAES,QAA9B,CAFiB,CAAlB;AAKA,SAAO;AACNK,IAAAA,SADM;AAENX,IAAAA;AAFM,GAAP;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport { getFontSizeClass } from '../components/font-sizes';\nimport { getComputedFluidTypographyValue } from '../components/font-sizes/fluid-utils';\n\n// This utility is intended to assist where the serialization of the typography\n// block support is being skipped for a block but the typography related CSS\n// styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's typography support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n * @param {Object|boolean} fluidTypographySettings If boolean, whether the function should try to convert font sizes to fluid values,\n * otherwise an object containing theme fluid typography settings.\n *\n * @return {Object} Typography block support derived CSS classes & styles.\n */\nexport function getTypographyClassesAndStyles(\n\tattributes,\n\tfluidTypographySettings\n) {\n\tlet typographyStyles = attributes?.style?.typography || {};\n\n\tif (\n\t\t!! fluidTypographySettings &&\n\t\t( true === fluidTypographySettings ||\n\t\t\tObject.keys( fluidTypographySettings ).length !== 0 )\n\t) {\n\t\tconst newFontSize =\n\t\t\tgetComputedFluidTypographyValue( {\n\t\t\t\tfontSize: attributes?.style?.typography?.fontSize,\n\t\t\t\tminimumFontSizeLimit: fluidTypographySettings?.minFontSize,\n\t\t\t} ) || attributes?.style?.typography?.fontSize;\n\t\ttypographyStyles = {\n\t\t\t...typographyStyles,\n\t\t\tfontSize: newFontSize,\n\t\t};\n\t}\n\n\tconst style = getInlineStyles( { typography: typographyStyles } );\n\tconst fontFamilyClassName = !! attributes?.fontFamily\n\t\t? `has-${ kebabCase( attributes.fontFamily ) }-font-family`\n\t\t: '';\n\n\tconst className = classnames(\n\t\tfontFamilyClassName,\n\t\tgetFontSizeClass( attributes?.fontSize )\n\t);\n\n\treturn {\n\t\tclassName,\n\t\tstyle,\n\t};\n}\n"]}
|
package/build/store/reducer.js
CHANGED
|
@@ -33,8 +33,6 @@ exports.temporarilyEditingAsBlocks = temporarilyEditingAsBlocks;
|
|
|
33
33
|
|
|
34
34
|
var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
|
|
35
35
|
|
|
36
|
-
var _lodash = require("lodash");
|
|
37
|
-
|
|
38
36
|
var _compose = require("@wordpress/compose");
|
|
39
37
|
|
|
40
38
|
var _data = require("@wordpress/data");
|
|
@@ -175,7 +173,13 @@ function getFlattenedClientIds(blocks) {
|
|
|
175
173
|
|
|
176
174
|
|
|
177
175
|
function getFlattenedBlocksWithoutAttributes(blocks) {
|
|
178
|
-
return flattenBlocks(blocks, block =>
|
|
176
|
+
return flattenBlocks(blocks, block => {
|
|
177
|
+
const {
|
|
178
|
+
attributes,
|
|
179
|
+
...restBlock
|
|
180
|
+
} = block;
|
|
181
|
+
return restBlock;
|
|
182
|
+
});
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
181
185
|
* Given an array of blocks, returns an object containing all block attributes,
|
|
@@ -775,9 +779,12 @@ withBlockReset, withPersistentBlockChange, withIgnoredBlockChange, withResetCont
|
|
|
775
779
|
} // Do nothing if only attributes change.
|
|
776
780
|
|
|
777
781
|
|
|
778
|
-
const
|
|
782
|
+
const {
|
|
783
|
+
attributes,
|
|
784
|
+
...changes
|
|
785
|
+
} = action.updates;
|
|
779
786
|
|
|
780
|
-
if (
|
|
787
|
+
if (Object.values(changes).length === 0) {
|
|
781
788
|
return state;
|
|
782
789
|
}
|
|
783
790
|
|
|
@@ -1686,7 +1693,10 @@ const blockListSettings = function () {
|
|
|
1686
1693
|
case 'REPLACE_BLOCKS':
|
|
1687
1694
|
case 'REMOVE_BLOCKS':
|
|
1688
1695
|
{
|
|
1689
|
-
return (
|
|
1696
|
+
return Object.fromEntries(Object.entries(state).filter(_ref10 => {
|
|
1697
|
+
let [id] = _ref10;
|
|
1698
|
+
return !action.clientIds.includes(id);
|
|
1699
|
+
}));
|
|
1690
1700
|
}
|
|
1691
1701
|
|
|
1692
1702
|
case 'UPDATE_BLOCK_LIST_SETTINGS':
|
|
@@ -1697,7 +1707,11 @@ const blockListSettings = function () {
|
|
|
1697
1707
|
|
|
1698
1708
|
if (!action.settings) {
|
|
1699
1709
|
if (state.hasOwnProperty(clientId)) {
|
|
1700
|
-
|
|
1710
|
+
const {
|
|
1711
|
+
[clientId]: removedBlock,
|
|
1712
|
+
...restBlocks
|
|
1713
|
+
} = state;
|
|
1714
|
+
return restBlocks;
|
|
1701
1715
|
}
|
|
1702
1716
|
|
|
1703
1717
|
return state;
|
|
@@ -1897,14 +1911,18 @@ function lastBlockInserted() {
|
|
|
1897
1911
|
|
|
1898
1912
|
switch (action.type) {
|
|
1899
1913
|
case 'INSERT_BLOCKS':
|
|
1914
|
+
case 'REPLACE_BLOCKS':
|
|
1915
|
+
case 'REPLACE_INNER_BLOCKS':
|
|
1900
1916
|
if (!action.blocks.length) {
|
|
1901
1917
|
return state;
|
|
1902
1918
|
}
|
|
1903
1919
|
|
|
1904
|
-
const
|
|
1920
|
+
const clientIds = action.blocks.map(block => {
|
|
1921
|
+
return block.clientId;
|
|
1922
|
+
});
|
|
1905
1923
|
const source = (_action$meta = action.meta) === null || _action$meta === void 0 ? void 0 : _action$meta.source;
|
|
1906
1924
|
return {
|
|
1907
|
-
|
|
1925
|
+
clientIds,
|
|
1908
1926
|
source
|
|
1909
1927
|
};
|
|
1910
1928
|
|