@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
|
@@ -78,7 +78,7 @@ export function onBlockDrop(
|
|
|
78
78
|
blocks,
|
|
79
79
|
} = parseDropEvent( event );
|
|
80
80
|
|
|
81
|
-
// If the user is inserting a block
|
|
81
|
+
// If the user is inserting a block.
|
|
82
82
|
if ( dropType === 'inserter' ) {
|
|
83
83
|
clearSelectedBlock();
|
|
84
84
|
const blocksToInsert = blocks.map( ( block ) =>
|
|
@@ -93,7 +93,7 @@ export function onBlockDrop(
|
|
|
93
93
|
);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
// If the user is moving a block
|
|
96
|
+
// If the user is moving a block.
|
|
97
97
|
if ( dropType === 'block' ) {
|
|
98
98
|
const sourceBlockIndex = getBlockIndex( sourceClientIds[ 0 ] );
|
|
99
99
|
|
|
@@ -118,13 +118,16 @@ export default function useTabNav() {
|
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
// Allow tabbing
|
|
121
|
+
// Allow tabbing from the block wrapper to a form element,
|
|
122
|
+
// and between form elements rendered in a block,
|
|
122
123
|
// such as inside a placeholder. Form elements are generally
|
|
123
124
|
// meant to be UI rather than part of the content. Ideally
|
|
124
125
|
// these are not rendered in the content and perhaps in the
|
|
125
126
|
// future they can be rendered in an iframe or shadow DOM.
|
|
126
127
|
if (
|
|
127
|
-
isFormElement( event.target )
|
|
128
|
+
( isFormElement( event.target ) ||
|
|
129
|
+
event.target.getAttribute( 'data-block' ) ===
|
|
130
|
+
getSelectedBlockClientId() ) &&
|
|
128
131
|
isFormElement( focus.tabbable[ direction ]( event.target ) )
|
|
129
132
|
) {
|
|
130
133
|
return;
|
|
@@ -183,7 +186,7 @@ export default function useTabNav() {
|
|
|
183
186
|
const isShift = event.shiftKey;
|
|
184
187
|
const direction = isShift ? 'findPrevious' : 'findNext';
|
|
185
188
|
const target = focus.tabbable[ direction ]( event.target );
|
|
186
|
-
//
|
|
189
|
+
// Only do something when the next tabbable is a focus capture div (before/after)
|
|
187
190
|
if (
|
|
188
191
|
target === focusCaptureBeforeRef.current ||
|
|
189
192
|
target === focusCaptureAfterRef.current
|
package/src/hooks/align.js
CHANGED
|
@@ -86,7 +86,7 @@ export function getValidAlignments(
|
|
|
86
86
|
* @return {Object} Filtered block settings.
|
|
87
87
|
*/
|
|
88
88
|
export function addAttribute( settings ) {
|
|
89
|
-
//
|
|
89
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
90
90
|
if ( has( settings.attributes, [ 'align', 'type' ] ) ) {
|
|
91
91
|
return settings;
|
|
92
92
|
}
|
package/src/hooks/anchor.js
CHANGED
|
@@ -34,7 +34,7 @@ const ANCHOR_REGEX = /[\s#]/g;
|
|
|
34
34
|
* @return {Object} Filtered block settings.
|
|
35
35
|
*/
|
|
36
36
|
export function addAttribute( settings ) {
|
|
37
|
-
//
|
|
37
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
38
38
|
if ( has( settings.attributes, [ 'anchor', 'type' ] ) ) {
|
|
39
39
|
return settings;
|
|
40
40
|
}
|
package/src/hooks/border.js
CHANGED
|
@@ -37,8 +37,6 @@ export const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
|
37
37
|
|
|
38
38
|
export function BorderPanel( props ) {
|
|
39
39
|
const { clientId } = props;
|
|
40
|
-
const isDisabled = useIsBorderDisabled( props );
|
|
41
|
-
const isSupported = hasBorderSupport( props.name );
|
|
42
40
|
|
|
43
41
|
const isColorSupported =
|
|
44
42
|
useSetting( 'border.color' ) && hasBorderSupport( props.name, 'color' );
|
|
@@ -53,7 +51,14 @@ export function BorderPanel( props ) {
|
|
|
53
51
|
const isWidthSupported =
|
|
54
52
|
useSetting( 'border.width' ) && hasBorderSupport( props.name, 'width' );
|
|
55
53
|
|
|
56
|
-
|
|
54
|
+
const isDisabled = [
|
|
55
|
+
! isColorSupported,
|
|
56
|
+
! isRadiusSupported,
|
|
57
|
+
! isStyleSupported,
|
|
58
|
+
! isWidthSupported,
|
|
59
|
+
].every( Boolean );
|
|
60
|
+
|
|
61
|
+
if ( isDisabled ) {
|
|
57
62
|
return null;
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -179,22 +184,6 @@ export function shouldSkipSerialization( blockType ) {
|
|
|
179
184
|
return support?.__experimentalSkipSerialization;
|
|
180
185
|
}
|
|
181
186
|
|
|
182
|
-
/**
|
|
183
|
-
* Determines if all border support features have been disabled.
|
|
184
|
-
*
|
|
185
|
-
* @return {boolean} If border support is completely disabled.
|
|
186
|
-
*/
|
|
187
|
-
const useIsBorderDisabled = () => {
|
|
188
|
-
const configs = [
|
|
189
|
-
! useSetting( 'border.color' ),
|
|
190
|
-
! useSetting( 'border.radius' ),
|
|
191
|
-
! useSetting( 'border.style' ),
|
|
192
|
-
! useSetting( 'border.width' ),
|
|
193
|
-
];
|
|
194
|
-
|
|
195
|
-
return configs.every( Boolean );
|
|
196
|
-
};
|
|
197
|
-
|
|
198
187
|
/**
|
|
199
188
|
* Returns a new style object where the specified border attribute has been
|
|
200
189
|
* removed.
|
package/src/hooks/color.js
CHANGED
|
@@ -209,7 +209,7 @@ function addAttributes( settings ) {
|
|
|
209
209
|
return settings;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
//
|
|
212
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
213
213
|
if ( ! settings.attributes.backgroundColor ) {
|
|
214
214
|
Object.assign( settings.attributes, {
|
|
215
215
|
backgroundColor: {
|
|
@@ -269,7 +269,7 @@ export function addSaveProps( props, blockType, attributes ) {
|
|
|
269
269
|
textClass,
|
|
270
270
|
gradientClass,
|
|
271
271
|
{
|
|
272
|
-
// Don't apply the background class if there's a custom gradient
|
|
272
|
+
// Don't apply the background class if there's a custom gradient.
|
|
273
273
|
[ backgroundClass ]:
|
|
274
274
|
( ! hasGradient || ! style?.color?.gradient ) &&
|
|
275
275
|
!! backgroundClass,
|
package/src/hooks/duotone.js
CHANGED
|
@@ -12,7 +12,7 @@ import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
|
|
|
12
12
|
import { SVG } from '@wordpress/components';
|
|
13
13
|
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
14
14
|
import { addFilter } from '@wordpress/hooks';
|
|
15
|
-
import { useContext, createPortal } from '@wordpress/element';
|
|
15
|
+
import { useMemo, useContext, createPortal } from '@wordpress/element';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Internal dependencies
|
|
@@ -140,12 +140,36 @@ ${ selector } {
|
|
|
140
140
|
);
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
+
function useMultiOriginPresets( { presetSetting, defaultSetting } ) {
|
|
144
|
+
const disableDefault = ! useSetting( defaultSetting );
|
|
145
|
+
const userPresets =
|
|
146
|
+
useSetting( `${ presetSetting }.custom` ) || EMPTY_ARRAY;
|
|
147
|
+
const themePresets =
|
|
148
|
+
useSetting( `${ presetSetting }.theme` ) || EMPTY_ARRAY;
|
|
149
|
+
const defaultPresets =
|
|
150
|
+
useSetting( `${ presetSetting }.default` ) || EMPTY_ARRAY;
|
|
151
|
+
return useMemo(
|
|
152
|
+
() => [
|
|
153
|
+
...userPresets,
|
|
154
|
+
...themePresets,
|
|
155
|
+
...( disableDefault ? EMPTY_ARRAY : defaultPresets ),
|
|
156
|
+
],
|
|
157
|
+
[ disableDefault, userPresets, themePresets, defaultPresets ]
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
|
|
143
161
|
function DuotonePanel( { attributes, setAttributes } ) {
|
|
144
162
|
const style = attributes?.style;
|
|
145
163
|
const duotone = style?.color?.duotone;
|
|
146
164
|
|
|
147
|
-
const duotonePalette =
|
|
148
|
-
|
|
165
|
+
const duotonePalette = useMultiOriginPresets( {
|
|
166
|
+
presetSetting: 'color.duotone',
|
|
167
|
+
defaultSetting: 'color.defaultDuotone',
|
|
168
|
+
} );
|
|
169
|
+
const colorPalette = useMultiOriginPresets( {
|
|
170
|
+
presetSetting: 'color.palette',
|
|
171
|
+
defaultSetting: 'color.defaultPalette',
|
|
172
|
+
} );
|
|
149
173
|
const disableCustomColors = ! useSetting( 'color.custom' );
|
|
150
174
|
const disableCustomDuotone =
|
|
151
175
|
! useSetting( 'color.customDuotone' ) ||
|
|
@@ -20,11 +20,11 @@ import { hasBlockSupport, getBlockDefaultClassName } from '@wordpress/blocks';
|
|
|
20
20
|
* @return {Object} Filtered props applied to save element.
|
|
21
21
|
*/
|
|
22
22
|
export function addGeneratedClassName( extraProps, blockType ) {
|
|
23
|
-
// Adding the generated className
|
|
23
|
+
// Adding the generated className.
|
|
24
24
|
if ( hasBlockSupport( blockType, 'className', true ) ) {
|
|
25
25
|
if ( typeof extraProps.className === 'string' ) {
|
|
26
26
|
// We have some extra classes and want to add the default classname
|
|
27
|
-
// We use uniq to prevent duplicate classnames
|
|
27
|
+
// We use uniq to prevent duplicate classnames.
|
|
28
28
|
|
|
29
29
|
extraProps.className = uniq( [
|
|
30
30
|
getBlockDefaultClassName( blockType.name ),
|
|
@@ -34,7 +34,7 @@ export function addGeneratedClassName( extraProps, blockType ) {
|
|
|
34
34
|
.trim();
|
|
35
35
|
} else {
|
|
36
36
|
// There is no string in the className variable,
|
|
37
|
-
// so we just dump the default name in there
|
|
37
|
+
// so we just dump the default name in there.
|
|
38
38
|
extraProps.className = getBlockDefaultClassName( blockType.name );
|
|
39
39
|
}
|
|
40
40
|
}
|
package/src/hooks/lock.js
CHANGED
|
@@ -16,7 +16,7 @@ import { addFilter } from '@wordpress/hooks';
|
|
|
16
16
|
* @return {Object} Filtered block settings.
|
|
17
17
|
*/
|
|
18
18
|
export function addAttribute( settings ) {
|
|
19
|
-
//
|
|
19
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
20
20
|
if ( has( settings.attributes, [ 'lock', 'type' ] ) ) {
|
|
21
21
|
return settings;
|
|
22
22
|
}
|
package/src/hooks/style.js
CHANGED
|
@@ -122,8 +122,11 @@ function compileElementsStyles( selector, elements = {} ) {
|
|
|
122
122
|
return map( elements, ( styles, element ) => {
|
|
123
123
|
const elementStyles = getInlineStyles( styles );
|
|
124
124
|
if ( ! isEmpty( elementStyles ) ) {
|
|
125
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
126
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
127
|
+
// styles to override element styles because of higher specificity.
|
|
125
128
|
return [
|
|
126
|
-
|
|
129
|
+
`.editor-styles-wrapper .${ selector } ${ ELEMENTS[ element ] }{`,
|
|
127
130
|
...map(
|
|
128
131
|
elementStyles,
|
|
129
132
|
( value, property ) =>
|
|
@@ -148,7 +151,7 @@ function addAttribute( settings ) {
|
|
|
148
151
|
return settings;
|
|
149
152
|
}
|
|
150
153
|
|
|
151
|
-
//
|
|
154
|
+
// Allow blocks to specify their own attribute definition with default values if needed.
|
|
152
155
|
if ( ! settings.attributes.style ) {
|
|
153
156
|
Object.assign( settings.attributes, {
|
|
154
157
|
style: {
|
package/src/hooks/test/align.js
CHANGED
|
@@ -167,7 +167,7 @@ describe( 'align', () => {
|
|
|
167
167
|
isSelected
|
|
168
168
|
/>
|
|
169
169
|
);
|
|
170
|
-
//
|
|
170
|
+
// When there's only one child, `rendered` in the tree is an object not an array.
|
|
171
171
|
expect( wrapper.toTree().rendered ).toBeInstanceOf( Object );
|
|
172
172
|
} );
|
|
173
173
|
|
package/src/store/actions.js
CHANGED
|
@@ -675,7 +675,7 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
|
675
675
|
const blockA = select.getBlock( clientIdA );
|
|
676
676
|
const blockAType = getBlockType( blockA.name );
|
|
677
677
|
|
|
678
|
-
// Only focus the previous block if it's not mergeable
|
|
678
|
+
// Only focus the previous block if it's not mergeable.
|
|
679
679
|
if ( blockAType && ! blockAType.merge ) {
|
|
680
680
|
dispatch.selectBlock( blockA.clientId );
|
|
681
681
|
return;
|
|
@@ -744,18 +744,18 @@ export const mergeBlocks = ( firstBlockClientId, secondBlockClientId ) => ( {
|
|
|
744
744
|
}
|
|
745
745
|
|
|
746
746
|
// We can only merge blocks with similar types
|
|
747
|
-
// thus, we transform the block to merge first
|
|
747
|
+
// thus, we transform the block to merge first.
|
|
748
748
|
const blocksWithTheSameType =
|
|
749
749
|
blockA.name === blockB.name
|
|
750
750
|
? [ cloneB ]
|
|
751
751
|
: switchToBlockType( cloneB, blockA.name );
|
|
752
752
|
|
|
753
|
-
// If the block types can not match, do nothing
|
|
753
|
+
// If the block types can not match, do nothing.
|
|
754
754
|
if ( ! blocksWithTheSameType || ! blocksWithTheSameType.length ) {
|
|
755
755
|
return;
|
|
756
756
|
}
|
|
757
757
|
|
|
758
|
-
// Calling the merge to update the attributes and remove the block to be merged
|
|
758
|
+
// Calling the merge to update the attributes and remove the block to be merged.
|
|
759
759
|
const updatedAttributes = blockAType.merge(
|
|
760
760
|
cloneA.attributes,
|
|
761
761
|
blocksWithTheSameType[ 0 ].attributes
|
package/src/store/defaults.js
CHANGED
|
@@ -134,7 +134,7 @@ export const SETTINGS_DEFAULTS = {
|
|
|
134
134
|
{ slug: 'full', name: __( 'Full Size' ) },
|
|
135
135
|
],
|
|
136
136
|
|
|
137
|
-
// Allow plugin to disable Image Editor if need be
|
|
137
|
+
// Allow plugin to disable Image Editor if need be.
|
|
138
138
|
imageEditing: true,
|
|
139
139
|
|
|
140
140
|
// This is current max width of the block inner area
|
|
@@ -158,7 +158,6 @@ export const SETTINGS_DEFAULTS = {
|
|
|
158
158
|
__experimentalSpotlightEntityBlocks: [],
|
|
159
159
|
__experimentalGenerateAnchors: false,
|
|
160
160
|
__unstableGalleryWithImageBlocks: false,
|
|
161
|
-
|
|
162
161
|
// gradients setting is not used anymore now defaults are passed from theme.json on the server and core has its own defaults.
|
|
163
162
|
// The setting is only kept for backward compatibility purposes.
|
|
164
163
|
gradients: [
|
package/src/store/reducer.js
CHANGED
|
@@ -216,7 +216,7 @@ function updateParentInnerBlocksInTree(
|
|
|
216
216
|
controlledParents.add( current );
|
|
217
217
|
break;
|
|
218
218
|
} else {
|
|
219
|
-
//
|
|
219
|
+
// Else continue traversing up through parents.
|
|
220
220
|
uncontrolledParents.add( current );
|
|
221
221
|
current = state.parents[ current ];
|
|
222
222
|
}
|
|
@@ -611,7 +611,7 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
|
|
|
611
611
|
const subTree = buildBlockTree( newState, action.blocks );
|
|
612
612
|
newState.tree = {
|
|
613
613
|
...subTree,
|
|
614
|
-
// Root
|
|
614
|
+
// Root.
|
|
615
615
|
'': {
|
|
616
616
|
innerBlocks: action.blocks.map(
|
|
617
617
|
( subBlock ) => subTree[ subBlock.clientId ]
|
|
@@ -712,7 +712,7 @@ const withSaveReusableBlock = ( reducer ) => ( state, action ) => {
|
|
|
712
712
|
if ( state && action.type === 'SAVE_REUSABLE_BLOCK_SUCCESS' ) {
|
|
713
713
|
const { id, updatedId } = action;
|
|
714
714
|
|
|
715
|
-
// If a temporary reusable block is saved, we swap the temporary id with the final one
|
|
715
|
+
// If a temporary reusable block is saved, we swap the temporary id with the final one.
|
|
716
716
|
if ( id === updatedId ) {
|
|
717
717
|
return state;
|
|
718
718
|
}
|
|
@@ -769,10 +769,10 @@ const withResetControlledBlocks = ( reducer ) => ( state, action ) => {
|
|
|
769
769
|
*/
|
|
770
770
|
export const blocks = flow(
|
|
771
771
|
combineReducers,
|
|
772
|
-
withSaveReusableBlock, //
|
|
773
|
-
withBlockTree, //
|
|
772
|
+
withSaveReusableBlock, // Needs to be before withBlockCache.
|
|
773
|
+
withBlockTree, // Needs to be before withInnerBlocksRemoveCascade.
|
|
774
774
|
withInnerBlocksRemoveCascade,
|
|
775
|
-
withReplaceInnerBlocks, //
|
|
775
|
+
withReplaceInnerBlocks, // Needs to be after withInnerBlocksRemoveCascade.
|
|
776
776
|
withBlockReset,
|
|
777
777
|
withPersistentBlockChange,
|
|
778
778
|
withIgnoredBlockChange,
|
|
@@ -788,7 +788,7 @@ export const blocks = flow(
|
|
|
788
788
|
};
|
|
789
789
|
|
|
790
790
|
case 'UPDATE_BLOCK':
|
|
791
|
-
// Ignore updates if block isn't known
|
|
791
|
+
// Ignore updates if block isn't known.
|
|
792
792
|
if ( ! state[ action.clientId ] ) {
|
|
793
793
|
return state;
|
|
794
794
|
}
|
|
@@ -947,7 +947,7 @@ export const blocks = flow(
|
|
|
947
947
|
} = action;
|
|
948
948
|
const { index = state[ toRootClientId ].length } = action;
|
|
949
949
|
|
|
950
|
-
// Moving inside the same parent block
|
|
950
|
+
// Moving inside the same parent block.
|
|
951
951
|
if ( fromRootClientId === toRootClientId ) {
|
|
952
952
|
const subState = state[ toRootClientId ];
|
|
953
953
|
const fromIndex = subState.indexOf( clientIds[ 0 ] );
|
|
@@ -962,7 +962,7 @@ export const blocks = flow(
|
|
|
962
962
|
};
|
|
963
963
|
}
|
|
964
964
|
|
|
965
|
-
// Moving from a parent block to another
|
|
965
|
+
// Moving from a parent block to another.
|
|
966
966
|
return {
|
|
967
967
|
...state,
|
|
968
968
|
[ fromRootClientId ]: without(
|
|
@@ -1068,10 +1068,10 @@ export const blocks = flow(
|
|
|
1068
1068
|
|
|
1069
1069
|
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
|
1070
1070
|
return flow( [
|
|
1071
|
-
// Remove inner block ordering for removed blocks
|
|
1071
|
+
// Remove inner block ordering for removed blocks.
|
|
1072
1072
|
( nextState ) => omit( nextState, action.removedClientIds ),
|
|
1073
1073
|
|
|
1074
|
-
// Remove deleted blocks from other blocks' orderings
|
|
1074
|
+
// Remove deleted blocks from other blocks' orderings.
|
|
1075
1075
|
( nextState ) =>
|
|
1076
1076
|
mapValues( nextState, ( subState ) =>
|
|
1077
1077
|
without( subState, ...action.removedClientIds )
|
package/src/store/selectors.js
CHANGED
|
@@ -44,7 +44,7 @@ import { symbol } from '@wordpress/icons';
|
|
|
44
44
|
* text value. See `wp.richText.create`.
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
// Module constants
|
|
47
|
+
// Module constants.
|
|
48
48
|
const MILLISECONDS_PER_HOUR = 3600 * 1000;
|
|
49
49
|
const MILLISECONDS_PER_DAY = 24 * 3600 * 1000;
|
|
50
50
|
const MILLISECONDS_PER_WEEK = 7 * 24 * 3600 * 1000;
|
|
@@ -1359,7 +1359,7 @@ export function canRemoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1359
1359
|
return ! parentIsLocked;
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
|
-
//
|
|
1362
|
+
// When remove is true, it means we cannot remove it.
|
|
1363
1363
|
return ! lock?.remove;
|
|
1364
1364
|
}
|
|
1365
1365
|
|
|
@@ -1400,7 +1400,7 @@ export function canMoveBlock( state, clientId, rootClientId = null ) {
|
|
|
1400
1400
|
return ! parentIsLocked;
|
|
1401
1401
|
}
|
|
1402
1402
|
|
|
1403
|
-
//
|
|
1403
|
+
// When move is true, it means we cannot move it.
|
|
1404
1404
|
return ! lock?.move;
|
|
1405
1405
|
}
|
|
1406
1406
|
|
|
@@ -1554,7 +1554,7 @@ const buildBlockTypeItem = ( state, { buildScope = 'inserter' } ) => (
|
|
|
1554
1554
|
keywords: blockType.keywords,
|
|
1555
1555
|
variations: inserterVariations,
|
|
1556
1556
|
example: blockType.example,
|
|
1557
|
-
utility: 1, //
|
|
1557
|
+
utility: 1, // Deprecated.
|
|
1558
1558
|
};
|
|
1559
1559
|
};
|
|
1560
1560
|
|
|
@@ -1654,7 +1654,7 @@ export const getInserterItems = createSelector(
|
|
|
1654
1654
|
category: 'reusable',
|
|
1655
1655
|
keywords: [],
|
|
1656
1656
|
isDisabled: false,
|
|
1657
|
-
utility: 1, //
|
|
1657
|
+
utility: 1, // Deprecated.
|
|
1658
1658
|
frecency,
|
|
1659
1659
|
};
|
|
1660
1660
|
};
|
|
@@ -1675,7 +1675,7 @@ export const getInserterItems = createSelector(
|
|
|
1675
1675
|
|
|
1676
1676
|
const items = blockTypeInserterItems.reduce( ( accumulator, item ) => {
|
|
1677
1677
|
const { variations = [] } = item;
|
|
1678
|
-
// Exclude any block type item that is to be replaced by a default variation
|
|
1678
|
+
// Exclude any block type item that is to be replaced by a default variation.
|
|
1679
1679
|
if ( ! variations.some( ( { isDefault } ) => isDefault ) ) {
|
|
1680
1680
|
accumulator.push( item );
|
|
1681
1681
|
}
|
|
@@ -630,7 +630,7 @@ describe( 'state', () => {
|
|
|
630
630
|
controlledInnerBlocks: {},
|
|
631
631
|
} );
|
|
632
632
|
|
|
633
|
-
//
|
|
633
|
+
// The block object of the parent should be updated.
|
|
634
634
|
expect( state.tree.chicken ).not.toBe(
|
|
635
635
|
existingState.tree.chicken
|
|
636
636
|
);
|
|
@@ -3074,7 +3074,7 @@ describe( 'selectors', () => {
|
|
|
3074
3074
|
} );
|
|
3075
3075
|
|
|
3076
3076
|
it( 'should return empty object if settings for the blocks don’t exist', () => {
|
|
3077
|
-
// Does not include target Block clientIds
|
|
3077
|
+
// Does not include target Block clientIds.
|
|
3078
3078
|
const state = {
|
|
3079
3079
|
blockListSettings: {
|
|
3080
3080
|
'test-2-dummy-clientId': {
|
|
@@ -86,7 +86,7 @@ function parseUnitFunction( cssUnit ) {
|
|
|
86
86
|
cssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );
|
|
87
87
|
}
|
|
88
88
|
|
|
89
|
-
//
|
|
89
|
+
// If the unit hasn't been modified or we have a single value break free.
|
|
90
90
|
if ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
@@ -123,7 +123,7 @@ function evalMathExpression( cssUnit ) {
|
|
|
123
123
|
const parsedUnit = parseUnit( getPxFromCssUnit( unit ) );
|
|
124
124
|
if ( ! parseFloat( parsedUnit.value ) ) {
|
|
125
125
|
errorFound = true;
|
|
126
|
-
//
|
|
126
|
+
// End early since we are dealing with a null value.
|
|
127
127
|
break;
|
|
128
128
|
}
|
|
129
129
|
cssUnit = cssUnit.replace( unit, parsedUnit.value );
|
|
@@ -171,7 +171,7 @@ function convertParsedUnitToPx( parsedUnit, options ) {
|
|
|
171
171
|
? setOptions.fontSize
|
|
172
172
|
: setOptions.width ) * ONE_PERCENT,
|
|
173
173
|
ch: 8, // The advance measure (width) of the glyph "0" of the element's font. Approximate
|
|
174
|
-
ex: 7.15625, //
|
|
174
|
+
ex: 7.15625, // X-height of the element's font. Approximate.
|
|
175
175
|
lh: setOptions.lineHeight,
|
|
176
176
|
};
|
|
177
177
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createBlobURL } from '@wordpress/blob';
|
|
5
|
+
import { getFilesFromDataTransfer } from '@wordpress/dom';
|
|
6
|
+
|
|
7
|
+
export function getPasteEventData( { clipboardData } ) {
|
|
8
|
+
let plainText = '';
|
|
9
|
+
let html = '';
|
|
10
|
+
|
|
11
|
+
// IE11 only supports `Text` as an argument for `getData` and will
|
|
12
|
+
// otherwise throw an invalid argument error, so we try the standard
|
|
13
|
+
// arguments first, then fallback to `Text` if they fail.
|
|
14
|
+
try {
|
|
15
|
+
plainText = clipboardData.getData( 'text/plain' );
|
|
16
|
+
html = clipboardData.getData( 'text/html' );
|
|
17
|
+
} catch ( error1 ) {
|
|
18
|
+
try {
|
|
19
|
+
html = clipboardData.getData( 'Text' );
|
|
20
|
+
} catch ( error2 ) {
|
|
21
|
+
// Some browsers like UC Browser paste plain text by default and
|
|
22
|
+
// don't support clipboardData at all, so allow default
|
|
23
|
+
// behaviour.
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const files = getFilesFromDataTransfer(
|
|
29
|
+
clipboardData
|
|
30
|
+
).filter( ( { type } ) => /^image\/(?:jpe?g|png|gif|webp)$/.test( type ) );
|
|
31
|
+
|
|
32
|
+
if (
|
|
33
|
+
files.length &&
|
|
34
|
+
! shouldDismissPastedFiles( files, html, plainText )
|
|
35
|
+
) {
|
|
36
|
+
html = files
|
|
37
|
+
.map( ( file ) => `<img src="${ createBlobURL( file ) }">` )
|
|
38
|
+
.join( '' );
|
|
39
|
+
plainText = '';
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { html, plainText };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Given a collection of DataTransfer files and HTML and plain text strings,
|
|
47
|
+
* determine whether the files are to be dismissed in favor of the HTML.
|
|
48
|
+
*
|
|
49
|
+
* Certain office-type programs, like Microsoft Word or Apple Numbers,
|
|
50
|
+
* will, upon copy, generate a screenshot of the content being copied and
|
|
51
|
+
* attach it to the clipboard alongside the actual rich text that the user
|
|
52
|
+
* sought to copy. In those cases, we should let Gutenberg handle the rich text
|
|
53
|
+
* content and not the screenshot, since this allows Gutenberg to insert
|
|
54
|
+
* meaningful blocks, like paragraphs, lists or even tables.
|
|
55
|
+
*
|
|
56
|
+
* @param {File[]} files File objects obtained from a paste event
|
|
57
|
+
* @param {string} html HTML content obtained from a paste event
|
|
58
|
+
* @return {boolean} True if the files should be dismissed
|
|
59
|
+
*/
|
|
60
|
+
export function shouldDismissPastedFiles( files, html /*, plainText */ ) {
|
|
61
|
+
// The question is only relevant when there is actual HTML content and when
|
|
62
|
+
// there is exactly one image file.
|
|
63
|
+
if (
|
|
64
|
+
html &&
|
|
65
|
+
files?.length === 1 &&
|
|
66
|
+
files[ 0 ].type.indexOf( 'image/' ) === 0
|
|
67
|
+
) {
|
|
68
|
+
// A single <img> tag found in the HTML source suggests that the
|
|
69
|
+
// content being pasted revolves around an image. Sometimes there are
|
|
70
|
+
// other elements found, like <figure>, but we assume that the user's
|
|
71
|
+
// intention is to paste the actual image file.
|
|
72
|
+
const IMAGE_TAG = /<\s*img\b/gi;
|
|
73
|
+
return html.match( IMAGE_TAG )?.length !== 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
jest.useRealTimers();
|
|
10
10
|
|
|
11
11
|
describe( 'getPxFromCssUnit', () => {
|
|
12
|
-
// Absolute units
|
|
12
|
+
// Absolute units.
|
|
13
13
|
describe( 'absolute unites should return px values', () => {
|
|
14
14
|
const testData = [
|
|
15
15
|
[ '25px', '25px' ],
|
|
@@ -19,7 +19,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
19
19
|
[ '1in', '96px' ],
|
|
20
20
|
[ '12pt', '16px' ],
|
|
21
21
|
[ '1pc', '16px' ],
|
|
22
|
-
[ '40Q', '38px' ], // 40 Q should be 1 cm
|
|
22
|
+
[ '40Q', '38px' ], // 40 Q should be 1 cm.
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
test.each( testData )(
|
|
@@ -87,7 +87,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
87
87
|
);
|
|
88
88
|
} );
|
|
89
89
|
|
|
90
|
-
// Function units
|
|
90
|
+
// Function units.
|
|
91
91
|
|
|
92
92
|
describe( 'function unites should return px values', () => {
|
|
93
93
|
const settings = {
|
|
@@ -120,7 +120,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
120
120
|
[ 123.456, '123px' ],
|
|
121
121
|
[ 'abc', null ],
|
|
122
122
|
[ 'console.log("howdy"); + 10px', null ],
|
|
123
|
-
[ 'calc(12vw * 10px', null ], //
|
|
123
|
+
[ 'calc(12vw * 10px', null ], // Missing closing bracket.
|
|
124
124
|
];
|
|
125
125
|
|
|
126
126
|
test.each( testData )(
|
|
@@ -159,7 +159,7 @@ describe( 'getPxFromCssUnit', () => {
|
|
|
159
159
|
|
|
160
160
|
const startM = Date.now();
|
|
161
161
|
i = 0;
|
|
162
|
-
//
|
|
162
|
+
// The memoized Version should be at 10X better then the non default one.
|
|
163
163
|
while ( i < intervals * 10 ) {
|
|
164
164
|
memoizedGetPxFromCssUnit( 'max(25px, 35px)', { width: 201 } );
|
|
165
165
|
i++;
|