@wordpress/block-editor 14.11.0 → 14.13.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 +4 -0
- package/build/autocompleters/block.js +0 -1
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +0 -1
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/alignment-control/ui.js +0 -1
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/autocomplete/index.js +0 -1
- package/build/components/autocomplete/index.js.map +1 -1
- package/build/components/background-image-control/index.js +0 -1
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-actions/index.js +0 -1
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/ui.js +0 -1
- package/build/components/block-alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/ui.native.js +0 -1
- package/build/components/block-alignment-control/ui.native.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +0 -1
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +0 -1
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/index.js +0 -1
- package/build/components/block-compare/index.js.map +1 -1
- package/build/components/block-controls/fill.js +0 -1
- package/build/components/block-controls/fill.js.map +1 -1
- package/build/components/block-edit/edit.js +0 -1
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +0 -1
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +0 -1
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.native.js +0 -1
- package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +0 -1
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +0 -1
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +0 -1
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +0 -1
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.js +9 -6
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/index.native.js +0 -1
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js +0 -1
- package/build/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +0 -1
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-lock/modal.js +0 -1
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-manager/category.js +0 -1
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +0 -1
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +0 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-media-update-progress/index.native.js +0 -1
- package/build/components/block-media-update-progress/index.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +0 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-mover/mover-description.native.js +0 -1
- package/build/components/block-mover/mover-description.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +0 -1
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/use-patterns-setup.js +0 -1
- package/build/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
- package/build/components/block-patterns-list/index.js +0 -1
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/use-popover-scroll.js +13 -7
- package/build/components/block-popover/use-popover-scroll.js.map +1 -1
- package/build/components/block-quick-navigation/index.js +0 -1
- package/build/components/block-quick-navigation/index.js.map +1 -1
- package/build/components/block-rename/modal.js +0 -1
- package/build/components/block-rename/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +0 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +0 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-styles/index.native.js +0 -1
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/menu-items.js +0 -1
- package/build/components/block-styles/menu-items.js.map +1 -1
- package/build/components/block-styles/preview.native.js +0 -1
- package/build/components/block-styles/preview.native.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +0 -1
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.native.js +0 -1
- package/build/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +0 -1
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build/components/block-switcher/index.js +0 -1
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +0 -1
- package/build/components/block-switcher/pattern-transformations-menu.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-switcher/utils.js +0 -1
- package/build/components/block-switcher/utils.js.map +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js +0 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +0 -1
- package/build/components/block-toolbar/change-design.js.map +1 -1
- package/build/components/block-toolbar/index.js +0 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-toolbar-popover.js +3 -2
- package/build/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build/components/block-tools/use-selected-block-tool-props.js +0 -1
- package/build/components/block-tools/use-selected-block-tool-props.js.map +1 -1
- package/build/components/block-types-list/index.js +0 -1
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/block-variation-picker/index.js +0 -1
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +0 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +0 -1
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/block-vertical-alignment-control/ui.js +0 -1
- package/build/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build/components/border-radius-control/index.js +0 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/input-controls.js +0 -1
- package/build/components/border-radius-control/input-controls.js.map +1 -1
- package/build/components/border-radius-control/utils.js +0 -1
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors/utils.js +0 -1
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors/with-colors.js +0 -1
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -1
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +0 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js +0 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/toolbar.js +0 -1
- package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/dimensions-tool/scale-tool.js +0 -1
- package/build/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build/components/duotone/utils.js +0 -1
- package/build/components/duotone/utils.js.map +1 -1
- package/build/components/editor-styles/index.js +0 -1
- package/build/components/editor-styles/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +0 -1
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +0 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +0 -1
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/global-styles/border-panel.js +0 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.js +0 -1
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/color-panel.native.js +0 -1
- package/build/components/global-styles/color-panel.native.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +0 -1
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/filters-panel.js +42 -25
- package/build/components/global-styles/filters-panel.js.map +1 -1
- package/build/components/global-styles/get-global-styles-changes.js +0 -1
- package/build/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +41 -17
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +0 -1
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-context.native.js +0 -1
- package/build/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +0 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +0 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +11 -20
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/use-grid-layout-sync.js +0 -1
- package/build/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build/components/grid/utils.js +6 -5
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +0 -1
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/image-editor/aspect-ratio-dropdown.js +1 -2
- package/build/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -2
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +2 -2
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-block-context.js +0 -1
- package/build/components/inner-blocks/use-block-context.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +0 -1
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +0 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +0 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +0 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +0 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +0 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +0 -1
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js +0 -1
- package/build/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +0 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter/index.js +0 -1
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +0 -1
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +0 -1
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +0 -1
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-tab.js +0 -1
- package/build/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build/components/inserter/menu.js +13 -2
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +0 -1
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build/components/inserter/no-results.js +3 -7
- package/build/components/inserter/no-results.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -1
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +0 -1
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +1 -2
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.native.js +0 -1
- package/build/components/inserter/tabs.native.js.map +1 -1
- package/build/components/inserter/utils.native.js +0 -1
- package/build/components/inserter/utils.native.js.map +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +0 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls-tabs/index.js +0 -1
- package/build/components/inspector-controls-tabs/index.js.map +1 -1
- package/build/components/inspector-controls-tabs/position-controls-panel.js +49 -21
- package/build/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build/components/inspector-popover-header/index.js +0 -1
- package/build/components/inspector-popover-header/index.js.map +1 -1
- package/build/components/justify-content-control/ui.js +0 -1
- package/build/components/justify-content-control/ui.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/link-control/index.js +0 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-results.js +0 -1
- package/build/components/link-control/search-results.js.map +1 -1
- package/build/components/link-control/settings.js +0 -1
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/link-control/use-internal-value.js +0 -1
- package/build/components/link-control/use-internal-value.js.map +1 -1
- package/build/components/link-control/use-search-handler.js +0 -1
- package/build/components/link-control/use-search-handler.js.map +1 -1
- package/build/components/list-view/block-select-button.js +0 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +0 -1
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +0 -1
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +0 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-block-selection.js +0 -1
- package/build/components/list-view/use-block-selection.js.map +1 -1
- package/build/components/list-view/use-clipboard-handler.js +0 -1
- package/build/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build/components/list-view/use-list-view-block-indexes.js +0 -1
- package/build/components/list-view/use-list-view-block-indexes.js.map +1 -1
- package/build/components/list-view/use-list-view-drop-zone.js +0 -1
- package/build/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build/components/list-view/utils.js +0 -1
- package/build/components/list-view/utils.js.map +1 -1
- package/build/components/media-placeholder/index.js +0 -1
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +0 -1
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/media-replace-flow/index.js +0 -1
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/media-upload/index.native.js +0 -1
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/navigable-toolbar/index.js +0 -1
- package/build/components/navigable-toolbar/index.js.map +1 -1
- package/build/components/panel-color-settings/index.js +0 -1
- package/build/components/panel-color-settings/index.js.map +1 -1
- package/build/components/provider/use-block-sync.js +0 -1
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/responsive-block-control/index.js +0 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +0 -1
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build/components/rich-text/event-listeners/before-input-rules.js +0 -1
- package/build/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build/components/rich-text/event-listeners/delete.js +5 -3
- package/build/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build/components/rich-text/event-listeners/index.js +0 -1
- package/build/components/rich-text/event-listeners/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +0 -1
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/event-listeners/paste-handler.js +0 -1
- package/build/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build/components/rich-text/file-paste-handler.native.js +0 -1
- package/build/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build/components/rich-text/format-edit.js +0 -1
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +0 -1
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +0 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/multiline.js +0 -1
- package/build/components/rich-text/multiline.js.map +1 -1
- package/build/components/rich-text/native/format-edit.js +0 -1
- package/build/components/rich-text/native/format-edit.js.map +1 -1
- package/build/components/rich-text/native/get-format-colors.native.js +0 -1
- package/build/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +0 -1
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/native/toolbar-button-with-options.native.js +0 -1
- package/build/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build/components/rich-text/native/use-format-types.js +0 -1
- package/build/components/rich-text/native/use-format-types.js.map +1 -1
- package/build/components/rich-text/use-format-types.js +0 -1
- package/build/components/rich-text/use-format-types.js.map +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +0 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +44 -2
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/linked-button.js +6 -9
- package/build/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +0 -109
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +0 -1
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/text-alignment-control/index.js +0 -1
- package/build/components/text-alignment-control/index.js.map +1 -1
- package/build/components/text-decoration-control/index.js +0 -1
- package/build/components/text-decoration-control/index.js.map +1 -1
- package/build/components/text-transform-control/index.js +0 -1
- package/build/components/text-transform-control/index.js.map +1 -1
- package/build/components/unsupported-block-details/index.native.js +0 -1
- package/build/components/unsupported-block-details/index.native.js.map +1 -1
- package/build/components/url-input/index.js +0 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +0 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-commands/index.js +0 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +0 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +0 -1
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-flash-editable-blocks/index.js +0 -1
- package/build/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +0 -1
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.native.js +0 -1
- package/build/components/use-on-block-drop/index.native.js.map +1 -1
- package/build/components/use-paste-styles/index.js +0 -1
- package/build/components/use-paste-styles/index.js.map +1 -1
- package/build/components/warning/index.js +0 -1
- package/build/components/warning/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +0 -1
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/components/writing-flow/use-clipboard-handler.js +0 -1
- package/build/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build/components/writing-flow/use-input.js +0 -1
- package/build/components/writing-flow/use-input.js.map +1 -1
- package/build/components/writing-flow/use-tab-nav.js +3 -1
- package/build/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build/components/writing-flow/utils.js +0 -1
- package/build/components/writing-flow/utils.js.map +1 -1
- package/build/components/writing-mode-control/index.js +0 -1
- package/build/components/writing-mode-control/index.js.map +1 -1
- package/build/hooks/align.js +0 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/align.native.js +0 -1
- package/build/hooks/align.native.js.map +1 -1
- package/build/hooks/aria-label.js +3 -8
- package/build/hooks/aria-label.js.map +1 -1
- package/build/hooks/block-bindings.js +0 -1
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/block-hooks.js +0 -1
- package/build/hooks/block-hooks.js.map +1 -1
- package/build/hooks/block-style-variation.js +0 -1
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/contrast-checker.js +40 -22
- package/build/hooks/contrast-checker.js.map +1 -1
- package/build/hooks/custom-class-name.js +2 -1
- package/build/hooks/custom-class-name.js.map +1 -1
- package/build/hooks/duotone.js +0 -1
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +0 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/hooks/style.js +0 -1
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +0 -1
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/text-align.js +0 -1
- package/build/hooks/text-align.js.map +1 -1
- package/build/hooks/typography.js +0 -1
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +0 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/constrained.js +0 -1
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/flex.js +0 -1
- package/build/layouts/flex.js.map +1 -1
- package/build/layouts/flow.js +0 -1
- package/build/layouts/flow.js.map +1 -1
- package/build/layouts/index.js +0 -1
- package/build/layouts/index.js.map +1 -1
- package/build/layouts/utils.js +0 -1
- package/build/layouts/utils.js.map +1 -1
- package/build/store/actions.js +0 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/get-block-settings.js +0 -1
- package/build/store/get-block-settings.js.map +1 -1
- package/build/store/private-actions.js +0 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -3
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +0 -1
- package/build/store/utils.js.map +1 -1
- package/build/utils/block-bindings.js +0 -1
- package/build/utils/block-bindings.js.map +1 -1
- package/build/utils/get-editor-region.js +0 -1
- package/build/utils/get-editor-region.js.map +1 -1
- package/build/utils/get-font-styles-and-weights.js +0 -1
- package/build/utils/get-font-styles-and-weights.js.map +1 -1
- package/build/utils/math.js +0 -1
- package/build/utils/math.js.map +1 -1
- package/build/utils/object.js +0 -1
- package/build/utils/object.js.map +1 -1
- package/build/utils/selection.js +0 -1
- package/build/utils/selection.js.map +1 -1
- package/build/utils/transform-styles/index.js +0 -1
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/autocompleters/block.js +0 -1
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +0 -1
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +0 -1
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/autocomplete/index.js +0 -1
- package/build-module/components/autocomplete/index.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-actions/index.js +0 -1
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.js +0 -1
- package/build-module/components/block-alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/ui.native.js +0 -1
- package/build-module/components/block-alignment-control/ui.native.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +0 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +0 -1
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/index.js +0 -1
- package/build-module/components/block-compare/index.js.map +1 -1
- package/build-module/components/block-controls/fill.js +0 -1
- package/build-module/components/block-controls/fill.js.map +1 -1
- package/build-module/components/block-edit/edit.js +0 -1
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +0 -1
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +0 -1
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js +0 -1
- package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +0 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +0 -1
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +0 -1
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +0 -1
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +0 -1
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -6
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/index.native.js +0 -1
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js +0 -1
- package/build-module/components/block-list/use-block-props/use-focus-first-element.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +0 -1
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-lock/modal.js +0 -1
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-manager/category.js +0 -1
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +0 -1
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +0 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-media-update-progress/index.native.js +0 -1
- package/build-module/components/block-media-update-progress/index.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +0 -1
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-mover/mover-description.native.js +0 -1
- package/build-module/components/block-mover/mover-description.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +0 -1
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/use-patterns-setup.js +0 -1
- package/build-module/components/block-pattern-setup/use-patterns-setup.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +0 -1
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/use-popover-scroll.js +12 -7
- package/build-module/components/block-popover/use-popover-scroll.js.map +1 -1
- package/build-module/components/block-quick-navigation/index.js +0 -1
- package/build-module/components/block-quick-navigation/index.js.map +1 -1
- package/build-module/components/block-rename/modal.js +0 -1
- package/build-module/components/block-rename/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +0 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +0 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +0 -1
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/menu-items.js +0 -1
- package/build-module/components/block-styles/menu-items.js.map +1 -1
- package/build-module/components/block-styles/preview.native.js +0 -1
- package/build-module/components/block-styles/preview.native.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +0 -1
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js +0 -1
- package/build-module/components/block-switcher/block-transformations-menu.native.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +0 -1
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -1
- package/build-module/components/block-switcher/index.js +0 -1
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +0 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.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-switcher/utils.js +0 -1
- package/build-module/components/block-switcher/utils.js.map +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js +0 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +0 -1
- package/build-module/components/block-toolbar/change-design.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +0 -1
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-toolbar-popover.js +3 -2
- package/build-module/components/block-tools/block-toolbar-popover.js.map +1 -1
- package/build-module/components/block-tools/use-selected-block-tool-props.js +0 -1
- package/build-module/components/block-tools/use-selected-block-tool-props.js.map +1 -1
- package/build-module/components/block-types-list/index.js +0 -1
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +0 -1
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +0 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +0 -1
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/block-vertical-alignment-control/ui.js +0 -1
- package/build-module/components/block-vertical-alignment-control/ui.js.map +1 -1
- package/build-module/components/border-radius-control/index.js +0 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/input-controls.js +0 -1
- package/build-module/components/border-radius-control/input-controls.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +0 -1
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors/utils.js +0 -1
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors/with-colors.js +0 -1
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -1
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +0 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js +0 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js +0 -1
- package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/dimensions-tool/scale-tool.js +0 -1
- package/build-module/components/dimensions-tool/scale-tool.js.map +1 -1
- package/build-module/components/duotone/utils.js +0 -1
- package/build-module/components/duotone/utils.js.map +1 -1
- package/build-module/components/editor-styles/index.js +0 -1
- package/build-module/components/editor-styles/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +0 -1
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +0 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +0 -1
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +0 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +0 -1
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/color-panel.native.js +0 -1
- package/build-module/components/global-styles/color-panel.native.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +0 -1
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/filters-panel.js +45 -28
- package/build-module/components/global-styles/filters-panel.js.map +1 -1
- package/build-module/components/global-styles/get-global-styles-changes.js +0 -1
- package/build-module/components/global-styles/get-global-styles-changes.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +44 -20
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +0 -1
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js +0 -1
- package/build-module/components/global-styles/use-global-styles-context.native.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +0 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +0 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +11 -20
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/use-grid-layout-sync.js +0 -1
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -1
- package/build-module/components/grid/utils.js +6 -5
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +0 -1
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/image-editor/aspect-ratio-dropdown.js +1 -2
- package/build-module/components/image-editor/aspect-ratio-dropdown.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -2
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +2 -2
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-block-context.js +0 -1
- package/build-module/components/inner-blocks/use-block-context.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +0 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +0 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +0 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +0 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +0 -1
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +0 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +0 -1
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js +0 -1
- package/build-module/components/inserter/hooks/use-block-type-impressions.native.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +0 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter/index.js +0 -1
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +0 -1
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +0 -1
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +0 -1
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-tab.js +0 -1
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -1
- package/build-module/components/inserter/menu.js +13 -2
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +0 -1
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
- package/build-module/components/inserter/no-results.js +4 -8
- package/build-module/components/inserter/no-results.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -1
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +0 -1
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +1 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.native.js +0 -1
- package/build-module/components/inserter/tabs.native.js.map +1 -1
- package/build-module/components/inserter/utils.native.js +0 -1
- package/build-module/components/inserter/utils.native.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +0 -1
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/index.js +0 -1
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js +51 -23
- package/build-module/components/inspector-controls-tabs/position-controls-panel.js.map +1 -1
- package/build-module/components/inspector-popover-header/index.js +0 -1
- package/build-module/components/inspector-popover-header/index.js.map +1 -1
- package/build-module/components/justify-content-control/ui.js +0 -1
- package/build-module/components/justify-content-control/ui.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/link-control/index.js +0 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-results.js +0 -1
- package/build-module/components/link-control/search-results.js.map +1 -1
- package/build-module/components/link-control/settings.js +0 -1
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/link-control/use-internal-value.js +0 -1
- package/build-module/components/link-control/use-internal-value.js.map +1 -1
- package/build-module/components/link-control/use-search-handler.js +0 -1
- package/build-module/components/link-control/use-search-handler.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +0 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +0 -1
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +0 -1
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +0 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-block-selection.js +0 -1
- package/build-module/components/list-view/use-block-selection.js.map +1 -1
- package/build-module/components/list-view/use-clipboard-handler.js +0 -1
- package/build-module/components/list-view/use-clipboard-handler.js.map +1 -1
- package/build-module/components/list-view/use-list-view-block-indexes.js +0 -1
- package/build-module/components/list-view/use-list-view-block-indexes.js.map +1 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js +0 -1
- package/build-module/components/list-view/use-list-view-drop-zone.js.map +1 -1
- package/build-module/components/list-view/utils.js +0 -1
- package/build-module/components/list-view/utils.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +0 -1
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +0 -1
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +0 -1
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +0 -1
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/navigable-toolbar/index.js +0 -1
- package/build-module/components/navigable-toolbar/index.js.map +1 -1
- package/build-module/components/panel-color-settings/index.js +0 -1
- package/build-module/components/panel-color-settings/index.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +0 -1
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +0 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +0 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js +0 -1
- package/build-module/components/rich-text/event-listeners/before-input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +5 -3
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/index.js +0 -1
- package/build-module/components/rich-text/event-listeners/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +0 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js +0 -1
- package/build-module/components/rich-text/event-listeners/paste-handler.js.map +1 -1
- package/build-module/components/rich-text/file-paste-handler.native.js +0 -1
- package/build-module/components/rich-text/file-paste-handler.native.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +0 -1
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +0 -1
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +0 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/multiline.js +0 -1
- package/build-module/components/rich-text/multiline.js.map +1 -1
- package/build-module/components/rich-text/native/format-edit.js +0 -1
- package/build-module/components/rich-text/native/format-edit.js.map +1 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js +0 -1
- package/build-module/components/rich-text/native/get-format-colors.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +0 -1
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js +0 -1
- package/build-module/components/rich-text/native/toolbar-button-with-options.native.js.map +1 -1
- package/build-module/components/rich-text/native/use-format-types.js +0 -1
- package/build-module/components/rich-text/native/use-format-types.js.map +1 -1
- package/build-module/components/rich-text/use-format-types.js +0 -1
- package/build-module/components/rich-text/use-format-types.js.map +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +0 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +45 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/linked-button.js +7 -10
- package/build-module/components/spacing-sizes-control/linked-button.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +0 -105
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +0 -1
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/text-alignment-control/index.js +0 -1
- package/build-module/components/text-alignment-control/index.js.map +1 -1
- package/build-module/components/text-decoration-control/index.js +0 -1
- package/build-module/components/text-decoration-control/index.js.map +1 -1
- package/build-module/components/text-transform-control/index.js +0 -1
- package/build-module/components/text-transform-control/index.js.map +1 -1
- package/build-module/components/unsupported-block-details/index.native.js +0 -1
- package/build-module/components/unsupported-block-details/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +0 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +0 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +0 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +0 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +0 -1
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-flash-editable-blocks/index.js +0 -1
- package/build-module/components/use-flash-editable-blocks/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +0 -1
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.native.js +0 -1
- package/build-module/components/use-on-block-drop/index.native.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +0 -1
- package/build-module/components/use-paste-styles/index.js.map +1 -1
- package/build-module/components/warning/index.js +0 -1
- package/build-module/components/warning/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +0 -1
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js +0 -1
- package/build-module/components/writing-flow/use-clipboard-handler.js.map +1 -1
- package/build-module/components/writing-flow/use-input.js +0 -1
- package/build-module/components/writing-flow/use-input.js.map +1 -1
- package/build-module/components/writing-flow/use-tab-nav.js +3 -1
- package/build-module/components/writing-flow/use-tab-nav.js.map +1 -1
- package/build-module/components/writing-flow/utils.js +0 -1
- package/build-module/components/writing-flow/utils.js.map +1 -1
- package/build-module/components/writing-mode-control/index.js +0 -1
- package/build-module/components/writing-mode-control/index.js.map +1 -1
- package/build-module/hooks/align.js +0 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/align.native.js +0 -1
- package/build-module/hooks/align.native.js.map +1 -1
- package/build-module/hooks/aria-label.js +3 -7
- package/build-module/hooks/aria-label.js.map +1 -1
- package/build-module/hooks/block-bindings.js +0 -1
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/block-hooks.js +0 -1
- package/build-module/hooks/block-hooks.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +0 -1
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/contrast-checker.js +41 -23
- package/build-module/hooks/contrast-checker.js.map +1 -1
- package/build-module/hooks/custom-class-name.js +2 -1
- package/build-module/hooks/custom-class-name.js.map +1 -1
- package/build-module/hooks/duotone.js +0 -1
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +0 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/hooks/style.js +0 -1
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +0 -1
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/text-align.js +0 -1
- package/build-module/hooks/text-align.js.map +1 -1
- package/build-module/hooks/typography.js +0 -1
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +0 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/constrained.js +0 -1
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/flex.js +0 -1
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/layouts/flow.js +0 -1
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/layouts/index.js +0 -1
- package/build-module/layouts/index.js.map +1 -1
- package/build-module/layouts/utils.js +0 -1
- package/build-module/layouts/utils.js.map +1 -1
- package/build-module/store/actions.js +0 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/get-block-settings.js +0 -1
- package/build-module/store/get-block-settings.js.map +1 -1
- package/build-module/store/private-actions.js +0 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +13 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +0 -1
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/block-bindings.js +0 -1
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-module/utils/get-editor-region.js +0 -1
- package/build-module/utils/get-editor-region.js.map +1 -1
- package/build-module/utils/get-font-styles-and-weights.js +0 -1
- package/build-module/utils/get-font-styles-and-weights.js.map +1 -1
- package/build-module/utils/math.js +0 -1
- package/build-module/utils/math.js.map +1 -1
- package/build-module/utils/object.js +0 -1
- package/build-module/utils/object.js.map +1 -1
- package/build-module/utils/selection.js +0 -1
- package/build-module/utils/selection.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +0 -1
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +22 -25
- package/build-style/content.css +22 -25
- package/build-style/style-rtl.css +131 -104
- package/build-style/style.css +131 -104
- package/package.json +34 -34
- package/src/components/block-canvas/style.scss +3 -2
- package/src/components/block-draggable/style.scss +3 -1
- package/src/components/block-list/content.scss +19 -12
- package/src/components/block-list/index.js +21 -7
- package/src/components/block-mover/style.scss +5 -4
- package/src/components/block-pattern-setup/style.scss +3 -1
- package/src/components/block-patterns-list/style.scss +3 -3
- package/src/components/block-popover/use-popover-scroll.js +13 -8
- package/src/components/block-switcher/style.scss +3 -1
- package/src/components/block-toolbar/style.scss +5 -3
- package/src/components/block-tools/block-toolbar-popover.js +4 -3
- package/src/components/block-tools/style.scss +6 -3
- package/src/components/button-block-appender/content.scss +2 -4
- package/src/components/colors-gradients/style.scss +3 -2
- package/src/components/global-styles/filters-panel.js +48 -21
- package/src/components/global-styles/shadow-panel-components.js +44 -13
- package/src/components/global-styles/style.scss +53 -1
- package/src/components/grid/grid-visualizer.js +10 -21
- package/src/components/grid/style.scss +6 -4
- package/src/components/grid/utils.js +6 -4
- package/src/components/iframe/content.scss +5 -2
- package/src/components/image-editor/aspect-ratio-dropdown.js +1 -1
- package/src/components/inner-blocks/index.js +2 -2
- package/src/components/inner-blocks/index.native.js +2 -2
- package/src/components/inserter/menu.js +11 -9
- package/src/components/inserter/no-results.js +0 -5
- package/src/components/inserter/quick-inserter.js +4 -1
- package/src/components/inserter/search-results.js +3 -1
- package/src/components/inserter/style.scss +6 -8
- package/src/components/inserter-list-item/style.scss +9 -6
- package/src/components/inspector-controls-tabs/position-controls-panel.js +62 -27
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/link-control/style.scss +11 -6
- package/src/components/list-view/style.scss +34 -17
- package/src/components/rich-text/event-listeners/delete.js +3 -3
- package/src/components/spacing-sizes-control/README.md +93 -0
- package/src/components/spacing-sizes-control/index.js +44 -1
- package/src/components/spacing-sizes-control/linked-button.js +8 -10
- package/src/components/spacing-sizes-control/test/utils.js +0 -151
- package/src/components/spacing-sizes-control/utils.js +0 -106
- package/src/components/url-input/style.scss +3 -2
- package/src/components/writing-flow/use-tab-nav.js +4 -0
- package/src/hooks/aria-label.js +3 -8
- package/src/hooks/contrast-checker.js +64 -30
- package/src/hooks/custom-class-name.js +2 -1
- package/src/store/selectors.js +15 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["computeCaretRect","focus","isHorizontalEdge","isVerticalEdge","placeCaretAtHorizontalEdge","placeCaretAtVerticalEdge","isRTL","UP","DOWN","LEFT","RIGHT","useDispatch","useSelect","useRefEffect","getBlockClientId","isInSameBlock","store","blockEditorStore","isNavigationCandidate","element","keyCode","hasModifier","isVertical","tagName","elementType","getAttribute","verticalInputTypes","includes","simpleInputTypes","getClosestTabbable","target","isReverse","containerElement","onlyVertical","focusableNodes","focusable","find","reverse","slice","indexOf","targetRect","getBoundingClientRect","isTabCandidate","node","closest","children","length","firstElementChild","tabbable","isTabbableIndex","isContentEditable","contentEditable","nodeRect","left","right","useArrowNav","getMultiSelectedBlocksStartClientId","getMultiSelectedBlocksEndClientId","getSettings","hasMultiSelection","__unstableIsFullySelected","selectBlock","verticalRect","onMouseDown","isClosestTabbableABlock","closestTabbable","onKeyDown","event","defaultPrevented","shiftKey","ctrlKey","altKey","metaKey","isUp","isDown","isLeft","isRight","isHorizontal","isNav","isNavEdge","ownerDocument","defaultView","preventDefault","isReverseDir","keepCaretInsideBlock","undefined","getSelection","isCollapsed","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-arrow-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getBlockClientId, isInSameBlock } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\tconst { tagName } = element;\n\tconst elementType = element.getAttribute( 'type' );\n\n\t// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.\n\tif ( isVertical && ! hasModifier ) {\n\t\tif ( tagName === 'INPUT' ) {\n\t\t\tconst verticalInputTypes = [\n\t\t\t\t'date',\n\t\t\t\t'datetime-local',\n\t\t\t\t'month',\n\t\t\t\t'number',\n\t\t\t\t'range',\n\t\t\t\t'time',\n\t\t\t\t'week',\n\t\t\t];\n\t\t\treturn ! verticalInputTypes.includes( elementType );\n\t\t}\n\t\treturn true;\n\t}\n\n\t// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.\n\tif ( tagName === 'INPUT' ) {\n\t\tconst simpleInputTypes = [\n\t\t\t'button',\n\t\t\t'checkbox',\n\t\t\t'number',\n\t\t\t'color',\n\t\t\t'file',\n\t\t\t'image',\n\t\t\t'radio',\n\t\t\t'reset',\n\t\t\t'submit',\n\t\t];\n\t\treturn simpleInputTypes.includes( elementType );\n\t}\n\n\t// Native textareas should not navigate horizontally.\n\treturn tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes.reverse();\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\tif ( node.closest( '[inert]' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Skip if there's only one child that is content editable (and thus a\n\t\t// better candidate).\n\t\tif (\n\t\t\tnode.children.length === 1 &&\n\t\t\tisInSameBlock( node, node.firstElementChild ) &&\n\t\t\tnode.firstElementChild.getAttribute( 'contenteditable' ) === 'true'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn focusableNodes.find( isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetMultiSelectedBlocksStartClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t\t__unstableIsFullySelected,\n\t} = useSelect( blockEditorStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\tfunction isClosestTabbableABlock( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn closestTabbable && getBlockClientId( closestTabbable );\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } =\n\t\t\t\tevent;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst hasModifier = shiftKey || ctrlKey || altKey || metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there is a multi-selection, the arrow keys should collapse the\n\t\t\t// selection to the start or end of the selection.\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\tif ( shiftKey ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle if we have a full selection (not a native partial\n\t\t\t\t// selection).\n\t\t\t\tif ( ! __unstableIsFullySelected() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( isReverse ) {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksStartClientId() );\n\t\t\t\t} else {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksEndClientId(), -1 );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\n\t\t\tif ( shiftKey ) {\n\t\t\t\tif (\n\t\t\t\t\tisClosestTabbableABlock( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t// When Alt is pressed, only intercept if the caret is also at\n\t\t\t\t// the horizontal edge.\n\t\t\t\t( altKey ? isHorizontalEdge( target, isReverseDir ) : true ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\t// When Alt is pressed, place the caret at the furthest\n\t\t\t\t\t\t// horizontal edge and the furthest vertical edge.\n\t\t\t\t\t\taltKey ? ! isReverse : isReverse,\n\t\t\t\t\t\taltKey ? undefined : verticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,gBAAgB,EAChBC,KAAK,EACLC,gBAAgB,EAChBC,cAAc,EACdC,0BAA0B,EAC1BC,wBAAwB,EACxBC,KAAK,QACC,gBAAgB;AACvB,SAASC,EAAE,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,qBAAqB;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,iBAAiB;AACjE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAG;EACtE,MAAMC,UAAU,GAAGF,OAAO,KAAKb,EAAE,IAAIa,OAAO,KAAKZ,IAAI;EACrD,MAAM;IAAEe;EAAQ,CAAC,GAAGJ,OAAO;EAC3B,MAAMK,WAAW,GAAGL,OAAO,CAACM,YAAY,CAAE,MAAO,CAAC;;EAElD;EACA,IAAKH,UAAU,IAAI,CAAED,WAAW,EAAG;IAClC,IAAKE,OAAO,KAAK,OAAO,EAAG;MAC1B,MAAMG,kBAAkB,GAAG,CAC1B,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,CACN;MACD,OAAO,CAAEA,kBAAkB,CAACC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xC,IACD,CAAC;QACDvC,0BAA0B,CAAE6D,eAAe,EAAElC,SAAU,CAAC;QACxDoC,KAAK,CAACe,cAAc,CAAC,CAAC;MACvB;IACD;IAEAvC,IAAI,CAAC6C,gBAAgB,CAAE,WAAW,EAAEzB,WAAY,CAAC;IACjDpB,IAAI,CAAC6C,gBAAgB,CAAE,SAAS,EAAEtB,SAAU,CAAC;IAC7C,OAAO,MAAM;MACZvB,IAAI,CAAC8C,mBAAmB,CAAE,WAAW,EAAE1B,WAAY,CAAC;MACpDpB,IAAI,CAAC8C,mBAAmB,CAAE,SAAS,EAAEvB,SAAU,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["computeCaretRect","focus","isHorizontalEdge","isVerticalEdge","placeCaretAtHorizontalEdge","placeCaretAtVerticalEdge","isRTL","UP","DOWN","LEFT","RIGHT","useDispatch","useSelect","useRefEffect","getBlockClientId","isInSameBlock","store","blockEditorStore","isNavigationCandidate","element","keyCode","hasModifier","isVertical","tagName","elementType","getAttribute","verticalInputTypes","includes","simpleInputTypes","getClosestTabbable","target","isReverse","containerElement","onlyVertical","focusableNodes","focusable","find","reverse","slice","indexOf","targetRect","getBoundingClientRect","isTabCandidate","node","closest","children","length","firstElementChild","tabbable","isTabbableIndex","isContentEditable","contentEditable","nodeRect","left","right","useArrowNav","getMultiSelectedBlocksStartClientId","getMultiSelectedBlocksEndClientId","getSettings","hasMultiSelection","__unstableIsFullySelected","selectBlock","verticalRect","onMouseDown","isClosestTabbableABlock","closestTabbable","onKeyDown","event","defaultPrevented","shiftKey","ctrlKey","altKey","metaKey","isUp","isDown","isLeft","isRight","isHorizontal","isNav","isNavEdge","ownerDocument","defaultView","preventDefault","isReverseDir","keepCaretInsideBlock","undefined","getSelection","isCollapsed","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-arrow-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tcomputeCaretRect,\n\tfocus,\n\tisHorizontalEdge,\n\tisVerticalEdge,\n\tplaceCaretAtHorizontalEdge,\n\tplaceCaretAtVerticalEdge,\n\tisRTL,\n} from '@wordpress/dom';\nimport { UP, DOWN, LEFT, RIGHT } from '@wordpress/keycodes';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { getBlockClientId, isInSameBlock } from '../../utils/dom';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Returns true if the element should consider edge navigation upon a keyboard\n * event of the given directional key code, or false otherwise.\n *\n * @param {Element} element HTML element to test.\n * @param {number} keyCode KeyboardEvent keyCode to test.\n * @param {boolean} hasModifier Whether a modifier is pressed.\n *\n * @return {boolean} Whether element should consider edge navigation.\n */\nexport function isNavigationCandidate( element, keyCode, hasModifier ) {\n\tconst isVertical = keyCode === UP || keyCode === DOWN;\n\tconst { tagName } = element;\n\tconst elementType = element.getAttribute( 'type' );\n\n\t// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.\n\tif ( isVertical && ! hasModifier ) {\n\t\tif ( tagName === 'INPUT' ) {\n\t\t\tconst verticalInputTypes = [\n\t\t\t\t'date',\n\t\t\t\t'datetime-local',\n\t\t\t\t'month',\n\t\t\t\t'number',\n\t\t\t\t'range',\n\t\t\t\t'time',\n\t\t\t\t'week',\n\t\t\t];\n\t\t\treturn ! verticalInputTypes.includes( elementType );\n\t\t}\n\t\treturn true;\n\t}\n\n\t// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.\n\tif ( tagName === 'INPUT' ) {\n\t\tconst simpleInputTypes = [\n\t\t\t'button',\n\t\t\t'checkbox',\n\t\t\t'number',\n\t\t\t'color',\n\t\t\t'file',\n\t\t\t'image',\n\t\t\t'radio',\n\t\t\t'reset',\n\t\t\t'submit',\n\t\t];\n\t\treturn simpleInputTypes.includes( elementType );\n\t}\n\n\t// Native textareas should not navigate horizontally.\n\treturn tagName !== 'TEXTAREA';\n}\n\n/**\n * Returns the optimal tab target from the given focused element in the desired\n * direction. A preference is made toward text fields, falling back to the block\n * focus stop if no other candidates exist for the block.\n *\n * @param {Element} target Currently focused text field.\n * @param {boolean} isReverse True if considering as the first field.\n * @param {Element} containerElement Element containing all blocks.\n * @param {boolean} onlyVertical Whether to only consider tabbable elements\n * that are visually above or under the\n * target.\n *\n * @return {?Element} Optimal tab target, if one exists.\n */\nexport function getClosestTabbable(\n\ttarget,\n\tisReverse,\n\tcontainerElement,\n\tonlyVertical\n) {\n\t// Since the current focus target is not guaranteed to be a text field, find\n\t// all focusables. Tabbability is considered later.\n\tlet focusableNodes = focus.focusable.find( containerElement );\n\n\tif ( isReverse ) {\n\t\tfocusableNodes.reverse();\n\t}\n\n\t// Consider as candidates those focusables after the current target. It's\n\t// assumed this can only be reached if the target is focusable (on its\n\t// keydown event), so no need to verify it exists in the set.\n\tfocusableNodes = focusableNodes.slice(\n\t\tfocusableNodes.indexOf( target ) + 1\n\t);\n\n\tlet targetRect;\n\n\tif ( onlyVertical ) {\n\t\ttargetRect = target.getBoundingClientRect();\n\t}\n\n\tfunction isTabCandidate( node ) {\n\t\tif ( node.closest( '[inert]' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Skip if there's only one child that is content editable (and thus a\n\t\t// better candidate).\n\t\tif (\n\t\t\tnode.children.length === 1 &&\n\t\t\tisInSameBlock( node, node.firstElementChild ) &&\n\t\t\tnode.firstElementChild.getAttribute( 'contenteditable' ) === 'true'\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Not a candidate if the node is not tabbable.\n\t\tif ( ! focus.tabbable.isTabbableIndex( node ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Skip focusable elements such as links within content editable nodes.\n\t\tif ( node.isContentEditable && node.contentEditable !== 'true' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif ( onlyVertical ) {\n\t\t\tconst nodeRect = node.getBoundingClientRect();\n\n\t\t\tif (\n\t\t\t\tnodeRect.left >= targetRect.right ||\n\t\t\t\tnodeRect.right <= targetRect.left\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\treturn focusableNodes.find( isTabCandidate );\n}\n\nexport default function useArrowNav() {\n\tconst {\n\t\tgetMultiSelectedBlocksStartClientId,\n\t\tgetMultiSelectedBlocksEndClientId,\n\t\tgetSettings,\n\t\thasMultiSelection,\n\t\t__unstableIsFullySelected,\n\t} = useSelect( blockEditorStore );\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\treturn useRefEffect( ( node ) => {\n\t\t// Here a DOMRect is stored while moving the caret vertically so\n\t\t// vertical position of the start position can be restored. This is to\n\t\t// recreate browser behaviour across blocks.\n\t\tlet verticalRect;\n\n\t\tfunction onMouseDown() {\n\t\t\tverticalRect = null;\n\t\t}\n\n\t\tfunction isClosestTabbableABlock( target, isReverse ) {\n\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\ttarget,\n\t\t\t\tisReverse,\n\t\t\t\tnode\n\t\t\t);\n\t\t\treturn closestTabbable && getBlockClientId( closestTabbable );\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\t// Abort if navigation has already been handled (e.g. RichText\n\t\t\t// inline boundaries).\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst { keyCode, target, shiftKey, ctrlKey, altKey, metaKey } =\n\t\t\t\tevent;\n\t\t\tconst isUp = keyCode === UP;\n\t\t\tconst isDown = keyCode === DOWN;\n\t\t\tconst isLeft = keyCode === LEFT;\n\t\t\tconst isRight = keyCode === RIGHT;\n\t\t\tconst isReverse = isUp || isLeft;\n\t\t\tconst isHorizontal = isLeft || isRight;\n\t\t\tconst isVertical = isUp || isDown;\n\t\t\tconst isNav = isHorizontal || isVertical;\n\t\t\tconst hasModifier = shiftKey || ctrlKey || altKey || metaKey;\n\t\t\tconst isNavEdge = isVertical ? isVerticalEdge : isHorizontalEdge;\n\t\t\tconst { ownerDocument } = node;\n\t\t\tconst { defaultView } = ownerDocument;\n\n\t\t\tif ( ! isNav ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If there is a multi-selection, the arrow keys should collapse the\n\t\t\t// selection to the start or end of the selection.\n\t\t\tif ( hasMultiSelection() ) {\n\t\t\t\tif ( shiftKey ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Only handle if we have a full selection (not a native partial\n\t\t\t\t// selection).\n\t\t\t\tif ( ! __unstableIsFullySelected() ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( isReverse ) {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksStartClientId() );\n\t\t\t\t} else {\n\t\t\t\t\tselectBlock( getMultiSelectedBlocksEndClientId(), -1 );\n\t\t\t\t}\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Abort if our current target is not a candidate for navigation\n\t\t\t// (e.g. preserve native input behaviors).\n\t\t\tif ( ! isNavigationCandidate( target, keyCode, hasModifier ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// When presing any key other than up or down, the initial vertical\n\t\t\t// position must ALWAYS be reset. The vertical position is saved so\n\t\t\t// it can be restored as well as possible on sebsequent vertical\n\t\t\t// arrow key presses. It may not always be possible to restore the\n\t\t\t// exact same position (such as at an empty line), so it wouldn't be\n\t\t\t// good to compute the position right before any vertical arrow key\n\t\t\t// press.\n\t\t\tif ( ! isVertical ) {\n\t\t\t\tverticalRect = null;\n\t\t\t} else if ( ! verticalRect ) {\n\t\t\t\tverticalRect = computeCaretRect( defaultView );\n\t\t\t}\n\n\t\t\t// In the case of RTL scripts, right means previous and left means\n\t\t\t// next, which is the exact reverse of LTR.\n\t\t\tconst isReverseDir = isRTL( target ) ? ! isReverse : isReverse;\n\t\t\tconst { keepCaretInsideBlock } = getSettings();\n\n\t\t\tif ( shiftKey ) {\n\t\t\t\tif (\n\t\t\t\t\tisClosestTabbableABlock( target, isReverse ) &&\n\t\t\t\t\tisNavEdge( target, isReverse )\n\t\t\t\t) {\n\t\t\t\t\tnode.contentEditable = true;\n\t\t\t\t\t// Firefox doesn't automatically move focus.\n\t\t\t\t\tnode.focus();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisVertical &&\n\t\t\t\tisVerticalEdge( target, isReverse ) &&\n\t\t\t\t// When Alt is pressed, only intercept if the caret is also at\n\t\t\t\t// the horizontal edge.\n\t\t\t\t( altKey ? isHorizontalEdge( target, isReverseDir ) : true ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverse,\n\t\t\t\t\tnode,\n\t\t\t\t\ttrue\n\t\t\t\t);\n\n\t\t\t\tif ( closestTabbable ) {\n\t\t\t\t\tplaceCaretAtVerticalEdge(\n\t\t\t\t\t\tclosestTabbable,\n\t\t\t\t\t\t// When Alt is pressed, place the caret at the furthest\n\t\t\t\t\t\t// horizontal edge and the furthest vertical edge.\n\t\t\t\t\t\taltKey ? ! isReverse : isReverse,\n\t\t\t\t\t\taltKey ? undefined : verticalRect\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tisHorizontal &&\n\t\t\t\tdefaultView.getSelection().isCollapsed &&\n\t\t\t\tisHorizontalEdge( target, isReverseDir ) &&\n\t\t\t\t! keepCaretInsideBlock\n\t\t\t) {\n\t\t\t\tconst closestTabbable = getClosestTabbable(\n\t\t\t\t\ttarget,\n\t\t\t\t\tisReverseDir,\n\t\t\t\t\tnode\n\t\t\t\t);\n\t\t\t\tplaceCaretAtHorizontalEdge( closestTabbable, isReverse );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'mousedown', onMouseDown );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'mousedown', onMouseDown );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,gBAAgB,EAChBC,KAAK,EACLC,gBAAgB,EAChBC,cAAc,EACdC,0BAA0B,EAC1BC,wBAAwB,EACxBC,KAAK,QACC,gBAAgB;AACvB,SAASC,EAAE,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,QAAQ,qBAAqB;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,iBAAiB;AACjE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,qBAAqBA,CAAEC,OAAO,EAAEC,OAAO,EAAEC,WAAW,EAAG;EACtE,MAAMC,UAAU,GAAGF,OAAO,KAAKb,EAAE,IAAIa,OAAO,KAAKZ,IAAI;EACrD,MAAM;IAAEe;EAAQ,CAAC,GAAGJ,OAAO;EAC3B,MAAMK,WAAW,GAAGL,OAAO,CAACM,YAAY,CAAE,MAAO,CAAC;;EAElD;EACA,IAAKH,UAAU,IAAI,CAAED,WAAW,EAAG;IAClC,IAAKE,OAAO,KAAK,OAAO,EAAG;MAC1B,MAAMG,kBAAkB,GAAG,CAC1B,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,CACN;MACD,OAAO,CAAEA,kBAAkB,CAACC,QAAQ,CAAEH,WAAY,CAAC;IACpD;IACA,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKD,OAAO,KAAK,OAAO,EAAG;IAC1B,MAAMK,gBAAgB,GAAG,CACxB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C,gBAAgB,CAAE,WAAW,EAAEzB,WAAY,CAAC;IACjDpB,IAAI,CAAC6C,gBAAgB,CAAE,SAAS,EAAEtB,SAAU,CAAC;IAC7C,OAAO,MAAM;MACZvB,IAAI,CAAC8C,mBAAmB,CAAE,WAAW,EAAE1B,WAAY,CAAC;MACpDpB,IAAI,CAAC8C,mBAAmB,CAAE,SAAS,EAAEvB,SAAU,CAAC;IACjD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["pasteHandler","findTransform","getBlockTransforms","hasBlockSupport","switchToBlockType","documentHasSelection","documentHasUncollapsedSelection","useDispatch","useRegistry","useSelect","useRefEffect","store","blockEditorStore","useNotifyCopy","setClipboardBlocks","getPasteEventData","useClipboardHandler","registry","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","getBlockName","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","getBlockRootClientId","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","__unstableSplitSelection","notifyCopy","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","activeElement","isContentEditable","contains","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","preventDefault","blocks","head","tail","inBetweenBlocks","slice","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","isInternal","clipboardData","getData","plainText","html","files","isFullySelected","fromTransforms","reduce","accumulator","file","transformation","transform","isMatch","push","flat","HTML","mode","__deprecatedOnSplit","firstSelectedClientId","rootClientId","newBlocks","block","name","rootBlockName","switchedBlocks","switchedBlock","innerBlock","innerBlocks","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\thasBlockSupport,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { setClipboardBlocks } from './utils';\nimport { getPasteEventData } from '../../utils/pasting';\n\nexport default function useClipboardHandler() {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\tgetBlockName,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\t__unstableSplitSelection,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Let native copy/paste behaviour take over in input fields.\n\t\t\t// But always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument ) &&\n\t\t\t\t\t\t ! ownerDocument.activeElement.isContentEditable;\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst { activeElement } = event.target.ownerDocument;\n\n\t\t\tif ( ! node.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks, registry );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst isInternal =\n\t\t\t\t\tevent.clipboardData.getData( 'rich-text' ) === 'true';\n\t\t\t\tif ( isInternal ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { plainText, html, files } = getPasteEventData( event );\n\t\t\t\tconst isFullySelected = __unstableIsFullySelected();\n\t\t\t\tlet blocks = [];\n\n\t\t\t\tif ( files.length ) {\n\t\t\t\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\t\t\t\tblocks = files\n\t\t\t\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\t\tfromTransforms,\n\t\t\t\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\t\t\ttransformation.transform( [ file ] )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t\t}, [] )\n\t\t\t\t\t\t.flat();\n\t\t\t\t} else {\n\t\t\t\t\tblocks = pasteHandler( {\n\t\t\t\t\t\tHTML: html,\n\t\t\t\t\t\tplainText,\n\t\t\t\t\t\tmode: isFullySelected ? 'BLOCKS' : 'AUTO',\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t// Inline paste: let rich text handle it.\n\t\t\t\tif ( typeof blocks === 'string' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isFullySelected ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t\t-1\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If a block doesn't support splitting, let rich text paste\n\t\t\t\t// inline.\n\t\t\t\tif (\n\t\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t\t! hasBlockSupport(\n\t\t\t\t\t\tgetBlockName( selectedBlockClientIds[ 0 ] ),\n\t\t\t\t\t\t'splitting',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) &&\n\t\t\t\t\t! event.__deprecatedOnSplit\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ firstSelectedClientId ] = selectedBlockClientIds;\n\t\t\t\tconst rootClientId = getBlockRootClientId(\n\t\t\t\t\tfirstSelectedClientId\n\t\t\t\t);\n\n\t\t\t\tconst newBlocks = [];\n\n\t\t\t\tfor ( const block of blocks ) {\n\t\t\t\t\tif ( canInsertBlockType( block.name, rootClientId ) ) {\n\t\t\t\t\t\tnewBlocks.push( block );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If a block cannot be inserted in a root block, try\n\t\t\t\t\t\t// converting it to that root block type and insert the\n\t\t\t\t\t\t// inner blocks.\n\t\t\t\t\t\t// Example: paragraphs cannot be inserted into a list,\n\t\t\t\t\t\t// so convert the paragraphs to a list for list items.\n\t\t\t\t\t\tconst rootBlockName = getBlockName( rootClientId );\n\t\t\t\t\t\tconst switchedBlocks =\n\t\t\t\t\t\t\tblock.name !== rootBlockName\n\t\t\t\t\t\t\t\t? switchToBlockType( block, rootBlockName )\n\t\t\t\t\t\t\t\t: [ block ];\n\n\t\t\t\t\t\tif ( ! switchedBlocks ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( const switchedBlock of switchedBlocks ) {\n\t\t\t\t\t\t\tfor ( const innerBlock of switchedBlock.innerBlocks ) {\n\t\t\t\t\t\t\t\tnewBlocks.push( innerBlock );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t__unstableSplitSelection( newBlocks );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,eAAe,EACfC,iBAAiB,QACX,mBAAmB;AAC1B,SACCC,oBAAo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c,GACnBH,KAAK,CAACC,IAAI,KAAKC,aAAa,GACzBjF,iBAAiB,CAAE+E,KAAK,EAAEE,aAAc,CAAC,GACzC,CAAEF,KAAK,CAAE;YAEb,IAAK,CAAEG,cAAc,EAAG;cACvB;YACD;YAEA,KAAM,MAAMC,aAAa,IAAID,cAAc,EAAG;cAC7C,KAAM,MAAME,UAAU,IAAID,aAAa,CAACE,WAAW,EAAG;gBACrDP,SAAS,CAACP,IAAI,CAAEa,UAAW,CAAC;cAC7B;YACD;UACD;QACD;QAEAtD,wBAAwB,CAAEgD,SAAU,CAAC;QACrC5C,KAAK,CAACc,cAAc,CAAC,CAAC;MACvB;IACD;IAEAhB,IAAI,CAACO,aAAa,CAAC+C,gBAAgB,CAAE,MAAM,EAAErD,OAAQ,CAAC;IACtDD,IAAI,CAACO,aAAa,CAAC+C,gBAAgB,CAAE,KAAK,EAAErD,OAAQ,CAAC;IACrDD,IAAI,CAACO,aAAa,CAAC+C,gBAAgB,CAAE,OAAO,EAAErD,OAAQ,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,MAAM,EAAEtD,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,KAAK,EAAEtD,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,OAAO,EAAEtD,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["pasteHandler","findTransform","getBlockTransforms","hasBlockSupport","switchToBlockType","documentHasSelection","documentHasUncollapsedSelection","useDispatch","useRegistry","useSelect","useRefEffect","store","blockEditorStore","useNotifyCopy","setClipboardBlocks","getPasteEventData","useClipboardHandler","registry","getBlocksByClientId","getSelectedBlockClientIds","hasMultiSelection","getSettings","getBlockName","__unstableIsFullySelected","__unstableIsSelectionCollapsed","__unstableIsSelectionMergeable","__unstableGetSelectedBlocksWithPartialSelection","canInsertBlockType","getBlockRootClientId","flashBlock","removeBlocks","replaceBlocks","__unstableDeleteSelection","__unstableExpandSelection","__unstableSplitSelection","notifyCopy","node","handler","event","defaultPrevented","selectedBlockClientIds","length","target","ownerDocument","hasSelection","type","activeElement","isContentEditable","contains","isSelectionMergeable","shouldHandleWholeBlocks","expandSelectionIsNeeded","preventDefault","blocks","head","tail","inBetweenBlocks","slice","contentEditable","__experimentalCanUserUseUnfilteredHTML","canUserUseUnfilteredHTML","isInternal","clipboardData","getData","plainText","html","files","isFullySelected","fromTransforms","reduce","accumulator","file","transformation","transform","isMatch","push","flat","HTML","mode","__deprecatedOnSplit","firstSelectedClientId","rootClientId","newBlocks","block","name","rootBlockName","switchedBlocks","switchedBlock","innerBlock","innerBlocks","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-clipboard-handler.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\thasBlockSupport,\n\tswitchToBlockType,\n} from '@wordpress/blocks';\nimport {\n\tdocumentHasSelection,\n\tdocumentHasUncollapsedSelection,\n} from '@wordpress/dom';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\nimport { setClipboardBlocks } from './utils';\nimport { getPasteEventData } from '../../utils/pasting';\n\nexport default function useClipboardHandler() {\n\tconst registry = useRegistry();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\thasMultiSelection,\n\t\tgetSettings,\n\t\tgetBlockName,\n\t\t__unstableIsFullySelected,\n\t\t__unstableIsSelectionCollapsed,\n\t\t__unstableIsSelectionMergeable,\n\t\t__unstableGetSelectedBlocksWithPartialSelection,\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\tflashBlock,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\t__unstableSplitSelection,\n\t} = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction handler( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\t// This was likely already handled in rich-text/use-paste-handler.js.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst selectedBlockClientIds = getSelectedBlockClientIds();\n\n\t\t\tif ( selectedBlockClientIds.length === 0 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Let native copy/paste behaviour take over in input fields.\n\t\t\t// But always handle multiple selected blocks.\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tconst { target } = event;\n\t\t\t\tconst { ownerDocument } = target;\n\t\t\t\t// If copying, only consider actual text selection as selection.\n\t\t\t\t// Otherwise, any focus on an input field is considered.\n\t\t\t\tconst hasSelection =\n\t\t\t\t\tevent.type === 'copy' || event.type === 'cut'\n\t\t\t\t\t\t? documentHasUncollapsedSelection( ownerDocument )\n\t\t\t\t\t\t: documentHasSelection( ownerDocument ) &&\n\t\t\t\t\t\t ! ownerDocument.activeElement.isContentEditable;\n\n\t\t\t\t// Let native copy behaviour take over in input fields.\n\t\t\t\tif ( hasSelection ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst { activeElement } = event.target.ownerDocument;\n\n\t\t\tif ( ! node.contains( activeElement ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isSelectionMergeable = __unstableIsSelectionMergeable();\n\t\t\tconst shouldHandleWholeBlocks =\n\t\t\t\t__unstableIsSelectionCollapsed() || __unstableIsFullySelected();\n\t\t\tconst expandSelectionIsNeeded =\n\t\t\t\t! shouldHandleWholeBlocks && ! isSelectionMergeable;\n\t\t\tif ( event.type === 'copy' || event.type === 'cut' ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tif ( selectedBlockClientIds.length === 1 ) {\n\t\t\t\t\tflashBlock( selectedBlockClientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t\t// If we have a partial selection that is not mergeable, just\n\t\t\t\t// expand the selection to the whole blocks.\n\t\t\t\tif ( expandSelectionIsNeeded ) {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t} else {\n\t\t\t\t\tnotifyCopy( event.type, selectedBlockClientIds );\n\t\t\t\t\tlet blocks;\n\t\t\t\t\t// Check if we have partial selection.\n\t\t\t\t\tif ( shouldHandleWholeBlocks ) {\n\t\t\t\t\t\tblocks = getBlocksByClientId( selectedBlockClientIds );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst [ head, tail ] =\n\t\t\t\t\t\t\t__unstableGetSelectedBlocksWithPartialSelection();\n\t\t\t\t\t\tconst inBetweenBlocks = getBlocksByClientId(\n\t\t\t\t\t\t\tselectedBlockClientIds.slice(\n\t\t\t\t\t\t\t\t1,\n\t\t\t\t\t\t\t\tselectedBlockClientIds.length - 1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t\tblocks = [ head, ...inBetweenBlocks, tail ];\n\t\t\t\t\t}\n\n\t\t\t\t\tsetClipboardBlocks( event, blocks, registry );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( event.type === 'cut' ) {\n\t\t\t\t// We need to also check if at the start we needed to\n\t\t\t\t// expand the selection, as in this point we might have\n\t\t\t\t// programmatically fully selected the blocks above.\n\t\t\t\tif ( shouldHandleWholeBlocks && ! expandSelectionIsNeeded ) {\n\t\t\t\t\tremoveBlocks( selectedBlockClientIds );\n\t\t\t\t} else {\n\t\t\t\t\tevent.target.ownerDocument.activeElement.contentEditable = false;\n\t\t\t\t\t__unstableDeleteSelection();\n\t\t\t\t}\n\t\t\t} else if ( event.type === 'paste' ) {\n\t\t\t\tconst {\n\t\t\t\t\t__experimentalCanUserUseUnfilteredHTML:\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t} = getSettings();\n\t\t\t\tconst isInternal =\n\t\t\t\t\tevent.clipboardData.getData( 'rich-text' ) === 'true';\n\t\t\t\tif ( isInternal ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst { plainText, html, files } = getPasteEventData( event );\n\t\t\t\tconst isFullySelected = __unstableIsFullySelected();\n\t\t\t\tlet blocks = [];\n\n\t\t\t\tif ( files.length ) {\n\t\t\t\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\t\t\t\tblocks = files\n\t\t\t\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\t\tfromTransforms,\n\t\t\t\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\t\taccumulator.push(\n\t\t\t\t\t\t\t\t\ttransformation.transform( [ file ] )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t\t}, [] )\n\t\t\t\t\t\t.flat();\n\t\t\t\t} else {\n\t\t\t\t\tblocks = pasteHandler( {\n\t\t\t\t\t\tHTML: html,\n\t\t\t\t\t\tplainText,\n\t\t\t\t\t\tmode: isFullySelected ? 'BLOCKS' : 'AUTO',\n\t\t\t\t\t\tcanUserUseUnfilteredHTML,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\t// Inline paste: let rich text handle it.\n\t\t\t\tif ( typeof blocks === 'string' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif ( isFullySelected ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tselectedBlockClientIds,\n\t\t\t\t\t\tblocks,\n\t\t\t\t\t\tblocks.length - 1,\n\t\t\t\t\t\t-1\n\t\t\t\t\t);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// If a block doesn't support splitting, let rich text paste\n\t\t\t\t// inline.\n\t\t\t\tif (\n\t\t\t\t\t! hasMultiSelection() &&\n\t\t\t\t\t! hasBlockSupport(\n\t\t\t\t\t\tgetBlockName( selectedBlockClientIds[ 0 ] ),\n\t\t\t\t\t\t'splitting',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t) &&\n\t\t\t\t\t! event.__deprecatedOnSplit\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst [ firstSelectedClientId ] = selectedBlockClientIds;\n\t\t\t\tconst rootClientId = getBlockRootClientId(\n\t\t\t\t\tfirstSelectedClientId\n\t\t\t\t);\n\n\t\t\t\tconst newBlocks = [];\n\n\t\t\t\tfor ( const block of blocks ) {\n\t\t\t\t\tif ( canInsertBlockType( block.name, rootClientId ) ) {\n\t\t\t\t\t\tnewBlocks.push( block );\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If a block cannot be inserted in a root block, try\n\t\t\t\t\t\t// converting it to that root block type and insert the\n\t\t\t\t\t\t// inner blocks.\n\t\t\t\t\t\t// Example: paragraphs cannot be inserted into a list,\n\t\t\t\t\t\t// so convert the paragraphs to a list for list items.\n\t\t\t\t\t\tconst rootBlockName = getBlockName( rootClientId );\n\t\t\t\t\t\tconst switchedBlocks =\n\t\t\t\t\t\t\tblock.name !== rootBlockName\n\t\t\t\t\t\t\t\t? switchToBlockType( block, rootBlockName )\n\t\t\t\t\t\t\t\t: [ block ];\n\n\t\t\t\t\t\tif ( ! switchedBlocks ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor ( const switchedBlock of switchedBlocks ) {\n\t\t\t\t\t\t\tfor ( const innerBlock of switchedBlock.innerBlocks ) {\n\t\t\t\t\t\t\t\tnewBlocks.push( innerBlock );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t__unstableSplitSelection( newBlocks );\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tnode.ownerDocument.addEventListener( 'copy', handler );\n\t\tnode.ownerDocument.addEventListener( 'cut', handler );\n\t\tnode.ownerDocument.addEventListener( 'paste', handler );\n\n\t\treturn () => {\n\t\t\tnode.ownerDocument.removeEventListener( 'copy', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'cut', handler );\n\t\t\tnode.ownerDocument.removeEventListener( 'paste', handler );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,eAAe,EACfC,iBAAiB,QACX,mBAAmB;AAC1B,SACCC,oBAAoB,EACpBC,+BAA+B,QACzB,gBAAgB;AACvB,SAASC,WAAW,EAAEC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACrE,SAASC,YAAY,QAAQ,oBAAoB;;AAEjD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAASC,kBAAkB,QAAQ,SAAS;AAC5C,SAASC,iBAAiB,QAAQ,qBAAqB;AAEvD,eAAe,SAASC,mBAAmBA,CAAA,EAAG;EAC7C,MAAMC,QAAQ,GAAGT,WAAW,CAAC,CAAC;EAC9B,MAAM;IACLU,mBAAmB;IACnBC,yBAAyB;IACzBC,iBAAiB;IACjBC,WAAW;IACXC,YAAY;IACZC,yBAAyB;IACzBC,8BAA8B;IAC9BC,8BAA8B;IAC9BC,+CAA+C;IAC/CC,kBAAkB;IAClBC;EACD,CAAC,GAAGnB,SAAS,CAAEG,gBAAiB,CAAC;EACjC,MAAM;IACLiB,UAAU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Q,CAAC;IAEvD,OAAO,MAAM;MACZD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,MAAM,EAAEtD,OAAQ,CAAC;MACzDD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,KAAK,EAAEtD,OAAQ,CAAC;MACxDD,IAAI,CAACO,aAAa,CAACgD,mBAAmB,CAAE,OAAO,EAAEtD,OAAQ,CAAC;IAC3D,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","useRefEffect","ENTER","BACKSPACE","DELETE","createBlock","getDefaultBlockName","hasBlockSupport","getBlockTransforms","findTransform","store","blockEditorStore","useInput","__unstableIsFullySelected","getSelectedBlockClientIds","getSelectedBlockClientId","__unstableIsSelectionMergeable","hasMultiSelection","getBlockName","canInsertBlockType","getBlockRootClientId","getSelectionStart","getSelectionEnd","getBlockAttributes","replaceBlocks","__unstableSplitSelection","removeBlocks","__unstableDeleteSelection","__unstableExpandSelection","__unstableMarkAutomaticChange","node","onBeforeInput","event","contentEditable","preventDefault","onKeyDown","defaultPrevented","keyCode","shiftKey","clientId","blockName","selectionStart","selectionEnd","attributeKey","selectedAttributeValue","transforms","filter","type","transformation","item","regExp","test","transform","content","__deprecatedOnSplit","key","length","metaKey","ctrlKey","ownerDocument","defaultView","getSelection","removeAllRanges","onCompositionStart","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\thasBlockSupport,\n\tgetBlockTransforms,\n\tfindTransform,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Handles input for selections across blocks.\n */\nexport default function useInput() {\n\tconst {\n\t\t__unstableIsFullySelected,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSelectedBlockClientId,\n\t\t__unstableIsSelectionMergeable,\n\t\thasMultiSelection,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\tgetBlockAttributes,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\treplaceBlocks,\n\t\t__unstableSplitSelection,\n\t\tremoveBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onBeforeInput( event ) {\n\t\t\t// If writing flow is editable, NEVER allow the browser to alter the\n\t\t\t// DOM. This will cause React errors (and the DOM should only be\n\t\t\t// altered in a controlled fashion).\n\t\t\tif ( node.contentEditable === 'true' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\t\tif ( event.shiftKey || __unstableIsFullySelected() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\tconst selectionStart = getSelectionStart();\n\t\t\t\t\tconst selectionEnd = getSelectionEnd();\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectionStart.attributeKey ===\n\t\t\t\t\t\tselectionEnd.attributeKey\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst selectedAttributeValue =\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )[\n\t\t\t\t\t\t\t\tselectionStart.attributeKey\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\ttransforms,\n\t\t\t\t\t\t\t( item ) => {\n\t\t\t\t\t\t\t\treturn item.regExp.test(\n\t\t\t\t\t\t\t\t\tselectedAttributeValue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\ttransformation.transform( {\n\t\t\t\t\t\t\t\t\tcontent: selectedAttributeValue,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! hasBlockSupport( blockName, 'splitting', false ) &&\n\t\t\t\t\t\t! event.__deprecatedOnSplit\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ensure template is not locked.\n\t\t\t\t\tif (\n\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tgetSelectedBlockClientIds(),\n\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\t\tevent.keyCode === DELETE\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\tremoveBlocks( getSelectedBlockClientIds() );\n\t\t\t\t} else if ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t// If key.length is longer than 1, it's a control key that doesn't\n\t\t\t\t// input anything.\n\t\t\t\tevent.key.length === 1 &&\n\t\t\t\t! ( event.metaKey || event.ctrlKey )\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\t\tnode.ownerDocument.defaultView\n\t\t\t\t\t\t.getSelection()\n\t\t\t\t\t\t.removeAllRanges();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction onCompositionStart( event ) {\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tnode.contentEditable = false;\n\n\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t__unstableDeleteSelection();\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\tnode.ownerDocument.defaultView.getSelection().removeAllRanges();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'beforeinput', onBeforeInput );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'compositionstart', onCompositionStart );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'beforeinput', onBeforeInput );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'compositionstart', onCompositionStart );\n\t\t};\n\t}, [] );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAQ,qBAAqB;AAC9D,SACCC,WAAW,EACXC,mBAAmB,EACnBC,eAAe,EACfC,kBAAkB,EAClBC,aAAa,QACP,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;;AAEvD;AACA;AACA;AACA,eAAe,SAASC,QAAQA,CAAA,EAAG;EAClC,MAAM;IACLC,yBAAyB;IACzBC,yBAAyB;IACzBC,wBAAwB;IACxBC,8BAA8B;IAC9BC,iBAAiB;IACjBC,YAAY;IACZC,kBAAkB;IAClBC,oBAAoB;IACpBC,iBAAiB;IACjBC,eAAe;IACfC;EACD,CAAC,GAAGxB,SAAS,CAAEY,gBAAiB,CAAC;EACjC,MAAM;IACLa,aAAa;IACbC,wBAAwB;IACxBC,YAAY;IACZC,yBAAyB;IACzBC,yBAAyB;IACzBC;EACD,CAAC,GAAG7B,WAAW,CAAEW,gBAAiB,CAAC;EAEnC,OAAOV,YAAY,CAAI6B,IAAI,IAAM;IAChC,SAASC,aAAaA,CAAEC,KAAK,EAAG;MAC/B;MACA;MACA;MACA,IAAKF,IAAI,CAACG,eA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C,MAAO,CAAC;QACtD,CAAC,MAAM;UACN4B,KAAK,CAACE,cAAc,CAAC,CAAC;UACtB;UACA;UACA;UACAJ,IAAI,CAAC6B,aAAa,CAACC,WAAW,CAC5BC,YAAY,CAAC,CAAC,CACdC,eAAe,CAAC,CAAC;QACpB;MACD;IACD;IAEA,SAASC,kBAAkBA,CAAE/B,KAAK,EAAG;MACpC,IAAK,CAAEf,iBAAiB,CAAC,CAAC,EAAG;QAC5B;MACD;MAEAa,IAAI,CAACG,eAAe,GAAG,KAAK;MAE5B,IAAKjB,8BAA8B,CAAC,CAAC,EAAG;QACvCW,yBAAyB,CAAC,CAAC;MAC5B,CAAC,MAAM;QACNK,KAAK,CAACE,cAAc,CAAC,CAAC;QACtB;QACA;QACA;QACAJ,IAAI,CAAC6B,aAAa,CAACC,WAAW,CAACC,YAAY,CAAC,CAAC,CAACC,eAAe,CAAC,CAAC;MAChE;IACD;IAEAhC,IAAI,CAACkC,gBAAgB,CAAE,aAAa,EAAEjC,aAAc,CAAC;IACrDD,IAAI,CAACkC,gBAAgB,CAAE,SAAS,EAAE7B,SAAU,CAAC;IAC7CL,IAAI,CAACkC,gBAAgB,CAAE,kBAAkB,EAAED,kBAAmB,CAAC;IAC/D,OAAO,MAAM;MACZjC,IAAI,CAACmC,mBAAmB,CAAE,aAAa,EAAElC,aAAc,CAAC;MACxDD,IAAI,CAACmC,mBAAmB,CAAE,SAAS,EAAE9B,SAAU,CAAC;MAChDL,IAAI,CAACmC,mBAAmB,CAAE,kBAAkB,EAAEF,kBAAmB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","useRefEffect","ENTER","BACKSPACE","DELETE","createBlock","getDefaultBlockName","hasBlockSupport","getBlockTransforms","findTransform","store","blockEditorStore","useInput","__unstableIsFullySelected","getSelectedBlockClientIds","getSelectedBlockClientId","__unstableIsSelectionMergeable","hasMultiSelection","getBlockName","canInsertBlockType","getBlockRootClientId","getSelectionStart","getSelectionEnd","getBlockAttributes","replaceBlocks","__unstableSplitSelection","removeBlocks","__unstableDeleteSelection","__unstableExpandSelection","__unstableMarkAutomaticChange","node","onBeforeInput","event","contentEditable","preventDefault","onKeyDown","defaultPrevented","keyCode","shiftKey","clientId","blockName","selectionStart","selectionEnd","attributeKey","selectedAttributeValue","transforms","filter","type","transformation","item","regExp","test","transform","content","__deprecatedOnSplit","key","length","metaKey","ctrlKey","ownerDocument","defaultView","getSelection","removeAllRanges","onCompositionStart","addEventListener","removeEventListener"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect } from '@wordpress/compose';\nimport { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';\nimport {\n\tcreateBlock,\n\tgetDefaultBlockName,\n\thasBlockSupport,\n\tgetBlockTransforms,\n\tfindTransform,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Handles input for selections across blocks.\n */\nexport default function useInput() {\n\tconst {\n\t\t__unstableIsFullySelected,\n\t\tgetSelectedBlockClientIds,\n\t\tgetSelectedBlockClientId,\n\t\t__unstableIsSelectionMergeable,\n\t\thasMultiSelection,\n\t\tgetBlockName,\n\t\tcanInsertBlockType,\n\t\tgetBlockRootClientId,\n\t\tgetSelectionStart,\n\t\tgetSelectionEnd,\n\t\tgetBlockAttributes,\n\t} = useSelect( blockEditorStore );\n\tconst {\n\t\treplaceBlocks,\n\t\t__unstableSplitSelection,\n\t\tremoveBlocks,\n\t\t__unstableDeleteSelection,\n\t\t__unstableExpandSelection,\n\t\t__unstableMarkAutomaticChange,\n\t} = useDispatch( blockEditorStore );\n\n\treturn useRefEffect( ( node ) => {\n\t\tfunction onBeforeInput( event ) {\n\t\t\t// If writing flow is editable, NEVER allow the browser to alter the\n\t\t\t// DOM. This will cause React errors (and the DOM should only be\n\t\t\t// altered in a controlled fashion).\n\t\t\tif ( node.contentEditable === 'true' ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\t\tif ( event.shiftKey || __unstableIsFullySelected() ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst clientId = getSelectedBlockClientId();\n\t\t\t\t\tconst blockName = getBlockName( clientId );\n\t\t\t\t\tconst selectionStart = getSelectionStart();\n\t\t\t\t\tconst selectionEnd = getSelectionEnd();\n\n\t\t\t\t\tif (\n\t\t\t\t\t\tselectionStart.attributeKey ===\n\t\t\t\t\t\tselectionEnd.attributeKey\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst selectedAttributeValue =\n\t\t\t\t\t\t\tgetBlockAttributes( clientId )[\n\t\t\t\t\t\t\t\tselectionStart.attributeKey\n\t\t\t\t\t\t\t];\n\t\t\t\t\t\tconst transforms = getBlockTransforms( 'from' ).filter(\n\t\t\t\t\t\t\t( { type } ) => type === 'enter'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\t\t\ttransforms,\n\t\t\t\t\t\t\t( item ) => {\n\t\t\t\t\t\t\t\treturn item.regExp.test(\n\t\t\t\t\t\t\t\t\tselectedAttributeValue\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( transformation ) {\n\t\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\ttransformation.transform( {\n\t\t\t\t\t\t\t\t\tcontent: selectedAttributeValue,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t__unstableMarkAutomaticChange();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (\n\t\t\t\t\t\t! hasBlockSupport( blockName, 'splitting', false ) &&\n\t\t\t\t\t\t! event.__deprecatedOnSplit\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Ensure template is not locked.\n\t\t\t\t\tif (\n\t\t\t\t\t\tcanInsertBlockType(\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tgetBlockRootClientId( clientId )\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.keyCode === ENTER ) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\tgetSelectedBlockClientIds(),\n\t\t\t\t\t\tcreateBlock( getDefaultBlockName() )\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\t__unstableSplitSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\tevent.keyCode === BACKSPACE ||\n\t\t\t\tevent.keyCode === DELETE\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tevent.preventDefault();\n\t\t\t\tif ( __unstableIsFullySelected() ) {\n\t\t\t\t\tremoveBlocks( getSelectedBlockClientIds() );\n\t\t\t\t} else if ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\t__unstableExpandSelection();\n\t\t\t\t}\n\t\t\t} else if (\n\t\t\t\t// If key.length is longer than 1, it's a control key that doesn't\n\t\t\t\t// input anything.\n\t\t\t\tevent.key.length === 1 &&\n\t\t\t\t! ( event.metaKey || event.ctrlKey )\n\t\t\t) {\n\t\t\t\tnode.contentEditable = false;\n\t\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t\t__unstableDeleteSelection( event.keyCode === DELETE );\n\t\t\t\t} else {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\t\tnode.ownerDocument.defaultView\n\t\t\t\t\t\t.getSelection()\n\t\t\t\t\t\t.removeAllRanges();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfunction onCompositionStart( event ) {\n\t\t\tif ( ! hasMultiSelection() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tnode.contentEditable = false;\n\n\t\t\tif ( __unstableIsSelectionMergeable() ) {\n\t\t\t\t__unstableDeleteSelection();\n\t\t\t} else {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// Safari does not stop default behaviour with either\n\t\t\t\t// event.preventDefault() or node.contentEditable = false, so\n\t\t\t\t// remove the selection to stop browser manipulation.\n\t\t\t\tnode.ownerDocument.defaultView.getSelection().removeAllRanges();\n\t\t\t}\n\t\t}\n\n\t\tnode.addEventListener( 'beforeinput', onBeforeInput );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'compositionstart', onCompositionStart );\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'beforeinput', onBeforeInput );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'compositionstart', onCompositionStart );\n\t\t};\n\t}, [] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,KAAK,EAAEC,SAAS,EAAEC,MAAM,QAAQ,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,CAAC,CAAC;MAChE;IACD;IAEAhC,IAAI,CAACkC,gBAAgB,CAAE,aAAa,EAAEjC,aAAc,CAAC;IACrDD,IAAI,CAACkC,gBAAgB,CAAE,SAAS,EAAE7B,SAAU,CAAC;IAC7CL,IAAI,CAACkC,gBAAgB,CAAE,kBAAkB,EAAED,kBAAmB,CAAC;IAC/D,OAAO,MAAM;MACZjC,IAAI,CAACmC,mBAAmB,CAAE,aAAa,EAAElC,aAAc,CAAC;MACxDD,IAAI,CAACmC,mBAAmB,CAAE,SAAS,EAAE9B,SAAU,CAAC;MAChDL,IAAI,CAACmC,mBAAmB,CAAE,kBAAkB,EAAEF,kBAAmB,CAAC;IACnE,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;AACR","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* wp:polyfill */
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -103,6 +102,9 @@ export default function useTabNav() {
|
|
|
103
102
|
if (event.keyCode !== TAB) {
|
|
104
103
|
return;
|
|
105
104
|
}
|
|
105
|
+
if (!hasMultiSelection() && !getSelectedBlockClientId()) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
106
108
|
const isShift = event.shiftKey;
|
|
107
109
|
const direction = isShift ? 'findPrevious' : 'findNext';
|
|
108
110
|
const nextTabbable = focus.tabbable[direction](event.target);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["focus","isFormElement","TAB","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","setLastFocus","noCaptureRef","onFocusCapture","event","canvasElement","current","ownerDocument","target","defaultView","frameElement","querySelector","sectionRootClientId","sectionBlocks","length","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\tconst canvasElement =\n\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t? container.current\n\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse if ( sectionRootClientId ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t} else {\n\t\t\t\t// If we don't have any section root, focus the canvas.\n\t\t\t\tcanvasElement.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAGT,MAAM,CAAC,CAAC;EAC1B,MAAMU,qBAAqB,GAAGV,MAAM,CAAC,CAAC;EACtC,MAAMW,oBAAoB,G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CAACoB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAGnE,YAAY,CAAE,CAAEU,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAED,MAAM,EAAE0B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["focus","isFormElement","TAB","useSelect","useDispatch","useRefEffect","useMergeRefs","useRef","store","blockEditorStore","isInSameBlock","isInsideRootBlock","unlock","jsx","_jsx","useTabNav","container","focusCaptureBeforeRef","focusCaptureAfterRef","hasMultiSelection","getSelectedBlockClientId","getBlockCount","getBlockOrder","getLastFocus","getSectionRootClientId","isZoomOut","setLastFocus","noCaptureRef","onFocusCapture","event","canvasElement","current","ownerDocument","target","defaultView","frameElement","querySelector","sectionRootClientId","sectionBlocks","length","isBefore","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","tabbables","tabbable","find","next","before","ref","tabIndex","onFocus","after","node","onKeyDown","defaultPrevented","keyCode","isShift","shiftKey","direction","nextTabbable","currentBlock","closest","isElementPartOfSelectedBlock","preventScroll","onFocusOut","relatedTarget","activeElement","body","preventScrollOnTab","getAttribute","preventDefault","addEventListener","removeEventListener","mergedRefs"],"sources":["@wordpress/block-editor/src/components/writing-flow/use-tab-nav.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { focus, isFormElement } from '@wordpress/dom';\nimport { TAB } from '@wordpress/keycodes';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRefEffect, useMergeRefs } from '@wordpress/compose';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\nimport { isInSameBlock, isInsideRootBlock } from '../../utils/dom';\nimport { unlock } from '../../lock-unlock';\n\nexport default function useTabNav() {\n\tconst container = useRef();\n\tconst focusCaptureBeforeRef = useRef();\n\tconst focusCaptureAfterRef = useRef();\n\n\tconst {\n\t\thasMultiSelection,\n\t\tgetSelectedBlockClientId,\n\t\tgetBlockCount,\n\t\tgetBlockOrder,\n\t\tgetLastFocus,\n\t\tgetSectionRootClientId,\n\t\tisZoomOut,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { setLastFocus } = unlock( useDispatch( blockEditorStore ) );\n\n\t// Reference that holds the a flag for enabling or disabling\n\t// capturing on the focus capture elements.\n\tconst noCaptureRef = useRef();\n\n\tfunction onFocusCapture( event ) {\n\t\tconst canvasElement =\n\t\t\tcontainer.current.ownerDocument === event.target.ownerDocument\n\t\t\t\t? container.current\n\t\t\t\t: container.current.ownerDocument.defaultView.frameElement;\n\n\t\t// Do not capture incoming focus if set by us in WritingFlow.\n\t\tif ( noCaptureRef.current ) {\n\t\t\tnoCaptureRef.current = null;\n\t\t} else if ( hasMultiSelection() ) {\n\t\t\tcontainer.current.focus();\n\t\t} else if ( getSelectedBlockClientId() ) {\n\t\t\tif ( getLastFocus()?.current ) {\n\t\t\t\tgetLastFocus().current.focus();\n\t\t\t} else {\n\t\t\t\t// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector(\n\t\t\t\t\t\t`[data-block=\"${ getSelectedBlockClientId() }\"]`\n\t\t\t\t\t)\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t}\n\t\t// In \"compose\" mode without a selected ID, we want to place focus on the section root when tabbing to the canvas.\n\t\telse if ( isZoomOut() ) {\n\t\t\tconst sectionRootClientId = getSectionRootClientId();\n\t\t\tconst sectionBlocks = getBlockOrder( sectionRootClientId );\n\n\t\t\t// If we have section within the section root, focus the first one.\n\t\t\tif ( sectionBlocks.length ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionBlocks[ 0 ] }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t}\n\t\t\t// If we don't have any section blocks, focus the section root.\n\t\t\telse if ( sectionRootClientId ) {\n\t\t\t\tcontainer.current\n\t\t\t\t\t.querySelector( `[data-block=\"${ sectionRootClientId }\"]` )\n\t\t\t\t\t.focus();\n\t\t\t} else {\n\t\t\t\t// If we don't have any section root, focus the canvas.\n\t\t\t\tcanvasElement.focus();\n\t\t\t}\n\t\t} else {\n\t\t\tconst isBefore =\n\t\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\t\tevent.target.compareDocumentPosition( canvasElement ) &\n\t\t\t\tevent.target.DOCUMENT_POSITION_FOLLOWING;\n\t\t\tconst tabbables = focus.tabbable.find( container.current );\n\n\t\t\tif ( tabbables.length ) {\n\t\t\t\tconst next = isBefore\n\t\t\t\t\t? tabbables[ 0 ]\n\t\t\t\t\t: tabbables[ tabbables.length - 1 ];\n\t\t\t\tnext.focus();\n\t\t\t}\n\t\t}\n\t}\n\n\tconst before = (\n\t\t<div\n\t\t\tref={ focusCaptureBeforeRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst after = (\n\t\t<div\n\t\t\tref={ focusCaptureAfterRef }\n\t\t\ttabIndex=\"0\"\n\t\t\tonFocus={ onFocusCapture }\n\t\t/>\n\t);\n\n\tconst ref = useRefEffect( ( node ) => {\n\t\tfunction onKeyDown( event ) {\n\t\t\tif ( event.defaultPrevented ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// In Edit mode, Tab should focus the first tabbable element after\n\t\t\t// the content, which is normally the sidebar (with block controls)\n\t\t\t// and Shift+Tab should focus the first tabbable element before the\n\t\t\t// content, which is normally the block toolbar.\n\t\t\t// Arrow keys can be used, and Tab and arrow keys can be used in\n\t\t\t// Navigation mode (press Esc), to navigate through blocks.\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst nextTabbable = focus.tabbable[ direction ]( event.target );\n\n\t\t\t// We want to constrain the tabbing to the block and its child blocks.\n\t\t\t// If the preceding form element is within a different block,\n\t\t\t// such as two sibling image blocks in the placeholder state,\n\t\t\t// we want shift + tab from the first form element to move to the image\n\t\t\t// block toolbar and not the previous image block's form element.\n\t\t\tconst currentBlock = event.target.closest( '[data-block]' );\n\t\t\tconst isElementPartOfSelectedBlock =\n\t\t\t\tcurrentBlock &&\n\t\t\t\tnextTabbable &&\n\t\t\t\t( isInSameBlock( currentBlock, nextTabbable ) ||\n\t\t\t\t\tisInsideRootBlock( currentBlock, nextTabbable ) );\n\n\t\t\t// Allow tabbing from the block wrapper to a form element,\n\t\t\t// and between form elements rendered in a block and its child blocks,\n\t\t\t// such as inside a placeholder. Form elements are generally\n\t\t\t// meant to be UI rather than part of the content. Ideally\n\t\t\t// these are not rendered in the content and perhaps in the\n\t\t\t// future they can be rendered in an iframe or shadow DOM.\n\t\t\tif (\n\t\t\t\tisFormElement( nextTabbable ) &&\n\t\t\t\tisElementPartOfSelectedBlock\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;\n\n\t\t\t// Disable focus capturing on the focus capture element, so it\n\t\t\t// doesn't refocus this block and so it allows default behaviour\n\t\t\t// (moving focus to the next tabbable element).\n\t\t\tnoCaptureRef.current = true;\n\n\t\t\t// Focusing the focus capture element, which is located above and\n\t\t\t// below the editor, should not scroll the page all the way up or\n\t\t\t// down.\n\t\t\tnext.current.focus( { preventScroll: true } );\n\t\t}\n\n\t\tfunction onFocusOut( event ) {\n\t\t\tsetLastFocus( { ...getLastFocus(), current: event.target } );\n\n\t\t\tconst { ownerDocument } = node;\n\n\t\t\t// If focus disappears due to there being no blocks, move focus to\n\t\t\t// the writing flow wrapper.\n\t\t\tif (\n\t\t\t\t! event.relatedTarget &&\n\t\t\t\townerDocument.activeElement === ownerDocument.body &&\n\t\t\t\tgetBlockCount() === 0\n\t\t\t) {\n\t\t\t\tnode.focus();\n\t\t\t}\n\t\t}\n\n\t\t// When tabbing back to an element in block list, this event handler prevents scrolling if the\n\t\t// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph\n\t\t// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the\n\t\t// top or bottom of the document.\n\t\t//\n\t\t// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this\n\t\t// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.\n\t\t// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters\n\t\tfunction preventScrollOnTab( event ) {\n\t\t\tif ( event.keyCode !== TAB ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( event.target?.getAttribute( 'role' ) === 'region' ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( container.current === event.target ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst isShift = event.shiftKey;\n\t\t\tconst direction = isShift ? 'findPrevious' : 'findNext';\n\t\t\tconst target = focus.tabbable[ direction ]( event.target );\n\t\t\t// Only do something when the next tabbable is a focus capture div (before/after)\n\t\t\tif (\n\t\t\t\ttarget === focusCaptureBeforeRef.current ||\n\t\t\t\ttarget === focusCaptureAfterRef.current\n\t\t\t) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\ttarget.focus( { preventScroll: true } );\n\t\t\t}\n\t\t}\n\n\t\tconst { ownerDocument } = node;\n\t\tconst { defaultView } = ownerDocument;\n\t\tdefaultView.addEventListener( 'keydown', preventScrollOnTab );\n\t\tnode.addEventListener( 'keydown', onKeyDown );\n\t\tnode.addEventListener( 'focusout', onFocusOut );\n\t\treturn () => {\n\t\t\tdefaultView.removeEventListener( 'keydown', preventScrollOnTab );\n\t\t\tnode.removeEventListener( 'keydown', onKeyDown );\n\t\t\tnode.removeEventListener( 'focusout', onFocusOut );\n\t\t};\n\t}, [] );\n\n\tconst mergedRefs = useMergeRefs( [ container, ref ] );\n\n\treturn [ before, mergedRefs, after ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,aAAa,QAAQ,gBAAgB;AACrD,SAASC,GAAG,QAAQ,qBAAqB;AACzC,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,YAAY,EAAEC,YAAY,QAAQ,oBAAoB;AAC/D,SAASC,MAAM,QAAQ,oBAAoB;;AAE3C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,aAAa;AACvD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,iBAAiB;AAClE,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,eAAe,SAASC,SAASA,CAAA,EAAG;EACnC,MAAMC,SAAS,GAAGT,MAAM,CAAC,CAAC;EAC1B,MAAMU,qBAAqB,GAAGV,MAAM,CAAC,CAAC;EACtC,MAAMW,oBAAoB,GAAGX,MAAM,CAAC,CAAC;EAErC,MAAM;IACLY,iBAAiB;IACjBC,wBAAwB;IACxBC,aAAa;IACbC,aAAa;IACbC,YAAY;IACZC,sBAAsB;IACtBC;EACD,CAAC,GAAGb,MAAM,CAAET,SAAS,CAAEM,gBAAiB,CAAE,CAAC;EAC3C,MAAM;IAAEiB;EAAa,CAAC,GAAGd,MAAM,CAAER,WAAW,CAAEK,gBAAiB,CAAE,CAAC;;EAElE;EACA;EACA,MAAMkB,YAAY,GAAGpB,MAAM,CAAC,CAAC;EAE7B,SAASqB,cAAcA,CAAEC,KAAK,EAAG;IAChC,MAAMC,aAAa,GAClBd,SAAS,CAACe,OAAO,CAACC,aAAa,KAAKH,KAAK,CAACI,MAAM,CAACD,aAAa,GAC3DhB,SAAS,CAACe,OAAO,GACjBf,SAAS,CAACe,OAAO,CAACC,aAAa,CAACE,WAAW,CAACC,YAAY;;IAE5D;IACA,IAAK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B,MAAM,GAAGjC,KAAK,CAAC4C,QAAQ,CAAEc,SAAS,CAAE,CAAE7B,KAAK,CAACI,MAAO,CAAC;MAC1D;MACA,IACCA,MAAM,KAAKhB,qBAAqB,CAACc,OAAO,IACxCE,MAAM,KAAKf,oBAAoB,CAACa,OAAO,EACtC;QACDF,KAAK,CAACyC,cAAc,CAAC,CAAC;QACtBrC,MAAM,CAACjC,KAAK,CAAE;UAAE+D,aAAa,EAAE;QAAK,CAAE,CAAC;MACxC;IACD;IAEA,MAAM;MAAE/B;IAAc,CAAC,GAAGoB,IAAI;IAC9B,MAAM;MAAElB;IAAY,CAAC,GAAGF,aAAa;IACrCE,WAAW,CAACqC,gBAAgB,CAAE,SAAS,EAAEH,kBAAmB,CAAC;IAC7DhB,IAAI,CAACmB,gBAAgB,CAAE,SAAS,EAAElB,SAAU,CAAC;IAC7CD,IAAI,CAACmB,gBAAgB,CAAE,UAAU,EAAEP,UAAW,CAAC;IAC/C,OAAO,MAAM;MACZ9B,WAAW,CAACsC,mBAAmB,CAAE,SAAS,EAAEJ,kBAAmB,CAAC;MAChEhB,IAAI,CAACoB,mBAAmB,CAAE,SAAS,EAAEnB,SAAU,CAAC;MAChDD,IAAI,CAACoB,mBAAmB,CAAE,UAAU,EAAER,UAAW,CAAC;IACnD,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMS,UAAU,GAAGnE,YAAY,CAAE,CAAEU,SAAS,EAAEgC,GAAG,CAAG,CAAC;EAErD,OAAO,CAAED,MAAM,EAAE0B,UAAU,EAAEtB,KAAK,CAAE;AACrC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__unstableStripHTML","stripHTML","serialize","createBlock","pasteHandler","findTransform","getBlockTransforms","store","blocksStore","getPasteEventData","blockEditorStore","requiresWrapperOnCopy","Symbol","setClipboardBlocks","event","blocks","registry","_blocks","firstBlock","firstBlockType","select","getBlockType","name","getBlockRootClientId","getBlockName","getBlockAttributes","wrapperBlockClientId","clientId","wrapperBlockName","serialized","clipboardData","setData","toPlainText","getPasteBlocks","canUserUseUnfilteredHTML","plainText","html","files","length","fromTransforms","reduce","accumulator","file","transformation","transform","type","isMatch","push","flat","HTML","mode","replace","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tserialize,\n\tcreateBlock,\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\nimport { store as blockEditorStore } from '../../store';\n\nexport const requiresWrapperOnCopy = Symbol( 'requiresWrapperOnCopy' );\n\n/**\n * Sets the clipboard data for the provided blocks, with both HTML and plain\n * text representations.\n *\n * @param {ClipboardEvent} event Clipboard event.\n * @param {WPBlock[]} blocks Blocks to set as clipboard data.\n * @param {Object} registry The registry to select from.\n */\nexport function setClipboardBlocks( event, blocks, registry ) {\n\tlet _blocks = blocks;\n\n\tconst [ firstBlock ] = blocks;\n\n\tif ( firstBlock ) {\n\t\tconst firstBlockType = registry\n\t\t\t.select( blocksStore )\n\t\t\t.getBlockType( firstBlock.name );\n\n\t\tif ( firstBlockType[ requiresWrapperOnCopy ] ) {\n\t\t\tconst { getBlockRootClientId, getBlockName, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst wrapperBlockClientId = getBlockRootClientId(\n\t\t\t\tfirstBlock.clientId\n\t\t\t);\n\t\t\tconst wrapperBlockName = getBlockName( wrapperBlockClientId );\n\n\t\t\tif ( wrapperBlockName ) {\n\t\t\t\t_blocks = createBlock(\n\t\t\t\t\twrapperBlockName,\n\t\t\t\t\tgetBlockAttributes( wrapperBlockClientId ),\n\t\t\t\t\t_blocks\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serialized = serialize( _blocks );\n\n\tevent.clipboardData.setData( 'text/plain', toPlainText( serialized ) );\n\tevent.clipboardData.setData( 'text/html', serialized );\n}\n\n/**\n * Returns the blocks to be pasted from the clipboard event.\n *\n * @param {ClipboardEvent} event The clipboard event.\n * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.\n * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.\n */\nexport function getPasteBlocks( event, canUserUseUnfilteredHTML ) {\n\tconst { plainText, html, files } = getPasteEventData( event );\n\tlet blocks = [];\n\n\tif ( files.length ) {\n\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\tblocks = files\n\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\tfromTransforms,\n\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t);\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\taccumulator.push( transformation.transform( [ file ] ) );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] )\n\t\t\t.flat();\n\t} else {\n\t\tblocks = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t\tmode: 'BLOCKS',\n\t\t\tcanUserUseUnfilteredHTML,\n\t\t} );\n\t}\n\n\treturn blocks;\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\n\t// Merge any consecutive line breaks\n\treturn plainText.replace( /\\n\\n+/g, '\\n\\n' );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["__unstableStripHTML","stripHTML","serialize","createBlock","pasteHandler","findTransform","getBlockTransforms","store","blocksStore","getPasteEventData","blockEditorStore","requiresWrapperOnCopy","Symbol","setClipboardBlocks","event","blocks","registry","_blocks","firstBlock","firstBlockType","select","getBlockType","name","getBlockRootClientId","getBlockName","getBlockAttributes","wrapperBlockClientId","clientId","wrapperBlockName","serialized","clipboardData","setData","toPlainText","getPasteBlocks","canUserUseUnfilteredHTML","plainText","html","files","length","fromTransforms","reduce","accumulator","file","transformation","transform","type","isMatch","push","flat","HTML","mode","replace","trim"],"sources":["@wordpress/block-editor/src/components/writing-flow/utils.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport {\n\tserialize,\n\tcreateBlock,\n\tpasteHandler,\n\tfindTransform,\n\tgetBlockTransforms,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { getPasteEventData } from '../../utils/pasting';\nimport { store as blockEditorStore } from '../../store';\n\nexport const requiresWrapperOnCopy = Symbol( 'requiresWrapperOnCopy' );\n\n/**\n * Sets the clipboard data for the provided blocks, with both HTML and plain\n * text representations.\n *\n * @param {ClipboardEvent} event Clipboard event.\n * @param {WPBlock[]} blocks Blocks to set as clipboard data.\n * @param {Object} registry The registry to select from.\n */\nexport function setClipboardBlocks( event, blocks, registry ) {\n\tlet _blocks = blocks;\n\n\tconst [ firstBlock ] = blocks;\n\n\tif ( firstBlock ) {\n\t\tconst firstBlockType = registry\n\t\t\t.select( blocksStore )\n\t\t\t.getBlockType( firstBlock.name );\n\n\t\tif ( firstBlockType[ requiresWrapperOnCopy ] ) {\n\t\t\tconst { getBlockRootClientId, getBlockName, getBlockAttributes } =\n\t\t\t\tregistry.select( blockEditorStore );\n\t\t\tconst wrapperBlockClientId = getBlockRootClientId(\n\t\t\t\tfirstBlock.clientId\n\t\t\t);\n\t\t\tconst wrapperBlockName = getBlockName( wrapperBlockClientId );\n\n\t\t\tif ( wrapperBlockName ) {\n\t\t\t\t_blocks = createBlock(\n\t\t\t\t\twrapperBlockName,\n\t\t\t\t\tgetBlockAttributes( wrapperBlockClientId ),\n\t\t\t\t\t_blocks\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst serialized = serialize( _blocks );\n\n\tevent.clipboardData.setData( 'text/plain', toPlainText( serialized ) );\n\tevent.clipboardData.setData( 'text/html', serialized );\n}\n\n/**\n * Returns the blocks to be pasted from the clipboard event.\n *\n * @param {ClipboardEvent} event The clipboard event.\n * @param {boolean} canUserUseUnfilteredHTML Whether the user can or can't post unfiltered HTML.\n * @return {Array|string} A list of blocks or a string, depending on `handlerMode`.\n */\nexport function getPasteBlocks( event, canUserUseUnfilteredHTML ) {\n\tconst { plainText, html, files } = getPasteEventData( event );\n\tlet blocks = [];\n\n\tif ( files.length ) {\n\t\tconst fromTransforms = getBlockTransforms( 'from' );\n\t\tblocks = files\n\t\t\t.reduce( ( accumulator, file ) => {\n\t\t\t\tconst transformation = findTransform(\n\t\t\t\t\tfromTransforms,\n\t\t\t\t\t( transform ) =>\n\t\t\t\t\t\ttransform.type === 'files' &&\n\t\t\t\t\t\ttransform.isMatch( [ file ] )\n\t\t\t\t);\n\t\t\t\tif ( transformation ) {\n\t\t\t\t\taccumulator.push( transformation.transform( [ file ] ) );\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, [] )\n\t\t\t.flat();\n\t} else {\n\t\tblocks = pasteHandler( {\n\t\t\tHTML: html,\n\t\t\tplainText,\n\t\t\tmode: 'BLOCKS',\n\t\t\tcanUserUseUnfilteredHTML,\n\t\t} );\n\t}\n\n\treturn blocks;\n}\n\n/**\n * Given a string of HTML representing serialized blocks, returns the plain\n * text extracted after stripping the HTML of any tags and fixing line breaks.\n *\n * @param {string} html Serialized blocks.\n * @return {string} The plain-text content with any html removed.\n */\nfunction toPlainText( html ) {\n\t// Manually handle BR tags as line breaks prior to `stripHTML` call\n\thtml = html.replace( /<br>/g, '\\n' );\n\n\tconst plainText = stripHTML( html ).trim();\n\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,MAAMhB,SAAS,GAAGlC,SAAS,CAAEmC,IAAK,CAAC,CAACgB,IAAI,CAAC,CAAC;;EAE1C;EACA,OAAOjB,SAAS,CAACgB,OAAO,CAAE,QAAQ,EAAE,MAAO,CAAC;AAC7C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","__","isRTL","textHorizontal","textVertical","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","jsx","_jsx","WRITING_MODES","label","value","icon","WritingModeControl","className","onChange","isDeselectable","__nextHasNoMarginBottom","__next40pxDefaultSize","newValue","undefined","children","map","option"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\n\nconst WRITING_MODES = [\n\t{\n\t\tlabel: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tlabel: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\tisDeselectable\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\tclassName={ clsx( 'block-editor-writing-mode-control', className ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( newValue ) => {\n\t\t\t\tonChange( newValue === value ? undefined : newValue );\n\t\t\t} }\n\t\t>\n\t\t\t{ WRITING_MODES.map( ( option ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["clsx","__","isRTL","textHorizontal","textVertical","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOptionIcon","ToggleGroupControlOptionIcon","jsx","_jsx","WRITING_MODES","label","value","icon","WritingModeControl","className","onChange","isDeselectable","__nextHasNoMarginBottom","__next40pxDefaultSize","newValue","undefined","children","map","option"],"sources":["@wordpress/block-editor/src/components/writing-mode-control/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __, isRTL } from '@wordpress/i18n';\nimport { textHorizontal, textVertical } from '@wordpress/icons';\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n} from '@wordpress/components';\n\nconst WRITING_MODES = [\n\t{\n\t\tlabel: __( 'Horizontal' ),\n\t\tvalue: 'horizontal-tb',\n\t\ticon: textHorizontal,\n\t},\n\t{\n\t\tlabel: __( 'Vertical' ),\n\t\tvalue: isRTL() ? 'vertical-lr' : 'vertical-rl',\n\t\ticon: textVertical,\n\t},\n];\n\n/**\n * Control to facilitate writing mode selections.\n *\n * @param {Object} props Component props.\n * @param {string} props.className Class name to add to the control.\n * @param {string} props.value Currently selected writing mode.\n * @param {Function} props.onChange Handles change in the writing mode selection.\n *\n * @return {Element} Writing Mode control.\n */\nexport default function WritingModeControl( { className, value, onChange } ) {\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\tisDeselectable\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Orientation' ) }\n\t\t\tclassName={ clsx( 'block-editor-writing-mode-control', className ) }\n\t\t\tvalue={ value }\n\t\t\tonChange={ ( newValue ) => {\n\t\t\t\tonChange( newValue === value ? undefined : newValue );\n\t\t\t} }\n\t\t>\n\t\t\t{ WRITING_MODES.map( ( option ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ option.value }\n\t\t\t\t\t\tvalue={ option.value }\n\t\t\t\t\t\ticon={ option.icon }\n\t\t\t\t\t\tlabel={ option.label }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ToggleGroupControl>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,EAAE,EAAEC,KAAK,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,EAAEC,YAAY,QAAQ,kBAAkB;AAC/D,SACCC,gCAAgC,IAAIC,kBAAkB,EACtDC,0CAA0C,IAAIC,4BAA4B,QACpE,uBAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/B,MAAMC,aAAa,GAAG,CACrB;EACCC,KAAK,EAAEX,EAAE,CAAE,YAAa,CAAC;EACzBY,KAAK,EAAE,eAAe;EACtBC,IAAI,EAAEX;AACP,CAAC,EACD;EACCS,KAAK,EAAEX,EAAE,CAAE,UAAW,CAAC;EACvBY,KAAK,EAAEX,KAAK,CAAC,CAAC,GAAG,aAAa,GAAG,aAAa;EAC9CY,IAAI,EAAEV;AACP,CAAC,CACD;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASW,kBAAkBA,CAAE;EAAEC,SAAS;EAAEH,KAAK;EAAEI;AAAS,CAAC,EAAG;EAC5E,oBACCP,IAAA,CAACJ,kBAAkB;IAClBY,cAAc;IACdC,uBAAuB;IACvBC,qBAAqB;IACrBR,KAAK,EAAGX,EAAE,CAAE,aAAc,CAAG;IAC7Be,SAAS,EAAGhB,IAAI,CAAE,mCAAmC,EAAEgB,SAAU,CAAG;IACpEH,KAAK,EAAGA,KAAO;IACfI,QAAQ,EAAKI,QAAQ,IAAM;MAC1BJ,QAAQ,CAAEI,QAAQ,KAAKR,KAAK,GAAGS,SAAS,GAAGD,QAAS,CAAC;IACtD,CAAG;IAAAE,QAAA,EAEDZ,aAAa,CAACa,GAAG,CAAIC,MAAM,IAAM;MAClC,oBACCf,IAAA,CAACF,4BAA4B;QAE5BK,KAAK,EAAGY,MAAM,CAACZ,KAAO;QACtBC,IAAI,EAAGW,MAAM,CAACX,IAAM;QACpBF,KAAK,EAAGa,MAAM,CAACb;MAAO,GAHhBa,MAAM,CAACZ,KAIb,CAAC;IAEJ,CAAE;EAAC,CACgB,CAAC;AAEvB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","addFilter","getBlockSupport","getBlockType","hasBlockSupport","BlockControls","BlockAlignmentControl","useAvailableAlignments","useBlockEditingMode","jsx","_jsx","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","group","__experimentalShareWithChildBlocks","children","onChange","controls","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACCC,eAAe,EAC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AS,EAAE,OAAQ,CAAC;EACxD,MAAM1B,mBAAmB,GAAGX,eAAe,CAAEqC,SAAS,EAAE,WAAW,EAAE,IAAK,CAAC;;EAE3E;EACA;EACA;EACA,MAAMiB,YAAY,GAAG7C,kBAAkB,CACtCC,UAAU,EACVC,mBACD,CAAC,CAACO,QAAQ,CAAEM,KAAM,CAAC;EACnB,IAAK8B,YAAY,EAAG;IACnBD,KAAK,CAACE,SAAS,GAAG3D,IAAI,CAAE,QAAS4B,KAAK,EAAG,EAAE6B,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEAxD,SAAS,CACR,0BAA0B,EAC1B,gCAAgC,EAChCuB,YACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","addFilter","getBlockSupport","getBlockType","hasBlockSupport","BlockControls","BlockAlignmentControl","useAvailableAlignments","useBlockEditingMode","jsx","_jsx","ALL_ALIGNMENTS","WIDE_ALIGNMENTS","getValidAlignments","blockAlign","hasWideBlockSupport","hasWideEnabled","validAlignments","Array","isArray","filter","value","includes","alignment","addAttribute","settings","_settings$attributes$","attributes","align","type","enum","BlockEditAlignmentToolbarControlsPure","name","blockName","setAttributes","blockAllowedAlignments","map","blockEditingMode","length","updateAlignment","nextAlign","blockType","blockDefaultAlign","default","group","__experimentalShareWithChildBlocks","children","onChange","controls","shareWithChildBlocks","edit","useBlockProps","addSaveProps","addAssignedAlign","attributeKeys","hasSupport","some","props","isAlignValid","className"],"sources":["@wordpress/block-editor/src/hooks/align.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport {\n\tgetBlockSupport,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { BlockControls, BlockAlignmentControl } from '../components';\nimport useAvailableAlignments from '../components/block-alignment-control/use-available-alignments';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * An array which includes all possible valid alignments,\n * used to validate if an alignment is valid or not.\n *\n * @constant\n * @type {string[]}\n */\nconst ALL_ALIGNMENTS = [ 'left', 'center', 'right', 'wide', 'full' ];\n\n/**\n * An array which includes all wide alignments.\n * In order for this alignments to be valid they need to be supported by the block,\n * and by the theme.\n *\n * @constant\n * @type {string[]}\n */\nconst WIDE_ALIGNMENTS = [ 'wide', 'full' ];\n\n/**\n * Returns the valid alignments.\n * Takes into consideration the aligns supported by a block, if the block supports wide controls or not and if theme supports wide controls or not.\n * Exported just for testing purposes, not exported outside the module.\n *\n * @param {?boolean|string[]} blockAlign Aligns supported by the block.\n * @param {?boolean} hasWideBlockSupport True if block supports wide alignments. And False otherwise.\n * @param {?boolean} hasWideEnabled True if theme supports wide alignments. And False otherwise.\n *\n * @return {string[]} Valid alignments.\n */\nexport function getValidAlignments(\n\tblockAlign,\n\thasWideBlockSupport = true,\n\thasWideEnabled = true\n) {\n\tlet validAlignments;\n\tif ( Array.isArray( blockAlign ) ) {\n\t\tvalidAlignments = ALL_ALIGNMENTS.filter( ( value ) =>\n\t\t\tblockAlign.includes( value )\n\t\t);\n\t} else if ( blockAlign === true ) {\n\t\t// `true` includes all alignments...\n\t\tvalidAlignments = [ ...ALL_ALIGNMENTS ];\n\t} else {\n\t\tvalidAlignments = [];\n\t}\n\n\tif (\n\t\t! hasWideEnabled ||\n\t\t( blockAlign === true && ! hasWideBlockSupport )\n\t) {\n\t\treturn validAlignments.filter(\n\t\t\t( alignment ) => ! WIDE_ALIGNMENTS.includes( alignment )\n\t\t);\n\t}\n\n\treturn validAlignments;\n}\n\n/**\n * Filters registered block settings, extending attributes to include `align`.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.align ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'align' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\talign: {\n\t\t\t\ttype: 'string',\n\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\tenum: [ ...ALL_ALIGNMENTS, '' ],\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAlignmentToolbarControlsPure( {\n\tname: blockName,\n\talign,\n\tsetAttributes,\n} ) {\n\t// Compute the block valid alignments by taking into account,\n\t// if the theme supports wide alignments or not and the layout's\n\t// available alignments. We do that for conditionally rendering\n\t// Slot.\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( blockName, 'align' ),\n\t\thasBlockSupport( blockName, 'alignWide', true )\n\t);\n\n\tconst validAlignments = useAvailableAlignments(\n\t\tblockAllowedAlignments\n\t).map( ( { name } ) => name );\n\tconst blockEditingMode = useBlockEditingMode();\n\tif ( ! validAlignments.length || blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst updateAlignment = ( nextAlign ) => {\n\t\tif ( ! nextAlign ) {\n\t\t\tconst blockType = getBlockType( blockName );\n\t\t\tconst blockDefaultAlign = blockType?.attributes?.align?.default;\n\t\t\tif ( blockDefaultAlign ) {\n\t\t\t\tnextAlign = '';\n\t\t\t}\n\t\t}\n\t\tsetAttributes( { align: nextAlign } );\n\t};\n\n\treturn (\n\t\t<BlockControls group=\"block\" __experimentalShareWithChildBlocks>\n\t\t\t<BlockAlignmentControl\n\t\t\t\tvalue={ align }\n\t\t\t\tonChange={ updateAlignment }\n\t\t\t\tcontrols={ validAlignments }\n\t\t\t/>\n\t\t</BlockControls>\n\t);\n}\n\nexport default {\n\tshareWithChildBlocks: true,\n\tedit: BlockEditAlignmentToolbarControlsPure,\n\tuseBlockProps,\n\taddSaveProps: addAssignedAlign,\n\tattributeKeys: [ 'align' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'align', false );\n\t},\n};\n\nfunction useBlockProps( { name, align } ) {\n\tconst blockAllowedAlignments = getValidAlignments(\n\t\tgetBlockSupport( name, 'align' ),\n\t\thasBlockSupport( name, 'alignWide', true )\n\t);\n\tconst validAlignments = useAvailableAlignments( blockAllowedAlignments );\n\n\tif ( validAlignments.some( ( alignment ) => alignment.name === align ) ) {\n\t\treturn { 'data-align': align };\n\t}\n\n\treturn {};\n}\n\n/**\n * Override props assigned to save component to inject alignment class name if\n * block supports it.\n *\n * @param {Object} props Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addAssignedAlign( props, blockType, attributes ) {\n\tconst { align } = attributes;\n\tconst blockAlign = getBlockSupport( blockType, 'align' );\n\tconst hasWideBlockSupport = hasBlockSupport( blockType, 'alignWide', true );\n\n\t// Compute valid alignments without taking into account if\n\t// the theme supports wide alignments or not.\n\t// This way changing themes does not impact the block save.\n\tconst isAlignValid = getValidAlignments(\n\t\tblockAlign,\n\t\thasWideBlockSupport\n\t).includes( align );\n\tif ( isAlignValid ) {\n\t\tprops.className = clsx( `align${ align }`, props.className );\n\t}\n\n\treturn props;\n}\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/editor/align/addAttribute',\n\taddAttribute\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SACCC,eAAe,EACfC,YAAY,EACZC,eAAe,QACT,mBAAmB;;AAE1B;AACA;AACA;AACA,SAASC,aAAa,EAAEC,qBAAqB,QAAQ,eAAe;AACpE,OAAOC,sBAAsB,MAAM,gEAAgE;AACnG,SAASC,mBAAmB,QAAQ,kCAAkC;;AAEtE;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,MAAMC,cAAc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AK,CAACE,SAAS,GAAG3D,IAAI,CAAE,QAAS4B,KAAK,EAAG,EAAE6B,KAAK,CAACE,SAAU,CAAC;EAC7D;EAEA,OAAOF,KAAK;AACb;AAEAxD,SAAS,CACR,0BAA0B,EAC1B,gCAAgC,EAChCuB,YACD,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","hasBlockSupport","WIDE_ALIGNMENTS","ALIGNMENTS","default","settings","name","excludeBlocks","includes","blockAlign","supports","align","Array","isArray","filter","alignment","Object","values","alignments","alignWide","attributes","type","enum"],"sources":["@wordpress/block-editor/src/hooks/align.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { WIDE_ALIGNMENTS } from '@wordpress/components';\n\nconst ALIGNMENTS = [ 'left', 'center', 'right' ];\n\nexport * from './align.js';\nexport { default } from './align.js';\n\n// Used to filter out blocks that don't support wide/full alignment on mobile\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/react-native-editor/align',\n\t( settings, name ) => {\n\t\tif (\n\t\t\tWIDE_ALIGNMENTS.excludeBlocks.includes( name ) &&\n\t\t\thasBlockSupport( settings, 'align' )\n\t\t) {\n\t\t\tconst blockAlign = settings.supports.align;\n\n\t\t\tsettings.supports = {\n\t\t\t\t...settings.supports,\n\t\t\t\talign: Array.isArray( blockAlign )\n\t\t\t\t\t? blockAlign.filter(\n\t\t\t\t\t\t\t( alignment ) =>\n\t\t\t\t\t\t\t\t! Object.values(\n\t\t\t\t\t\t\t\t\tWIDE_ALIGNMENTS.alignments\n\t\t\t\t\t\t\t\t).includes( alignment )\n\t\t\t\t\t )\n\t\t\t\t\t: blockAlign,\n\t\t\t\talignWide: false,\n\t\t\t};\n\t\t\tsettings.attributes = {\n\t\t\t\t...settings.attributes,\n\t\t\t\talign: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\t\tenum: [ ...ALIGNMENTS, '' ],\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn settings;\n\t}\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["addFilter","hasBlockSupport","WIDE_ALIGNMENTS","ALIGNMENTS","default","settings","name","excludeBlocks","includes","blockAlign","supports","align","Array","isArray","filter","alignment","Object","values","alignments","alignWide","attributes","type","enum"],"sources":["@wordpress/block-editor/src/hooks/align.native.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { WIDE_ALIGNMENTS } from '@wordpress/components';\n\nconst ALIGNMENTS = [ 'left', 'center', 'right' ];\n\nexport * from './align.js';\nexport { default } from './align.js';\n\n// Used to filter out blocks that don't support wide/full alignment on mobile\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/react-native-editor/align',\n\t( settings, name ) => {\n\t\tif (\n\t\t\tWIDE_ALIGNMENTS.excludeBlocks.includes( name ) &&\n\t\t\thasBlockSupport( settings, 'align' )\n\t\t) {\n\t\t\tconst blockAlign = settings.supports.align;\n\n\t\t\tsettings.supports = {\n\t\t\t\t...settings.supports,\n\t\t\t\talign: Array.isArray( blockAlign )\n\t\t\t\t\t? blockAlign.filter(\n\t\t\t\t\t\t\t( alignment ) =>\n\t\t\t\t\t\t\t\t! Object.values(\n\t\t\t\t\t\t\t\t\tWIDE_ALIGNMENTS.alignments\n\t\t\t\t\t\t\t\t).includes( alignment )\n\t\t\t\t\t )\n\t\t\t\t\t: blockAlign,\n\t\t\t\talignWide: false,\n\t\t\t};\n\t\t\tsettings.attributes = {\n\t\t\t\t...settings.attributes,\n\t\t\t\talign: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\t// Allow for '' since it is used by the `updateAlignment` function\n\t\t\t\t\t// in toolbar controls for special cases with defined default values.\n\t\t\t\t\t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5
5
|
import { hasBlockSupport } from '@wordpress/blocks';
|
|
6
|
-
const ARIA_LABEL_SCHEMA = {
|
|
7
|
-
type: 'string',
|
|
8
|
-
source: 'attribute',
|
|
9
|
-
attribute: 'aria-label',
|
|
10
|
-
selector: '*'
|
|
11
|
-
};
|
|
12
6
|
|
|
13
7
|
/**
|
|
14
8
|
* Filters registered block settings, extending attributes with ariaLabel using aria-label
|
|
@@ -27,7 +21,9 @@ export function addAttribute(settings) {
|
|
|
27
21
|
// Gracefully handle if settings.attributes is undefined.
|
|
28
22
|
settings.attributes = {
|
|
29
23
|
...settings.attributes,
|
|
30
|
-
ariaLabel:
|
|
24
|
+
ariaLabel: {
|
|
25
|
+
type: 'string'
|
|
26
|
+
}
|
|
31
27
|
};
|
|
32
28
|
}
|
|
33
29
|
return settings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["addFilter","hasBlockSupport","
|
|
1
|
+
{"version":3,"names":["addFilter","hasBlockSupport","addAttribute","settings","attributes","ariaLabel","type","addSaveProps","extraProps","blockType","attributeKeys","hasSupport","name"],"sources":["@wordpress/block-editor/src/hooks/aria-label.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Filters registered block settings, extending attributes with ariaLabel using aria-label\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( settings?.attributes?.ariaLabel?.type ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'ariaLabel' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tariaLabel: {\n\t\t\t\ttype: 'string',\n\t\t\t},\n\t\t};\n\t}\n\n\treturn settings;\n}\n\n/**\n * Override props assigned to save component to inject aria-label, if block\n * supports ariaLabel. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'ariaLabel' ) ) {\n\t\textraProps[ 'aria-label' ] =\n\t\t\tattributes.ariaLabel === '' ? null : attributes.ariaLabel;\n\t}\n\n\treturn extraProps;\n}\n\nexport default {\n\taddSaveProps,\n\tattributeKeys: [ 'ariaLabel' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'ariaLabel' );\n\t},\n};\n\naddFilter(\n\t'blocks.registerBlockType',\n\t'core/ariaLabel/attribute',\n\taddAttribute\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,eAAe,QAAQ,mBAAmB;;AAEnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EACxC;EACA,IAAKA,QAAQ,EAAEC,UAAU,EAAEC,SAAS,EAAEC,IAAI,EAAG;IAC5C,OAAOH,QAAQ;EAChB;EACA,IAAKF,eAAe,CAAEE,QAAQ,EAAE,WAAY,CAAC,EAAG;IAC/C;IACAA,QAAQ,CAACC,UAAU,GAAG;MACrB,GAAGD,QAAQ,CAACC,UAAU;MACtBC,SAAS,EAAE;QACVC,IAAI,EAAE;MACP;IACD,CAAC;EACF;EAEA,OAAOH,QAAQ;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,YAAYA,CAAEC,UAAU,EAAEC,SAAS,EAAEL,UAAU,EAAG;EACjE,IAAKH,eAAe,CAAEQ,SAAS,EAAE,WAAY,CAAC,EAAG;IAChDD,UAAU,CAAE,YAAY,CAAE,GACzBJ,UAAU,CAACC,SAAS,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,SAAS;EAC3D;EAEA,OAAOG,UAAU;AAClB;AAEA,eAAe;EACdD,YAAY;EACZG,aAAa,EAAE,CAAE,WAAW,CAAE;EAC9BC,UAAUA,CAAEC,IAAI,EAAG;IAClB,OAAOX,eAAe,CAAEW,IAAI,EAAE,WAAY,CAAC;EAC5C;AACD,CAAC;AAEDZ,SAAS,CACR,0BAA0B,EAC1B,0BAA0B,EAC1BE,YACD,CAAC","ignoreList":[]}
|