@wordpress/block-editor 8.2.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/README.md +6 -2
- 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 +1 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +5 -5
- 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-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-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.native.js +29 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +4 -4
- 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-select-button.js +2 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +1 -1
- package/build/components/list-view/block.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.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 -11
- 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/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/generated-class-name.js +3 -3
- package/build/hooks/generated-class-name.js.map +1 -1
- package/build/hooks/lock.js +1 -1
- package/build/hooks/lock.js.map +1 -1
- package/build/hooks/style.js +5 -2
- package/build/hooks/style.js.map +1 -1
- package/build/store/actions.js +4 -4
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +11 -11
- 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/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 +1 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +5 -5
- 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-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-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.native.js +4 -4
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +4 -4
- 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-select-button.js +2 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +1 -1
- package/build-module/components/list-view/block.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.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 -11
- 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/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/generated-class-name.js +3 -3
- package/build-module/hooks/generated-class-name.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 +5 -2
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/store/actions.js +4 -4
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +11 -11
- 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/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 +7 -0
- package/build-style/style.css +7 -0
- package/package.json +27 -27
- 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 +1 -1
- package/src/components/block-list/block.native.js +5 -5
- package/src/components/block-list/index.native.js +5 -5
- package/src/components/block-list/use-block-props/use-block-class-names.js +1 -1
- 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-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.native.js +10 -4
- package/src/components/inserter/block-patterns-tab.js +1 -1
- 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 +1 -1
- package/src/components/inserter/search-items.js +1 -1
- package/src/components/inserter/search-results.js +1 -1
- 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/index.js +4 -4
- package/src/components/line-height-control/index.native.js +2 -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/block-select-button.js +1 -1
- package/src/components/list-view/block.js +1 -1
- 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.native.js +3 -3
- package/src/components/rich-text/use-paste-handler.js +7 -13
- 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/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/generated-class-name.js +3 -3
- package/src/hooks/lock.js +1 -1
- package/src/hooks/style.js +5 -2
- package/src/hooks/test/align.js +1 -1
- package/src/store/actions.js +4 -4
- package/src/store/defaults.js +1 -2
- package/src/store/reducer.js +11 -11
- package/src/store/selectors.js +6 -6
- package/src/store/test/actions.js +1 -1
- package/src/store/test/reducer.js +1 -1
- package/src/store/test/selectors.js +1 -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-module/utils/get-paste-event-data.js +0 -47
- package/build-module/utils/get-paste-event-data.js.map +0 -1
- package/src/utils/get-paste-event-data.js +0 -42
|
@@ -75,7 +75,7 @@ describe( 'AlignmentUI', () => {
|
|
|
75
75
|
const customControls = wrapperCustomControls.props().controls;
|
|
76
76
|
expect( customControls ).toHaveLength( 2 );
|
|
77
77
|
|
|
78
|
-
//
|
|
78
|
+
// Should correctly call on change when right alignment is pressed (active alignment)
|
|
79
79
|
const rightControl = customControls.find(
|
|
80
80
|
( { align } ) => align === 'custom-right'
|
|
81
81
|
);
|
|
@@ -85,7 +85,7 @@ describe( 'AlignmentUI', () => {
|
|
|
85
85
|
expect( onChangeSpy ).toHaveBeenCalledWith( undefined );
|
|
86
86
|
onChangeSpy.mockClear();
|
|
87
87
|
|
|
88
|
-
//
|
|
88
|
+
// Should correctly call on change when right alignment is pressed (inactive alignment)
|
|
89
89
|
const leftControl = customControls.find(
|
|
90
90
|
( { align } ) => align === 'custom-left'
|
|
91
91
|
);
|
|
@@ -19,6 +19,7 @@ import { getDefaultBlockName, getBlockSupport } from '@wordpress/blocks';
|
|
|
19
19
|
*/
|
|
20
20
|
import { useBlockEditContext } from '../block-edit/context';
|
|
21
21
|
import blockAutocompleter from '../../autocompleters/block';
|
|
22
|
+
import linkAutocompleter from '../../autocompleters/link';
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* Shared reference to an empty array for cases where it is important to avoid
|
|
@@ -39,6 +40,7 @@ function useCompleters( { completers = EMPTY_ARRAY } ) {
|
|
|
39
40
|
) {
|
|
40
41
|
filteredCompleters = filteredCompleters.concat( [
|
|
41
42
|
blockAutocompleter,
|
|
43
|
+
linkAutocompleter,
|
|
42
44
|
] );
|
|
43
45
|
}
|
|
44
46
|
|
|
@@ -98,7 +98,7 @@ export default function BlockActions( {
|
|
|
98
98
|
|
|
99
99
|
const groupingBlockName = getGroupingBlockName();
|
|
100
100
|
|
|
101
|
-
// Activate the `transform` on `core/group` which does the conversion
|
|
101
|
+
// Activate the `transform` on `core/group` which does the conversion.
|
|
102
102
|
const newBlocks = switchToBlockType( blocks, groupingBlockName );
|
|
103
103
|
|
|
104
104
|
if ( ! newBlocks ) {
|
|
@@ -14,7 +14,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
14
14
|
import BlockAlignmentUI from '../ui';
|
|
15
15
|
|
|
16
16
|
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
17
|
-
// This allows us to tweak the returned value on each test
|
|
17
|
+
// This allows us to tweak the returned value on each test.
|
|
18
18
|
const mock = jest.fn();
|
|
19
19
|
return mock;
|
|
20
20
|
} );
|
|
@@ -80,7 +80,10 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
80
80
|
variant="tertiary"
|
|
81
81
|
onClick={ () => selectBlock( parentClientId ) }
|
|
82
82
|
>
|
|
83
|
-
<BlockTitle
|
|
83
|
+
<BlockTitle
|
|
84
|
+
clientId={ parentClientId }
|
|
85
|
+
maximumLength={ 35 }
|
|
86
|
+
/>
|
|
84
87
|
</Button>
|
|
85
88
|
<Icon
|
|
86
89
|
icon={ chevronRightSmall }
|
|
@@ -93,7 +96,7 @@ function BlockBreadcrumb( { rootLabelText } ) {
|
|
|
93
96
|
className="block-editor-block-breadcrumb__current"
|
|
94
97
|
aria-current="true"
|
|
95
98
|
>
|
|
96
|
-
<BlockTitle clientId={ clientId } />
|
|
99
|
+
<BlockTitle clientId={ clientId } maximumLength={ 35 } />
|
|
97
100
|
</li>
|
|
98
101
|
) }
|
|
99
102
|
</ul>
|
|
@@ -43,10 +43,10 @@ function BlockCompare( {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function getConvertedContent( convertedBlock ) {
|
|
46
|
-
// The convertor may return an array of items or a single item
|
|
46
|
+
// The convertor may return an array of items or a single item.
|
|
47
47
|
const newBlocks = castArray( convertedBlock );
|
|
48
48
|
|
|
49
|
-
// Get converted block details
|
|
49
|
+
// Get converted block details.
|
|
50
50
|
const newContent = newBlocks.map( ( item ) =>
|
|
51
51
|
getSaveContent( item.name, item.attributes, item.innerBlocks )
|
|
52
52
|
);
|
|
@@ -8,7 +8,7 @@ const BlockControls = BlockControlsFill;
|
|
|
8
8
|
|
|
9
9
|
BlockControls.Slot = BlockControlsSlot;
|
|
10
10
|
|
|
11
|
-
// This is just here for backward compatibility
|
|
11
|
+
// This is just here for backward compatibility.
|
|
12
12
|
export const BlockFormatControls = ( props ) => {
|
|
13
13
|
return <BlockControlsFill group="inline" { ...props } />;
|
|
14
14
|
};
|
|
@@ -6,7 +6,7 @@ import BlockDraggableChip from '../draggable-chip';
|
|
|
6
6
|
export default { title: 'BlockEditor/BlockDraggable' };
|
|
7
7
|
|
|
8
8
|
export const _default = () => {
|
|
9
|
-
//
|
|
9
|
+
// Create a wrapper box for the absolutely-positioned child component.
|
|
10
10
|
const wrapperStyle = { margin: '24px 0', position: 'relative' };
|
|
11
11
|
return (
|
|
12
12
|
<div style={ wrapperStyle }>
|
|
@@ -55,7 +55,7 @@ export const Edit = ( props ) => {
|
|
|
55
55
|
return <Component { ...props } context={ context } />;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
// Generate a class name for the block's editable form
|
|
58
|
+
// Generate a class name for the block's editable form.
|
|
59
59
|
const generatedClassName = hasBlockSupport( blockType, 'className', true )
|
|
60
60
|
? getBlockDefaultClassName( name )
|
|
61
61
|
: null;
|
|
@@ -53,7 +53,7 @@ function BlockHTML( { clientId } ) {
|
|
|
53
53
|
isValid,
|
|
54
54
|
} );
|
|
55
55
|
|
|
56
|
-
// Ensure the state is updated if we reset so it displays the default content
|
|
56
|
+
// Ensure the state is updated if we reset so it displays the default content.
|
|
57
57
|
if ( ! html ) {
|
|
58
58
|
setHtml( { content } );
|
|
59
59
|
}
|
|
@@ -28,7 +28,7 @@ export function BlockInvalidWarning( {
|
|
|
28
28
|
const onCompare = useCallback( () => setCompare( true ), [] );
|
|
29
29
|
const onCompareClose = useCallback( () => setCompare( false ), [] );
|
|
30
30
|
|
|
31
|
-
// We memo the array here to prevent the children components from being updated unexpectedly
|
|
31
|
+
// We memo the array here to prevent the children components from being updated unexpectedly.
|
|
32
32
|
const hiddenActions = useMemo(
|
|
33
33
|
() =>
|
|
34
34
|
[
|
|
@@ -209,18 +209,18 @@ export default compose( [
|
|
|
209
209
|
! isStackedHorizontally &&
|
|
210
210
|
blockInsertionPointIsVisible &&
|
|
211
211
|
insertionPoint.rootClientId === rootClientId &&
|
|
212
|
-
//
|
|
212
|
+
// If list is empty, show the insertion point (via the default appender)
|
|
213
213
|
( blockClientIds.length === 0 ||
|
|
214
|
-
//
|
|
214
|
+
// Or if the insertion point is right before the denoted block.
|
|
215
215
|
blockClientIds[ insertionPoint.index ] === clientId );
|
|
216
216
|
|
|
217
217
|
const shouldShowInsertionPointAfter =
|
|
218
218
|
! isStackedHorizontally &&
|
|
219
219
|
blockInsertionPointIsVisible &&
|
|
220
220
|
insertionPoint.rootClientId === rootClientId &&
|
|
221
|
-
//
|
|
221
|
+
// If the insertion point is at the end of the list.
|
|
222
222
|
blockClientIds.length === insertionPoint.index &&
|
|
223
|
-
//
|
|
223
|
+
// And the denoted block is the last one on the list, show the indicator at the end of the block.
|
|
224
224
|
blockClientIds[ insertionPoint.index - 1 ] === clientId;
|
|
225
225
|
|
|
226
226
|
const isReadOnly = getSettings().readOnly;
|
|
@@ -38,11 +38,11 @@ const BlockSelectionButton = ( {
|
|
|
38
38
|
<TouchableOpacity
|
|
39
39
|
style={ styles.button }
|
|
40
40
|
onPress={ () => {
|
|
41
|
-
/* Open BottomSheet with markup */
|
|
41
|
+
/* Open BottomSheet with markup. */
|
|
42
42
|
} }
|
|
43
43
|
disabled={
|
|
44
44
|
true
|
|
45
|
-
} /* Disable temporarily since onPress function is empty */
|
|
45
|
+
} /* Disable temporarily since onPress function is empty. */
|
|
46
46
|
>
|
|
47
47
|
{ rootClientId &&
|
|
48
48
|
rootBlockIcon && [
|
|
@@ -72,7 +72,7 @@ const BlockSelectionButton = ( {
|
|
|
72
72
|
numberOfLines={ 1 }
|
|
73
73
|
style={ styles.selectionButtonTitle }
|
|
74
74
|
>
|
|
75
|
-
<BlockTitle clientId={ clientId } />
|
|
75
|
+
<BlockTitle clientId={ clientId } maximumLength={ 35 } />
|
|
76
76
|
</Text>
|
|
77
77
|
</TouchableOpacity>
|
|
78
78
|
</View>
|
|
@@ -330,7 +330,7 @@ export default compose(
|
|
|
330
330
|
pure,
|
|
331
331
|
applyWithSelect,
|
|
332
332
|
applyWithDispatch,
|
|
333
|
-
//
|
|
333
|
+
// Block is sometimes not mounted at the right time, causing it be undefined
|
|
334
334
|
// see issue for more info
|
|
335
335
|
// https://github.com/WordPress/gutenberg/issues/17013
|
|
336
336
|
ifCondition( ( { block } ) => !! block ),
|
|
@@ -86,9 +86,9 @@ function BlockForType( {
|
|
|
86
86
|
onReplace={ onReplace }
|
|
87
87
|
insertBlocksAfter={ insertBlocksAfter }
|
|
88
88
|
mergeBlocks={ mergeBlocks }
|
|
89
|
-
// Block level styles
|
|
89
|
+
// Block level styles.
|
|
90
90
|
wrapperProps={ wrapperProps }
|
|
91
|
-
//
|
|
91
|
+
// Inherited styles merged with block level styles.
|
|
92
92
|
style={ mergedStyle }
|
|
93
93
|
clientId={ clientId }
|
|
94
94
|
parentWidth={ parentWidth }
|
|
@@ -127,7 +127,7 @@ class BlockListBlock extends Component {
|
|
|
127
127
|
this.props.onInsertBlocks( blocks, this.props.order + 1 );
|
|
128
128
|
|
|
129
129
|
if ( blocks[ 0 ] ) {
|
|
130
|
-
//
|
|
130
|
+
// Focus on the first block inserted.
|
|
131
131
|
this.props.onSelect( blocks[ 0 ].clientId );
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -286,7 +286,7 @@ class BlockListBlock extends Component {
|
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference
|
|
289
|
+
// Helper function to memoize the wrapperProps since getEditWrapperProps always returns a new reference.
|
|
290
290
|
const wrapperPropsCache = new WeakMap();
|
|
291
291
|
const emptyObj = {};
|
|
292
292
|
function getWrapperProps( value, getWrapperPropsFunction ) {
|
|
@@ -339,7 +339,7 @@ export default compose( [
|
|
|
339
339
|
: parents[ parents.length - 1 ];
|
|
340
340
|
|
|
341
341
|
const isParentSelected =
|
|
342
|
-
//
|
|
342
|
+
// Set false as a default value to prevent re-render when it's changed from null to false.
|
|
343
343
|
( selectedBlockClientId || false ) &&
|
|
344
344
|
selectedBlockClientId === parentId;
|
|
345
345
|
|
|
@@ -171,7 +171,7 @@ export class BlockList extends Component {
|
|
|
171
171
|
|
|
172
172
|
render() {
|
|
173
173
|
const { isRootList } = this.props;
|
|
174
|
-
// Use of Context to propagate the main scroll ref to its children e.g InnerBlocks
|
|
174
|
+
// Use of Context to propagate the main scroll ref to its children e.g InnerBlocks.
|
|
175
175
|
const blockList = isRootList ? (
|
|
176
176
|
<BlockListContext.Provider value={ this.scrollViewRef }>
|
|
177
177
|
{ this.renderList() }
|
|
@@ -223,7 +223,7 @@ export class BlockList extends Component {
|
|
|
223
223
|
|
|
224
224
|
const containerStyle = {
|
|
225
225
|
flex: isRootList ? 1 : 0,
|
|
226
|
-
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks
|
|
226
|
+
// We set negative margin in the parent to remove the edge spacing between parent block and child block in ineer blocks.
|
|
227
227
|
marginVertical: isRootList ? 0 : -marginVertical,
|
|
228
228
|
marginHorizontal: isRootList ? 0 : -marginHorizontal,
|
|
229
229
|
};
|
|
@@ -388,7 +388,7 @@ export default compose( [
|
|
|
388
388
|
const selectedBlockClientId = getSelectedBlockClientId();
|
|
389
389
|
|
|
390
390
|
let blockClientIds = getBlockOrder( rootClientId );
|
|
391
|
-
// Display only block which fulfill the condition in passed `filterInnerBlocks` function
|
|
391
|
+
// Display only block which fulfill the condition in passed `filterInnerBlocks` function.
|
|
392
392
|
if ( filterInnerBlocks ) {
|
|
393
393
|
blockClientIds = filterInnerBlocks( blockClientIds );
|
|
394
394
|
}
|
|
@@ -477,9 +477,9 @@ const EmptyListComponentCompose = compose( [
|
|
|
477
477
|
! isStackedHorizontally &&
|
|
478
478
|
blockInsertionPointIsVisible &&
|
|
479
479
|
insertionPoint.rootClientId === rootClientId &&
|
|
480
|
-
//
|
|
480
|
+
// If list is empty, show the insertion point (via the default appender)
|
|
481
481
|
( blockClientIds.length === 0 ||
|
|
482
|
-
//
|
|
482
|
+
// Or if the insertion point is right before the denoted block.
|
|
483
483
|
! blockClientIds[ insertionPoint.index ] );
|
|
484
484
|
|
|
485
485
|
return {
|
|
@@ -43,7 +43,7 @@ export function useBlockClassNames( clientId ) {
|
|
|
43
43
|
const isSelected = isBlockSelected( clientId );
|
|
44
44
|
const name = getBlockName( clientId );
|
|
45
45
|
const checkDeep = true;
|
|
46
|
-
// "ancestor" is the more appropriate label due to "deep" check
|
|
46
|
+
// "ancestor" is the more appropriate label due to "deep" check.
|
|
47
47
|
const isAncestorOfSelectedBlock = hasSelectedInnerBlock(
|
|
48
48
|
clientId,
|
|
49
49
|
checkDeep
|
|
@@ -124,7 +124,7 @@ export class BlockMediaUpdateProgress extends Component {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
// ---- Block media save actions
|
|
127
|
+
// ---- Block media save actions.
|
|
128
128
|
updateMediaSaveProgress( payload ) {
|
|
129
129
|
this.setState( {
|
|
130
130
|
progress: payload.progress,
|
|
@@ -184,7 +184,7 @@ export class BlockMediaUpdateProgress extends Component {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
// ---- Block media upload actions
|
|
187
|
+
// ---- Block media upload actions.
|
|
188
188
|
updateMediaUploadProgress( payload ) {
|
|
189
189
|
this.setState( {
|
|
190
190
|
progress: payload.progress,
|
|
@@ -220,7 +220,7 @@ export class BlockMediaUpdateProgress extends Component {
|
|
|
220
220
|
}
|
|
221
221
|
|
|
222
222
|
addMediaUploadListener() {
|
|
223
|
-
//
|
|
223
|
+
// If we already have a subscription not worth doing it again.
|
|
224
224
|
if ( this.subscriptionParentMediaUpload ) {
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
@@ -238,7 +238,7 @@ export class BlockMediaUpdateProgress extends Component {
|
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
addMediaSaveListener() {
|
|
241
|
-
//
|
|
241
|
+
// If we already have a subscription not worth doing it again.
|
|
242
242
|
if ( this.subscriptionParentMediaSave ) {
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
@@ -130,7 +130,7 @@ describe( 'BlockMediaUpdateProgress component', () => {
|
|
|
130
130
|
expect( onUpdateMediaUploadProgress ).toHaveBeenCalledWith( payload );
|
|
131
131
|
} );
|
|
132
132
|
|
|
133
|
-
// UPLOAD tests
|
|
133
|
+
// UPLOAD tests.
|
|
134
134
|
it( 'upload does not get affected by unrelated media uploads', () => {
|
|
135
135
|
const payload = {
|
|
136
136
|
state: MEDIA_UPLOAD_STATE_UPLOADING,
|
|
@@ -276,7 +276,7 @@ describe( 'BlockMediaUpdateProgress component', () => {
|
|
|
276
276
|
expect( onMediaUploadStateReset ).toHaveBeenCalledWith( payloadReset );
|
|
277
277
|
} );
|
|
278
278
|
|
|
279
|
-
// SAVE tests
|
|
279
|
+
// SAVE tests.
|
|
280
280
|
it( 'save does not get affected by unrelated media save events', () => {
|
|
281
281
|
const payload = {
|
|
282
282
|
state: MEDIA_SAVE_STATE_SAVING,
|
|
@@ -39,7 +39,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
39
39
|
import BlockTransformationsMenu from '../block-switcher/block-transformations-menu';
|
|
40
40
|
|
|
41
41
|
const BlockActionsMenu = ( {
|
|
42
|
-
// Select
|
|
42
|
+
// Select.
|
|
43
43
|
blockTitle,
|
|
44
44
|
canInsertBlockType,
|
|
45
45
|
getBlocksByClientId,
|
|
@@ -53,7 +53,7 @@ const BlockActionsMenu = ( {
|
|
|
53
53
|
rootClientId,
|
|
54
54
|
selectedBlockClientId,
|
|
55
55
|
selectedBlockPossibleTransformations,
|
|
56
|
-
// Dispatch
|
|
56
|
+
// Dispatch.
|
|
57
57
|
createSuccessNotice,
|
|
58
58
|
convertToRegularBlocks,
|
|
59
59
|
duplicateBlock,
|
|
@@ -62,7 +62,7 @@ const BlockActionsMenu = ( {
|
|
|
62
62
|
openGeneralSidebar,
|
|
63
63
|
pasteBlock,
|
|
64
64
|
removeBlocks,
|
|
65
|
-
// Passed in
|
|
65
|
+
// Passed in.
|
|
66
66
|
anchorNodeRef,
|
|
67
67
|
isStackedHorizontally,
|
|
68
68
|
onDelete,
|
|
@@ -76,10 +76,10 @@ const BlockMobileToolbar = ( {
|
|
|
76
76
|
<View style={ styles.spacer } />
|
|
77
77
|
|
|
78
78
|
<BlockSettingsButton.Slot>
|
|
79
|
-
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls */ }
|
|
79
|
+
{ /* Render only one settings icon even if we have more than one fill - need for hooks with controls. */ }
|
|
80
80
|
{ ( fills = [ null ] ) => (
|
|
81
81
|
// The purpose of BlockSettingsButtonFill component is only to provide a way
|
|
82
|
-
// to pass data upstream from the slot rendering
|
|
82
|
+
// to pass data upstream from the slot rendering.
|
|
83
83
|
<BlockSettingsButtonFill
|
|
84
84
|
fillsLength={ fills.length }
|
|
85
85
|
onChangeFillsLength={ setFillsLength }
|
|
@@ -64,7 +64,7 @@ export function getBlockMoverDescription(
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
if ( dir > 0 && ! isLast ) {
|
|
67
|
-
//
|
|
67
|
+
// Moving down.
|
|
68
68
|
const movementDirection = getMovementDirection( 'down' );
|
|
69
69
|
|
|
70
70
|
if ( movementDirection === 'down' ) {
|
|
@@ -105,7 +105,7 @@ export function getBlockMoverDescription(
|
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
if ( dir > 0 && isLast ) {
|
|
108
|
-
//
|
|
108
|
+
// Moving down, and is the last item.
|
|
109
109
|
const movementDirection = getMovementDirection( 'down' );
|
|
110
110
|
|
|
111
111
|
if ( movementDirection === 'down' ) {
|
|
@@ -140,7 +140,7 @@ export function getBlockMoverDescription(
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
if ( dir < 0 && ! isFirst ) {
|
|
143
|
-
//
|
|
143
|
+
// Moving up.
|
|
144
144
|
const movementDirection = getMovementDirection( 'up' );
|
|
145
145
|
|
|
146
146
|
if ( movementDirection === 'up' ) {
|
|
@@ -179,7 +179,7 @@ export function getBlockMoverDescription(
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
if ( dir < 0 && isFirst ) {
|
|
182
|
-
//
|
|
182
|
+
// Moving up, and is the first item.
|
|
183
183
|
const movementDirection = getMovementDirection( 'up' );
|
|
184
184
|
|
|
185
185
|
if ( movementDirection === 'up' ) {
|
|
@@ -70,11 +70,11 @@ function switchButtonPropIfRTL(
|
|
|
70
70
|
isStackedHorizontally
|
|
71
71
|
) {
|
|
72
72
|
if ( I18nManager.isRTL && isStackedHorizontally ) {
|
|
73
|
-
//
|
|
73
|
+
// For RTL and horizontal direction switch prop between forward and backward button.
|
|
74
74
|
if ( isBackwardButton ) {
|
|
75
|
-
return forwardButtonProp; //
|
|
75
|
+
return forwardButtonProp; // Set forwardButtonProp for backward button.
|
|
76
76
|
}
|
|
77
|
-
return backwardButtonProp; //
|
|
77
|
+
return backwardButtonProp; // Set backwardButtonProp for forward button.
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
return isBackwardButton ? backwardButtonProp : forwardButtonProp;
|
|
@@ -128,10 +128,10 @@ function getMoverActionTitle( isStackedHorizontally ) {
|
|
|
128
128
|
|
|
129
129
|
function getMoverButtonTitle( isStackedHorizontally, { firstIndex } ) {
|
|
130
130
|
const getIndexes = ( isBackwardButton ) => {
|
|
131
|
-
const fromIndex = firstIndex + 1; //
|
|
131
|
+
const fromIndex = firstIndex + 1; // Current position based on index
|
|
132
132
|
// for backwardButton decrease index (move left/up) for forwardButton increase index (move right/down)
|
|
133
133
|
const direction = isBackwardButton ? -1 : 1;
|
|
134
|
-
const toIndex = fromIndex + direction; //
|
|
134
|
+
const toIndex = fromIndex + direction; // Position after move.
|
|
135
135
|
return [ fromIndex, toIndex ];
|
|
136
136
|
};
|
|
137
137
|
|
|
@@ -10,9 +10,8 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
10
10
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
11
11
|
import { useSelect } from '@wordpress/data';
|
|
12
12
|
import { moreVertical } from '@wordpress/icons';
|
|
13
|
-
|
|
14
13
|
import { Children, cloneElement, useCallback } from '@wordpress/element';
|
|
15
|
-
import { serialize
|
|
14
|
+
import { serialize } from '@wordpress/blocks';
|
|
16
15
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
17
16
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
18
17
|
|
|
@@ -25,6 +24,7 @@ import BlockHTMLConvertButton from './block-html-convert-button';
|
|
|
25
24
|
import __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';
|
|
26
25
|
import BlockSettingsMenuControls from '../block-settings-menu-controls';
|
|
27
26
|
import { store as blockEditorStore } from '../../store';
|
|
27
|
+
import useBlockDisplayTitle from '../block-title/use-block-display-title';
|
|
28
28
|
|
|
29
29
|
const POPOVER_PROPS = {
|
|
30
30
|
className: 'block-editor-block-settings-menu__popover',
|
|
@@ -46,14 +46,11 @@ export function BlockSettingsDropdown( {
|
|
|
46
46
|
const blockClientIds = castArray( clientIds );
|
|
47
47
|
const count = blockClientIds.length;
|
|
48
48
|
const firstBlockClientId = blockClientIds[ 0 ];
|
|
49
|
-
const { onlyBlock
|
|
49
|
+
const { onlyBlock } = useSelect(
|
|
50
50
|
( select ) => {
|
|
51
|
-
const { getBlockCount
|
|
52
|
-
const { getBlockType } = select( blocksStore );
|
|
51
|
+
const { getBlockCount } = select( blockEditorStore );
|
|
53
52
|
return {
|
|
54
53
|
onlyBlock: 1 === getBlockCount(),
|
|
55
|
-
title: getBlockType( getBlockName( firstBlockClientId ) )
|
|
56
|
-
?.title,
|
|
57
54
|
};
|
|
58
55
|
},
|
|
59
56
|
[ firstBlockClientId ]
|
|
@@ -87,10 +84,12 @@ export function BlockSettingsDropdown( {
|
|
|
87
84
|
[ __experimentalSelectBlock ]
|
|
88
85
|
);
|
|
89
86
|
|
|
87
|
+
const blockTitle = useBlockDisplayTitle( firstBlockClientId, 25 );
|
|
88
|
+
|
|
90
89
|
const label = sprintf(
|
|
91
90
|
/* translators: %s: block name */
|
|
92
91
|
__( 'Remove %s' ),
|
|
93
|
-
|
|
92
|
+
blockTitle
|
|
94
93
|
);
|
|
95
94
|
const removeBlockLabel = count === 1 ? label : __( 'Remove blocks' );
|
|
96
95
|
|
|
@@ -32,7 +32,7 @@ function StylePreview( { onPress, isActive, style, url } ) {
|
|
|
32
32
|
|
|
33
33
|
function onLayout() {
|
|
34
34
|
const columnsNum =
|
|
35
|
-
// To indicate scroll availabilty, there is a need to display additional half the column
|
|
35
|
+
// To indicate scroll availabilty, there is a need to display additional half the column.
|
|
36
36
|
Math.floor( BottomSheet.getWidth() / MAX_ITEM_WIDTH ) + HALF_COLUMN;
|
|
37
37
|
setItemWidth( BottomSheet.getWidth() / columnsNum );
|
|
38
38
|
}
|
|
@@ -158,7 +158,10 @@ export const BlockSwitcherDropdownMenu = ( { clientIds, blocks } ) => {
|
|
|
158
158
|
/>
|
|
159
159
|
{ ( isReusable || isTemplate ) && (
|
|
160
160
|
<span className="block-editor-block-switcher__toggle-text">
|
|
161
|
-
<BlockTitle
|
|
161
|
+
<BlockTitle
|
|
162
|
+
clientId={ clientIds }
|
|
163
|
+
maximumLength={ 35 }
|
|
164
|
+
/>
|
|
162
165
|
</span>
|
|
163
166
|
) }
|
|
164
167
|
</>
|
|
@@ -92,7 +92,6 @@ export const getPatternTransformedBlocks = (
|
|
|
92
92
|
* @param {WPBlock[]} selectedBlocks The currently selected blocks.
|
|
93
93
|
* @return {TransformedBlockPattern[]} Returns the eligible matched patterns with all the selected blocks.
|
|
94
94
|
*/
|
|
95
|
-
// TODO tests
|
|
96
95
|
const useTransformedPatterns = ( patterns, selectedBlocks ) => {
|
|
97
96
|
return useMemo(
|
|
98
97
|
() =>
|
|
@@ -5,5 +5,21 @@ Renders the block's configured title as a string, or empty if the title cannot b
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```jsx
|
|
8
|
-
<BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
|
|
8
|
+
<BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 12 }/>
|
|
9
9
|
```
|
|
10
|
+
|
|
11
|
+
### Props
|
|
12
|
+
|
|
13
|
+
#### clientId
|
|
14
|
+
|
|
15
|
+
The client ID of a block.
|
|
16
|
+
|
|
17
|
+
- Type: `String`
|
|
18
|
+
- Required: Yes
|
|
19
|
+
|
|
20
|
+
#### maximumLength
|
|
21
|
+
|
|
22
|
+
The maximum length that the block title string may be before truncated. If `undefined` no truncation will take place.
|
|
23
|
+
|
|
24
|
+
- Type: `Number`
|
|
25
|
+
- Required: No
|
|
@@ -1,23 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { truncate } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
11
|
-
getBlockType,
|
|
12
|
-
__experimentalGetBlockLabel as getBlockLabel,
|
|
13
|
-
isReusableBlock,
|
|
14
|
-
} from '@wordpress/blocks';
|
|
15
|
-
|
|
16
1
|
/**
|
|
17
2
|
* Internal dependencies
|
|
18
3
|
*/
|
|
19
|
-
|
|
20
|
-
import
|
|
4
|
+
|
|
5
|
+
import useBlockDisplayTitle from './use-block-display-title';
|
|
21
6
|
|
|
22
7
|
/**
|
|
23
8
|
* Renders the block's configured title as a string, or empty if the title
|
|
@@ -26,55 +11,15 @@ import { store as blockEditorStore } from '../../store';
|
|
|
26
11
|
* @example
|
|
27
12
|
*
|
|
28
13
|
* ```jsx
|
|
29
|
-
* <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" />
|
|
14
|
+
* <BlockTitle clientId="afd1cb17-2c08-4e7a-91be-007ba7ddc3a1" maximumLength={ 17 }/>
|
|
30
15
|
* ```
|
|
31
16
|
*
|
|
32
17
|
* @param {Object} props
|
|
33
18
|
* @param {string} props.clientId Client ID of block.
|
|
19
|
+
* @param {number|undefined} props.maximumLength The maximum length that the block title string may be before truncated.
|
|
34
20
|
*
|
|
35
|
-
* @return {
|
|
21
|
+
* @return {JSX.Element} Block title.
|
|
36
22
|
*/
|
|
37
|
-
export default function BlockTitle( { clientId } ) {
|
|
38
|
-
|
|
39
|
-
( select ) => {
|
|
40
|
-
if ( ! clientId ) {
|
|
41
|
-
return {};
|
|
42
|
-
}
|
|
43
|
-
const {
|
|
44
|
-
getBlockName,
|
|
45
|
-
getBlockAttributes,
|
|
46
|
-
__experimentalGetReusableBlockTitle,
|
|
47
|
-
} = select( blockEditorStore );
|
|
48
|
-
const blockName = getBlockName( clientId );
|
|
49
|
-
if ( ! blockName ) {
|
|
50
|
-
return {};
|
|
51
|
-
}
|
|
52
|
-
const isReusable = isReusableBlock( getBlockType( blockName ) );
|
|
53
|
-
return {
|
|
54
|
-
attributes: getBlockAttributes( clientId ),
|
|
55
|
-
name: blockName,
|
|
56
|
-
reusableBlockTitle:
|
|
57
|
-
isReusable &&
|
|
58
|
-
__experimentalGetReusableBlockTitle(
|
|
59
|
-
getBlockAttributes( clientId ).ref
|
|
60
|
-
),
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
[ clientId ]
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
const blockInformation = useBlockDisplayInformation( clientId );
|
|
67
|
-
if ( ! name || ! blockInformation ) return null;
|
|
68
|
-
const blockType = getBlockType( name );
|
|
69
|
-
const blockLabel = blockType
|
|
70
|
-
? getBlockLabel( blockType, attributes )
|
|
71
|
-
: null;
|
|
72
|
-
const label = reusableBlockTitle || blockLabel;
|
|
73
|
-
// Label will fallback to the title if no label is defined for the current
|
|
74
|
-
// label context. If the label is defined we prioritize it over possible
|
|
75
|
-
// possible block variation title match.
|
|
76
|
-
if ( label && label !== blockType.title ) {
|
|
77
|
-
return truncate( label, { length: 35 } );
|
|
78
|
-
}
|
|
79
|
-
return blockInformation.title;
|
|
23
|
+
export default function BlockTitle( { clientId, maximumLength } ) {
|
|
24
|
+
return useBlockDisplayTitle( clientId, maximumLength );
|
|
80
25
|
}
|