@wordpress/block-editor 8.2.0 → 8.3.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 +2 -0
- 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 +2 -2
- 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/duotone.js +22 -4
- package/build/hooks/duotone.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 +2 -2
- 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/duotone.js +23 -5
- package/build-module/hooks/duotone.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 +2 -2
- 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/duotone.js +27 -3
- 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
|
@@ -55,7 +55,7 @@ jest.mock( '../../use-block-display-information', () => {
|
|
|
55
55
|
} );
|
|
56
56
|
|
|
57
57
|
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
58
|
-
// This allows us to tweak the returned value on each test
|
|
58
|
+
// This allows us to tweak the returned value on each test.
|
|
59
59
|
const mock = jest.fn();
|
|
60
60
|
return mock;
|
|
61
61
|
} );
|
|
@@ -106,7 +106,23 @@ describe( 'BlockTitle', () => {
|
|
|
106
106
|
expect( wrapper.text() ).toBe( 'Test Label' );
|
|
107
107
|
} );
|
|
108
108
|
|
|
109
|
-
it( 'truncates the label
|
|
109
|
+
it( 'truncates the label with custom truncate length', () => {
|
|
110
|
+
useSelect.mockImplementation( () => ( {
|
|
111
|
+
name: 'name-with-long-label',
|
|
112
|
+
attributes: null,
|
|
113
|
+
} ) );
|
|
114
|
+
|
|
115
|
+
const wrapper = shallow(
|
|
116
|
+
<BlockTitle
|
|
117
|
+
clientId="id-name-with-long-label"
|
|
118
|
+
maximumLength={ 12 }
|
|
119
|
+
/>
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
expect( wrapper.text() ).toBe( 'This is a...' );
|
|
123
|
+
} );
|
|
124
|
+
|
|
125
|
+
it( 'should not truncate the label if maximum length is undefined', () => {
|
|
110
126
|
useSelect.mockImplementation( () => ( {
|
|
111
127
|
name: 'name-with-long-label',
|
|
112
128
|
attributes: null,
|
|
@@ -116,6 +132,8 @@ describe( 'BlockTitle', () => {
|
|
|
116
132
|
<BlockTitle clientId="id-name-with-long-label" />
|
|
117
133
|
);
|
|
118
134
|
|
|
119
|
-
expect( wrapper.text() ).toBe(
|
|
135
|
+
expect( wrapper.text() ).toBe(
|
|
136
|
+
'This is a longer label than typical for blocks to have.'
|
|
137
|
+
);
|
|
120
138
|
} );
|
|
121
139
|
} );
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import useBlockDisplayInformation from '../use-block-display-information';
|
|
20
|
+
import { store as blockEditorStore } from '../../store';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Returns the block's configured title as a string, or empty if the title
|
|
24
|
+
* cannot be determined.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
*
|
|
28
|
+
* ```js
|
|
29
|
+
* useBlockDisplayTitle( 'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1', 17 );
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param {string} clientId Client ID of block.
|
|
33
|
+
* @param {number|undefined} maximumLength The maximum length that the block title string may be before truncated.
|
|
34
|
+
* @return {?string} Block title.
|
|
35
|
+
*/
|
|
36
|
+
export default function useBlockDisplayTitle( clientId, maximumLength ) {
|
|
37
|
+
const { attributes, name, reusableBlockTitle } = useSelect(
|
|
38
|
+
( select ) => {
|
|
39
|
+
if ( ! clientId ) {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const {
|
|
43
|
+
getBlockName,
|
|
44
|
+
getBlockAttributes,
|
|
45
|
+
__experimentalGetReusableBlockTitle,
|
|
46
|
+
} = select( blockEditorStore );
|
|
47
|
+
const blockName = getBlockName( clientId );
|
|
48
|
+
if ( ! blockName ) {
|
|
49
|
+
return {};
|
|
50
|
+
}
|
|
51
|
+
const isReusable = isReusableBlock( getBlockType( blockName ) );
|
|
52
|
+
return {
|
|
53
|
+
attributes: getBlockAttributes( clientId ),
|
|
54
|
+
name: blockName,
|
|
55
|
+
reusableBlockTitle:
|
|
56
|
+
isReusable &&
|
|
57
|
+
__experimentalGetReusableBlockTitle(
|
|
58
|
+
getBlockAttributes( clientId ).ref
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
[ clientId ]
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
66
|
+
if ( ! name || ! blockInformation ) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const blockType = getBlockType( name );
|
|
70
|
+
const blockLabel = blockType
|
|
71
|
+
? getBlockLabel( blockType, attributes )
|
|
72
|
+
: null;
|
|
73
|
+
const label = reusableBlockTitle || blockLabel;
|
|
74
|
+
// Label will fallback to the title if no label is defined for the current
|
|
75
|
+
// label context. If the label is defined we prioritize it over possible
|
|
76
|
+
// possible block variation title match.
|
|
77
|
+
if ( label && label !== blockType.title ) {
|
|
78
|
+
return maximumLength && maximumLength > 0
|
|
79
|
+
? truncate( label, { length: maximumLength } )
|
|
80
|
+
: label;
|
|
81
|
+
}
|
|
82
|
+
return blockInformation.title;
|
|
83
|
+
}
|
|
@@ -44,7 +44,6 @@ export function useDebouncedShowMovers( {
|
|
|
44
44
|
|
|
45
45
|
const shouldHideMovers = () => {
|
|
46
46
|
const isHovered = getIsHovered();
|
|
47
|
-
|
|
48
47
|
return ! isFocused && ! isHovered;
|
|
49
48
|
};
|
|
50
49
|
|
|
@@ -82,7 +81,18 @@ export function useDebouncedShowMovers( {
|
|
|
82
81
|
}, debounceTimeout );
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
useEffect(
|
|
84
|
+
useEffect(
|
|
85
|
+
() => () => {
|
|
86
|
+
/**
|
|
87
|
+
* We need to call the change handler with `isFocused`
|
|
88
|
+
* set to false on unmount because we also clear the
|
|
89
|
+
* timeout that would handle that.
|
|
90
|
+
*/
|
|
91
|
+
handleOnChange( false );
|
|
92
|
+
clearTimeoutRef();
|
|
93
|
+
},
|
|
94
|
+
[]
|
|
95
|
+
);
|
|
86
96
|
|
|
87
97
|
return {
|
|
88
98
|
showMovers,
|
|
@@ -297,7 +297,7 @@ function wrapperSelector( select ) {
|
|
|
297
297
|
const { name, attributes = {}, isValid } = getBlock( clientId ) || {};
|
|
298
298
|
const blockParentsClientIds = getBlockParents( clientId );
|
|
299
299
|
|
|
300
|
-
// Get Block List Settings for all ancestors of the current Block clientId
|
|
300
|
+
// Get Block List Settings for all ancestors of the current Block clientId.
|
|
301
301
|
const parentBlockListSettings = __experimentalGetBlockListSettingsForBlocks(
|
|
302
302
|
blockParentsClientIds
|
|
303
303
|
);
|
|
@@ -262,7 +262,10 @@ function BlockSelectionButton( { clientId, rootClientId, blockElement } ) {
|
|
|
262
262
|
label={ label }
|
|
263
263
|
className="block-selection-button_select-button"
|
|
264
264
|
>
|
|
265
|
-
<BlockTitle
|
|
265
|
+
<BlockTitle
|
|
266
|
+
clientId={ clientId }
|
|
267
|
+
maximumLength={ 35 }
|
|
268
|
+
/>
|
|
266
269
|
</Button>
|
|
267
270
|
</FlexItem>
|
|
268
271
|
</Flex>
|
|
@@ -85,7 +85,7 @@ export default function BlockTypesList( {
|
|
|
85
85
|
return (
|
|
86
86
|
<FlatList
|
|
87
87
|
onLayout={ onLayout }
|
|
88
|
-
key={ `InserterUI-${ name }-${ numberOfColumns }` } //
|
|
88
|
+
key={ `InserterUI-${ name }-${ numberOfColumns }` } // Re-render when numberOfColumns changes.
|
|
89
89
|
testID={ `InserterUI-${ name }` }
|
|
90
90
|
keyboardShouldPersistTaps="always"
|
|
91
91
|
numColumns={ numberOfColumns }
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
RangeControl,
|
|
6
|
-
|
|
6
|
+
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
7
7
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { useState } from '@wordpress/element';
|
|
@@ -58,7 +58,9 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
58
58
|
const unitConfig = units && units.find( ( item ) => item.value === unit );
|
|
59
59
|
const step = unitConfig?.step || 1;
|
|
60
60
|
|
|
61
|
-
const [ allValue ] =
|
|
61
|
+
const [ allValue ] = parseQuantityAndUnitFromRawValue(
|
|
62
|
+
getAllValue( values )
|
|
63
|
+
);
|
|
62
64
|
|
|
63
65
|
const toggleLinked = () => setIsLinked( ! isLinked );
|
|
64
66
|
|
|
@@ -82,7 +84,7 @@ export default function BorderRadiusControl( { onChange, values } ) {
|
|
|
82
84
|
/>
|
|
83
85
|
<RangeControl
|
|
84
86
|
className="components-border-radius-control__range-control"
|
|
85
|
-
value={ allValue }
|
|
87
|
+
value={ allValue ?? '' }
|
|
86
88
|
min={ MIN_BORDER_RADIUS_VALUE }
|
|
87
89
|
max={ MAX_BORDER_RADIUS_VALUES[ unit ] }
|
|
88
90
|
initialPosition={ 0 }
|
|
@@ -91,14 +91,14 @@ describe( 'getAllValue', () => {
|
|
|
91
91
|
} );
|
|
92
92
|
|
|
93
93
|
describe( 'when provided object based values', () => {
|
|
94
|
-
it( 'should return
|
|
94
|
+
it( 'should return undefined if values are mixed', () => {
|
|
95
95
|
const values = {
|
|
96
96
|
bottomLeft: '2em',
|
|
97
97
|
bottomRight: '2em',
|
|
98
98
|
topLeft: '0',
|
|
99
99
|
topRight: '2px',
|
|
100
100
|
};
|
|
101
|
-
expect( getAllValue( values ) ).toBe(
|
|
101
|
+
expect( getAllValue( values ) ).toBe( undefined );
|
|
102
102
|
} );
|
|
103
103
|
|
|
104
104
|
it( 'should return the common value + unit when all values are the same', () => {
|
|
@@ -121,26 +121,26 @@ describe( 'getAllValue', () => {
|
|
|
121
121
|
expect( getAllValue( values ) ).toBe( '1em' );
|
|
122
122
|
} );
|
|
123
123
|
|
|
124
|
-
it( 'should fall back to
|
|
124
|
+
it( 'should fall back to undefined when values are undefined', () => {
|
|
125
125
|
const values = {
|
|
126
126
|
bottomLeft: undefined,
|
|
127
127
|
bottomRight: undefined,
|
|
128
128
|
topLeft: undefined,
|
|
129
129
|
topRight: undefined,
|
|
130
130
|
};
|
|
131
|
-
expect( getAllValue( values ) ).toBe(
|
|
131
|
+
expect( getAllValue( values ) ).toBe( undefined );
|
|
132
132
|
} );
|
|
133
133
|
} );
|
|
134
134
|
|
|
135
135
|
describe( 'when provided invalid values', () => {
|
|
136
|
-
it( 'should return
|
|
137
|
-
expect( getAllValue( [] ) ).toBe(
|
|
136
|
+
it( 'should return undefined when passed an array', () => {
|
|
137
|
+
expect( getAllValue( [] ) ).toBe( undefined );
|
|
138
138
|
} );
|
|
139
|
-
it( 'should return
|
|
140
|
-
expect( getAllValue( false ) ).toBe(
|
|
139
|
+
it( 'should return undefined when passed a boolean', () => {
|
|
140
|
+
expect( getAllValue( false ) ).toBe( undefined );
|
|
141
141
|
} );
|
|
142
|
-
it( 'should return
|
|
143
|
-
expect( getAllValue(
|
|
142
|
+
it( 'should return undefined when passed undefined', () => {
|
|
143
|
+
expect( getAllValue( undefined ) ).toBe( undefined );
|
|
144
144
|
} );
|
|
145
145
|
} );
|
|
146
146
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Gets the (non-undefined) item with the highest occurrence within an array
|
|
@@ -36,12 +36,12 @@ export function mode( inputArray ) {
|
|
|
36
36
|
*/
|
|
37
37
|
export function getAllUnit( values = {} ) {
|
|
38
38
|
if ( typeof values === 'string' ) {
|
|
39
|
-
const [ , unit ] =
|
|
39
|
+
const [ , unit ] = parseQuantityAndUnitFromRawValue( values );
|
|
40
40
|
return unit || 'px';
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
const allUnits = Object.values( values ).map( ( value ) => {
|
|
44
|
-
const [ , unit ] =
|
|
44
|
+
const [ , unit ] = parseQuantityAndUnitFromRawValue( value );
|
|
45
45
|
return unit;
|
|
46
46
|
} );
|
|
47
47
|
|
|
@@ -64,19 +64,21 @@ export function getAllValue( values = {} ) {
|
|
|
64
64
|
return values;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
const
|
|
68
|
-
|
|
67
|
+
const parsedQuantitiesAndUnits = Object.values( values ).map( ( value ) =>
|
|
68
|
+
parseQuantityAndUnitFromRawValue( value )
|
|
69
69
|
);
|
|
70
70
|
|
|
71
|
-
const allValues =
|
|
72
|
-
|
|
71
|
+
const allValues = parsedQuantitiesAndUnits.map(
|
|
72
|
+
( value ) => value[ 0 ] ?? ''
|
|
73
|
+
);
|
|
74
|
+
const allUnits = parsedQuantitiesAndUnits.map( ( value ) => value[ 1 ] );
|
|
73
75
|
|
|
74
76
|
const value = allValues.every( ( v ) => v === allValues[ 0 ] )
|
|
75
77
|
? allValues[ 0 ]
|
|
76
78
|
: '';
|
|
77
79
|
const unit = mode( allUnits );
|
|
78
80
|
|
|
79
|
-
const allValue = value === 0 || value ? `${ value }${ unit }` :
|
|
81
|
+
const allValue = value === 0 || value ? `${ value }${ unit }` : undefined;
|
|
80
82
|
|
|
81
83
|
return allValue;
|
|
82
84
|
}
|
|
@@ -19,7 +19,7 @@ function ContrastChecker( {
|
|
|
19
19
|
fallbackBackgroundColor,
|
|
20
20
|
fallbackTextColor,
|
|
21
21
|
fallbackLinkColor,
|
|
22
|
-
fontSize, //
|
|
22
|
+
fontSize, // Font size value in pixels.
|
|
23
23
|
isLargeText,
|
|
24
24
|
textColor,
|
|
25
25
|
linkColor,
|
|
@@ -84,14 +84,14 @@ function ContrastChecker( {
|
|
|
84
84
|
message =
|
|
85
85
|
backgroundColorBrightness < colordTextColor.brightness()
|
|
86
86
|
? sprintf(
|
|
87
|
-
// translators: %s is a type of text color, e.g., "text color" or "link color"
|
|
87
|
+
// translators: %s is a type of text color, e.g., "text color" or "link color".
|
|
88
88
|
__(
|
|
89
89
|
'This color combination may be hard for people to read. Try using a darker background color and/or a brighter %s.'
|
|
90
90
|
),
|
|
91
91
|
item.description
|
|
92
92
|
)
|
|
93
93
|
: sprintf(
|
|
94
|
-
// translators: %s is a type of text color, e.g., "text color" or "link color"
|
|
94
|
+
// translators: %s is a type of text color, e.g., "text color" or "link color".
|
|
95
95
|
__(
|
|
96
96
|
'This color combination may be hard for people to read. Try using a brighter background color and/or a darker %s.'
|
|
97
97
|
),
|
|
@@ -22,7 +22,7 @@ function ConvertToGroupButton( {
|
|
|
22
22
|
} ) {
|
|
23
23
|
const { replaceBlocks } = useDispatch( blockEditorStore );
|
|
24
24
|
const onConvertToGroup = () => {
|
|
25
|
-
// Activate the `transform` on the Grouping Block which does the conversion
|
|
25
|
+
// Activate the `transform` on the Grouping Block which does the conversion.
|
|
26
26
|
const newBlocks = switchToBlockType(
|
|
27
27
|
blocksSelection,
|
|
28
28
|
groupingBlockName
|
|
@@ -64,12 +64,7 @@ export default function useConvertToGroupButtonProps() {
|
|
|
64
64
|
// Do we have
|
|
65
65
|
// 1. Grouping block available to be inserted?
|
|
66
66
|
// 2. One or more blocks selected
|
|
67
|
-
|
|
68
|
-
// they are a soltiary group block themselves)
|
|
69
|
-
const _isGroupable =
|
|
70
|
-
groupingBlockAvailable &&
|
|
71
|
-
_blocksSelection.length &&
|
|
72
|
-
! isSingleGroupingBlock;
|
|
67
|
+
const _isGroupable = groupingBlockAvailable && _blocksSelection.length;
|
|
73
68
|
|
|
74
69
|
// Do we have a single Group Block selected and does that group have inner blocks?
|
|
75
70
|
const _isUngroupable =
|
|
@@ -19,7 +19,7 @@ import { useRefEffect } from '@wordpress/compose';
|
|
|
19
19
|
/**
|
|
20
20
|
* Internal dependencies
|
|
21
21
|
*/
|
|
22
|
-
import { getPasteEventData } from '../../utils/
|
|
22
|
+
import { getPasteEventData } from '../../utils/pasting';
|
|
23
23
|
import { store as blockEditorStore } from '../../store';
|
|
24
24
|
|
|
25
25
|
export function useNotifyCopy() {
|
|
@@ -132,7 +132,7 @@ export function useClipboardHandler() {
|
|
|
132
132
|
removeBlocks( selectedBlockClientIds );
|
|
133
133
|
} else if ( event.type === 'paste' ) {
|
|
134
134
|
if ( eventDefaultPrevented ) {
|
|
135
|
-
// This was likely already handled in rich-text/use-paste-handler.js
|
|
135
|
+
// This was likely already handled in rich-text/use-paste-handler.js.
|
|
136
136
|
return;
|
|
137
137
|
}
|
|
138
138
|
const {
|
|
@@ -123,7 +123,7 @@ export default ( ...fontSizeNames ) => {
|
|
|
123
123
|
fontSizeAttributeName
|
|
124
124
|
) => {
|
|
125
125
|
if ( previousState[ fontSizeAttributeName ] ) {
|
|
126
|
-
//
|
|
126
|
+
// If new font size is name compare with the previous slug.
|
|
127
127
|
if ( attributes[ fontSizeAttributeName ] ) {
|
|
128
128
|
return (
|
|
129
129
|
attributes[ fontSizeAttributeName ] !==
|
|
@@ -131,14 +131,14 @@ export default ( ...fontSizeNames ) => {
|
|
|
131
131
|
.slug
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
|
-
//
|
|
134
|
+
// If font size is not named, update when the font size value changes.
|
|
135
135
|
return (
|
|
136
136
|
previousState[ fontSizeAttributeName ]
|
|
137
137
|
.size !==
|
|
138
138
|
attributes[ customFontSizeAttributeName ]
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
|
-
//
|
|
141
|
+
// In this case we need to build the font size object.
|
|
142
142
|
return true;
|
|
143
143
|
};
|
|
144
144
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Block Creation Components
|
|
1
|
+
// Block Creation Components.
|
|
2
2
|
export {
|
|
3
3
|
BlockAlignmentControl,
|
|
4
4
|
BlockAlignmentToolbar,
|
|
@@ -44,7 +44,13 @@ export {
|
|
|
44
44
|
MEDIA_TYPE_AUDIO,
|
|
45
45
|
MEDIA_TYPE_ANY,
|
|
46
46
|
} from './media-upload';
|
|
47
|
-
export {
|
|
47
|
+
export {
|
|
48
|
+
default as MediaUploadProgress,
|
|
49
|
+
MEDIA_UPLOAD_STATE_UPLOADING,
|
|
50
|
+
MEDIA_UPLOAD_STATE_SUCCEEDED,
|
|
51
|
+
MEDIA_UPLOAD_STATE_FAILED,
|
|
52
|
+
MEDIA_UPLOAD_STATE_RESET,
|
|
53
|
+
} from './media-upload-progress';
|
|
48
54
|
export { default as BlockMediaUpdateProgress } from './block-media-update-progress';
|
|
49
55
|
export { default as URLInput } from './url-input';
|
|
50
56
|
export { default as BlockInvalidWarning } from './block-list/block-invalid-warning';
|
|
@@ -65,7 +71,7 @@ export {
|
|
|
65
71
|
} from './block-settings';
|
|
66
72
|
export { default as VideoPlayer, VIDEO_ASPECT_RATIO } from './video-player';
|
|
67
73
|
|
|
68
|
-
// Content Related Components
|
|
74
|
+
// Content Related Components.
|
|
69
75
|
export { default as BlockList } from './block-list';
|
|
70
76
|
export { default as BlockMover } from './block-mover';
|
|
71
77
|
export { default as BlockToolbar } from './block-toolbar';
|
|
@@ -77,5 +83,5 @@ export { default as Inserter } from './inserter';
|
|
|
77
83
|
export { useBlockProps } from './block-list/use-block-props';
|
|
78
84
|
export { default as FloatingToolbar } from './floating-toolbar';
|
|
79
85
|
|
|
80
|
-
// State Related Components
|
|
86
|
+
// State Related Components.
|
|
81
87
|
export { default as BlockEditorProvider } from './provider';
|
|
@@ -90,7 +90,7 @@ export function BlockTypesTab( {
|
|
|
90
90
|
const didRenderAllCategories =
|
|
91
91
|
categories.length === currentlyRenderedCategories.length;
|
|
92
92
|
|
|
93
|
-
// Async List requires an array
|
|
93
|
+
// Async List requires an array.
|
|
94
94
|
const collectionEntries = useMemo( () => {
|
|
95
95
|
return Object.entries( collections );
|
|
96
96
|
}, [ collections ] );
|
|
@@ -32,12 +32,12 @@ function useBlockTypeImpressions( blockTypes ) {
|
|
|
32
32
|
...blockTypeImpressions,
|
|
33
33
|
[ name ]: 0,
|
|
34
34
|
};
|
|
35
|
-
// Persist block type impression to JavaScript store
|
|
35
|
+
// Persist block type impression to JavaScript store.
|
|
36
36
|
updateSettings( {
|
|
37
37
|
impressions: updatedBlockTypeImpressions,
|
|
38
38
|
} );
|
|
39
39
|
|
|
40
|
-
// Persist block type impression count to native app store
|
|
40
|
+
// Persist block type impression count to native app store.
|
|
41
41
|
setBlockTypeImpressions( updatedBlockTypeImpressions );
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -44,7 +44,7 @@ const defaultRenderToggle = ( {
|
|
|
44
44
|
|
|
45
45
|
const { onClick, ...rest } = toggleProps;
|
|
46
46
|
|
|
47
|
-
// Handle both onClick functions from the toggle and the parent component
|
|
47
|
+
// Handle both onClick functions from the toggle and the parent component.
|
|
48
48
|
function handleClick( event ) {
|
|
49
49
|
if ( onToggle ) {
|
|
50
50
|
onToggle( event );
|
|
@@ -81,7 +81,7 @@ class Inserter extends Component {
|
|
|
81
81
|
onToggle( isOpen ) {
|
|
82
82
|
const { onToggle } = this.props;
|
|
83
83
|
|
|
84
|
-
// Surface toggle callback to parent component
|
|
84
|
+
// Surface toggle callback to parent component.
|
|
85
85
|
if ( onToggle ) {
|
|
86
86
|
onToggle( isOpen );
|
|
87
87
|
}
|
|
@@ -336,7 +336,7 @@ export default compose( [
|
|
|
336
336
|
return getBlockIndex( end ) + 1;
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
-
// Otherwise, we insert at the end of the current rootClientId
|
|
339
|
+
// Otherwise, we insert at the end of the current rootClientId.
|
|
340
340
|
return getBlockOrder( rootClientId ).length;
|
|
341
341
|
}
|
|
342
342
|
|
|
@@ -168,17 +168,17 @@ export class Inserter extends Component {
|
|
|
168
168
|
{}
|
|
169
169
|
);
|
|
170
170
|
|
|
171
|
-
// Persist block type impression to JavaScript store
|
|
171
|
+
// Persist block type impression to JavaScript store.
|
|
172
172
|
updateSettings( {
|
|
173
173
|
impressions: decrementedImpressions,
|
|
174
174
|
} );
|
|
175
175
|
|
|
176
|
-
// Persist block type impression count to native app store
|
|
176
|
+
// Persist block type impression count to native app store.
|
|
177
177
|
setBlockTypeImpressions( decrementedImpressions );
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// Surface toggle callback to parent component
|
|
181
|
+
// Surface toggle callback to parent component.
|
|
182
182
|
if ( onToggle ) {
|
|
183
183
|
onToggle( isOpen );
|
|
184
184
|
}
|
|
@@ -354,7 +354,7 @@ export default compose( [
|
|
|
354
354
|
__experimentalShouldInsertAtTheTop: shouldInsertAtTheTop,
|
|
355
355
|
} = getBlockEditorSettings();
|
|
356
356
|
|
|
357
|
-
//
|
|
357
|
+
// If post title is selected insert as first block.
|
|
358
358
|
if ( shouldInsertAtTheTop ) {
|
|
359
359
|
return 0;
|
|
360
360
|
}
|
|
@@ -366,16 +366,16 @@ export default compose( [
|
|
|
366
366
|
|
|
367
367
|
// If there is a selected block,
|
|
368
368
|
if ( isAnyBlockSelected ) {
|
|
369
|
-
//
|
|
369
|
+
// And the last selected block is unmodified (empty), it will be replaced.
|
|
370
370
|
if ( isSelectedUnmodifiedDefaultBlock ) {
|
|
371
371
|
return selectedBlockIndex;
|
|
372
372
|
}
|
|
373
373
|
|
|
374
|
-
//
|
|
374
|
+
// We insert after the selected block.
|
|
375
375
|
return selectedBlockIndex + 1;
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
// Otherwise, we insert at the end of the current rootClientId
|
|
378
|
+
// Otherwise, we insert at the end of the current rootClientId.
|
|
379
379
|
return endOfRootIndex;
|
|
380
380
|
}
|
|
381
381
|
|
|
@@ -188,7 +188,7 @@ function InserterMenu(
|
|
|
188
188
|
return (
|
|
189
189
|
<div className="block-editor-inserter__menu">
|
|
190
190
|
<div className="block-editor-inserter__main-area">
|
|
191
|
-
{ /*
|
|
191
|
+
{ /* The following div is necessary to fix the sticky position of the search form. */ }
|
|
192
192
|
<div className="block-editor-inserter__content">
|
|
193
193
|
<SearchControl
|
|
194
194
|
className="block-editor-inserter__search"
|
|
@@ -106,8 +106,8 @@ function InserterMenu( {
|
|
|
106
106
|
}, [] );
|
|
107
107
|
|
|
108
108
|
const onClose = useCallback( () => {
|
|
109
|
-
//
|
|
110
|
-
// re-insert default block
|
|
109
|
+
// If should replace but didn't insert any block
|
|
110
|
+
// re-insert default block.
|
|
111
111
|
if ( shouldReplaceBlock ) {
|
|
112
112
|
insertDefaultBlock( {}, destinationRootClientId, insertionIndex );
|
|
113
113
|
}
|
|
@@ -140,7 +140,7 @@ function InserterMenu( {
|
|
|
140
140
|
// Avoid a focus loop, see https://github.com/WordPress/gutenberg/issues/30562
|
|
141
141
|
if ( Platform.OS === 'ios' ) {
|
|
142
142
|
AccessibilityInfo.isScreenReaderEnabled().then( ( enabled ) => {
|
|
143
|
-
// In testing, the bug focus loop needed a longer timeout when VoiceOver was enabled
|
|
143
|
+
// In testing, the bug focus loop needed a longer timeout when VoiceOver was enabled.
|
|
144
144
|
const timeout = enabled ? 200 : 100;
|
|
145
145
|
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
|
|
146
146
|
setTimeout( () => {
|
|
@@ -87,7 +87,7 @@ export default function QuickInserter( {
|
|
|
87
87
|
}, [ setInserterIsOpened ] );
|
|
88
88
|
|
|
89
89
|
// When clicking Browse All select the appropriate block so as
|
|
90
|
-
// the insertion point can work as expected
|
|
90
|
+
// the insertion point can work as expected.
|
|
91
91
|
const onBrowseAll = () => {
|
|
92
92
|
setInserterIsOpened( { rootClientId, insertionIndex, filterValue } );
|
|
93
93
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { deburr, differenceWith, find, words } from 'lodash';
|
|
5
5
|
|
|
6
|
-
// Default search helpers
|
|
6
|
+
// Default search helpers.
|
|
7
7
|
const defaultGetName = ( item ) => item.name || '';
|
|
8
8
|
const defaultGetTitle = ( item ) => item.title;
|
|
9
9
|
const defaultGetDescription = ( item ) => item.description || '';
|