@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
|
@@ -30,15 +30,15 @@ var _blocks = require("@wordpress/blocks");
|
|
|
30
30
|
* @return {Object} Filtered props applied to save element.
|
|
31
31
|
*/
|
|
32
32
|
function addGeneratedClassName(extraProps, blockType) {
|
|
33
|
-
// Adding the generated className
|
|
33
|
+
// Adding the generated className.
|
|
34
34
|
if ((0, _blocks.hasBlockSupport)(blockType, 'className', true)) {
|
|
35
35
|
if (typeof extraProps.className === 'string') {
|
|
36
36
|
// We have some extra classes and want to add the default classname
|
|
37
|
-
// We use uniq to prevent duplicate classnames
|
|
37
|
+
// We use uniq to prevent duplicate classnames.
|
|
38
38
|
extraProps.className = (0, _lodash.uniq)([(0, _blocks.getBlockDefaultClassName)(blockType.name), ...extraProps.className.split(' ')]).join(' ').trim();
|
|
39
39
|
} else {
|
|
40
40
|
// There is no string in the className variable,
|
|
41
|
-
// so we just dump the default name in there
|
|
41
|
+
// so we just dump the default name in there.
|
|
42
42
|
extraProps.className = (0, _blocks.getBlockDefaultClassName)(blockType.name);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/generated-class-name.js"],"names":["addGeneratedClassName","extraProps","blockType","className","name","split","join","trim"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAAgCC,UAAhC,EAA4CC,SAA5C,EAAwD;AAC9D;AACA,MAAK,6BAAiBA,SAAjB,EAA4B,WAA5B,EAAyC,IAAzC,CAAL,EAAuD;AACtD,QAAK,OAAOD,UAAU,CAACE,SAAlB,KAAgC,QAArC,EAAgD;AAC/C;AACA;AAEAF,MAAAA,UAAU,CAACE,SAAX,GAAuB,kBAAM,CAC5B,sCAA0BD,SAAS,CAACE,IAApC,CAD4B,EAE5B,GAAGH,UAAU,CAACE,SAAX,CAAqBE,KAArB,CAA4B,GAA5B,CAFyB,CAAN,EAIrBC,IAJqB,CAIf,GAJe,EAKrBC,IALqB,EAAvB;AAMA,KAVD,MAUO;AACN;AACA;AACAN,MAAAA,UAAU,CAACE,SAAX,GAAuB,sCAA0BD,SAAS,CAACE,IAApC,CAAvB;AACA;AACD;;AACD,SAAOH,UAAP;AACA;;AAED,sBACC,kCADD,EAEC,sCAFD,EAGCD,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport, getBlockDefaultClassName } from '@wordpress/blocks';\n\n/**\n * Override props assigned to save component to inject generated className if\n * block supports it. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addGeneratedClassName( extraProps, blockType ) {\n\t// Adding the generated className
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/generated-class-name.js"],"names":["addGeneratedClassName","extraProps","blockType","className","name","split","join","trim"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,qBAAT,CAAgCC,UAAhC,EAA4CC,SAA5C,EAAwD;AAC9D;AACA,MAAK,6BAAiBA,SAAjB,EAA4B,WAA5B,EAAyC,IAAzC,CAAL,EAAuD;AACtD,QAAK,OAAOD,UAAU,CAACE,SAAlB,KAAgC,QAArC,EAAgD;AAC/C;AACA;AAEAF,MAAAA,UAAU,CAACE,SAAX,GAAuB,kBAAM,CAC5B,sCAA0BD,SAAS,CAACE,IAApC,CAD4B,EAE5B,GAAGH,UAAU,CAACE,SAAX,CAAqBE,KAArB,CAA4B,GAA5B,CAFyB,CAAN,EAIrBC,IAJqB,CAIf,GAJe,EAKrBC,IALqB,EAAvB;AAMA,KAVD,MAUO;AACN;AACA;AACAN,MAAAA,UAAU,CAACE,SAAX,GAAuB,sCAA0BD,SAAS,CAACE,IAApC,CAAvB;AACA;AACD;;AACD,SAAOH,UAAP;AACA;;AAED,sBACC,kCADD,EAEC,sCAFD,EAGCD,qBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport { uniq } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport, getBlockDefaultClassName } from '@wordpress/blocks';\n\n/**\n * Override props assigned to save component to inject generated className if\n * block supports it. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addGeneratedClassName( extraProps, blockType ) {\n\t// Adding the generated className.\n\tif ( hasBlockSupport( blockType, 'className', true ) ) {\n\t\tif ( typeof extraProps.className === 'string' ) {\n\t\t\t// We have some extra classes and want to add the default classname\n\t\t\t// We use uniq to prevent duplicate classnames.\n\n\t\t\textraProps.className = uniq( [\n\t\t\t\tgetBlockDefaultClassName( blockType.name ),\n\t\t\t\t...extraProps.className.split( ' ' ),\n\t\t\t] )\n\t\t\t\t.join( ' ' )\n\t\t\t\t.trim();\n\t\t} else {\n\t\t\t// There is no string in the className variable,\n\t\t\t// so we just dump the default name in there.\n\t\t\textraProps.className = getBlockDefaultClassName( blockType.name );\n\t\t}\n\t}\n\treturn extraProps;\n}\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/generated-class-name/save-props',\n\taddGeneratedClassName\n);\n"]}
|
|
@@ -61,6 +61,8 @@ function LineHeightEdit(props) {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
return (0, _element.createElement)(_lineHeightControl.default, {
|
|
64
|
+
__unstableInputWidth: "100%",
|
|
65
|
+
__nextHasNoMarginBottom: true,
|
|
64
66
|
value: style === null || style === void 0 ? void 0 : (_style$typography = style.typography) === null || _style$typography === void 0 ? void 0 : _style$typography.lineHeight,
|
|
65
67
|
onChange: onChange
|
|
66
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled","hasLineHeightValue","resetLineHeight","undefined"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,kBAAF,IAA0B;AAC1C,UAAMC,QAAQ,GAAG,EAChB,GAAGJ,KADa;AAEhBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEH;AAFD;AAFI,KAAjB;AAQAF,IAAAA,aAAa,CAAE;AAAED,MAAAA,KAAK,EAAE,6BAAkBI,QAAlB;AAAT,KAAF,CAAb;AACA,GAVD;;AAWA,SACC,4BAAC,0BAAD;AACC,IAAA,KAAK,EAAGJ,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEK,UAAV,sDAAG,kBAAmBC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/line-height.js"],"names":["LINE_HEIGHT_SUPPORT_KEY","LineHeightEdit","props","attributes","style","setAttributes","onChange","newLineHeightValue","newStyle","typography","lineHeight","useIsLineHeightDisabled","name","blockName","isDisabled","hasLineHeightValue","resetLineHeight","undefined"],"mappings":";;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AAVA;AACA;AACA;;AAGA;AACA;AACA;AAKO,MAAMA,uBAAuB,GAAG,uBAAhC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,cAAT,CAAyBC,KAAzB,EAAiC;AAAA;;AACvC,QAAM;AACLC,IAAAA,UAAU,EAAE;AAAEC,MAAAA;AAAF,KADP;AAELC,IAAAA;AAFK,MAGFH,KAHJ;;AAKA,QAAMI,QAAQ,GAAKC,kBAAF,IAA0B;AAC1C,UAAMC,QAAQ,GAAG,EAChB,GAAGJ,KADa;AAEhBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEH;AAFD;AAFI,KAAjB;AAQAF,IAAAA,aAAa,CAAE;AAAED,MAAAA,KAAK,EAAE,6BAAkBI,QAAlB;AAAT,KAAF,CAAb;AACA,GAVD;;AAWA,SACC,4BAAC,0BAAD;AACC,IAAA,oBAAoB,EAAC,MADtB;AAEC,IAAA,uBAAuB,EAAG,IAF3B;AAGC,IAAA,KAAK,EAAGJ,KAAH,aAAGA,KAAH,4CAAGA,KAAK,CAAEK,UAAV,sDAAG,kBAAmBC,UAH5B;AAIC,IAAA,QAAQ,EAAGJ;AAJZ,IADD;AAQA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASK,uBAAT,GAA6D;AAAA,MAA3B;AAAEC,IAAAA,IAAI,EAAEC;AAAR,GAA2B,uEAAL,EAAK;AACnE,QAAMC,UAAU,GAAG,CAAE,yBAAY,uBAAZ,CAArB;AAEA,SACC,CAAE,6BAAiBD,SAAjB,EAA4Bb,uBAA5B,CAAF,IAA2Dc,UAD5D;AAGA;AAED;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,kBAAT,CAA6Bb,KAA7B,EAAqC;AAAA;;AAC3C,SAAO,CAAC,2BAAEA,KAAK,CAACC,UAAN,CAAiBC,KAAnB,4EAAE,sBAAwBK,UAA1B,mDAAE,uBAAoCC,UAAtC,CAAR;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,eAAT,OAA+D;AAAA,MAArC;AAAEb,IAAAA,UAAU,GAAG,EAAf;AAAmBE,IAAAA;AAAnB,GAAqC;AACrE,QAAM;AAAED,IAAAA;AAAF,MAAYD,UAAlB;AAEAE,EAAAA,aAAa,CAAE;AACdD,IAAAA,KAAK,EAAE,6BAAkB,EACxB,GAAGA,KADqB;AAExBK,MAAAA,UAAU,EAAE,EACX,IAAGL,KAAH,aAAGA,KAAH,uBAAGA,KAAK,CAAEK,UAAV,CADW;AAEXC,QAAAA,UAAU,EAAEO;AAFD;AAFY,KAAlB;AADO,GAAF,CAAb;AASA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport LineHeightControl from '../components/line-height-control';\nimport { cleanEmptyObject } from './utils';\nimport useSetting from '../components/use-setting';\n\nexport const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';\n\n/**\n * Inspector control panel containing the line height related configuration\n *\n * @param {Object} props\n *\n * @return {WPElement} Line height edit element.\n */\nexport function LineHeightEdit( props ) {\n\tconst {\n\t\tattributes: { style },\n\t\tsetAttributes,\n\t} = props;\n\n\tconst onChange = ( newLineHeightValue ) => {\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: newLineHeightValue,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( { style: cleanEmptyObject( newStyle ) } );\n\t};\n\treturn (\n\t\t<LineHeightControl\n\t\t\t__unstableInputWidth=\"100%\"\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tvalue={ style?.typography?.lineHeight }\n\t\t\tonChange={ onChange }\n\t\t/>\n\t);\n}\n\n/**\n * Custom hook that checks if line-height settings have been disabled.\n *\n * @param {string} name The name of the block.\n * @return {boolean} Whether setting is disabled.\n */\nexport function useIsLineHeightDisabled( { name: blockName } = {} ) {\n\tconst isDisabled = ! useSetting( 'typography.lineHeight' );\n\n\treturn (\n\t\t! hasBlockSupport( blockName, LINE_HEIGHT_SUPPORT_KEY ) || isDisabled\n\t);\n}\n\n/**\n * Checks if there is a current value set for the line height block support.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a line height value set.\n */\nexport function hasLineHeightValue( props ) {\n\treturn !! props.attributes.style?.typography?.lineHeight;\n}\n\n/**\n * Resets the line height block support attribute. This can be used when\n * disabling the line height support controls for a block via a progressive\n * discovery panel.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetLineHeight( { attributes = {}, setAttributes } ) {\n\tconst { style } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\ttypography: {\n\t\t\t\t...style?.typography,\n\t\t\t\tlineHeight: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n"]}
|
package/build/hooks/lock.js
CHANGED
|
@@ -25,7 +25,7 @@ var _hooks = require("@wordpress/hooks");
|
|
|
25
25
|
* @return {Object} Filtered block settings.
|
|
26
26
|
*/
|
|
27
27
|
function addAttribute(settings) {
|
|
28
|
-
//
|
|
28
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
29
29
|
if ((0, _lodash.has)(settings.attributes, ['lock', 'type'])) {
|
|
30
30
|
return settings;
|
|
31
31
|
} // Gracefully handle if settings.attributes is undefined.
|
package/build/hooks/lock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/lock.js"],"names":["addAttribute","settings","attributes","lock","type"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,QAAvB,EAAkC;AACxC;AACA,MAAK,iBAAKA,QAAQ,CAACC,UAAd,EAA0B,CAAE,MAAF,EAAU,MAAV,CAA1B,CAAL,EAAsD;AACrD,WAAOD,QAAP;AACA,GAJuC,CAKxC;;;AACAA,EAAAA,QAAQ,CAACC,UAAT,GAAsB,EACrB,GAAGD,QAAQ,CAACC,UADS;AAErBC,IAAAA,IAAI,EAAE;AACLC,MAAAA,IAAI,EAAE;AADD;AAFe,GAAtB;AAOA,SAAOH,QAAP;AACA;;AAED,sBAAW,0BAAX,EAAuC,wBAAvC,EAAiED,YAAjE","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Filters registered block settings, extending attributes to include `lock`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t//
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/lock.js"],"names":["addAttribute","settings","attributes","lock","type"],"mappings":";;;;;;;AAGA;;AAKA;;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,YAAT,CAAuBC,QAAvB,EAAkC;AACxC;AACA,MAAK,iBAAKA,QAAQ,CAACC,UAAd,EAA0B,CAAE,MAAF,EAAU,MAAV,CAA1B,CAAL,EAAsD;AACrD,WAAOD,QAAP;AACA,GAJuC,CAKxC;;;AACAA,EAAAA,QAAQ,CAACC,UAAT,GAAsB,EACrB,GAAGD,QAAQ,CAACC,UADS;AAErBC,IAAAA,IAAI,EAAE;AACLC,MAAAA,IAAI,EAAE;AADD;AAFe,GAAtB;AAOA,SAAOH,QAAP;AACA;;AAED,sBAAW,0BAAX,EAAuC,wBAAvC,EAAiED,YAAjE","sourcesContent":["/**\n * External dependencies\n */\nimport { has } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Filters registered block settings, extending attributes to include `lock`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( has( settings.attributes, [ 'lock', 'type' ] ) ) {\n\t\treturn settings;\n\t}\n\t// Gracefully handle if settings.attributes is undefined.\n\tsettings.attributes = {\n\t\t...settings.attributes,\n\t\tlock: {\n\t\t\ttype: 'object',\n\t\t},\n\t};\n\n\treturn settings;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/lock/addAttribute', addAttribute );\n"]}
|
package/build/hooks/style.js
CHANGED
|
@@ -24,6 +24,8 @@ var _blocks = require("@wordpress/blocks");
|
|
|
24
24
|
|
|
25
25
|
var _compose = require("@wordpress/compose");
|
|
26
26
|
|
|
27
|
+
var _styleEngine = require("@wordpress/style-engine");
|
|
28
|
+
|
|
27
29
|
var _blockList = _interopRequireDefault(require("../components/block-list"));
|
|
28
30
|
|
|
29
31
|
var _border = require("./border");
|
|
@@ -85,19 +87,33 @@ function getInlineStyles() {
|
|
|
85
87
|
// option and backwards compatibility for border radius support.
|
|
86
88
|
const styleValue = (0, _lodash.get)(styles, path);
|
|
87
89
|
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
if (!_blocks.__EXPERIMENTAL_STYLE_PROPERTY[propKey].useEngine) {
|
|
91
|
+
if (!!subPaths && !(0, _lodash.isString)(styleValue)) {
|
|
92
|
+
Object.entries(subPaths).forEach(entry => {
|
|
93
|
+
const [name, subPath] = entry;
|
|
94
|
+
const value = (0, _lodash.get)(styleValue, [subPath]);
|
|
95
|
+
|
|
96
|
+
if (value) {
|
|
97
|
+
output[name] = compileStyleValue(value);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} else if (!ignoredStyles.includes(path.join('.'))) {
|
|
101
|
+
output[propKey] = compileStyleValue((0, _lodash.get)(styles, path));
|
|
102
|
+
}
|
|
99
103
|
}
|
|
100
104
|
}
|
|
105
|
+
}); // The goal is to move everything to server side generated engine styles
|
|
106
|
+
// This is temporary as we absorb more and more styles into the engine.
|
|
107
|
+
|
|
108
|
+
const extraRules = (0, _styleEngine.getCSSRules)(styles, {
|
|
109
|
+
selector: 'self'
|
|
110
|
+
});
|
|
111
|
+
extraRules.forEach(rule => {
|
|
112
|
+
if (rule.selector !== 'self') {
|
|
113
|
+
throw "This style can't be added as inline style";
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
output[rule.key] = rule.value;
|
|
101
117
|
});
|
|
102
118
|
return output;
|
|
103
119
|
}
|
|
@@ -108,7 +124,10 @@ function compileElementsStyles(selector) {
|
|
|
108
124
|
const elementStyles = getInlineStyles(styles);
|
|
109
125
|
|
|
110
126
|
if (!(0, _lodash.isEmpty)(elementStyles)) {
|
|
111
|
-
|
|
127
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
128
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
129
|
+
// styles to override element styles because of higher specificity.
|
|
130
|
+
return [`.editor-styles-wrapper .${selector} ${_blocks.__EXPERIMENTAL_ELEMENTS[element]}{`, ...(0, _lodash.map)(elementStyles, (value, property) => `\t${(0, _lodash.kebabCase)(property)}: ${value};`), '}'].join('\n');
|
|
112
131
|
}
|
|
113
132
|
|
|
114
133
|
return '';
|
|
@@ -126,7 +145,7 @@ function compileElementsStyles(selector) {
|
|
|
126
145
|
function addAttribute(settings) {
|
|
127
146
|
if (!hasStyleSupport(settings)) {
|
|
128
147
|
return settings;
|
|
129
|
-
} //
|
|
148
|
+
} // Allow blocks to specify their own attribute definition with default values if needed.
|
|
130
149
|
|
|
131
150
|
|
|
132
151
|
if (!settings.attributes.style) {
|
package/build/hooks/style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","blockType","some","key","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","compileStyleValue","uncompiledValue","variable","slice","length","split","join","getInlineStyles","styles","ignoredStyles","output","Object","keys","STYLE_PROPERTY","forEach","propKey","path","value","subPaths","properties","styleValue","entries","entry","name","subPath","includes","compileElementsStyles","selector","elements","element","elementStyles","ELEMENTS","property","addAttribute","settings","attributes","style","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","addSaveProps","props","skipPaths","indicator","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","BlockList","__unstableElementContext","__html","className"],"mappings":";;;;;;;;;;;;AAoBA;;;;AAjBA;;AAYA;;AAMA;;AACA;;AAMA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA1CA;AACA;AACA;;AAeA;AACA;AACA;;AAWA;AACA;AACA;AAYA,MAAMA,gBAAgB,GAAG,CACxB,GAAGC,mCADqB,EAExBC,0BAFwB,EAGxBC,wBAHwB,EAIxBC,+BAJwB,CAAzB;;AAOA,MAAMC,eAAe,GAAKC,SAAF,IACvBN,gBAAgB,CAACO,IAAjB,CAAyBC,GAAF,IAAW,6BAAiBF,SAAjB,EAA4BE,GAA5B,CAAlC,CADD;;AAGA,MAAMC,yBAAyB,GAAG,MAAlC;AACA,MAAMC,uCAAuC,GAAG,GAAhD;AACA,MAAMC,mCAAmC,GAAG,IAA5C;;AACA,SAASC,iBAAT,CAA4BC,eAA5B,EAA8C;AAC7C,MAAK,wBAAYA,eAAZ,EAA6BJ,yBAA7B,CAAL,EAAgE;AAC/D,UAAMK,QAAQ,GAAGD,eAAe,CAC9BE,KADe,CACRN,yBAAyB,CAACO,MADlB,EAEfC,KAFe,CAERP,uCAFQ,EAGfQ,IAHe,CAGTP,mCAHS,CAAjB;AAIA,WAAQ,aAAaG,QAAU,GAA/B;AACA;;AACD,SAAOD,eAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASM,eAAT,GAAwC;AAAA,MAAdC,MAAc,uEAAL,EAAK;AAC9C,QAAMC,aAAa,GAAG,CAAE,kBAAF,CAAtB;AACA,QAAMC,MAAM,GAAG,EAAf;AACAC,EAAAA,MAAM,CAACC,IAAP,CAAaC,qCAAb,EAA8BC,OAA9B,CAAyCC,OAAF,IAAe;AACrD,UAAMC,IAAI,GAAGH,sCAAgBE,OAAhB,EAA0BE,KAAvC;AACA,UAAMC,QAAQ,GAAGL,sCAAgBE,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\tisString,\n\tkebabCase,\n\tmap,\n\tomit,\n\tstartsWith,\n} from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport { SPACING_SUPPORT_KEY, DimensionsPanel } from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\nconst VARIABLE_REFERENCE_PREFIX = 'var:';\nconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\nconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\nfunction compileStyleValue( uncompiledValue ) {\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst ignoredStyles = [ 'spacing.blockGap' ];\n\tconst output = {};\n\tObject.keys( STYLE_PROPERTY ).forEach( ( propKey ) => {\n\t\tconst path = STYLE_PROPERTY[ propKey ].value;\n\t\tconst subPaths = STYLE_PROPERTY[ propKey ].properties;\n\t\t// Ignore styles on elements because they are handled on the server.\n\t\tif ( has( styles, path ) && 'elements' !== first( path ) ) {\n\t\t\t// Checking if style value is a string allows for shorthand css\n\t\t\t// option and backwards compatibility for border radius support.\n\t\t\tconst styleValue = get( styles, path );\n\n\t\t\tif ( !! subPaths && ! isString( styleValue ) ) {\n\t\t\t\tObject.entries( subPaths ).forEach( ( entry ) => {\n\t\t\t\t\tconst [ name, subPath ] = entry;\n\t\t\t\t\tconst value = get( styleValue, [ subPath ] );\n\n\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\toutput[ name ] = compileStyleValue( value );\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t} else if ( ! ignoredStyles.includes( path.join( '.' ) ) ) {\n\t\t\t\toutput[ propKey ] = compileStyleValue( get( styles, path ) );\n\t\t\t}\n\t\t}\n\t} );\n\n\treturn output;\n}\n\nfunction compileElementsStyles( selector, elements = {} ) {\n\treturn map( elements, ( styles, element ) => {\n\t\tconst elementStyles = getInlineStyles( styles );\n\t\tif ( ! isEmpty( elementStyles ) ) {\n\t\t\treturn [\n\t\t\t\t`.${ selector } ${ ELEMENTS[ element ] }{`,\n\t\t\t\t...map(\n\t\t\t\t\telementStyles,\n\t\t\t\t\t( value, property ) =>\n\t\t\t\t\t\t`\\t${ kebabCase( property ) }: ${ value };`\n\t\t\t\t),\n\t\t\t\t'}',\n\t\t\t].join( '\\n' );\n\t\t}\n\t\treturn '';\n\t} ).join( '\\n' );\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\t'spacing',\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\n\tforEach( skipPaths, ( path, indicator ) => {\n\t\tif ( getBlockSupport( blockType, indicator ) ) {\n\t\t\tstyle = omit( style, path );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst elements = props.attributes.style?.elements;\n\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\t\tconst styles = compileElementsStyles(\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tprops.attributes.style?.elements\n\t\t);\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ elements &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\telements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/style.js"],"names":["styleSupportKeys","TYPOGRAPHY_SUPPORT_KEYS","BORDER_SUPPORT_KEY","COLOR_SUPPORT_KEY","SPACING_SUPPORT_KEY","hasStyleSupport","blockType","some","key","VARIABLE_REFERENCE_PREFIX","VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE","VARIABLE_PATH_SEPARATOR_TOKEN_STYLE","compileStyleValue","uncompiledValue","variable","slice","length","split","join","getInlineStyles","styles","ignoredStyles","output","Object","keys","STYLE_PROPERTY","forEach","propKey","path","value","subPaths","properties","styleValue","useEngine","entries","entry","name","subPath","includes","extraRules","selector","rule","compileElementsStyles","elements","element","elementStyles","ELEMENTS","property","addAttribute","settings","attributes","style","assign","type","skipSerializationPathsEdit","TYPOGRAPHY_SUPPORT_KEY","skipSerializationPathsSave","addSaveProps","props","skipPaths","indicator","addEditProps","existingGetEditWrapperProps","getEditWrapperProps","withBlockControls","BlockEdit","shouldDisplayControls","withElementsStyles","BlockListBlock","blockElementsContainerIdentifier","BlockList","__unstableElementContext","__html","className"],"mappings":";;;;;;;;;;;;AAoBA;;;;AAjBA;;AAYA;;AAMA;;AACA;;AAMA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AA3CA;AACA;AACA;;AAeA;AACA;AACA;;AAYA;AACA;AACA;AAYA,MAAMA,gBAAgB,GAAG,CACxB,GAAGC,mCADqB,EAExBC,0BAFwB,EAGxBC,wBAHwB,EAIxBC,+BAJwB,CAAzB;;AAOA,MAAMC,eAAe,GAAKC,SAAF,IACvBN,gBAAgB,CAACO,IAAjB,CAAyBC,GAAF,IAAW,6BAAiBF,SAAjB,EAA4BE,GAA5B,CAAlC,CADD;;AAGA,MAAMC,yBAAyB,GAAG,MAAlC;AACA,MAAMC,uCAAuC,GAAG,GAAhD;AACA,MAAMC,mCAAmC,GAAG,IAA5C;;AACA,SAASC,iBAAT,CAA4B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gC,CAA1B;AAqBP;AACA;AACA;AACA;AACA;AACA;;;AACA,MAAMS,kBAAkB,GAAG,yCACxBC,cAAF,IAAwBV,KAAF,IAAa;AAAA;;AAClC,QAAMf,QAAQ,4BAAGe,KAAK,CAACR,UAAN,CAAiBC,KAApB,0DAAG,sBAAwBR,QAAzC;AAEA,QAAM0B,gCAAgC,GAAI,eAAe,4BACxDD,cADwD,CAEtD,EAFH;AAGA,QAAMhD,MAAM,GAAGsB,qBAAqB,CACnC2B,gCADmC,4BAEnCX,KAAK,CAACR,UAAN,CAAiBC,KAFkB,2DAEnC,uBAAwBR,QAFW,CAApC;AAIA,QAAMC,OAAO,GAAG,yBAAY0B,mBAAUC,wBAAtB,CAAhB;AAEA,SACC,qDACG5B,QAAQ,IACTC,OADC,IAED,2BACC;AACC,IAAA,uBAAuB,EAAG;AACzB4B,MAAAA,MAAM,EAAEpD;AADiB;AAD3B,IADD,EAMCwB,OAND,CAHF,EAYC,4BAAC,cAAD,6BACMc,KADN;AAEC,IAAA,SAAS,EACRf,QAAQ,GACL,yBACAe,KAAK,CAACe,SADN,EAEAJ,gCAFA,CADK,GAKLX,KAAK,CAACe;AARX,KAZD,CADD;AA0BA,CAvCyB,CAA3B;AA0CA,sBACC,0BADD,EAEC,yBAFD,EAGCzB,YAHD;AAMA,sBACC,kCADD,EAEC,yBAFD,EAGCS,YAHD;AAMA,sBACC,0BADD,EAEC,yBAFD,EAGCI,YAHD;AAMA,sBACC,kBADD,EAEC,gCAFD,EAGCG,iBAHD;AAMA,sBACC,uBADD,EAEC,kCAFD,EAGCG,kBAHD","sourcesContent":["/**\n * External dependencies\n */\nimport {\n\tfirst,\n\tforEach,\n\tget,\n\thas,\n\tisEmpty,\n\tisString,\n\tkebabCase,\n\tmap,\n\tomit,\n\tstartsWith,\n} from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useContext, createPortal } from '@wordpress/element';\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\thasBlockSupport,\n\t__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,\n\t__EXPERIMENTAL_ELEMENTS as ELEMENTS,\n} from '@wordpress/blocks';\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { getCSSRules } from '@wordpress/style-engine';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../components/block-list';\nimport { BORDER_SUPPORT_KEY, BorderPanel } from './border';\nimport { COLOR_SUPPORT_KEY, ColorEdit } from './color';\nimport {\n\tTypographyPanel,\n\tTYPOGRAPHY_SUPPORT_KEY,\n\tTYPOGRAPHY_SUPPORT_KEYS,\n} from './typography';\nimport { SPACING_SUPPORT_KEY, DimensionsPanel } from './dimensions';\nimport useDisplayBlockControls from '../components/use-display-block-controls';\n\nconst styleSupportKeys = [\n\t...TYPOGRAPHY_SUPPORT_KEYS,\n\tBORDER_SUPPORT_KEY,\n\tCOLOR_SUPPORT_KEY,\n\tSPACING_SUPPORT_KEY,\n];\n\nconst hasStyleSupport = ( blockType ) =>\n\tstyleSupportKeys.some( ( key ) => hasBlockSupport( blockType, key ) );\n\nconst VARIABLE_REFERENCE_PREFIX = 'var:';\nconst VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE = '|';\nconst VARIABLE_PATH_SEPARATOR_TOKEN_STYLE = '--';\nfunction compileStyleValue( uncompiledValue ) {\n\tif ( startsWith( uncompiledValue, VARIABLE_REFERENCE_PREFIX ) ) {\n\t\tconst variable = uncompiledValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })`;\n\t}\n\treturn uncompiledValue;\n}\n\n/**\n * Returns the inline styles to add depending on the style object\n *\n * @param {Object} styles Styles configuration.\n *\n * @return {Object} Flattened CSS variables declaration.\n */\nexport function getInlineStyles( styles = {} ) {\n\tconst ignoredStyles = [ 'spacing.blockGap' ];\n\tconst output = {};\n\tObject.keys( STYLE_PROPERTY ).forEach( ( propKey ) => {\n\t\tconst path = STYLE_PROPERTY[ propKey ].value;\n\t\tconst subPaths = STYLE_PROPERTY[ propKey ].properties;\n\t\t// Ignore styles on elements because they are handled on the server.\n\t\tif ( has( styles, path ) && 'elements' !== first( path ) ) {\n\t\t\t// Checking if style value is a string allows for shorthand css\n\t\t\t// option and backwards compatibility for border radius support.\n\t\t\tconst styleValue = get( styles, path );\n\n\t\t\tif ( ! STYLE_PROPERTY[ propKey ].useEngine ) {\n\t\t\t\tif ( !! subPaths && ! isString( styleValue ) ) {\n\t\t\t\t\tObject.entries( subPaths ).forEach( ( entry ) => {\n\t\t\t\t\t\tconst [ name, subPath ] = entry;\n\t\t\t\t\t\tconst value = get( styleValue, [ subPath ] );\n\n\t\t\t\t\t\tif ( value ) {\n\t\t\t\t\t\t\toutput[ name ] = compileStyleValue( value );\n\t\t\t\t\t\t}\n\t\t\t\t\t} );\n\t\t\t\t} else if ( ! ignoredStyles.includes( path.join( '.' ) ) ) {\n\t\t\t\t\toutput[ propKey ] = compileStyleValue(\n\t\t\t\t\t\tget( styles, path )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} );\n\n\t// The goal is to move everything to server side generated engine styles\n\t// This is temporary as we absorb more and more styles into the engine.\n\tconst extraRules = getCSSRules( styles, { selector: 'self' } );\n\textraRules.forEach( ( rule ) => {\n\t\tif ( rule.selector !== 'self' ) {\n\t\t\tthrow \"This style can't be added as inline style\";\n\t\t}\n\t\toutput[ rule.key ] = rule.value;\n\t} );\n\n\treturn output;\n}\n\nfunction compileElementsStyles( selector, elements = {} ) {\n\treturn map( elements, ( styles, element ) => {\n\t\tconst elementStyles = getInlineStyles( styles );\n\t\tif ( ! isEmpty( elementStyles ) ) {\n\t\t\t// The .editor-styles-wrapper selector is required on elements styles. As it is\n\t\t\t// added to all other editor styles, not providing it causes reset and global\n\t\t\t// styles to override element styles because of higher specificity.\n\t\t\treturn [\n\t\t\t\t`.editor-styles-wrapper .${ selector } ${ ELEMENTS[ element ] }{`,\n\t\t\t\t...map(\n\t\t\t\t\telementStyles,\n\t\t\t\t\t( value, property ) =>\n\t\t\t\t\t\t`\\t${ kebabCase( property ) }: ${ value };`\n\t\t\t\t),\n\t\t\t\t'}',\n\t\t\t].join( '\\n' );\n\t\t}\n\t\treturn '';\n\t} ).join( '\\n' );\n}\n\n/**\n * Filters registered block settings, extending attributes to include `style` attribute.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nfunction addAttribute( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( ! settings.attributes.style ) {\n\t\tObject.assign( settings.attributes, {\n\t\t\tstyle: {\n\t\t\t\ttype: 'object',\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn settings;\n}\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsEdit = {\n\t[ `${ BORDER_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [ 'border' ],\n\t[ `${ COLOR_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tCOLOR_SUPPORT_KEY,\n\t],\n\t[ `${ TYPOGRAPHY_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\tTYPOGRAPHY_SUPPORT_KEY,\n\t],\n\t[ `${ SPACING_SUPPORT_KEY }.__experimentalSkipSerialization` ]: [\n\t\t'spacing',\n\t],\n};\n\n/**\n * A dictionary of paths to flag skipping block support serialization as the key,\n * with values providing the style paths to be omitted from serialization.\n *\n * Extends the Edit skip paths to enable skipping additional paths in just\n * the Save component. This allows a block support to be serialized within the\n * editor, while using an alternate approach, such as server-side rendering, when\n * the support is saved.\n *\n * @constant\n * @type {Record<string, string[]>}\n */\nconst skipSerializationPathsSave = {\n\t...skipSerializationPathsEdit,\n\t[ `${ SPACING_SUPPORT_KEY }` ]: [ 'spacing.blockGap' ],\n};\n\n/**\n * Override props assigned to save component to inject the CSS variables definition.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n * @param {?Record<string, string[]>} skipPaths An object of keys and paths to skip serialization.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps(\n\tprops,\n\tblockType,\n\tattributes,\n\tskipPaths = skipSerializationPathsSave\n) {\n\tif ( ! hasStyleSupport( blockType ) ) {\n\t\treturn props;\n\t}\n\n\tlet { style } = attributes;\n\n\tforEach( skipPaths, ( path, indicator ) => {\n\t\tif ( getBlockSupport( blockType, indicator ) ) {\n\t\t\tstyle = omit( style, path );\n\t\t}\n\t} );\n\n\tprops.style = {\n\t\t...getInlineStyles( style ),\n\t\t...props.style,\n\t};\n\n\treturn props;\n}\n\n/**\n * Filters registered block settings to extend the block edit wrapper\n * to apply the desired styles and classnames properly.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object}.Filtered block settings.\n */\nexport function addEditProps( settings ) {\n\tif ( ! hasStyleSupport( settings ) ) {\n\t\treturn settings;\n\t}\n\n\tconst existingGetEditWrapperProps = settings.getEditWrapperProps;\n\tsettings.getEditWrapperProps = ( attributes ) => {\n\t\tlet props = {};\n\t\tif ( existingGetEditWrapperProps ) {\n\t\t\tprops = existingGetEditWrapperProps( attributes );\n\t\t}\n\n\t\treturn addSaveProps(\n\t\t\tprops,\n\t\t\tsettings,\n\t\t\tattributes,\n\t\t\tskipSerializationPathsEdit\n\t\t);\n\t};\n\n\treturn settings;\n}\n\n/**\n * Override the default edit UI to include new inspector controls for\n * all the custom styles configs.\n *\n * @param {Function} BlockEdit Original component.\n *\n * @return {Function} Wrapped component.\n */\nexport const withBlockControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst shouldDisplayControls = useDisplayBlockControls();\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ shouldDisplayControls && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ColorEdit { ...props } />\n\t\t\t\t\t\t<TypographyPanel { ...props } />\n\t\t\t\t\t\t<BorderPanel { ...props } />\n\t\t\t\t\t\t<DimensionsPanel { ...props } />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\n/**\n * Override the default block element to include duotone styles.\n *\n * @param {Function} BlockListBlock Original component\n * @return {Function} Wrapped component\n */\nconst withElementsStyles = createHigherOrderComponent(\n\t( BlockListBlock ) => ( props ) => {\n\t\tconst elements = props.attributes.style?.elements;\n\n\t\tconst blockElementsContainerIdentifier = `wp-elements-${ useInstanceId(\n\t\t\tBlockListBlock\n\t\t) }`;\n\t\tconst styles = compileElementsStyles(\n\t\t\tblockElementsContainerIdentifier,\n\t\t\tprops.attributes.style?.elements\n\t\t);\n\t\tconst element = useContext( BlockList.__unstableElementContext );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ elements &&\n\t\t\t\t\telement &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<style\n\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t__html: styles,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>,\n\t\t\t\t\t\telement\n\t\t\t\t\t) }\n\n\t\t\t\t<BlockListBlock\n\t\t\t\t\t{ ...props }\n\t\t\t\t\tclassName={\n\t\t\t\t\t\telements\n\t\t\t\t\t\t\t? classnames(\n\t\t\t\t\t\t\t\t\tprops.className,\n\t\t\t\t\t\t\t\t\tblockElementsContainerIdentifier\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: props.className\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</>\n\t\t);\n\t}\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addAttribute',\n\taddAttribute\n);\n\naddFilter(\n\t'blocks.getSaveContent.extraProps',\n\t'core/style/addSaveProps',\n\taddSaveProps\n);\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/style/addEditProps',\n\taddEditProps\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/style/with-block-controls',\n\twithBlockControls\n);\n\naddFilter(\n\t'editor.BlockListBlock',\n\t'core/editor/with-elements-styles',\n\twithElementsStyles\n);\n"]}
|
package/build/layouts/flow.js
CHANGED
|
@@ -109,29 +109,31 @@ var _default = {
|
|
|
109
109
|
const hasBlockGapStylesSupport = blockGapSupport !== null;
|
|
110
110
|
const blockGapValue = (_style$spacing$blockG = style === null || style === void 0 ? void 0 : (_style$spacing = style.spacing) === null || _style$spacing === void 0 ? void 0 : _style$spacing.blockGap) !== null && _style$spacing$blockG !== void 0 ? _style$spacing$blockG : 'var( --wp--style--block-gap )';
|
|
111
111
|
let output = !!contentSize || !!wideSize ? `
|
|
112
|
-
${(0, _utils.appendSelectors)(selector, '>
|
|
112
|
+
${(0, _utils.appendSelectors)(selector, '> :where(:not(.alignleft):not(.alignright))')} {
|
|
113
113
|
max-width: ${contentSize !== null && contentSize !== void 0 ? contentSize : wideSize};
|
|
114
114
|
margin-left: auto !important;
|
|
115
115
|
margin-right: auto !important;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
${(0, _utils.appendSelectors)(selector, '>
|
|
118
|
+
${(0, _utils.appendSelectors)(selector, '> .alignwide')} {
|
|
119
119
|
max-width: ${wideSize !== null && wideSize !== void 0 ? wideSize : contentSize};
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
${(0, _utils.appendSelectors)(selector, '>
|
|
122
|
+
${(0, _utils.appendSelectors)(selector, '> .alignfull')} {
|
|
123
123
|
max-width: none;
|
|
124
124
|
}
|
|
125
125
|
` : '';
|
|
126
126
|
output += `
|
|
127
|
-
${(0, _utils.appendSelectors)(selector, '>
|
|
127
|
+
${(0, _utils.appendSelectors)(selector, '> .alignleft')} {
|
|
128
128
|
float: left;
|
|
129
129
|
margin-right: 2em;
|
|
130
|
+
margin-left: 0;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
${(0, _utils.appendSelectors)(selector, '>
|
|
133
|
+
${(0, _utils.appendSelectors)(selector, '> .alignright')} {
|
|
133
134
|
float: right;
|
|
134
135
|
margin-left: 2em;
|
|
136
|
+
margin-right: 0;
|
|
135
137
|
}
|
|
136
138
|
|
|
137
139
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","positionCenter","stretchWide","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","save","DefaultLayoutStyle","selector","style","blockGapSupport","hasBlockGapStylesSupport","blockGapValue","spacing","blockGap","output","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","includes","unshift","map","alignment","info","wide","none","sizeRegex","test"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;eAIe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,OAGf;AAAA,QAHwD;AAC3DC,MAAAA,MAD2D;AAE3DC,MAAAA;AAF2D,KAGxD;AACH,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,QAA4BH,MAAlC;AACA,UAAMI,KAAK,GAAG,8CAAgB;AAC7BC,MAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAChD,GADgD,EAEhD,IAFgD,EAGhD,IAHgD,EAIhD,KAJgD,EAKhD,IALgD;AADpB,KAAhB,CAAd;AAUA,WACC,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lB;AAAEA,MAAAA,IAAI,EAAE;AAAR,KAHkB,CAAnB;;AAMA,QAAKO,WAAL,EAAmB;AAClByB,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAElC,QAAAA,IAAI,EAAE;AAAR,OAApB;AACA;;AAED,QAAKM,QAAL,EAAgB;AACf0B,MAAAA,UAAU,CAACE,OAAX,CAAoB;AAAElC,QAAAA,IAAI,EAAE,MAAR;AAAgBqC,QAAAA,IAAI,EAAEP,aAAa,CAACQ;AAApC,OAApB;AACA;;AAEDN,IAAAA,UAAU,CAACE,OAAX,CAAoB;AAAElC,MAAAA,IAAI,EAAE,MAAR;AAAgBqC,MAAAA,IAAI,EAAEP,aAAa,CAACS;AAApC,KAApB;AAEA,WAAOP,UAAP;AACA;;AAhLa,C;AAmLf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASD,iBAAT,CAA4B3B,MAA5B,EAAqC;AACpC,QAAM;AAAEG,IAAAA,WAAF;AAAeD,IAAAA;AAAf,MAA4BF,MAAlC;AACA,QAAM0B,aAAa,GAAG,EAAtB;AACA,QAAMU,SAAS,GAAG,iCAAlB;;AACA,MAAKA,SAAS,CAACC,IAAV,CAAgBlC,WAAhB,CAAL,EAAqC;AACpC;AACAuB,IAAAA,aAAa,CAACS,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BhC,WAA9B,CAArB;AACA;;AACD,MAAKiC,SAAS,CAACC,IAAV,CAAgBnC,QAAhB,CAAL,EAAkC;AACjC;AACAwB,IAAAA,aAAa,CAACQ,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BhC,QAA9B,CAArB;AACA;;AACD,SAAOwB,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors } from './utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tsave: function DefaultLayoutStyle( { selector, layout = {}, style } ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapStylesSupport = blockGapSupport !== null;\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap ?? 'var( --wp--style--block-gap )';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors( selector, '> *' ) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t${ appendSelectors( selector, '> [data-align=\"wide\"]' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\n\t\t\t\t\t${ appendSelectors( selector, '> [data-align=\"full\"]' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\toutput += `\n\t\t\t${ appendSelectors( selector, '> [data-align=\"left\"]' ) } {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-right: 2em;\n\t\t\t}\n\n\t\t\t${ appendSelectors( selector, '> [data-align=\"right\"]' ) } {\n\t\t\t\tfloat: right;\n\t\t\t\tmargin-left: 2em;\n\t\t\t}\n\n\t\t`;\n\n\t\tif ( hasBlockGapStylesSupport ) {\n\t\t\toutput += `\n\t\t\t\t${ appendSelectors( selector, '> *' ) } {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\tmargin-bottom: 0;\n\t\t\t\t}\n\t\t\t\t${ appendSelectors( selector, '> * + *' ) } {\n\t\t\t\t\tmargin-top: ${ blockGapValue };\n\t\t\t\t}\n\t\t\t`;\n\t\t}\n\n\t\treturn <style>{ output }</style>;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nfunction getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/layouts/flow.js"],"names":["name","label","inspectorControls","DefaultLayoutInspectorControls","layout","onChange","wideSize","contentSize","units","availableUnits","nextWidth","parseFloat","positionCenter","stretchWide","undefined","inherit","toolBarControls","DefaultLayoutToolbarControls","save","DefaultLayoutStyle","selector","style","blockGapSupport","hasBlockGapStylesSupport","blockGapValue","spacing","blockGap","output","getOrientation","getAlignments","alignmentInfo","getAlignmentsInfo","alignments","includes","unshift","map","alignment","info","wide","none","sizeRegex","test"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AAKA;;AACA;;AAfA;AACA;AACA;;AASA;AACA;AACA;eAIe;AACdA,EAAAA,IAAI,EAAE,SADQ;AAEdC,EAAAA,KAAK,EAAE,cAAI,MAAJ,CAFO;AAGdC,EAAAA,iBAAiB,EAAE,SAASC,8BAAT,OAGf;AAAA,QAHwD;AAC3DC,MAAAA,MAD2D;AAE3DC,MAAAA;AAF2D,KAGxD;AACH,UAAM;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,QAA4BH,MAAlC;AACA,UAAMI,KAAK,GAAG,8CAAgB;AAC7BC,MAAAA,cAAc,EAAE,yBAAY,eAAZ,KAAiC,CAChD,GADgD,EAEhD,IAFgD,EAGhD,IAHgD,EAIhD,KAJgD,EAKhD,IALgD;AADpB,KAAhB,CAAd;AAUA,WACC,qDACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,4BAAC,qCAAD;AACC,MAAA,KAAK,EAAG,cAAI,SAAJ,CADT;AAEC,MAAA,aAAa,EAAC,KAFf;AAGC,MAAA,oBAAoB,EAAC,MAHtB;AAIC,MAAA,KAAK,EAAGF,WAAW,IAAID,QAAf,IAA2B,EAJpC;AAKC,MAAA,QAAQ,EAAKI,SAAF,IAAiB;AAC3BA,QAAAA,SAAS,GACR,IAAIC,UAAU,CAAED,SAAF,CAAd,GACG,GADH,GAEGA,SAHJ;AAIAL,QAAAA,QAAQ,CAAE,EACT,GAAGD,MADM;AAETG,UAAAA,WAAW,EAAEG;AAFJ,SAAF,CAAR;AAIA,OAdF;AAeC,MAAA,KAAK,EAAG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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACA,SAASD,iBAAT,CAA4B3B,MAA5B,EAAqC;AACpC,QAAM;AAAEG,IAAAA,WAAF;AAAeD,IAAAA;AAAf,MAA4BF,MAAlC;AACA,QAAM0B,aAAa,GAAG,EAAtB;AACA,QAAMU,SAAS,GAAG,iCAAlB;;AACA,MAAKA,SAAS,CAACC,IAAV,CAAgBlC,WAAhB,CAAL,EAAqC;AACpC;AACAuB,IAAAA,aAAa,CAACS,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BhC,WAA9B,CAArB;AACA;;AACD,MAAKiC,SAAS,CAACC,IAAV,CAAgBnC,QAAhB,CAAL,EAAkC;AACjC;AACAwB,IAAAA,aAAa,CAACQ,IAAd,GAAqB,mBAAS,cAAI,aAAJ,CAAT,EAA8BhC,QAA9B,CAArB;AACA;;AACD,SAAOwB,aAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalUnitControl as UnitControl,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport useSetting from '../components/use-setting';\nimport { appendSelectors } from './utils';\n\nexport default {\n\tname: 'default',\n\tlabel: __( 'Flow' ),\n\tinspectorControls: function DefaultLayoutInspectorControls( {\n\t\tlayout,\n\t\tonChange,\n\t} ) {\n\t\tconst { wideSize, contentSize } = layout;\n\t\tconst units = useCustomUnits( {\n\t\t\tavailableUnits: useSetting( 'spacing.units' ) || [\n\t\t\t\t'%',\n\t\t\t\t'px',\n\t\t\t\t'em',\n\t\t\t\t'rem',\n\t\t\t\t'vw',\n\t\t\t],\n\t\t} );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls\">\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSize || wideSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcontentSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"block-editor-hooks__layout-controls-unit\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSize || contentSize || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWidth ) => {\n\t\t\t\t\t\t\t\tnextWidth =\n\t\t\t\t\t\t\t\t\t0 > parseFloat( nextWidth )\n\t\t\t\t\t\t\t\t\t\t? '0'\n\t\t\t\t\t\t\t\t\t\t: nextWidth;\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\twideSize: nextWidth,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<div className=\"block-editor-hooks__layout-controls-reset\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\tisSmall\n\t\t\t\t\t\tdisabled={ ! contentSize && ! wideSize }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcontentSize: undefined,\n\t\t\t\t\t\t\t\twideSize: undefined,\n\t\t\t\t\t\t\t\tinherit: false,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</div>\n\n\t\t\t\t<p className=\"block-editor-hooks__layout-controls-helptext\">\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Customize the width for all elements that are assigned to the center or wide columns.'\n\t\t\t\t\t) }\n\t\t\t\t</p>\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tsave: function DefaultLayoutStyle( { selector, layout = {}, style } ) {\n\t\tconst { contentSize, wideSize } = layout;\n\t\tconst blockGapSupport = useSetting( 'spacing.blockGap' );\n\t\tconst hasBlockGapStylesSupport = blockGapSupport !== null;\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap ?? 'var( --wp--style--block-gap )';\n\n\t\tlet output =\n\t\t\t!! contentSize || !! wideSize\n\t\t\t\t? `\n\t\t\t\t\t${ appendSelectors(\n\t\t\t\t\t\tselector,\n\t\t\t\t\t\t'> :where(:not(.alignleft):not(.alignright))'\n\t\t\t\t\t) } {\n\t\t\t\t\t\tmax-width: ${ contentSize ?? wideSize };\n\t\t\t\t\t\tmargin-left: auto !important;\n\t\t\t\t\t\tmargin-right: auto !important;\n\t\t\t\t\t}\n\n\t\t\t\t\t${ appendSelectors( selector, '> .alignwide' ) } {\n\t\t\t\t\t\tmax-width: ${ wideSize ?? contentSize };\n\t\t\t\t\t}\n\n\t\t\t\t\t${ appendSelectors( selector, '> .alignfull' ) } {\n\t\t\t\t\t\tmax-width: none;\n\t\t\t\t\t}\n\t\t\t\t`\n\t\t\t\t: '';\n\n\t\toutput += `\n\t\t\t${ appendSelectors( selector, '> .alignleft' ) } {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-right: 2em;\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\n\t\t\t${ appendSelectors( selector, '> .alignright' ) } {\n\t\t\t\tfloat: right;\n\t\t\t\tmargin-left: 2em;\n\t\t\t\tmargin-right: 0;\n\t\t\t}\n\n\t\t`;\n\n\t\tif ( hasBlockGapStylesSupport ) {\n\t\t\toutput += `\n\t\t\t\t${ appendSelectors( selector, '> *' ) } {\n\t\t\t\t\tmargin-top: 0;\n\t\t\t\t\tmargin-bottom: 0;\n\t\t\t\t}\n\t\t\t\t${ appendSelectors( selector, '> * + *' ) } {\n\t\t\t\t\tmargin-top: ${ blockGapValue };\n\t\t\t\t}\n\t\t\t`;\n\t\t}\n\n\t\treturn <style>{ output }</style>;\n\t},\n\tgetOrientation() {\n\t\treturn 'vertical';\n\t},\n\tgetAlignments( layout ) {\n\t\tconst alignmentInfo = getAlignmentsInfo( layout );\n\t\tif ( layout.alignments !== undefined ) {\n\t\t\tif ( ! layout.alignments.includes( 'none' ) ) {\n\t\t\t\tlayout.alignments.unshift( 'none' );\n\t\t\t}\n\t\t\treturn layout.alignments.map( ( alignment ) => ( {\n\t\t\t\tname: alignment,\n\t\t\t\tinfo: alignmentInfo[ alignment ],\n\t\t\t} ) );\n\t\t}\n\t\tconst { contentSize, wideSize } = layout;\n\n\t\tconst alignments = [\n\t\t\t{ name: 'left' },\n\t\t\t{ name: 'center' },\n\t\t\t{ name: 'right' },\n\t\t];\n\n\t\tif ( contentSize ) {\n\t\t\talignments.unshift( { name: 'full' } );\n\t\t}\n\n\t\tif ( wideSize ) {\n\t\t\talignments.unshift( { name: 'wide', info: alignmentInfo.wide } );\n\t\t}\n\n\t\talignments.unshift( { name: 'none', info: alignmentInfo.none } );\n\n\t\treturn alignments;\n\t},\n};\n\n/**\n * Helper method to assign contextual info to clarify\n * alignment settings.\n *\n * Besides checking if `contentSize` and `wideSize` have a\n * value, we now show this information only if their values\n * are not a `css var`. This needs to change when parsing\n * css variables land.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34710#issuecomment-918000752\n *\n * @param {Object} layout The layout object.\n * @return {Object} An object with contextual info per alignment.\n */\nfunction getAlignmentsInfo( layout ) {\n\tconst { contentSize, wideSize } = layout;\n\tconst alignmentInfo = {};\n\tconst sizeRegex = /^(?!0)\\d+(px|em|rem|vw|vh|%)?$/i;\n\tif ( sizeRegex.test( contentSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.none = sprintf( __( 'Max %s wide' ), contentSize );\n\t}\n\tif ( sizeRegex.test( wideSize ) ) {\n\t\t// translators: %s: container size (i.e. 600px etc)\n\t\talignmentInfo.wide = sprintf( __( 'Max %s wide' ), wideSize );\n\t}\n\treturn alignmentInfo;\n}\n"]}
|
package/build/store/actions.js
CHANGED
|
@@ -17,9 +17,7 @@ exports.flashBlock = void 0;
|
|
|
17
17
|
exports.hideInsertionPoint = hideInsertionPoint;
|
|
18
18
|
exports.insertBeforeBlock = exports.insertAfterBlock = void 0;
|
|
19
19
|
exports.insertBlock = insertBlock;
|
|
20
|
-
exports.insertBlocks = void 0;
|
|
21
|
-
exports.insertDefaultBlock = insertDefaultBlock;
|
|
22
|
-
exports.mergeBlocks = void 0;
|
|
20
|
+
exports.mergeBlocks = exports.insertDefaultBlock = exports.insertBlocks = void 0;
|
|
23
21
|
exports.moveBlockToPosition = moveBlockToPosition;
|
|
24
22
|
exports.multiSelect = exports.moveBlocksUp = exports.moveBlocksToPosition = exports.moveBlocksDown = void 0;
|
|
25
23
|
exports.receiveBlocks = receiveBlocks;
|
|
@@ -345,32 +343,38 @@ function stopMultiSelect() {
|
|
|
345
343
|
/**
|
|
346
344
|
* Action that changes block multi-selection.
|
|
347
345
|
*
|
|
348
|
-
* @param {string}
|
|
349
|
-
* @param {string}
|
|
346
|
+
* @param {string} start First block of the multi selection.
|
|
347
|
+
* @param {string} end Last block of the multiselection.
|
|
348
|
+
* @param {number|null} __experimentalInitialPosition Optional initial position. Pass as null to skip focus within editor canvas.
|
|
350
349
|
*/
|
|
351
350
|
|
|
352
351
|
|
|
353
|
-
const multiSelect = (start, end)
|
|
354
|
-
let
|
|
355
|
-
select,
|
|
356
|
-
dispatch
|
|
357
|
-
} = _ref6;
|
|
358
|
-
const startBlockRootClientId = select.getBlockRootClientId(start);
|
|
359
|
-
const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
|
|
352
|
+
const multiSelect = function (start, end) {
|
|
353
|
+
let __experimentalInitialPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
360
354
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
355
|
+
return _ref6 => {
|
|
356
|
+
let {
|
|
357
|
+
select,
|
|
358
|
+
dispatch
|
|
359
|
+
} = _ref6;
|
|
360
|
+
const startBlockRootClientId = select.getBlockRootClientId(start);
|
|
361
|
+
const endBlockRootClientId = select.getBlockRootClientId(end); // Only allow block multi-selections at the same level.
|
|
364
362
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
363
|
+
if (startBlockRootClientId !== endBlockRootClientId) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
dispatch({
|
|
368
|
+
type: 'MULTI_SELECT',
|
|
369
|
+
start,
|
|
370
|
+
end,
|
|
371
|
+
initialPosition: __experimentalInitialPosition
|
|
372
|
+
});
|
|
373
|
+
const blockCount = select.getSelectedBlockCount();
|
|
374
|
+
(0, _a11y.speak)((0, _i18n.sprintf)(
|
|
375
|
+
/* translators: %s: number of selected blocks */
|
|
376
|
+
(0, _i18n._n)('%s block selected.', '%s blocks selected.', blockCount), blockCount), 'assertive');
|
|
377
|
+
};
|
|
374
378
|
};
|
|
375
379
|
/**
|
|
376
380
|
* Action that clears the block selection.
|
|
@@ -776,7 +780,7 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 => {
|
|
|
776
780
|
});
|
|
777
781
|
const [clientIdA, clientIdB] = blocks;
|
|
778
782
|
const blockA = select.getBlock(clientIdA);
|
|
779
|
-
const blockAType = (0, _blocks.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable
|
|
783
|
+
const blockAType = (0, _blocks.getBlockType)(blockA.name); // Only focus the previous block if it's not mergeable.
|
|
780
784
|
|
|
781
785
|
if (blockAType && !blockAType.merge) {
|
|
782
786
|
dispatch.selectBlock(blockA.clientId);
|
|
@@ -833,14 +837,14 @@ const mergeBlocks = (firstBlockClientId, secondBlockClientId) => _ref12 => {
|
|
|
833
837
|
preserveWhiteSpace
|
|
834
838
|
});
|
|
835
839
|
} // We can only merge blocks with similar types
|
|
836
|
-
// thus, we transform the block to merge first
|
|
840
|
+
// thus, we transform the block to merge first.
|
|
837
841
|
|
|
838
842
|
|
|
839
|
-
const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0, _blocks.switchToBlockType)(cloneB, blockA.name); // If the block types can not match, do nothing
|
|
843
|
+
const blocksWithTheSameType = blockA.name === blockB.name ? [cloneB] : (0, _blocks.switchToBlockType)(cloneB, blockA.name); // If the block types can not match, do nothing.
|
|
840
844
|
|
|
841
845
|
if (!blocksWithTheSameType || !blocksWithTheSameType.length) {
|
|
842
846
|
return;
|
|
843
|
-
} // Calling the merge to update the attributes and remove the block to be merged
|
|
847
|
+
} // Calling the merge to update the attributes and remove the block to be merged.
|
|
844
848
|
|
|
845
849
|
|
|
846
850
|
const updatedAttributes = blockAType.merge(cloneA.attributes, blocksWithTheSameType[0].attributes);
|
|
@@ -1086,13 +1090,14 @@ function selectionChange(clientId, attributeKey, startOffset, endOffset) {
|
|
|
1086
1090
|
* @param {?Object} attributes Optional attributes of the block to assign.
|
|
1087
1091
|
* @param {?string} rootClientId Optional root client ID of block list on which
|
|
1088
1092
|
* to append.
|
|
1089
|
-
* @param {?number} index Optional index where to insert the default block
|
|
1090
|
-
*
|
|
1091
|
-
* @return {Object} Action object
|
|
1093
|
+
* @param {?number} index Optional index where to insert the default block.
|
|
1092
1094
|
*/
|
|
1093
1095
|
|
|
1094
1096
|
|
|
1095
|
-
|
|
1097
|
+
const insertDefaultBlock = (attributes, rootClientId, index) => _ref14 => {
|
|
1098
|
+
let {
|
|
1099
|
+
dispatch
|
|
1100
|
+
} = _ref14;
|
|
1096
1101
|
// Abort if there is no default block type (if it has been unregistered).
|
|
1097
1102
|
const defaultBlockName = (0, _blocks.getDefaultBlockName)();
|
|
1098
1103
|
|
|
@@ -1101,8 +1106,8 @@ function insertDefaultBlock(attributes, rootClientId, index) {
|
|
|
1101
1106
|
}
|
|
1102
1107
|
|
|
1103
1108
|
const block = (0, _blocks.createBlock)(defaultBlockName, attributes);
|
|
1104
|
-
return insertBlock(block, index, rootClientId);
|
|
1105
|
-
}
|
|
1109
|
+
return dispatch.insertBlock(block, index, rootClientId);
|
|
1110
|
+
};
|
|
1106
1111
|
/**
|
|
1107
1112
|
* Action that changes the nested settings of a given block.
|
|
1108
1113
|
*
|
|
@@ -1114,6 +1119,8 @@ function insertDefaultBlock(attributes, rootClientId, index) {
|
|
|
1114
1119
|
*/
|
|
1115
1120
|
|
|
1116
1121
|
|
|
1122
|
+
exports.insertDefaultBlock = insertDefaultBlock;
|
|
1123
|
+
|
|
1117
1124
|
function updateBlockListSettings(clientId, settings) {
|
|
1118
1125
|
return {
|
|
1119
1126
|
type: 'UPDATE_BLOCK_LIST_SETTINGS',
|
|
@@ -1187,10 +1194,10 @@ function __unstableMarkNextChangeAsNotPersistent() {
|
|
|
1187
1194
|
*/
|
|
1188
1195
|
|
|
1189
1196
|
|
|
1190
|
-
const __unstableMarkAutomaticChange = () =>
|
|
1197
|
+
const __unstableMarkAutomaticChange = () => _ref15 => {
|
|
1191
1198
|
let {
|
|
1192
1199
|
dispatch
|
|
1193
|
-
} =
|
|
1200
|
+
} = _ref15;
|
|
1194
1201
|
dispatch({
|
|
1195
1202
|
type: 'MARK_AUTOMATIC_CHANGE'
|
|
1196
1203
|
});
|
|
@@ -1214,10 +1221,10 @@ exports.__unstableMarkAutomaticChange = __unstableMarkAutomaticChange;
|
|
|
1214
1221
|
|
|
1215
1222
|
const setNavigationMode = function () {
|
|
1216
1223
|
let isNavigationMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
1217
|
-
return
|
|
1224
|
+
return _ref16 => {
|
|
1218
1225
|
let {
|
|
1219
1226
|
dispatch
|
|
1220
|
-
} =
|
|
1227
|
+
} = _ref16;
|
|
1221
1228
|
dispatch({
|
|
1222
1229
|
type: 'SET_NAVIGATION_MODE',
|
|
1223
1230
|
isNavigationMode
|
|
@@ -1241,10 +1248,10 @@ exports.setNavigationMode = setNavigationMode;
|
|
|
1241
1248
|
|
|
1242
1249
|
const setBlockMovingClientId = function () {
|
|
1243
1250
|
let hasBlockMovingClientId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1244
|
-
return
|
|
1251
|
+
return _ref17 => {
|
|
1245
1252
|
let {
|
|
1246
1253
|
dispatch
|
|
1247
|
-
} =
|
|
1254
|
+
} = _ref17;
|
|
1248
1255
|
dispatch({
|
|
1249
1256
|
type: 'SET_BLOCK_MOVING_MODE',
|
|
1250
1257
|
hasBlockMovingClientId
|
|
@@ -1267,11 +1274,11 @@ exports.setBlockMovingClientId = setBlockMovingClientId;
|
|
|
1267
1274
|
|
|
1268
1275
|
const duplicateBlocks = function (clientIds) {
|
|
1269
1276
|
let updateSelection = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
1270
|
-
return
|
|
1277
|
+
return _ref18 => {
|
|
1271
1278
|
let {
|
|
1272
1279
|
select,
|
|
1273
1280
|
dispatch
|
|
1274
|
-
} =
|
|
1281
|
+
} = _ref18;
|
|
1275
1282
|
|
|
1276
1283
|
if (!clientIds || !clientIds.length) {
|
|
1277
1284
|
return;
|
|
@@ -1312,11 +1319,11 @@ const duplicateBlocks = function (clientIds) {
|
|
|
1312
1319
|
|
|
1313
1320
|
exports.duplicateBlocks = duplicateBlocks;
|
|
1314
1321
|
|
|
1315
|
-
const insertBeforeBlock = clientId =>
|
|
1322
|
+
const insertBeforeBlock = clientId => _ref19 => {
|
|
1316
1323
|
let {
|
|
1317
1324
|
select,
|
|
1318
1325
|
dispatch
|
|
1319
|
-
} =
|
|
1326
|
+
} = _ref19;
|
|
1320
1327
|
|
|
1321
1328
|
if (!clientId) {
|
|
1322
1329
|
return;
|
|
@@ -1341,11 +1348,11 @@ const insertBeforeBlock = clientId => _ref18 => {
|
|
|
1341
1348
|
|
|
1342
1349
|
exports.insertBeforeBlock = insertBeforeBlock;
|
|
1343
1350
|
|
|
1344
|
-
const insertAfterBlock = clientId =>
|
|
1351
|
+
const insertAfterBlock = clientId => _ref20 => {
|
|
1345
1352
|
let {
|
|
1346
1353
|
select,
|
|
1347
1354
|
dispatch
|
|
1348
|
-
} =
|
|
1355
|
+
} = _ref20;
|
|
1349
1356
|
|
|
1350
1357
|
if (!clientId) {
|
|
1351
1358
|
return;
|
|
@@ -1385,10 +1392,10 @@ function toggleBlockHighlight(clientId, isHighlighted) {
|
|
|
1385
1392
|
*/
|
|
1386
1393
|
|
|
1387
1394
|
|
|
1388
|
-
const flashBlock = clientId => async
|
|
1395
|
+
const flashBlock = clientId => async _ref21 => {
|
|
1389
1396
|
let {
|
|
1390
1397
|
dispatch
|
|
1391
|
-
} =
|
|
1398
|
+
} = _ref21;
|
|
1392
1399
|
dispatch(toggleBlockHighlight(clientId, true));
|
|
1393
1400
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
1394
1401
|
dispatch(toggleBlockHighlight(clientId, false));
|