@wordpress/block-editor 8.1.2-next.f435e9e01b.0 → 8.2.1-next.a55ed9455a.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 +11 -1
- package/README.md +6 -26
- package/build/autocompleters/link.js +78 -0
- package/build/autocompleters/link.js.map +1 -0
- package/build/components/autocomplete/index.js +3 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/block-actions/index.js +1 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +4 -2
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/index.js +2 -2
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-controls/index.js +1 -1
- package/build/components/block-controls/index.js.map +1 -1
- package/build/components/block-draggable/index.js +1 -1
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-edit/edit.js +1 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/block-html.js +1 -1
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +1 -1
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block-list-item.native.js +4 -4
- package/build/components/block-list/block-list-item.native.js.map +1 -1
- package/build/components/block-list/block-selection-button.native.js +4 -3
- package/build/components/block-list/block-selection-button.native.js.map +1 -1
- package/build/components/block-list/block.js +17 -3
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +6 -6
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +5 -5
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/build/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +3 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-block-props/use-multi-selection.js +25 -27
- package/build/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +4 -4
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- 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-mover/mover-description.js +4 -4
- package/build/components/block-mover/mover-description.js.map +1 -1
- package/build/components/block-mover/mover-description.native.js +5 -5
- package/build/components/block-mover/mover-description.native.js.map +1 -1
- package/build/components/block-settings/container.native.js +1 -5
- package/build/components/block-settings/container.native.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -12
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/preview.native.js +1 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/index.js +2 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build/components/block-title/index.js +7 -62
- package/build/components/block-title/index.js.map +1 -1
- package/build/components/block-title/use-block-display-title.js +94 -0
- package/build/components/block-title/use-block-display-title.js.map +1 -0
- package/build/components/block-toolbar/utils.js +9 -1
- package/build/components/block-toolbar/utils.js.map +1 -1
- package/build/components/block-tools/block-popover.js +1 -1
- package/build/components/block-tools/block-popover.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +2 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/block-types-list/index.native.js +1 -1
- package/build/components/block-types-list/index.native.js.map +1 -1
- package/build/components/border-radius-control/index.js +2 -2
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +10 -6
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/contrast-checker/index.js +3 -3
- package/build/components/contrast-checker/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +1 -1
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/copy-handler/index.js +3 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +3 -3
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js +38 -1
- package/build/components/index.native.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/block-types-tab.js +1 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/index.js +3 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +7 -7
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/menu.native.js +3 -3
- package/build/components/inserter/menu.native.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +20 -8
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +1 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +28 -11
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/letter-spacing-control/index.js +3 -3
- package/build/components/letter-spacing-control/index.js.map +1 -1
- package/build/components/line-height-control/index.js +63 -45
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/line-height-control/index.native.js +3 -1
- package/build/components/line-height-control/index.native.js.map +1 -1
- package/build/components/link-control/index.js +2 -2
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/search-results.js +2 -2
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/use-rich-url-data.js +1 -1
- package/build/components/link-control/use-rich-url-data.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +2 -2
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-contents.js +8 -4
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block-select-button.js +2 -2
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +20 -9
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +2 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +49 -41
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +139 -0
- package/build/components/list-view/use-block-selection.js.map +1 -0
- package/build/components/list-view/use-list-view-expand-selected-item.js +60 -0
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
- package/build/components/list-view/utils.js +29 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +7 -5
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +20 -24
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +4 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/media-upload-progress/index.native.js +1 -1
- package/build/components/media-upload-progress/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +3 -3
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +3 -3
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +2 -2
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.native.js +1 -1
- package/build/components/rich-text/format-toolbar-container.native.js.map +1 -1
- package/build/components/rich-text/index.js +7 -12
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +3 -3
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +7 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/url-input/index.js +11 -11
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +1 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +2 -2
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -0
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/components/writing-flow/use-multi-selection.js +22 -24
- package/build/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build/components/writing-flow/use-select-all.js +3 -2
- package/build/components/writing-flow/use-select-all.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +4 -3
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/hooks/align.js +1 -1
- 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 +2 -14
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +2 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/custom-class-name.js +40 -0
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/generated-class-name.js +3 -3
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/line-height.js +2 -0
- package/build/hooks/line-height.js.map +1 -1
- package/build/hooks/lock.js +1 -1
- package/build/hooks/lock.js.map +1 -1
- package/build/hooks/style.js +32 -13
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/flow.js +7 -5
- package/build/layouts/flow.js.map +1 -1
- package/build/store/actions.js +55 -48
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +2 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +1 -2
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +13 -13
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -6
- package/build/store/selectors.js.map +1 -1
- package/build/utils/index.js +0 -14
- package/build/utils/index.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +3 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build/utils/pasting.js +91 -0
- package/build/utils/pasting.js.map +1 -0
- package/build/utils/transform-styles/ast/parse.js +5 -5
- package/build/utils/transform-styles/ast/parse.js.map +1 -1
- package/build/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
- package/build-module/autocompleters/link.js +64 -0
- package/build-module/autocompleters/link.js.map +1 -0
- package/build-module/components/autocomplete/index.js +2 -1
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +1 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -2
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/index.js +2 -2
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/index.js +1 -1
- package/build-module/components/block-controls/index.js.map +1 -1
- package/build-module/components/block-draggable/index.js +1 -1
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +1 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/block-html.js +1 -1
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-list-item.native.js +4 -4
- package/build-module/components/block-list/block-list-item.native.js.map +1 -1
- package/build-module/components/block-list/block-selection-button.native.js +4 -3
- package/build-module/components/block-list/block-selection-button.native.js.map +1 -1
- package/build-module/components/block-list/block.js +18 -4
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +7 -7
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +5 -5
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/build-module/components/block-list/use-block-props/use-block-class-names.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +2 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-multi-selection.js +23 -28
- package/build-module/components/block-list/use-block-props/use-multi-selection.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +4 -4
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- 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-mover/mover-description.js +4 -4
- package/build-module/components/block-mover/mover-description.js.map +1 -1
- package/build-module/components/block-mover/mover-description.native.js +5 -5
- package/build-module/components/block-mover/mover-description.native.js.map +1 -1
- package/build-module/components/block-settings/container.native.js +2 -6
- package/build-module/components/block-settings/container.native.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -13
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +1 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/index.js +2 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js +0 -1
- package/build-module/components/block-switcher/use-transformed-patterns.js.map +1 -1
- package/build-module/components/block-title/index.js +7 -58
- package/build-module/components/block-title/index.js.map +1 -1
- package/build-module/components/block-title/use-block-display-title.js +80 -0
- package/build-module/components/block-title/use-block-display-title.js.map +1 -0
- package/build-module/components/block-toolbar/utils.js +9 -1
- package/build-module/components/block-toolbar/utils.js.map +1 -1
- package/build-module/components/block-tools/block-popover.js +1 -1
- package/build-module/components/block-tools/block-popover.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +2 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/block-types-list/index.native.js +1 -1
- package/build-module/components/block-types-list/index.native.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +3 -3
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +11 -7
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/contrast-checker/index.js +3 -3
- package/build-module/components/contrast-checker/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +1 -1
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -3
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/copy-handler/index.js +2 -2
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +3 -3
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js +5 -4
- package/build-module/components/index.native.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/block-types-tab.js +1 -1
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +7 -7
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/menu.native.js +3 -3
- package/build-module/components/inserter/menu.native.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +20 -8
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +1 -1
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +28 -11
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/letter-spacing-control/index.js +3 -3
- package/build-module/components/letter-spacing-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +61 -45
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/line-height-control/index.native.js +3 -1
- package/build-module/components/line-height-control/index.native.js.map +1 -1
- package/build-module/components/link-control/index.js +2 -2
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/search-results.js +2 -2
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/use-rich-url-data.js +1 -1
- package/build-module/components/link-control/use-rich-url-data.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +2 -2
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +8 -4
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +2 -2
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +20 -9
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +2 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +46 -42
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +123 -0
- package/build-module/components/list-view/use-block-selection.js.map +1 -0
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +50 -0
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -0
- package/build-module/components/list-view/utils.js +25 -0
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +7 -5
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +22 -27
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +4 -3
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/media-upload-progress/index.native.js +1 -1
- package/build-module/components/media-upload-progress/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +3 -3
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +3 -3
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +2 -2
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.native.js +1 -1
- package/build-module/components/rich-text/format-toolbar-container.native.js.map +1 -1
- package/build-module/components/rich-text/index.js +7 -12
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +3 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +6 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/url-input/index.js +11 -11
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +1 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +2 -2
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -0
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/components/writing-flow/use-multi-selection.js +21 -21
- package/build-module/components/writing-flow/use-multi-selection.js.map +1 -1
- package/build-module/components/writing-flow/use-select-all.js +3 -2
- package/build-module/components/writing-flow/use-select-all.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +4 -3
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/hooks/align.js +1 -1
- 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 +2 -14
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +2 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +38 -0
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/generated-class-name.js +3 -3
- package/build-module/hooks/generated-class-name.js.map +1 -1
- package/build-module/hooks/line-height.js +2 -0
- package/build-module/hooks/line-height.js.map +1 -1
- package/build-module/hooks/lock.js +1 -1
- package/build-module/hooks/lock.js.map +1 -1
- package/build-module/hooks/style.js +31 -13
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/flow.js +7 -5
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/actions.js +52 -45
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +2 -1
- package/build-module/store/defaults.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 +13 -13
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/index.js +0 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +3 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/utils/pasting.js +80 -0
- package/build-module/utils/pasting.js.map +1 -0
- package/build-module/utils/transform-styles/ast/parse.js +5 -5
- package/build-module/utils/transform-styles/ast/parse.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +1 -1
- package/build-style/style-rtl.css +10 -12
- package/build-style/style.css +10 -12
- package/package.json +27 -26
- package/src/autocompleters/link.js +62 -0
- package/src/autocompleters/style.scss +8 -0
- package/src/components/alignment-control/test/index.js +2 -2
- package/src/components/autocomplete/index.js +2 -0
- package/src/components/block-actions/index.js +1 -1
- package/src/components/block-alignment-control/test/index.js +1 -1
- package/src/components/block-breadcrumb/index.js +5 -2
- package/src/components/block-compare/index.js +2 -2
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-draggable/index.js +1 -1
- package/src/components/block-draggable/stories/index.js +1 -1
- package/src/components/block-edit/edit.js +1 -1
- package/src/components/block-list/block-html.js +1 -1
- package/src/components/block-list/block-invalid-warning.js +1 -1
- package/src/components/block-list/block-list-item.native.js +4 -4
- package/src/components/block-list/block-selection-button.native.js +3 -3
- package/src/components/block-list/block.js +28 -4
- package/src/components/block-list/block.native.js +7 -6
- package/src/components/block-list/index.native.js +5 -5
- package/src/components/block-list/style.scss +3 -1
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +3 -0
- package/src/components/block-list/use-block-props/use-multi-selection.js +22 -30
- package/src/components/block-media-update-progress/index.native.js +4 -4
- package/src/components/block-media-update-progress/test/index.native.js +2 -2
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +3 -3
- package/src/components/block-mobile-toolbar/index.native.js +2 -2
- package/src/components/block-mover/mover-description.js +4 -4
- package/src/components/block-mover/mover-description.native.js +5 -5
- package/src/components/block-settings/container.native.js +5 -6
- package/src/components/block-settings-menu/block-settings-dropdown.js +7 -8
- package/src/components/block-styles/preview.native.js +1 -1
- package/src/components/block-switcher/index.js +4 -1
- package/src/components/block-switcher/use-transformed-patterns.js +0 -1
- package/src/components/block-title/README.md +17 -1
- package/src/components/block-title/index.js +7 -62
- package/src/components/block-title/test/index.js +21 -3
- package/src/components/block-title/use-block-display-title.js +83 -0
- package/src/components/block-toolbar/utils.js +12 -2
- package/src/components/block-tools/block-popover.js +1 -1
- package/src/components/block-tools/block-selection-button.js +4 -1
- package/src/components/block-types-list/index.native.js +1 -1
- package/src/components/border-radius-control/index.js +5 -3
- package/src/components/border-radius-control/test/utils.js +10 -10
- package/src/components/border-radius-control/utils.js +10 -8
- package/src/components/contrast-checker/index.js +3 -3
- package/src/components/convert-to-group-buttons/index.js +1 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +1 -6
- package/src/components/copy-handler/index.js +2 -2
- package/src/components/font-sizes/with-font-sizes.js +3 -3
- package/src/components/image-size-control/test/index.js +1 -1
- package/src/components/index.js +1 -0
- package/src/components/index.native.js +11 -4
- package/src/components/inserter/block-patterns-tab.js +13 -17
- package/src/components/inserter/block-types-tab.js +1 -1
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +2 -2
- package/src/components/inserter/index.js +3 -3
- package/src/components/inserter/index.native.js +7 -7
- package/src/components/inserter/menu.js +1 -1
- package/src/components/inserter/menu.native.js +3 -3
- package/src/components/inserter/quick-inserter.js +32 -10
- package/src/components/inserter/search-items.js +1 -1
- package/src/components/inserter/search-results.js +55 -43
- package/src/components/inserter/test/fixtures/index.native.js +1 -1
- package/src/components/inserter/test/reusable-blocks-tab.js +2 -2
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/letter-spacing-control/index.js +1 -1
- package/src/components/line-height-control/README.md +13 -2
- package/src/components/line-height-control/index.js +66 -43
- package/src/components/line-height-control/index.native.js +2 -0
- package/src/components/line-height-control/stories/index.js +33 -0
- package/src/components/line-height-control/test/index.js +61 -0
- package/src/components/link-control/index.js +2 -2
- package/src/components/link-control/search-input.js +1 -1
- package/src/components/link-control/search-results.js +2 -2
- package/src/components/link-control/test/index.js +142 -144
- package/src/components/link-control/use-rich-url-data.js +1 -1
- package/src/components/link-control/use-search-handler.js +2 -2
- package/src/components/list-view/README.md +2 -2
- package/src/components/list-view/block-contents.js +10 -3
- package/src/components/list-view/block-select-button.js +1 -2
- package/src/components/list-view/block.js +30 -10
- package/src/components/list-view/branch.js +1 -0
- package/src/components/list-view/index.js +56 -30
- package/src/components/list-view/test/utils.js +50 -0
- package/src/components/list-view/use-block-selection.js +163 -0
- package/src/components/list-view/use-list-view-expand-selected-item.js +58 -0
- package/src/components/list-view/utils.js +31 -0
- package/src/components/media-placeholder/index.native.js +11 -9
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +20 -26
- package/src/components/media-replace-flow/test/index.js +100 -0
- package/src/components/media-upload/index.native.js +3 -2
- package/src/components/media-upload-progress/index.native.js +1 -1
- package/src/components/navigable-toolbar/index.js +3 -3
- package/src/components/plain-text/index.native.js +3 -3
- package/src/components/responsive-block-control/test/index.js +6 -6
- package/src/components/rich-text/format-toolbar-container.js +2 -2
- package/src/components/rich-text/format-toolbar-container.native.js +1 -1
- package/src/components/rich-text/index.js +7 -14
- package/src/components/rich-text/index.native.js +3 -3
- package/src/components/rich-text/use-paste-handler.js +7 -14
- package/src/components/url-input/index.js +11 -11
- package/src/components/use-block-drop-zone/test/index.js +1 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-on-block-drop/index.js +2 -2
- package/src/components/writing-flow/index.js +1 -0
- package/src/components/writing-flow/use-multi-selection.js +17 -20
- package/src/components/writing-flow/use-select-all.js +6 -2
- package/src/components/writing-flow/use-tab-nav.js +6 -3
- package/src/hooks/align.js +1 -1
- package/src/hooks/anchor.js +1 -1
- package/src/hooks/border.js +8 -19
- package/src/hooks/color.js +2 -2
- package/src/hooks/custom-class-name.js +45 -0
- package/src/hooks/generated-class-name.js +3 -3
- package/src/hooks/line-height.js +2 -0
- package/src/hooks/lock.js +1 -1
- package/src/hooks/style.js +31 -13
- package/src/hooks/test/align.js +1 -1
- package/src/hooks/typography.scss +0 -4
- package/src/layouts/flow.js +10 -5
- package/src/store/actions.js +24 -14
- package/src/store/defaults.js +2 -2
- package/src/store/index.js +0 -1
- package/src/store/reducer.js +13 -12
- package/src/store/selectors.js +6 -6
- package/src/store/test/actions.js +2 -2
- package/src/store/test/reducer.js +10 -1
- package/src/store/test/selectors.js +1 -1
- package/src/style.scss +0 -1
- package/src/utils/index.js +0 -1
- package/src/utils/parse-css-unit-to-px.js +3 -3
- package/src/utils/pasting.js +77 -0
- package/src/utils/test/parse-css-unit-to-px.js +5 -5
- package/src/utils/test/pasting.js +84 -0
- package/src/utils/transform-styles/ast/parse.js +5 -5
- package/src/utils/transform-styles/transforms/url-rewrite.js +2 -2
- package/build/utils/get-paste-event-data.js +0 -56
- package/build/utils/get-paste-event-data.js.map +0 -1
- package/build/utils/theme.js +0 -63
- package/build/utils/theme.js.map +0 -1
- package/build-module/utils/get-paste-event-data.js +0 -47
- package/build-module/utils/get-paste-event-data.js.map +0 -1
- package/build-module/utils/theme.js +0 -53
- package/build-module/utils/theme.js.map +0 -1
- package/src/components/line-height-control/style.scss +0 -8
- package/src/components/writing-flow/test/use-multi-selection.js +0 -36
- package/src/utils/get-paste-event-data.js +0 -42
- package/src/utils/theme.js +0 -48
package/src/store/reducer.js
CHANGED
|
@@ -216,7 +216,7 @@ function updateParentInnerBlocksInTree(
|
|
|
216
216
|
controlledParents.add( current );
|
|
217
217
|
break;
|
|
218
218
|
} else {
|
|
219
|
-
//
|
|
219
|
+
// Else continue traversing up through parents.
|
|
220
220
|
uncontrolledParents.add( current );
|
|
221
221
|
current = state.parents[ current ];
|
|
222
222
|
}
|
|
@@ -611,7 +611,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
|
|
|
611
611
|
const subTree = buildBlockTree( newState, action.blocks );
|
|
612
612
|
newState.tree = {
|
|
613
613
|
...subTree,
|
|
614
|
-
// Root
|
|
614
|
+
// Root.
|
|
615
615
|
'': {
|
|
616
616
|
innerBlocks: action.blocks.map(
|
|
617
617
|
( subBlock ) => subTree[ subBlock.clientId ]
|
|
@@ -712,7 +712,7 @@ const withSaveReusableBlock = ( reducer ) => ( state, action ) => {
|
|
|
712
712
|
if ( state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS' ) {
|
|
713
713
|
const { id, updatedId } = action;
|
|
714
714
|
|
|
715
|
-
// If a temporary reusable block is saved, we swap the temporary id with the final one
|
|
715
|
+
// If a temporary reusable block is saved, we swap the temporary id with the final one.
|
|
716
716
|
if ( id === updatedId ) {
|
|
717
717
|
return state;
|
|
718
718
|
}
|
|
@@ -769,10 +769,10 @@ const withResetControlledBlocks = ( reducer ) => ( state, action ) => {
|
|
|
769
769
|
*/
|
|
770
770
|
export const blocks = flow(
|
|
771
771
|
combineReducers,
|
|
772
|
-
withSaveReusableBlock, //
|
|
773
|
-
withBlockTree, //
|
|
772
|
+
withSaveReusableBlock, // Needs to be before withBlockCache.
|
|
773
|
+
withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
|
|
774
774
|
withInnerBlocksRemoveCascade,
|
|
775
|
-
withReplaceInnerBlocks, //
|
|
775
|
+
withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
|
|
776
776
|
withBlockReset,
|
|
777
777
|
withPersistentBlockChange,
|
|
778
778
|
withIgnoredBlockChange,
|
|
@@ -788,7 +788,7 @@ export const blocks = flow(
|
|
|
788
788
|
};
|
|
789
789
|
|
|
790
790
|
case 'UPDATE_BLOCK':
|
|
791
|
-
// Ignore updates if block isn't known
|
|
791
|
+
// Ignore updates if block isn't known.
|
|
792
792
|
if ( ! state[ action.clientId ] ) {
|
|
793
793
|
return state;
|
|
794
794
|
}
|
|
@@ -947,7 +947,7 @@ export const blocks = flow(
|
|
|
947
947
|
} = action;
|
|
948
948
|
const { index = state[ toRootClientId ].length } = action;
|
|
949
949
|
|
|
950
|
-
// Moving inside the same parent block
|
|
950
|
+
// Moving inside the same parent block.
|
|
951
951
|
if ( fromRootClientId === toRootClientId ) {
|
|
952
952
|
const subState = state[ toRootClientId ];
|
|
953
953
|
const fromIndex = subState.indexOf( clientIds[ 0 ] );
|
|
@@ -962,7 +962,7 @@ export const blocks = flow(
|
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
|
|
965
|
-
// Moving from a parent block to another
|
|
965
|
+
// Moving from a parent block to another.
|
|
966
966
|
return {
|
|
967
967
|
...state,
|
|
968
968
|
[ fromRootClientId ]: without(
|
|
@@ -1068,10 +1068,10 @@ export const blocks = flow(
|
|
|
1068
1068
|
|
|
1069
1069
|
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
|
1070
1070
|
return flow( [
|
|
1071
|
-
// Remove inner block ordering for removed blocks
|
|
1071
|
+
// Remove inner block ordering for removed blocks.
|
|
1072
1072
|
( nextState ) => omit( nextState, action.removedClientIds ),
|
|
1073
1073
|
|
|
1074
|
-
// Remove deleted blocks from other blocks' orderings
|
|
1074
|
+
// Remove deleted blocks from other blocks' orderings.
|
|
1075
1075
|
( nextState ) =>
|
|
1076
1076
|
mapValues( nextState, ( subState ) =>
|
|
1077
1077
|
without( subState, ...action.removedClientIds )
|
|
@@ -1380,7 +1380,7 @@ export function isSelectionEnabled( state = true, action ) {
|
|
|
1380
1380
|
}
|
|
1381
1381
|
|
|
1382
1382
|
/**
|
|
1383
|
-
* Reducer returning the
|
|
1383
|
+
* Reducer returning the initial block selection.
|
|
1384
1384
|
*
|
|
1385
1385
|
* Currently this in only used to restore the selection after block deletion and
|
|
1386
1386
|
* pasting new content.This reducer should eventually be removed in favour of setting
|
|
@@ -1399,6 +1399,7 @@ export function initialPosition( state = null, action ) {
|
|
|
1399
1399
|
return action.initialPosition;
|
|
1400
1400
|
} else if (
|
|
1401
1401
|
[
|
|
1402
|
+
'MULTI_SELECT',
|
|
1402
1403
|
'SELECT_BLOCK',
|
|
1403
1404
|
'RESET_SELECTION',
|
|
1404
1405
|
'INSERT_BLOCKS',
|
package/src/store/selectors.js
CHANGED
|
@@ -44,7 +44,7 @@ import { symbol } from '@wordpress/icons';
|
|
|
44
44
|
* text value. See `wp.richText.create`.
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
// Module constants
|
|
47
|
+
// Module constants.
|
|
48
48
|
const MILLISECONDS_PER_HOUR = 3600 * 1000;
|
|
49
49
|
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
|
|
50
50
|
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
|
|
@@ -1359,7 +1359,7 @@ export function canRemoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1359
1359
|
return ! parentIsLocked;
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
-
//
|
|
1362
|
+
// When remove is true, it means we cannot remove it.
|
|
1363
1363
|
return ! lock?.remove;
|
|
1364
1364
|
}
|
|
1365
1365
|
|
|
@@ -1400,7 +1400,7 @@ export function canMoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1400
1400
|
return ! parentIsLocked;
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
|
-
//
|
|
1403
|
+
// When move is true, it means we cannot move it.
|
|
1404
1404
|
return ! lock?.move;
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
@@ -1554,7 +1554,7 @@ const buildBlockTypeItem = ( state, { buildScope = 'inserter' } ) => (
|
|
|
1554
1554
|
keywords: blockType.keywords,
|
|
1555
1555
|
variations: inserterVariations,
|
|
1556
1556
|
example: blockType.example,
|
|
1557
|
-
utility: 1, //
|
|
1557
|
+
utility: 1, // Deprecated.
|
|
1558
1558
|
};
|
|
1559
1559
|
};
|
|
1560
1560
|
|
|
@@ -1654,7 +1654,7 @@ export const getInserterItems = createSelector(
|
|
|
1654
1654
|
category: 'reusable',
|
|
1655
1655
|
keywords: [],
|
|
1656
1656
|
isDisabled: false,
|
|
1657
|
-
utility: 1, //
|
|
1657
|
+
utility: 1, // Deprecated.
|
|
1658
1658
|
frecency,
|
|
1659
1659
|
};
|
|
1660
1660
|
};
|
|
@@ -1675,7 +1675,7 @@ export const getInserterItems = createSelector(
|
|
|
1675
1675
|
|
|
1676
1676
|
const items = blockTypeInserterItems.reduce( ( accumulator, item ) => {
|
|
1677
1677
|
const { variations = [] } = item;
|
|
1678
|
-
// Exclude any block type item that is to be replaced by a default variation
|
|
1678
|
+
// Exclude any block type item that is to be replaced by a default variation.
|
|
1679
1679
|
if ( ! variations.some( ( { isDefault } ) => isDefault ) ) {
|
|
1680
1680
|
accumulator.push( item );
|
|
1681
1681
|
}
|
|
@@ -151,7 +151,7 @@ describe( 'actions', () => {
|
|
|
151
151
|
const end = 'end';
|
|
152
152
|
const select = {
|
|
153
153
|
getBlockRootClientId() {
|
|
154
|
-
return 'parent'; //
|
|
154
|
+
return 'parent'; // For all client IDs.
|
|
155
155
|
},
|
|
156
156
|
getSelectedBlockCount() {
|
|
157
157
|
return 0;
|
|
@@ -165,6 +165,7 @@ describe( 'actions', () => {
|
|
|
165
165
|
type: 'MULTI_SELECT',
|
|
166
166
|
start,
|
|
167
167
|
end,
|
|
168
|
+
initialPosition: 0,
|
|
168
169
|
} );
|
|
169
170
|
} );
|
|
170
171
|
|
|
@@ -1166,7 +1167,6 @@ describe( 'actions', () => {
|
|
|
1166
1167
|
actions,
|
|
1167
1168
|
selectors,
|
|
1168
1169
|
reducer,
|
|
1169
|
-
__experimentalUseThunks: true,
|
|
1170
1170
|
} );
|
|
1171
1171
|
|
|
1172
1172
|
registerBlockType( 'core/test-block', defaultBlockSettings );
|
|
@@ -630,7 +630,7 @@ describe( 'state', () => {
|
|
|
630
630
|
controlledInnerBlocks: {},
|
|
631
631
|
} );
|
|
632
632
|
|
|
633
|
-
//
|
|
633
|
+
// The block object of the parent should be updated.
|
|
634
634
|
expect( state.tree.chicken ).not.toBe(
|
|
635
635
|
existingState.tree.chicken
|
|
636
636
|
);
|
|
@@ -2187,6 +2187,15 @@ describe( 'state', () => {
|
|
|
2187
2187
|
|
|
2188
2188
|
expect( state ).toBe( -1 );
|
|
2189
2189
|
} );
|
|
2190
|
+
|
|
2191
|
+
it( 'should allow setting null value in multi selection', () => {
|
|
2192
|
+
const state = initialPosition( undefined, {
|
|
2193
|
+
type: 'MULTI_SELECT',
|
|
2194
|
+
initialPosition: null,
|
|
2195
|
+
} );
|
|
2196
|
+
|
|
2197
|
+
expect( state ).toBe( null );
|
|
2198
|
+
} );
|
|
2190
2199
|
} );
|
|
2191
2200
|
|
|
2192
2201
|
describe( 'isMultiSelecting()', () => {
|
|
@@ -3074,7 +3074,7 @@ describe( 'selectors', () => {
|
|
|
3074
3074
|
} );
|
|
3075
3075
|
|
|
3076
3076
|
it( 'should return empty object if settings for the blocks don’t exist', () => {
|
|
3077
|
-
// Does not include target Block clientIds
|
|
3077
|
+
// Does not include target Block clientIds.
|
|
3078
3078
|
const state = {
|
|
3079
3079
|
blockListSettings: {
|
|
3080
3080
|
'test-2-dummy-clientId': {
|
package/src/style.scss
CHANGED
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
@import "./components/inner-blocks/style.scss";
|
|
37
37
|
@import "./components/inserter-list-item/style.scss";
|
|
38
38
|
@import "./components/justify-content-control/style.scss";
|
|
39
|
-
@import "./components/line-height-control/style.scss";
|
|
40
39
|
@import "./components/link-control/style.scss";
|
|
41
40
|
@import "./components/list-view/style.scss";
|
|
42
41
|
@import "./components/media-replace-flow/style.scss";
|
package/src/utils/index.js
CHANGED
|
@@ -86,7 +86,7 @@ function parseUnitFunction( cssUnit ) {
|
|
|
86
86
|
cssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//
|
|
89
|
+
// If the unit hasn't been modified or we have a single value break free.
|
|
90
90
|
if ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
@@ -123,7 +123,7 @@ function evalMathExpression( cssUnit ) {
|
|
|
123
123
|
const parsedUnit = parseUnit( getPxFromCssUnit( unit ) );
|
|
124
124
|
if ( ! parseFloat( parsedUnit.value ) ) {
|
|
125
125
|
errorFound = true;
|
|
126
|
-
//
|
|
126
|
+
// End early since we are dealing with a null value.
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
cssUnit = cssUnit.replace( unit, parsedUnit.value );
|
|
@@ -171,7 +171,7 @@ function convertParsedUnitToPx( parsedUnit, options ) {
|
|
|
171
171
|
? setOptions.fontSize
|
|
172
172
|
: setOptions.width ) * ONE_PERCENT,
|
|
173
173
|
ch: 8, // The advance measure (width) of the glyph "0" of the element's font. Approximate
|
|
174
|
-
ex: 7.15625, //
|
|
174
|
+
ex: 7.15625, // X-height of the element's font. Approximate.
|
|
175
175
|
lh: setOptions.lineHeight,
|
|
176
176
|
};
|
|
177
177
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlobURL } from '@wordpress/blob';
|
|
5
|
+
import { getFilesFromDataTransfer } from '@wordpress/dom';
|
|
6
|
+
|
|
7
|
+
export function getPasteEventData( { clipboardData } ) {
|
|
8
|
+
let plainText = '';
|
|
9
|
+
let html = '';
|
|
10
|
+
|
|
11
|
+
// IE11 only supports `Text` as an argument for `getData` and will
|
|
12
|
+
// otherwise throw an invalid argument error, so we try the standard
|
|
13
|
+
// arguments first, then fallback to `Text` if they fail.
|
|
14
|
+
try {
|
|
15
|
+
plainText = clipboardData.getData( 'text/plain' );
|
|
16
|
+
html = clipboardData.getData( 'text/html' );
|
|
17
|
+
} catch ( error1 ) {
|
|
18
|
+
try {
|
|
19
|
+
html = clipboardData.getData( 'Text' );
|
|
20
|
+
} catch ( error2 ) {
|
|
21
|
+
// Some browsers like UC Browser paste plain text by default and
|
|
22
|
+
// don't support clipboardData at all, so allow default
|
|
23
|
+
// behaviour.
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const files = getFilesFromDataTransfer(
|
|
29
|
+
clipboardData
|
|
30
|
+
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif|webp)$/.test( type ) );
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
files.length &&
|
|
34
|
+
! shouldDismissPastedFiles( files, html, plainText )
|
|
35
|
+
) {
|
|
36
|
+
html = files
|
|
37
|
+
.map( ( file ) => `<img src="${ createBlobURL( file ) }">` )
|
|
38
|
+
.join( '' );
|
|
39
|
+
plainText = '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { html, plainText };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Given a collection of DataTransfer files and HTML and plain text strings,
|
|
47
|
+
* determine whether the files are to be dismissed in favor of the HTML.
|
|
48
|
+
*
|
|
49
|
+
* Certain office-type programs, like Microsoft Word or Apple Numbers,
|
|
50
|
+
* will, upon copy, generate a screenshot of the content being copied and
|
|
51
|
+
* attach it to the clipboard alongside the actual rich text that the user
|
|
52
|
+
* sought to copy. In those cases, we should let Gutenberg handle the rich text
|
|
53
|
+
* content and not the screenshot, since this allows Gutenberg to insert
|
|
54
|
+
* meaningful blocks, like paragraphs, lists or even tables.
|
|
55
|
+
*
|
|
56
|
+
* @param {File[]} files File objects obtained from a paste event
|
|
57
|
+
* @param {string} html HTML content obtained from a paste event
|
|
58
|
+
* @return {boolean} True if the files should be dismissed
|
|
59
|
+
*/
|
|
60
|
+
export function shouldDismissPastedFiles( files, html /*, plainText */ ) {
|
|
61
|
+
// The question is only relevant when there is actual HTML content and when
|
|
62
|
+
// there is exactly one image file.
|
|
63
|
+
if (
|
|
64
|
+
html &&
|
|
65
|
+
files?.length === 1 &&
|
|
66
|
+
files[ 0 ].type.indexOf( 'image/' ) === 0
|
|
67
|
+
) {
|
|
68
|
+
// A single <img> tag found in the HTML source suggests that the
|
|
69
|
+
// content being pasted revolves around an image. Sometimes there are
|
|
70
|
+
// other elements found, like <figure>, but we assume that the user's
|
|
71
|
+
// intention is to paste the actual image file.
|
|
72
|
+
const IMAGE_TAG = /<\s*img\b/gi;
|
|
73
|
+
return html.match( IMAGE_TAG )?.length !== 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
jest.useRealTimers();
|
|
10
10
|
|
|
11
11
|
describe( 'getPxFromCssUnit', () => {
|
|
12
|
-
// Absolute units
|
|
12
|
+
// Absolute units.
|
|
13
13
|
describe( 'absolute unites should return px values', () => {
|
|
14
14
|
const testData = [
|
|
15
15
|
[ '25px', '25px' ],
|
|
@@ -19,7 +19,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
19
19
|
[ '1in', '96px' ],
|
|
20
20
|
[ '12pt', '16px' ],
|
|
21
21
|
[ '1pc', '16px' ],
|
|
22
|
-
[ '40Q', '38px' ], // 40 Q should be 1 cm
|
|
22
|
+
[ '40Q', '38px' ], // 40 Q should be 1 cm.
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
test.each( testData )(
|
|
@@ -87,7 +87,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
87
87
|
);
|
|
88
88
|
} );
|
|
89
89
|
|
|
90
|
-
// Function units
|
|
90
|
+
// Function units.
|
|
91
91
|
|
|
92
92
|
describe( 'function unites should return px values', () => {
|
|
93
93
|
const settings = {
|
|
@@ -120,7 +120,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
120
120
|
[ 123.456, '123px' ],
|
|
121
121
|
[ 'abc', null ],
|
|
122
122
|
[ 'console.log("howdy"); + 10px', null ],
|
|
123
|
-
[ 'calc(12vw * 10px', null ], //
|
|
123
|
+
[ 'calc(12vw * 10px', null ], // Missing closing bracket.
|
|
124
124
|
];
|
|
125
125
|
|
|
126
126
|
test.each( testData )(
|
|
@@ -159,7 +159,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
159
159
|
|
|
160
160
|
const startM = Date.now();
|
|
161
161
|
i = 0;
|
|
162
|
-
//
|
|
162
|
+
// The memoized Version should be at 10X better then the non default one.
|
|
163
163
|
while ( i < intervals * 10 ) {
|
|
164
164
|
memoizedGetPxFromCssUnit( 'max(25px, 35px)', { width: 201 } );
|
|
165
165
|
i++;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { shouldDismissPastedFiles } from '../pasting';
|
|
5
|
+
|
|
6
|
+
const mocks = {
|
|
7
|
+
pngImageFile: { type: 'image/png' },
|
|
8
|
+
jpgImageFile: { type: 'image/jpg' },
|
|
9
|
+
documentFile: { type: 'application/zip' },
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
describe( 'shouldDismissPastedFiles', () => {
|
|
13
|
+
it( 'should return false when no HTML is present', () => {
|
|
14
|
+
expect(
|
|
15
|
+
shouldDismissPastedFiles( [ mocks.pngImageFile ], '', '' )
|
|
16
|
+
).toBe( false );
|
|
17
|
+
} );
|
|
18
|
+
it( 'should return false when file is not an image', () => {
|
|
19
|
+
expect(
|
|
20
|
+
shouldDismissPastedFiles( [ mocks.documentFile ], '', '' )
|
|
21
|
+
).toBe( false );
|
|
22
|
+
} );
|
|
23
|
+
it( 'should return false when multiple images are present', () => {
|
|
24
|
+
expect(
|
|
25
|
+
shouldDismissPastedFiles(
|
|
26
|
+
[ mocks.pngImageFile, mocks.jpgImageFile ],
|
|
27
|
+
'',
|
|
28
|
+
''
|
|
29
|
+
)
|
|
30
|
+
).toBe( false );
|
|
31
|
+
} );
|
|
32
|
+
it( 'should return false when the HTML contains a single image', () => {
|
|
33
|
+
expect(
|
|
34
|
+
shouldDismissPastedFiles(
|
|
35
|
+
[ mocks.pngImageFile ],
|
|
36
|
+
'<img src="path.png">',
|
|
37
|
+
''
|
|
38
|
+
)
|
|
39
|
+
).toBe( false );
|
|
40
|
+
} );
|
|
41
|
+
it( 'should return true when the HTML contains more than one image', () => {
|
|
42
|
+
expect(
|
|
43
|
+
shouldDismissPastedFiles(
|
|
44
|
+
[ mocks.pngImageFile ],
|
|
45
|
+
'<img src="1.png"><br><img src="2.png">',
|
|
46
|
+
''
|
|
47
|
+
)
|
|
48
|
+
).toBe( true );
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
/*
|
|
52
|
+
* REAL-WORLD SCENARIOS
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
it( 'should return false when pasting an image from Google Photos', () => {
|
|
56
|
+
expect(
|
|
57
|
+
shouldDismissPastedFiles(
|
|
58
|
+
[ mocks.pngImageFile ],
|
|
59
|
+
'<img src="https://lh3.googleusercontent.com/ab/SOMESTRING?authuser=0">',
|
|
60
|
+
'https://lh3.googleusercontent.com/ab/SOMESTRING?authuser=0'
|
|
61
|
+
)
|
|
62
|
+
).toBe( false );
|
|
63
|
+
} );
|
|
64
|
+
|
|
65
|
+
it( 'should return false when pasting an image from Apple Numbers', () => {
|
|
66
|
+
expect(
|
|
67
|
+
shouldDismissPastedFiles(
|
|
68
|
+
[ mocks.pngImageFile ],
|
|
69
|
+
'<figure><img src="blob:..."></figure>',
|
|
70
|
+
''
|
|
71
|
+
)
|
|
72
|
+
).toBe( false );
|
|
73
|
+
} );
|
|
74
|
+
|
|
75
|
+
it( 'should return true when pasting a table from Apple Numbers', () => {
|
|
76
|
+
expect(
|
|
77
|
+
shouldDismissPastedFiles(
|
|
78
|
+
[ mocks.pngImageFile ],
|
|
79
|
+
'<meta charset="UTF-8"><table>Some table text</table>',
|
|
80
|
+
'Some table text'
|
|
81
|
+
)
|
|
82
|
+
).toBe( true );
|
|
83
|
+
} );
|
|
84
|
+
} );
|
|
@@ -240,7 +240,7 @@ export default function ( css, options ) {
|
|
|
240
240
|
function declaration() {
|
|
241
241
|
const pos = position();
|
|
242
242
|
|
|
243
|
-
// prop
|
|
243
|
+
// prop.
|
|
244
244
|
let prop = match( /^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/ );
|
|
245
245
|
if ( ! prop ) {
|
|
246
246
|
return;
|
|
@@ -252,7 +252,7 @@ export default function ( css, options ) {
|
|
|
252
252
|
return error( "property missing ':'" );
|
|
253
253
|
}
|
|
254
254
|
|
|
255
|
-
// val
|
|
255
|
+
// val.
|
|
256
256
|
const val = match(
|
|
257
257
|
/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/
|
|
258
258
|
);
|
|
@@ -281,7 +281,7 @@ export default function ( css, options ) {
|
|
|
281
281
|
}
|
|
282
282
|
comments( decls );
|
|
283
283
|
|
|
284
|
-
// declarations
|
|
284
|
+
// declarations.
|
|
285
285
|
let decl;
|
|
286
286
|
// eslint-disable-next-line no-cond-assign
|
|
287
287
|
while ( ( decl = declaration() ) ) {
|
|
@@ -491,7 +491,7 @@ export default function ( css, options ) {
|
|
|
491
491
|
}
|
|
492
492
|
let decls = comments();
|
|
493
493
|
|
|
494
|
-
// declarations
|
|
494
|
+
// declarations.
|
|
495
495
|
let decl;
|
|
496
496
|
// eslint-disable-next-line no-cond-assign
|
|
497
497
|
while ( ( decl = declaration() ) ) {
|
|
@@ -558,7 +558,7 @@ export default function ( css, options ) {
|
|
|
558
558
|
}
|
|
559
559
|
let decls = comments();
|
|
560
560
|
|
|
561
|
-
// declarations
|
|
561
|
+
// declarations.
|
|
562
562
|
let decl;
|
|
563
563
|
// eslint-disable-next-line no-cond-assign
|
|
564
564
|
while ( ( decl = declaration() ) ) {
|
|
@@ -28,7 +28,7 @@ function isAbsolutePath( filePath ) {
|
|
|
28
28
|
* @return {boolean} is valid.
|
|
29
29
|
*/
|
|
30
30
|
function isValidURL( meta ) {
|
|
31
|
-
//
|
|
31
|
+
// Ignore hashes or data uris.
|
|
32
32
|
if (
|
|
33
33
|
meta.value.indexOf( 'data:' ) === 0 ||
|
|
34
34
|
meta.value.indexOf( '#' ) === 0
|
|
@@ -40,7 +40,7 @@ function isValidURL( meta ) {
|
|
|
40
40
|
return false;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
//
|
|
43
|
+
// Do not handle the http/https urls if `includeRemote` is false.
|
|
44
44
|
if ( isRemotePath( meta.value ) ) {
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getPasteEventData = getPasteEventData;
|
|
7
|
-
|
|
8
|
-
var _blob = require("@wordpress/blob");
|
|
9
|
-
|
|
10
|
-
var _dom = require("@wordpress/dom");
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* WordPress dependencies
|
|
14
|
-
*/
|
|
15
|
-
function getPasteEventData(_ref) {
|
|
16
|
-
let {
|
|
17
|
-
clipboardData
|
|
18
|
-
} = _ref;
|
|
19
|
-
let plainText = '';
|
|
20
|
-
let html = ''; // IE11 only supports `Text` as an argument for `getData` and will
|
|
21
|
-
// otherwise throw an invalid argument error, so we try the standard
|
|
22
|
-
// arguments first, then fallback to `Text` if they fail.
|
|
23
|
-
|
|
24
|
-
try {
|
|
25
|
-
plainText = clipboardData.getData('text/plain');
|
|
26
|
-
html = clipboardData.getData('text/html');
|
|
27
|
-
} catch (error1) {
|
|
28
|
-
try {
|
|
29
|
-
html = clipboardData.getData('Text');
|
|
30
|
-
} catch (error2) {
|
|
31
|
-
// Some browsers like UC Browser paste plain text by default and
|
|
32
|
-
// don't support clipboardData at all, so allow default
|
|
33
|
-
// behaviour.
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const files = (0, _dom.getFilesFromDataTransfer)(clipboardData).filter(_ref2 => {
|
|
39
|
-
let {
|
|
40
|
-
type
|
|
41
|
-
} = _ref2;
|
|
42
|
-
return /^image\/(?:jpe?g|png|gif|webp)$/.test(type);
|
|
43
|
-
}); // Only process files if no HTML is present.
|
|
44
|
-
// A pasted file may have the URL as plain text.
|
|
45
|
-
|
|
46
|
-
if (files.length && !html) {
|
|
47
|
-
html = files.map(file => `<img src="${(0, _blob.createBlobURL)(file)}">`).join('');
|
|
48
|
-
plainText = '';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
html,
|
|
53
|
-
plainText
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=get-paste-event-data.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/get-paste-event-data.js"],"names":["getPasteEventData","clipboardData","plainText","html","getData","error1","error2","files","filter","type","test","length","map","file","join"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIO,SAASA,iBAAT,OAAgD;AAAA,MAApB;AAAEC,IAAAA;AAAF,GAAoB;AACtD,MAAIC,SAAS,GAAG,EAAhB;AACA,MAAIC,IAAI,GAAG,EAAX,CAFsD,CAItD;AACA;AACA;;AACA,MAAI;AACHD,IAAAA,SAAS,GAAGD,aAAa,CAACG,OAAd,CAAuB,YAAvB,CAAZ;AACAD,IAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,WAAvB,CAAP;AACA,GAHD,CAGE,OAAQC,MAAR,EAAiB;AAClB,QAAI;AACHF,MAAAA,IAAI,GAAGF,aAAa,CAACG,OAAd,CAAuB,MAAvB,CAAP;AACA,KAFD,CAEE,OAAQE,MAAR,EAAiB;AAClB;AACA;AACA;AACA;AACA;AACD;;AAED,QAAMC,KAAK,GAAG,mCACbN,aADa,EAEZO,MAFY,CAEJ;AAAA,QAAE;AAAEC,MAAAA;AAAF,KAAF;AAAA,WAAgB,kCAAkCC,IAAlC,CAAwCD,IAAxC,CAAhB;AAAA,GAFI,CAAd,CArBsD,CAyBtD;AACA;;AACA,MAAKF,KAAK,CAACI,MAAN,IAAgB,CAAER,IAAvB,EAA8B;AAC7BA,IAAAA,IAAI,GAAGI,KAAK,CACVK,GADK,CACEC,IAAF,IAAa,aAAa,yBAAeA,IAAf,CAAuB,IADjD,EAELC,IAFK,CAEC,EAFD,CAAP;AAGAZ,IAAAA,SAAS,GAAG,EAAZ;AACA;;AAED,SAAO;AAAEC,IAAAA,IAAF;AAAQD,IAAAA;AAAR,GAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlobURL } from '@wordpress/blob';\nimport { getFilesFromDataTransfer } from '@wordpress/dom';\n\nexport function getPasteEventData( { clipboardData } ) {\n\tlet plainText = '';\n\tlet html = '';\n\n\t// IE11 only supports `Text` as an argument for `getData` and will\n\t// otherwise throw an invalid argument error, so we try the standard\n\t// arguments first, then fallback to `Text` if they fail.\n\ttry {\n\t\tplainText = clipboardData.getData( 'text/plain' );\n\t\thtml = clipboardData.getData( 'text/html' );\n\t} catch ( error1 ) {\n\t\ttry {\n\t\t\thtml = clipboardData.getData( 'Text' );\n\t\t} catch ( error2 ) {\n\t\t\t// Some browsers like UC Browser paste plain text by default and\n\t\t\t// don't support clipboardData at all, so allow default\n\t\t\t// behaviour.\n\t\t\treturn;\n\t\t}\n\t}\n\n\tconst files = getFilesFromDataTransfer(\n\t\tclipboardData\n\t).filter( ( { type } ) => /^image\\/(?:jpe?g|png|gif|webp)$/.test( type ) );\n\n\t// Only process files if no HTML is present.\n\t// A pasted file may have the URL as plain text.\n\tif ( files.length && ! html ) {\n\t\thtml = files\n\t\t\t.map( ( file ) => `<img src=\"${ createBlobURL( file ) }\">` )\n\t\t\t.join( '' );\n\t\tplainText = '';\n\t}\n\n\treturn { html, plainText };\n}\n"]}
|
package/build/utils/theme.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.validateThemeColors = validateThemeColors;
|
|
7
|
-
exports.validateThemeGradients = validateThemeGradients;
|
|
8
|
-
|
|
9
|
-
var _defaults = require("../store/defaults");
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Given an array of theme colors checks colors for validity
|
|
17
|
-
*
|
|
18
|
-
* @param {Array} colors The array of theme colors
|
|
19
|
-
*
|
|
20
|
-
* @return {Array} The array of valid theme colors or the default colors
|
|
21
|
-
*/
|
|
22
|
-
function validateThemeColors(colors) {
|
|
23
|
-
if (colors === undefined) {
|
|
24
|
-
colors = _defaults.SETTINGS_DEFAULTS.colors;
|
|
25
|
-
} else {
|
|
26
|
-
const validColors = colors.filter(c => c.color);
|
|
27
|
-
|
|
28
|
-
if (validColors.length === 0) {
|
|
29
|
-
colors = _defaults.SETTINGS_DEFAULTS.colors;
|
|
30
|
-
} else if (validColors.length < colors.length) {
|
|
31
|
-
// Filter out invalid colors
|
|
32
|
-
colors = validColors;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return colors;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Given an array of theme gradients checks gradients for validity
|
|
40
|
-
*
|
|
41
|
-
* @param {Array} gradients The array of theme gradients
|
|
42
|
-
*
|
|
43
|
-
* @return {Array} The array of valid theme gradients or the default gradients
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
function validateThemeGradients(gradients) {
|
|
48
|
-
if (gradients === undefined) {
|
|
49
|
-
gradients = _defaults.SETTINGS_DEFAULTS.gradients;
|
|
50
|
-
} else {
|
|
51
|
-
const validGradients = gradients.filter(c => c.gradient);
|
|
52
|
-
|
|
53
|
-
if (validGradients.length === 0) {
|
|
54
|
-
gradients = _defaults.SETTINGS_DEFAULTS.gradients;
|
|
55
|
-
} else if (validGradients.length < gradients.length) {
|
|
56
|
-
// Filter out invalid gradients
|
|
57
|
-
gradients = validGradients;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return gradients;
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=theme.js.map
|
package/build/utils/theme.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/theme.js"],"names":["validateThemeColors","colors","undefined","SETTINGS_DEFAULTS","validColors","filter","c","color","length","validateThemeGradients","gradients","validGradients","gradient"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mBAAT,CAA8BC,MAA9B,EAAuC;AAC7C,MAAKA,MAAM,KAAKC,SAAhB,EAA4B;AAC3BD,IAAAA,MAAM,GAAGE,4BAAkBF,MAA3B;AACA,GAFD,MAEO;AACN,UAAMG,WAAW,GAAGH,MAAM,CAACI,MAAP,CAAiBC,CAAF,IAASA,CAAC,CAACC,KAA1B,CAApB;;AACA,QAAKH,WAAW,CAACI,MAAZ,KAAuB,CAA5B,EAAgC;AAC/BP,MAAAA,MAAM,GAAGE,4BAAkBF,MAA3B;AACA,KAFD,MAEO,IAAKG,WAAW,CAACI,MAAZ,GAAqBP,MAAM,CAACO,MAAjC,EAA0C;AAChD;AACAP,MAAAA,MAAM,GAAGG,WAAT;AACA;AACD;;AACD,SAAOH,MAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASQ,sBAAT,CAAiCC,SAAjC,EAA6C;AACnD,MAAKA,SAAS,KAAKR,SAAnB,EAA+B;AAC9BQ,IAAAA,SAAS,GAAGP,4BAAkBO,SAA9B;AACA,GAFD,MAEO;AACN,UAAMC,cAAc,GAAGD,SAAS,CAACL,MAAV,CAAoBC,CAAF,IAASA,CAAC,CAACM,QAA7B,CAAvB;;AACA,QAAKD,cAAc,CAACH,MAAf,KAA0B,CAA/B,EAAmC;AAClCE,MAAAA,SAAS,GAAGP,4BAAkBO,SAA9B;AACA,KAFD,MAEO,IAAKC,cAAc,CAACH,MAAf,GAAwBE,SAAS,CAACF,MAAvC,EAAgD;AACtD;AACAE,MAAAA,SAAS,GAAGC,cAAZ;AACA;AACD;;AACD,SAAOD,SAAP;AACA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { SETTINGS_DEFAULTS } from '../store/defaults';\n\n/**\n * Given an array of theme colors checks colors for validity\n *\n * @param {Array} colors The array of theme colors\n *\n * @return {Array} The array of valid theme colors or the default colors\n */\nexport function validateThemeColors( colors ) {\n\tif ( colors === undefined ) {\n\t\tcolors = SETTINGS_DEFAULTS.colors;\n\t} else {\n\t\tconst validColors = colors.filter( ( c ) => c.color );\n\t\tif ( validColors.length === 0 ) {\n\t\t\tcolors = SETTINGS_DEFAULTS.colors;\n\t\t} else if ( validColors.length < colors.length ) {\n\t\t\t// Filter out invalid colors\n\t\t\tcolors = validColors;\n\t\t}\n\t}\n\treturn colors;\n}\n\n/**\n * Given an array of theme gradients checks gradients for validity\n *\n * @param {Array} gradients The array of theme gradients\n *\n * @return {Array} The array of valid theme gradients or the default gradients\n */\nexport function validateThemeGradients( gradients ) {\n\tif ( gradients === undefined ) {\n\t\tgradients = SETTINGS_DEFAULTS.gradients;\n\t} else {\n\t\tconst validGradients = gradients.filter( ( c ) => c.gradient );\n\t\tif ( validGradients.length === 0 ) {\n\t\t\tgradients = SETTINGS_DEFAULTS.gradients;\n\t\t} else if ( validGradients.length < gradients.length ) {\n\t\t\t// Filter out invalid gradients\n\t\t\tgradients = validGradients;\n\t\t}\n\t}\n\treturn gradients;\n}\n"]}
|