@wordpress/block-editor 10.4.0 → 11.0.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 +17 -0
- package/README.md +0 -1
- package/build/autocompleters/block.js +2 -6
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -0
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/block-card/index.js +51 -3
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +46 -39
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -3
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +4 -7
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-inspector/index.js +35 -33
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +5 -8
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +55 -24
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +61 -28
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-lock/menu-item.js +1 -1
- package/build/components/block-lock/menu-item.js.map +1 -1
- package/build/components/block-lock/modal.js +16 -9
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +12 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +3 -2
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +33 -11
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +5 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/utils.js +3 -3
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-switcher/index.js +19 -4
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +8 -49
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +27 -4
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +1 -2
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/with-colors.js +4 -3
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +24 -40
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +7 -5
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/height-control/index.js +115 -0
- package/build/components/height-control/index.js.map +1 -0
- package/build/components/iframe/index.js +11 -8
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/image-editor/use-save-image.js +2 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +1 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/index.js +18 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +25 -9
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +25 -46
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +27 -0
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build/components/inserter/index.js +8 -3
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -4
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +103 -0
- package/build/components/inserter/media-tab/hooks.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +32 -0
- package/build/components/inserter/media-tab/index.js.map +1 -0
- package/build/components/inserter/media-tab/media-list.js +100 -0
- package/build/components/inserter/media-tab/media-list.js.map +1 -0
- package/build/components/inserter/media-tab/media-panel.js +96 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build/components/inserter/media-tab/media-tab.js +120 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build/components/inserter/media-tab/utils.js +54 -0
- package/build/components/inserter/media-tab/utils.js.map +1 -0
- package/build/components/inserter/menu.js +35 -12
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +70 -0
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build/components/inserter/quick-inserter.js +1 -0
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/reusable-blocks-tab.js +4 -1
- package/build/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build/components/inserter/search-results.js +3 -1
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +16 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +71 -0
- package/build/components/inspector-controls-tabs/index.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build/components/inspector-controls-tabs/utils.js +37 -0
- package/build/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build/components/link-control/index.js +19 -34
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +1 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +26 -0
- package/build/components/link-control/use-internal-input-value.js.map +1 -0
- package/build/components/list-view/block.js +10 -5
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +22 -15
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-upload/index.native.js +2 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +104 -0
- package/build/components/off-canvas-editor/appender.js.map +1 -0
- package/build/components/off-canvas-editor/block-contents.js +100 -0
- package/build/components/off-canvas-editor/block-contents.js.map +1 -0
- package/build/components/off-canvas-editor/block-edit-button.js +50 -0
- package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build/components/off-canvas-editor/block-select-button.js +119 -0
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -0
- package/build/components/off-canvas-editor/block.js +324 -0
- package/build/components/off-canvas-editor/block.js.map +1 -0
- package/build/components/off-canvas-editor/branch.js +179 -0
- package/build/components/off-canvas-editor/branch.js.map +1 -0
- package/build/components/off-canvas-editor/context.js +19 -0
- package/build/components/off-canvas-editor/context.js.map +1 -0
- package/build/components/off-canvas-editor/drop-indicator.js +118 -0
- package/build/components/off-canvas-editor/drop-indicator.js.map +1 -0
- package/build/components/off-canvas-editor/expander.js +41 -0
- package/build/components/off-canvas-editor/expander.js.map +1 -0
- package/build/components/off-canvas-editor/index.js +213 -0
- package/build/components/off-canvas-editor/index.js.map +1 -0
- package/build/components/off-canvas-editor/leaf.js +60 -0
- package/build/components/off-canvas-editor/leaf.js.map +1 -0
- package/build/components/off-canvas-editor/link-ui.js +185 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build/components/off-canvas-editor/update-attributes.js +108 -0
- package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build/components/off-canvas-editor/use-block-selection.js +139 -0
- package/build/components/off-canvas-editor/use-block-selection.js.map +1 -0
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +33 -0
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +235 -0
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +60 -0
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
- package/build/components/off-canvas-editor/utils.js +60 -0
- package/build/components/off-canvas-editor/utils.js.map +1 -0
- package/build/components/rich-text/format-toolbar/index.js +8 -4
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +3 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-insert-replacement-text.js +43 -0
- package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -19
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +4 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +46 -43
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/index.js +31 -2
- package/build/components/url-popover/index.js.map +1 -1
- package/build/components/use-block-display-information/index.js +8 -4
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +10 -2
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/child-layout.js +209 -0
- package/build/hooks/child-layout.js.map +1 -0
- package/build/hooks/color-panel.js +17 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +14 -7
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +65 -16
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/layout.js +59 -3
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +4 -2
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/min-height.js +139 -0
- package/build/hooks/min-height.js.map +1 -0
- package/build/hooks/padding.js +4 -2
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/style.js +3 -2
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/flex.js +22 -21
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +26 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +420 -265
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +73 -49
- package/build/store/selectors.js.map +1 -1
- package/build/utils/sorting.js +63 -0
- package/build/utils/sorting.js.map +1 -0
- package/build-module/autocompleters/block.js +2 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -0
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +40 -31
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +4 -6
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-inspector/index.js +32 -30
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +5 -8
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +55 -25
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +61 -28
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-lock/menu-item.js +2 -2
- package/build-module/components/block-lock/menu-item.js.map +1 -1
- package/build-module/components/block-lock/modal.js +17 -10
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +13 -6
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +3 -2
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +35 -13
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +5 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/utils.js +3 -3
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-switcher/index.js +19 -4
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +8 -49
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +27 -5
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +1 -2
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/with-colors.js +5 -4
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +24 -40
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +8 -6
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/height-control/index.js +103 -0
- package/build-module/components/height-control/index.js.map +1 -0
- package/build-module/components/iframe/index.js +11 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/image-editor/use-save-image.js +2 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +27 -11
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +27 -49
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -2
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build-module/components/inserter/index.js +8 -3
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +3 -5
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +89 -0
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +4 -0
- package/build-module/components/inserter/media-tab/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-list.js +86 -0
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js +77 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-tab.js +100 -0
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build-module/components/inserter/media-tab/utils.js +45 -0
- package/build-module/components/inserter/media-tab/utils.js.map +1 -0
- package/build-module/components/inserter/menu.js +33 -12
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build-module/components/inserter/quick-inserter.js +1 -0
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/reusable-blocks-tab.js +3 -1
- package/build-module/components/inserter/reusable-blocks-tab.js.map +1 -1
- package/build-module/components/inserter/search-results.js +3 -2
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +15 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +56 -0
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/utils.js +26 -0
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build-module/components/link-control/index.js +18 -34
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +1 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +18 -0
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -0
- package/build-module/components/list-view/block.js +10 -5
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +21 -14
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +2 -4
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +89 -0
- package/build-module/components/off-canvas-editor/appender.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-contents.js +85 -0
- package/build-module/components/off-canvas-editor/block-contents.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-select-button.js +101 -0
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block.js +298 -0
- package/build-module/components/off-canvas-editor/block.js.map +1 -0
- package/build-module/components/off-canvas-editor/branch.js +164 -0
- package/build-module/components/off-canvas-editor/branch.js.map +1 -0
- package/build-module/components/off-canvas-editor/context.js +7 -0
- package/build-module/components/off-canvas-editor/context.js.map +1 -0
- package/build-module/components/off-canvas-editor/drop-indicator.js +111 -0
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +1 -0
- package/build-module/components/off-canvas-editor/expander.js +32 -0
- package/build-module/components/off-canvas-editor/expander.js.map +1 -0
- package/build-module/components/off-canvas-editor/index.js +189 -0
- package/build-module/components/off-canvas-editor/index.js.map +1 -0
- package/build-module/components/off-canvas-editor/leaf.js +45 -0
- package/build-module/components/off-canvas-editor/leaf.js.map +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js +165 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
- package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-block-selection.js +124 -0
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +24 -0
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +220 -0
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +50 -0
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +1 -0
- package/build-module/components/off-canvas-editor/utils.js +44 -0
- package/build-module/components/off-canvas-editor/utils.js.map +1 -0
- package/build-module/components/rich-text/format-toolbar/index.js +6 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -16
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -2
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +46 -43
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/index.js +30 -3
- package/build-module/components/url-popover/index.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -5
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +9 -2
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/child-layout.js +189 -0
- package/build-module/hooks/child-layout.js.map +1 -0
- package/build-module/hooks/color-panel.js +17 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +16 -9
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +60 -16
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/layout.js +57 -2
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +4 -2
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/min-height.js +116 -0
- package/build-module/hooks/min-height.js.map +1 -0
- package/build-module/hooks/padding.js +4 -2
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/style.js +4 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/flex.js +23 -22
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +22 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +415 -265
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +66 -48
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/sorting.js +56 -0
- package/build-module/utils/sorting.js.map +1 -0
- package/build-style/content-rtl.css +701 -0
- package/build-style/content.css +701 -0
- package/build-style/default-editor-styles-rtl.css +14 -0
- package/build-style/default-editor-styles.css +14 -0
- package/build-style/style-rtl.css +305 -668
- package/build-style/style.css +305 -668
- package/package.json +32 -30
- package/src/autocompleters/block.js +2 -6
- package/src/autocompleters/link.js +2 -0
- package/src/components/alignment-control/README.md +1 -1
- package/src/components/alignment-control/test/index.js +4 -1
- package/src/components/block-alignment-control/test/index.js +4 -1
- package/src/components/block-alignment-control/test/index.native.js +4 -4
- package/src/components/block-card/index.js +46 -2
- package/src/components/block-card/style.scss +4 -0
- package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
- package/src/components/block-draggable/content.scss +20 -0
- package/src/components/block-draggable/index.native.js +54 -40
- package/src/components/block-draggable/style.scss +0 -21
- package/src/components/block-draggable/test/helpers.native.js +7 -9
- package/src/components/block-draggable/test/index.native.js +35 -45
- package/src/components/block-edit/edit.js +5 -2
- package/src/components/block-edit/edit.native.js +5 -6
- package/src/components/block-inspector/index.js +96 -81
- package/src/components/block-inspector/style.scss +9 -1
- package/src/components/block-list/block-list-context.native.js +5 -8
- package/src/components/block-list/block.js +74 -23
- package/src/components/block-list/block.native.js +78 -23
- package/src/components/block-list/{style.scss → content.scss} +11 -20
- package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
- package/src/components/block-lock/menu-item.js +5 -2
- package/src/components/block-lock/modal.js +19 -36
- package/src/components/block-lock/style.scss +8 -17
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +24 -6
- package/src/components/block-mover/style.scss +0 -1
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -2
- package/src/components/block-pattern-setup/index.js +2 -1
- package/src/components/block-patterns-list/index.js +47 -24
- package/src/components/block-popover/style.scss +1 -1
- package/src/components/block-preview/README.md +15 -10
- package/src/components/block-preview/auto.js +7 -1
- package/src/components/block-preview/content.scss +4 -0
- package/src/components/block-preview/index.js +7 -12
- package/src/components/block-preview/style.scss +0 -7
- package/src/components/block-preview/test/index.js +18 -35
- package/src/components/block-selection-clearer/test/index.js +12 -12
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
- package/src/components/block-styles/utils.js +3 -3
- package/src/components/block-switcher/index.js +19 -4
- package/src/components/block-switcher/test/index.js +4 -0
- package/src/components/block-toolbar/index.js +12 -5
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/insertion-point.js +3 -47
- package/src/components/block-tools/selected-block-popover.js +80 -34
- package/src/components/block-tools/style.scss +27 -5
- package/src/components/block-variation-picker/index.js +1 -4
- package/src/components/block-vertical-alignment-control/test/index.js +4 -1
- package/src/components/colors/with-colors.js +13 -23
- package/src/components/default-block-appender/{style.scss → content.scss} +1 -0
- package/src/components/font-sizes/fluid-utils.js +37 -64
- package/src/components/font-sizes/test/fluid-utils.js +5 -5
- package/src/components/font-sizes/with-font-sizes.js +14 -11
- package/src/components/height-control/index.js +123 -0
- package/src/components/height-control/stories/index.js +21 -0
- package/src/components/height-control/style.scss +5 -0
- package/src/components/iframe/index.js +25 -18
- package/src/components/image-editor/use-save-image.js +2 -0
- package/src/components/image-editor/zoom-dropdown.js +1 -0
- package/src/components/index.js +2 -0
- package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
- package/src/components/inner-blocks/index.js +30 -10
- package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
- package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/src/components/inserter/block-patterns-tab.js +28 -71
- package/src/components/inserter/block-types-tab.js +3 -2
- package/src/components/inserter/hooks/use-debounced-input.js +17 -0
- package/src/components/inserter/index.js +10 -2
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +88 -0
- package/src/components/inserter/media-tab/index.js +3 -0
- package/src/components/inserter/media-tab/media-list.js +93 -0
- package/src/components/inserter/media-tab/media-panel.js +83 -0
- package/src/components/inserter/media-tab/media-tab.js +135 -0
- package/src/components/inserter/media-tab/utils.js +37 -0
- package/src/components/inserter/menu.js +55 -13
- package/src/components/inserter/mobile-tab-navigation.js +85 -0
- package/src/components/inserter/quick-inserter.js +1 -0
- package/src/components/inserter/reusable-blocks-tab.js +4 -2
- package/src/components/inserter/search-results.js +3 -2
- package/src/components/inserter/stories/index.js +1 -1
- package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
- package/src/components/inserter/style.scss +184 -18
- package/src/components/inserter/tabs.js +12 -1
- package/src/components/inserter/test/reusable-blocks-tab.js +14 -57
- package/src/components/inserter-list-item/index.js +11 -1
- package/src/components/inserter-list-item/style.scss +26 -0
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/index.js +62 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
- package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
- package/src/components/inspector-controls-tabs/utils.js +28 -0
- package/src/components/line-height-control/test/index.js +5 -5
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/index.js +24 -39
- package/src/components/link-control/search-input.js +1 -2
- package/src/components/link-control/test/index.js +400 -582
- package/src/components/link-control/use-internal-input-value.js +22 -0
- package/src/components/list-view/block.js +7 -3
- package/src/components/list-view/branch.js +21 -14
- package/src/components/list-view/style.scss +20 -9
- package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
- package/src/components/media-replace-flow/test/index.js +37 -9
- package/src/components/media-upload/test/index.native.js +2 -0
- package/src/components/off-canvas-editor/README.md +5 -0
- package/src/components/off-canvas-editor/appender.js +93 -0
- package/src/components/off-canvas-editor/block-contents.js +89 -0
- package/src/components/off-canvas-editor/block-edit-button.js +27 -0
- package/src/components/off-canvas-editor/block-select-button.js +113 -0
- package/src/components/off-canvas-editor/block.js +401 -0
- package/src/components/off-canvas-editor/branch.js +208 -0
- package/src/components/off-canvas-editor/context.js +8 -0
- package/src/components/off-canvas-editor/drop-indicator.js +126 -0
- package/src/components/off-canvas-editor/expander.js +26 -0
- package/src/components/off-canvas-editor/index.js +242 -0
- package/src/components/off-canvas-editor/leaf.js +52 -0
- package/src/components/off-canvas-editor/link-ui.js +166 -0
- package/src/components/off-canvas-editor/style.scss +26 -0
- package/src/components/off-canvas-editor/test/utils.js +50 -0
- package/src/components/off-canvas-editor/update-attributes.js +99 -0
- package/src/components/off-canvas-editor/use-block-selection.js +169 -0
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +29 -0
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +260 -0
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +58 -0
- package/src/components/off-canvas-editor/utils.js +58 -0
- package/src/components/plain-text/{style.scss → content.scss} +0 -0
- package/src/components/recursion-provider/test/index.js +27 -29
- package/src/components/responsive-block-control/test/index.js +69 -92
- package/src/components/rich-text/content.scss +42 -0
- package/src/components/rich-text/format-toolbar/index.js +6 -4
- package/src/components/rich-text/index.js +2 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +0 -43
- package/src/components/rich-text/use-insert-replacement-text.js +31 -0
- package/src/components/rich-text/use-undo-automatic-change.js +7 -1
- package/src/components/rich-text/utils.js +2 -21
- package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
- package/src/components/ungroup-button/index.native.js +6 -2
- package/src/components/url-input/index.js +57 -73
- package/src/components/url-popover/README.md +12 -3
- package/src/components/url-popover/index.js +33 -3
- package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
- package/src/components/url-popover/test/index.js +21 -9
- package/src/components/use-block-display-information/index.js +14 -5
- package/src/components/use-setting/index.js +20 -2
- package/src/components/use-setting/test/index.js +99 -0
- package/src/content.scss +10 -0
- package/src/hooks/child-layout.js +190 -0
- package/src/hooks/color-panel.js +13 -1
- package/src/hooks/color.js +2 -0
- package/src/hooks/content-lock-ui.js +47 -35
- package/src/hooks/dimensions.js +119 -21
- package/src/hooks/layout.js +62 -3
- package/src/hooks/margin.js +4 -3
- package/src/hooks/min-height.js +104 -0
- package/src/hooks/padding.js +4 -3
- package/src/hooks/style.js +10 -2
- package/src/hooks/test/style.js +4 -0
- package/src/hooks/test/use-typography-props.js +1 -1
- package/src/layouts/flex.js +43 -38
- package/src/store/actions.js +22 -0
- package/src/store/reducer.js +480 -434
- package/src/store/selectors.js +70 -64
- package/src/store/test/actions.js +18 -0
- package/src/store/test/performance.js +71 -0
- package/src/store/test/reducer.js +662 -490
- package/src/store/test/selectors.js +1839 -1306
- package/src/style.scss +4 -7
- package/src/utils/sorting.js +54 -0
- package/src/utils/test/sorting.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-preview/live.js +0 -30
- package/build/components/block-preview/live.js.map +0 -1
- package/build-module/components/block-preview/live.js +0 -20
- package/build-module/components/block-preview/live.js.map +0 -1
- package/src/components/block-preview/live.js +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 11.0.0 (2022-12-14)
|
|
6
|
+
|
|
7
|
+
### Breaking Changes
|
|
8
|
+
|
|
9
|
+
- Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))
|
|
10
|
+
|
|
11
|
+
### Enhancements
|
|
12
|
+
|
|
13
|
+
- `URLInput`: the `renderSuggestions` callback prop now receives `currentInputValue` as a new parameter ([45806](https://github.com/WordPress/gutenberg/pull/45806)).
|
|
14
|
+
|
|
15
|
+
## 10.5.0 (2022-11-16)
|
|
16
|
+
|
|
17
|
+
### Enhancement
|
|
18
|
+
|
|
19
|
+
- `BlockLockModal`: Move Icon component out of CheckboxControl label ([#45535](https://github.com/WordPress/gutenberg/pull/45535))
|
|
20
|
+
- Fluid typography: adjust font size min and max rules ([#45536](https://github.com/WordPress/gutenberg/pull/45536)).
|
|
21
|
+
|
|
5
22
|
## 10.4.0 (2022-11-02)
|
|
6
23
|
|
|
7
24
|
### Bug Fix
|
package/README.md
CHANGED
|
@@ -428,7 +428,6 @@ _Parameters_
|
|
|
428
428
|
- _args.minimumFontSize_ `?string`: Minimum font size for any clamp() calculation. Optional.
|
|
429
429
|
- _args.scaleFactor_ `?number`: A scale factor to determine how fast a font scales within boundaries. Optional.
|
|
430
430
|
- _args.minimumFontSizeFactor_ `?number`: How much to scale defaultFontSize by to derive minimumFontSize. Optional.
|
|
431
|
-
- _args.maximumFontSizeFactor_ `?number`: How much to scale defaultFontSize by to derive maximumFontSize. Optional.
|
|
432
431
|
|
|
433
432
|
_Returns_
|
|
434
433
|
|
|
@@ -9,8 +9,6 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
-
var _lodash = require("lodash");
|
|
13
|
-
|
|
14
12
|
var _data = require("@wordpress/data");
|
|
15
13
|
|
|
16
14
|
var _blocks = require("@wordpress/blocks");
|
|
@@ -23,9 +21,7 @@ var _blockIcon = _interopRequireDefault(require("../components/block-icon"));
|
|
|
23
21
|
|
|
24
22
|
var _store = require("../store");
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
* External dependencies
|
|
28
|
-
*/
|
|
24
|
+
var _sorting = require("../utils/sorting");
|
|
29
25
|
|
|
30
26
|
/**
|
|
31
27
|
* WordPress dependencies
|
|
@@ -69,7 +65,7 @@ function createBlockCompleter() {
|
|
|
69
65
|
}, []);
|
|
70
66
|
const [items, categories, collections] = (0, _useBlockTypesState.default)(rootClientId, noop);
|
|
71
67
|
const filteredItems = (0, _element.useMemo)(() => {
|
|
72
|
-
const initialFilteredItems = !!filterValue.trim() ? (0, _searchItems.searchBlockItems)(items, categories, collections, filterValue) : (0,
|
|
68
|
+
const initialFilteredItems = !!filterValue.trim() ? (0, _searchItems.searchBlockItems)(items, categories, collections, filterValue) : (0, _sorting.orderBy)(items, 'frecency', 'desc');
|
|
73
69
|
return initialFilteredItems.filter(item => item.name !== selectedBlockName).slice(0, SHOWN_BLOCK_TYPES);
|
|
74
70
|
}, [filterValue, selectedBlockName, items, categories, collections]);
|
|
75
71
|
const options = (0, _element.useMemo)(() => filteredItems.map(blockItem => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/autocompleters/block.js"],"names":["noop","SHOWN_BLOCK_TYPES","createBlockCompleter","name","className","triggerPrefix","useItems","filterValue","rootClientId","selectedBlockName","select","getSelectedBlockClientId","getBlockName","getBlockInsertionPoint","blockEditorStore","selectedBlockClientId","items","categories","collections","filteredItems","initialFilteredItems","trim","filter","item","slice","options","map","blockItem","title","icon","isDisabled","key","id","value","label","allowContext","before","after","test","getOptionCompletion","inserterItem","initialAttributes","innerBlocks","action"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/autocompleters/block.js"],"names":["noop","SHOWN_BLOCK_TYPES","createBlockCompleter","name","className","triggerPrefix","useItems","filterValue","rootClientId","selectedBlockName","select","getSelectedBlockClientId","getBlockName","getBlockInsertionPoint","blockEditorStore","selectedBlockClientId","items","categories","collections","filteredItems","initialFilteredItems","trim","filter","item","slice","options","map","blockItem","title","icon","isDisabled","key","id","value","label","allowContext","before","after","test","getOptionCompletion","inserterItem","initialAttributes","innerBlocks","action"],"mappings":";;;;;;;;;AAQA;;AALA;;AACA;;AASA;;AACA;;AACA;;AACA;;AACA;;AAjBA;AACA;AACA;;AAQA;AACA;AACA;AAOA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,iBAAiB,GAAG,CAA1B;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,oBAAT,GAAgC;AAC/B,SAAO;AACNC,IAAAA,IAAI,EAAE,QADA;AAENC,IAAAA,SAAS,EAAE,oCAFL;AAGNC,IAAAA,aAAa,EAAE,GAHT;;AAKNC,IAAAA,QAAQ,CAAEC,WAAF,EAAgB;AACvB,YAAM;AAAEC,QAAAA,YAAF;AAAgBC,QAAAA;AAAhB,UAAsC,qBACzCC,MAAF,IAAc;AACb,cAAM;AACLC,UAAAA,wBAD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;AAGC,YAAA,UAAU;AAHX,YADD,EAMGD,KANH,CAJK;AAaNE,UAAAA;AAbM,SAAP;AAeA,OAjBD,CAFc,EAoBf,CAAEX,aAAF,CApBe,CAAhB;AAuBA,aAAO,CAAEM,OAAF,CAAP;AACA,KAzEK;;AA0ENU,IAAAA,YAAY,CAAEC,MAAF,EAAUC,KAAV,EAAkB;AAC7B,aAAO,EAAI,KAAKC,IAAL,CAAWF,MAAX,KAAuB,KAAKE,IAAL,CAAWD,KAAX,CAA3B,CAAP;AACA,KA5EK;;AA6ENE,IAAAA,mBAAmB,CAAEC,YAAF,EAAiB;AACnC,YAAM;AAAErC,QAAAA,IAAF;AAAQsC,QAAAA,iBAAR;AAA2BC,QAAAA;AAA3B,UAA2CF,YAAjD;AACA,aAAO;AACNG,QAAAA,MAAM,EAAE,SADF;AAENV,QAAAA,KAAK,EAAE,yBACN9B,IADM,EAENsC,iBAFM,EAGN,iDAAqCC,WAArC,CAHM;AAFD,OAAP;AAQA;;AAvFK,GAAP;AAyFA;AAED;AACA;AACA;AACA;AACA;;;eACexC,oBAAoB,E","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n} from '@wordpress/blocks';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { searchBlockItems } from '../components/inserter/search-items';\nimport useBlockTypesState from '../components/inserter/hooks/use-block-types-state';\nimport BlockIcon from '../components/block-icon';\nimport { store as blockEditorStore } from '../store';\nimport { orderBy } from '../utils/sorting';\n\nconst noop = () => {};\nconst SHOWN_BLOCK_TYPES = 9;\n\n/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */\n\n/**\n * Creates a blocks repeater for replacing the current block with a selected block type.\n *\n * @return {WPCompleter} A blocks completer.\n */\nfunction createBlockCompleter() {\n\treturn {\n\t\tname: 'blocks',\n\t\tclassName: 'block-editor-autocompleters__block',\n\t\ttriggerPrefix: '/',\n\n\t\tuseItems( filterValue ) {\n\t\t\tconst { rootClientId, selectedBlockName } = useSelect(\n\t\t\t\t( select ) => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tgetSelectedBlockClientId,\n\t\t\t\t\t\tgetBlockName,\n\t\t\t\t\t\tgetBlockInsertionPoint,\n\t\t\t\t\t} = select( blockEditorStore );\n\t\t\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tselectedBlockName: selectedBlockClientId\n\t\t\t\t\t\t\t? getBlockName( selectedBlockClientId )\n\t\t\t\t\t\t\t: null,\n\t\t\t\t\t\trootClientId: getBlockInsertionPoint().rootClientId,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\t\t\tconst [ items, categories, collections ] = useBlockTypesState(\n\t\t\t\trootClientId,\n\t\t\t\tnoop\n\t\t\t);\n\n\t\t\tconst filteredItems = useMemo( () => {\n\t\t\t\tconst initialFilteredItems = !! filterValue.trim()\n\t\t\t\t\t? searchBlockItems(\n\t\t\t\t\t\t\titems,\n\t\t\t\t\t\t\tcategories,\n\t\t\t\t\t\t\tcollections,\n\t\t\t\t\t\t\tfilterValue\n\t\t\t\t\t )\n\t\t\t\t\t: orderBy( items, 'frecency', 'desc' );\n\n\t\t\t\treturn initialFilteredItems\n\t\t\t\t\t.filter( ( item ) => item.name !== selectedBlockName )\n\t\t\t\t\t.slice( 0, SHOWN_BLOCK_TYPES );\n\t\t\t}, [\n\t\t\t\tfilterValue,\n\t\t\t\tselectedBlockName,\n\t\t\t\titems,\n\t\t\t\tcategories,\n\t\t\t\tcollections,\n\t\t\t] );\n\n\t\t\tconst options = useMemo(\n\t\t\t\t() =>\n\t\t\t\t\tfilteredItems.map( ( blockItem ) => {\n\t\t\t\t\t\tconst { title, icon, isDisabled } = blockItem;\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tkey: `block-${ blockItem.id }`,\n\t\t\t\t\t\t\tvalue: blockItem,\n\t\t\t\t\t\t\tlabel: (\n\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t<BlockIcon\n\t\t\t\t\t\t\t\t\t\tkey=\"icon\"\n\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\tshowColors\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tisDisabled,\n\t\t\t\t\t\t};\n\t\t\t\t\t} ),\n\t\t\t\t[ filteredItems ]\n\t\t\t);\n\n\t\t\treturn [ options ];\n\t\t},\n\t\tallowContext( before, after ) {\n\t\t\treturn ! ( /\\S/.test( before ) || /\\S/.test( after ) );\n\t\t},\n\t\tgetOptionCompletion( inserterItem ) {\n\t\t\tconst { name, initialAttributes, innerBlocks } = inserterItem;\n\t\t\treturn {\n\t\t\t\taction: 'replace',\n\t\t\t\tvalue: createBlock(\n\t\t\t\t\tname,\n\t\t\t\t\tinitialAttributes,\n\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate( innerBlocks )\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t};\n}\n\n/**\n * Creates a blocks repeater for replacing the current block with a selected block type.\n *\n * @return {WPCompleter} A blocks completer.\n */\nexport default createBlockCompleter();\n"]}
|
|
@@ -18,6 +18,8 @@ var _icons = require("@wordpress/icons");
|
|
|
18
18
|
/**
|
|
19
19
|
* WordPress dependencies
|
|
20
20
|
*/
|
|
21
|
+
// Disable Reason: Needs to be refactored.
|
|
22
|
+
// eslint-disable-next-line no-restricted-imports
|
|
21
23
|
const SHOWN_SUGGESTIONS = 10;
|
|
22
24
|
/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */
|
|
23
25
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/autocompleters/link.js"],"names":["SHOWN_SUGGESTIONS","createLinkCompleter","name","className","triggerPrefix","options","letters","path","per_page","search","type","order_by","filter","option","title","getOptionKeywords","item","expansionWords","split","getOptionLabel","subtype","page","post","getOptionCompletion","url"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/autocompleters/link.js"],"names":["SHOWN_SUGGESTIONS","createLinkCompleter","name","className","triggerPrefix","options","letters","path","per_page","search","type","order_by","filter","option","title","getOptionKeywords","item","expansionWords","split","getOptionLabel","subtype","page","post","getOptionCompletion","url"],"mappings":";;;;;;;;;;;AAKA;;AACA;;AACA;;AAPA;AACA;AACA;AACA;AACA;AAKA,MAAMA,iBAAiB,GAAG,EAA1B;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AACA,SAASC,mBAAT,GAA+B;AAC9B,SAAO;AACNC,IAAAA,IAAI,EAAE,OADA;AAENC,IAAAA,SAAS,EAAE,mCAFL;AAGNC,IAAAA,aAAa,EAAE,IAHT;AAINC,IAAAA,OAAO,EAAE,MAAQC,OAAR,IAAqB;AAC7B,UAAID,OAAO,GAAG,MAAM,uBAAU;AAC7BE,QAAAA,IAAI,EAAE,uBAAc,eAAd,EAA+B;AACpCC,UAAAA,QAAQ,EAAER,iBAD0B;AAEpCS,UAAAA,MAAM,EAAEH,OAF4B;AAGpCI,UAAAA,IAAI,EAAE,MAH8B;AAIpCC,UAAAA,QAAQ,EAAE;AAJ0B,SAA/B;AADuB,OAAV,CAApB;AASAN,MAAAA,OAAO,GAAGA,OAAO,CAACO,MAAR,CAAkBC,MAAF,IAAcA,MAAM,CAACC,KAAP,KAAiB,EAA/C,CAAV;AAEA,aAAOT,OAAP;AACA,KAjBK;;AAkBNU,IAAAA,iBAAiB,CAAEC,IAAF,EAAS;AACzB,YAAMC,cAAc,GAAGD,IAAI,CAACF,KAAL,CAAWI,KAAX,CAAkB,KAAlB,CAAvB;AACA,aAAO,CAAE,GAAGD,cAAL,CAAP;AACA,KArBK;;AAsBNE,IAAAA,cAAc,CAAEH,IAAF,EAAS;AACtB,aACC,qDACC,4BAAC,WAAD;AACC,QAAA,GAAG,EAAC,MADL;AAEC,QAAA,IAAI,EAAGA,IAAI,CAACI,OAAL,KAAiB,MAAjB,GAA0BC,WAA1B,GAAiCC;AAFzC,QADD,EAKGN,IAAI,CAACF,KALR,CADD;AASA,KAhCK;;AAiCNS,IAAAA,mBAAmB,CAAEP,IAAF,EAAS;AAC3B,aAAO;AAAG,QAAA,IAAI,EAAGA,IAAI,CAACQ;AAAf,SAAuBR,IAAI,CAACF,KAA5B,CAAP;AACA;;AAnCK,GAAP;AAqCA;AAED;AACA;AACA;AACA;AACA;;;eACeb,mBAAmB,E","sourcesContent":["/**\n * WordPress dependencies\n */\n// Disable Reason: Needs to be refactored.\n// eslint-disable-next-line no-restricted-imports\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport { Icon, page, post } from '@wordpress/icons';\n\nconst SHOWN_SUGGESTIONS = 10;\n\n/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */\n\n/**\n * Creates a suggestion list for links to posts or pages.\n *\n * @return {WPCompleter} A links completer.\n */\nfunction createLinkCompleter() {\n\treturn {\n\t\tname: 'links',\n\t\tclassName: 'block-editor-autocompleters__link',\n\t\ttriggerPrefix: '[[',\n\t\toptions: async ( letters ) => {\n\t\t\tlet options = await apiFetch( {\n\t\t\t\tpath: addQueryArgs( '/wp/v2/search', {\n\t\t\t\t\tper_page: SHOWN_SUGGESTIONS,\n\t\t\t\t\tsearch: letters,\n\t\t\t\t\ttype: 'post',\n\t\t\t\t\torder_by: 'menu_order',\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\t\toptions = options.filter( ( option ) => option.title !== '' );\n\n\t\t\treturn options;\n\t\t},\n\t\tgetOptionKeywords( item ) {\n\t\t\tconst expansionWords = item.title.split( /\\s+/ );\n\t\t\treturn [ ...expansionWords ];\n\t\t},\n\t\tgetOptionLabel( item ) {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tkey=\"icon\"\n\t\t\t\t\t\ticon={ item.subtype === 'page' ? page : post }\n\t\t\t\t\t/>\n\t\t\t\t\t{ item.title }\n\t\t\t\t</>\n\t\t\t);\n\t\t},\n\t\tgetOptionCompletion( item ) {\n\t\t\treturn <a href={ item.url }>{ item.title }</a>;\n\t\t},\n\t};\n}\n\n/**\n * Creates a suggestion list for links to posts or pages..\n *\n * @return {WPCompleter} A link completer.\n */\nexport default createLinkCompleter();\n"]}
|
|
@@ -9,10 +9,26 @@ exports.default = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _element = require("@wordpress/element");
|
|
11
11
|
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
12
14
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
13
15
|
|
|
16
|
+
var _components = require("@wordpress/components");
|
|
17
|
+
|
|
18
|
+
var _icons = require("@wordpress/icons");
|
|
19
|
+
|
|
20
|
+
var _i18n = require("@wordpress/i18n");
|
|
21
|
+
|
|
22
|
+
var _data = require("@wordpress/data");
|
|
23
|
+
|
|
14
24
|
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
15
25
|
|
|
26
|
+
var _store = require("../../store");
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* External dependencies
|
|
30
|
+
*/
|
|
31
|
+
|
|
16
32
|
/**
|
|
17
33
|
* WordPress dependencies
|
|
18
34
|
*/
|
|
@@ -21,11 +37,14 @@ var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
|
21
37
|
* Internal dependencies
|
|
22
38
|
*/
|
|
23
39
|
function BlockCard(_ref) {
|
|
40
|
+
var _window;
|
|
41
|
+
|
|
24
42
|
let {
|
|
25
43
|
title,
|
|
26
44
|
icon,
|
|
27
45
|
description,
|
|
28
|
-
blockType
|
|
46
|
+
blockType,
|
|
47
|
+
className
|
|
29
48
|
} = _ref;
|
|
30
49
|
|
|
31
50
|
if (blockType) {
|
|
@@ -40,9 +59,38 @@ function BlockCard(_ref) {
|
|
|
40
59
|
} = blockType);
|
|
41
60
|
}
|
|
42
61
|
|
|
62
|
+
const isOffCanvasNavigationEditorEnabled = ((_window = window) === null || _window === void 0 ? void 0 : _window.__experimentalEnableOffCanvasNavigationEditor) === true;
|
|
63
|
+
const {
|
|
64
|
+
parentNavBlockClientId
|
|
65
|
+
} = (0, _data.useSelect)(select => {
|
|
66
|
+
const {
|
|
67
|
+
getSelectedBlockClientId,
|
|
68
|
+
getBlockParentsByBlockName
|
|
69
|
+
} = select(_store.store);
|
|
70
|
+
|
|
71
|
+
const _selectedBlockClientId = getSelectedBlockClientId();
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
parentNavBlockClientId: getBlockParentsByBlockName(_selectedBlockClientId, 'core/navigation', true)[0]
|
|
75
|
+
};
|
|
76
|
+
}, []);
|
|
77
|
+
const {
|
|
78
|
+
selectBlock
|
|
79
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
43
80
|
return (0, _element.createElement)("div", {
|
|
44
|
-
className:
|
|
45
|
-
}, (0, _element.createElement)(
|
|
81
|
+
className: (0, _classnames.default)('block-editor-block-card', className)
|
|
82
|
+
}, isOffCanvasNavigationEditorEnabled && parentNavBlockClientId && (0, _element.createElement)(_components.Button, {
|
|
83
|
+
onClick: () => selectBlock(parentNavBlockClientId),
|
|
84
|
+
label: (0, _i18n.__)('Go to parent Navigation block'),
|
|
85
|
+
style: // TODO: This style override is also used in ToolsPanelHeader.
|
|
86
|
+
// It should be supported out-of-the-box by Button.
|
|
87
|
+
{
|
|
88
|
+
minWidth: 24,
|
|
89
|
+
padding: 0
|
|
90
|
+
},
|
|
91
|
+
icon: (0, _i18n.isRTL)() ? _icons.chevronRight : _icons.chevronLeft,
|
|
92
|
+
isSmall: true
|
|
93
|
+
}), (0, _element.createElement)(_blockIcon.default, {
|
|
46
94
|
icon: icon,
|
|
47
95
|
showColors: true
|
|
48
96
|
}), (0, _element.createElement)("div", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-card/index.js"],"names":["BlockCard","title","icon","description","blockType","since","alternative"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-card/index.js"],"names":["BlockCard","title","icon","description","blockType","className","since","alternative","isOffCanvasNavigationEditorEnabled","window","__experimentalEnableOffCanvasNavigationEditor","parentNavBlockClientId","select","getSelectedBlockClientId","getBlockParentsByBlockName","blockEditorStore","_selectedBlockClientId","selectBlock","minWidth","padding","chevronRight","chevronLeft"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAIA,SAASA,SAAT,OAAyE;AAAA;;AAAA,MAArD;AAAEC,IAAAA,KAAF;AAASC,IAAAA,IAAT;AAAeC,IAAAA,WAAf;AAA4BC,IAAAA,SAA5B;AAAuCC,IAAAA;AAAvC,GAAqD;;AACxE,MAAKD,SAAL,EAAiB;AAChB,6BAAY,+CAAZ,EAA6D;AAC5DE,MAAAA,KAAK,EAAE,KADqD;AAE5DC,MAAAA,WAAW,EAAE;AAF+C,KAA7D;AAIA,KAAE;AAAEN,MAAAA,KAAF;AAASC,MAAAA,IAAT;AAAeC,MAAAA;AAAf,QAA+BC,SAAjC;AACA;;AAED,QAAMI,kCAAkC,GACvC,YAAAC,MAAM,UAAN,0CAAQC,6CAAR,MAA0D,IAD3D;AAGA,QAAM;AAAEC,IAAAA;AAAF,MAA6B,qBAAaC,MAAF,IAAc;AAC3D,UAAM;AAAEC,MAAAA,wBAAF;AAA4BC,MAAAA;AAA5B,QACLF,MAAM,CAAEG,YAAF,CADP;;AAGA,UAAMC,sBAAsB,GAAGH,wBAAwB,EAAvD;;AAEA,WAAO;AACNF,MAAAA,sBAAsB,EAAEG,0BAA0B,CACjDE,sBADiD,EAEjD,iBAFiD,EAGjD,IAHiD,CAA1B,CAIrB,CAJqB;AADlB,KAAP;AAOA,GAbkC,EAahC,EAbgC,CAAnC;AAeA,QAAM;AAAEC,IAAAA;AAAF,MAAkB,uBAAaF,YAAb,CAAxB;AAEA,SACC;AAAK,IAAA,SAAS,EAAG,yBAAY,yBAAZ,EAAuCV,SAAvC;AAAjB,KACGG,kCAAkC,IAAIG,sBAAtC,IACD,4BAAC,kBAAD;AACC,IAAA,OAAO,EAAG,MAAMM,WAAW,CAAEN,sBAAF,CAD5B;AAEC,IAAA,KAAK,EAAG,cAAI,+BAAJ,CAFT;AAGC,IAAA,KAAK,EACJ;AACA;AACA;AAAEO,MAAAA,QAAQ,EAAE,EAAZ;AAAgBC,MAAAA,OAAO,EAAE;AAAzB,KANF;AAQC,IAAA,IAAI,EAAG,qBAAUC,mBAAV,GAAyBC,kBARjC;AASC,IAAA,OAAO;AATR,IAFF,EAcC,4BAAC,kBAAD;AAAW,IAAA,IAAI,EAAGnB,IAAlB;AAAyB,IAAA,UAAU;AAAnC,IAdD,EAeC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC;AAAI,IAAA,SAAS,EAAC;AAAd,KAAiDD,KAAjD,CADD,EAEC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACGE,WADH,CAFD,CAfD,CADD;AAwBA;;eAEcH,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\nimport { Button } from '@wordpress/components';\nimport { chevronLeft, chevronRight } from '@wordpress/icons';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\n\nfunction BlockCard( { title, icon, description, blockType, className } ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst isOffCanvasNavigationEditorEnabled =\n\t\twindow?.__experimentalEnableOffCanvasNavigationEditor === true;\n\n\tconst { parentNavBlockClientId } = useSelect( ( select ) => {\n\t\tconst { getSelectedBlockClientId, getBlockParentsByBlockName } =\n\t\t\tselect( blockEditorStore );\n\n\t\tconst _selectedBlockClientId = getSelectedBlockClientId();\n\n\t\treturn {\n\t\t\tparentNavBlockClientId: getBlockParentsByBlockName(\n\t\t\t\t_selectedBlockClientId,\n\t\t\t\t'core/navigation',\n\t\t\t\ttrue\n\t\t\t)[ 0 ],\n\t\t};\n\t}, [] );\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\treturn (\n\t\t<div className={ classnames( 'block-editor-block-card', className ) }>\n\t\t\t{ isOffCanvasNavigationEditorEnabled && parentNavBlockClientId && (\n\t\t\t\t<Button\n\t\t\t\t\tonClick={ () => selectBlock( parentNavBlockClientId ) }\n\t\t\t\t\tlabel={ __( 'Go to parent Navigation block' ) }\n\t\t\t\t\tstyle={\n\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t}\n\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\tisSmall\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t<div className=\"block-editor-block-card__content\">\n\t\t\t\t<h2 className=\"block-editor-block-card__title\">{ title }</h2>\n\t\t\t\t<span className=\"block-editor-block-card__description\">\n\t\t\t\t\t{ description }\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"]}
|
|
@@ -338,6 +338,48 @@ const BlockDraggableWrapper = _ref => {
|
|
|
338
338
|
icon: draggedBlockIcon
|
|
339
339
|
}))));
|
|
340
340
|
};
|
|
341
|
+
|
|
342
|
+
exports.BlockDraggableWrapper = BlockDraggableWrapper;
|
|
343
|
+
|
|
344
|
+
function useIsScreenReaderEnabled() {
|
|
345
|
+
const [isScreenReaderEnabled, setIsScreenReaderEnabled] = (0, _element.useState)(false);
|
|
346
|
+
(0, _element.useEffect)(() => {
|
|
347
|
+
let mounted = true;
|
|
348
|
+
|
|
349
|
+
const changeListener = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', enabled => setIsScreenReaderEnabled(enabled));
|
|
350
|
+
|
|
351
|
+
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(screenReaderEnabled => {
|
|
352
|
+
if (mounted && screenReaderEnabled) {
|
|
353
|
+
setIsScreenReaderEnabled(screenReaderEnabled);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
return () => {
|
|
358
|
+
mounted = false;
|
|
359
|
+
changeListener.remove();
|
|
360
|
+
};
|
|
361
|
+
}, []);
|
|
362
|
+
return isScreenReaderEnabled;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function useIsEditingText() {
|
|
366
|
+
const [isEditingText, setIsEditingText] = (0, _element.useState)(() => _reactNativeAztec.default.InputState.isFocused());
|
|
367
|
+
(0, _element.useEffect)(() => {
|
|
368
|
+
const onFocusChangeAztec = _ref9 => {
|
|
369
|
+
let {
|
|
370
|
+
isFocused
|
|
371
|
+
} = _ref9;
|
|
372
|
+
setIsEditingText(isFocused);
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
_reactNativeAztec.default.InputState.addFocusChangeListener(onFocusChangeAztec);
|
|
376
|
+
|
|
377
|
+
return () => {
|
|
378
|
+
_reactNativeAztec.default.InputState.removeFocusChangeListener(onFocusChangeAztec);
|
|
379
|
+
};
|
|
380
|
+
}, []);
|
|
381
|
+
return isEditingText;
|
|
382
|
+
}
|
|
341
383
|
/**
|
|
342
384
|
* Block draggable component
|
|
343
385
|
*
|
|
@@ -355,19 +397,17 @@ const BlockDraggableWrapper = _ref => {
|
|
|
355
397
|
*/
|
|
356
398
|
|
|
357
399
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const BlockDraggable = _ref9 => {
|
|
400
|
+
const BlockDraggable = _ref10 => {
|
|
361
401
|
let {
|
|
362
402
|
clientId,
|
|
363
403
|
children,
|
|
364
404
|
draggingClientId,
|
|
365
405
|
enabled = true,
|
|
366
406
|
testID
|
|
367
|
-
} =
|
|
407
|
+
} = _ref10;
|
|
368
408
|
const wasBeingDragged = (0, _element.useRef)(false);
|
|
369
|
-
const
|
|
370
|
-
const
|
|
409
|
+
const isEditingText = useIsEditingText();
|
|
410
|
+
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
371
411
|
const draggingAnimation = {
|
|
372
412
|
opacity: (0, _reactNativeReanimated.useSharedValue)(1)
|
|
373
413
|
};
|
|
@@ -412,39 +452,6 @@ const BlockDraggable = _ref9 => {
|
|
|
412
452
|
|
|
413
453
|
wasBeingDragged.current = isBeingDragged;
|
|
414
454
|
}, [isBeingDragged]);
|
|
415
|
-
const onFocusChangeAztec = (0, _element.useCallback)(_ref10 => {
|
|
416
|
-
let {
|
|
417
|
-
isFocused
|
|
418
|
-
} = _ref10;
|
|
419
|
-
setIsEditingText(isFocused);
|
|
420
|
-
}, []);
|
|
421
|
-
(0, _element.useEffect)(() => {
|
|
422
|
-
let mounted = true;
|
|
423
|
-
|
|
424
|
-
const isAnyAztecInputFocused = _reactNativeAztec.default.InputState.isFocused();
|
|
425
|
-
|
|
426
|
-
if (isAnyAztecInputFocused) {
|
|
427
|
-
setIsEditingText(isAnyAztecInputFocused);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
_reactNativeAztec.default.InputState.addFocusChangeListener(onFocusChangeAztec);
|
|
431
|
-
|
|
432
|
-
const screenReaderChangedListener = _reactNative.AccessibilityInfo.addEventListener('screenReaderChanged', setIsScreenReaderEnabled);
|
|
433
|
-
|
|
434
|
-
_reactNative.AccessibilityInfo.isScreenReaderEnabled().then(screenReaderEnabled => {
|
|
435
|
-
if (mounted) {
|
|
436
|
-
setIsScreenReaderEnabled(screenReaderEnabled);
|
|
437
|
-
}
|
|
438
|
-
});
|
|
439
|
-
|
|
440
|
-
return () => {
|
|
441
|
-
mounted = false;
|
|
442
|
-
|
|
443
|
-
_reactNativeAztec.default.InputState.removeFocusChangeListener(onFocusChangeAztec);
|
|
444
|
-
|
|
445
|
-
screenReaderChangedListener.remove();
|
|
446
|
-
};
|
|
447
|
-
}, []);
|
|
448
455
|
const onLongPressDraggable = (0, _element.useCallback)(() => {
|
|
449
456
|
// Ensure that no text input is focused when starting the dragging gesture in order to prevent conflicts with text editing.
|
|
450
457
|
_reactNativeAztec.default.InputState.blurCurrentFocusedElement();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/index.native.js"],"names":["CHIP_OFFSET_TO_TOUCH_POSITION","BLOCK_OPACITY_ANIMATION_CONFIG","duration","BLOCK_OPACITY_ANIMATION_DELAY","DEFAULT_LONG_PRESS_MIN_DURATION","DEFAULT_IOS_LONG_PRESS_MIN_DURATION","BlockDraggableWrapper","children","isRTL","draggedBlockIcon","setDraggedBlockIcon","selectBlock","startDraggingBlocks","stopDraggingBlocks","blockEditorStore","scrollRef","animatedScrollRef","left","right","width","safeAreaOffset","contentWidth","scroll","offsetY","chip","x","y","height","currentYPosition","isDragging","startScrolling","scrollOnDragOver","stopScrolling","draggingScrollHandler","scrollHandler","event","contentOffset","value","onBlockDragOver","onBlockDragEnd","onBlockDrop","targetBlockIndex","setDraggedBlockIconByClientId","clientId","blockName","getBlockName","blockIcon","icon","onStartDragging","position","stopDragging","onStopDragging","srcRootClientId","srcClientIds","type","undefined","onChipLayout","nativeEvent","layout","startDragging","id","dragPosition","updateDragging","chipDynamicStyles","chipOffset","translateX","transform","translateY","chipStyles","styles","exitingAnimation","currentHeight","currentWidth","animations","scale","initialValues","onScroll","ZoomInEasyDown","BlockDraggable","draggingClientId","enabled","testID","wasBeingDragged","isEditingText","setIsEditingText","isScreenReaderEnabled","setIsScreenReaderEnabled","draggingAnimation","opacity","startDraggingBlock","stopDraggingBlock","isDraggable","isBeingDragged","isBlockSelected","_select","getBlockRootClientId","getTemplateLock","isBlockBeingDragged","getSelectedBlockClientId","rootClientId","templateLock","selectedBlockClientId","current","onFocusChangeAztec","isFocused","mounted","isAnyAztecInputFocused","RCTAztecView","InputState","addFocusChangeListener","screenReaderChangedListener","AccessibilityInfo","addEventListener","then","screenReaderEnabled","removeFocusChangeListener","remove","onLongPressDraggable","blurCurrentFocusedElement","animatedWrapperStyles","wrapperStyles","canDragBlock","Platform","select","ios","android"],"mappings":";;;;;;;;;AAwBA;;AArBA;;AACA;;AAIA;;AAcA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA5CA;AACA;AACA;;AAiBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAMA,6BAA6B,GAAG,EAAtC;AACA,MAAMC,8BAA8B,GAAG;AAAEC,EAAAA,QAAQ,EAAE;AAAZ,CAAvC;AACA,MAAMC,6BAA6B,GAAG,GAAtC;AACA,MAAMC,+BAA+B,GAAG,GAAxC;AACA,MAAMC,mCAAmC,GACxCD,+BAA+B,GAAG,EADnC;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,qBAAqB,GAAG,QAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AACxD,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,wBAAlD;AAEA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MACL,uBAAaC,YAAb,CADD;AAGA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,4CAAtB;AACA,QAAMC,iBAAiB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BA,CApJD;;eAuJeb,c","sourcesContent":["/**\n * External dependencies\n */\nimport { AccessibilityInfo } from 'react-native';\nimport {\n\tuseSafeAreaInsets,\n\tuseSafeAreaFrame,\n} from 'react-native-safe-area-context';\nimport Animated, {\n\trunOnJS,\n\trunOnUI,\n\tuseAnimatedRef,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithDelay,\n\twithTiming,\n\tZoomInEasyDown,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { Draggable, DraggableTrigger } from '@wordpress/components';\nimport { select, useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tPlatform,\n} from '@wordpress/element';\nimport { getBlockType } from '@wordpress/blocks';\nimport { generateHapticFeedback } from '@wordpress/react-native-bridge';\nimport RCTAztecView from '@wordpress/react-native-aztec';\n\n/**\n * Internal dependencies\n */\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport DraggableChip from './draggable-chip';\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockListContext } from '../block-list/block-list-context';\nimport DroppingInsertionPoint from './dropping-insertion-point';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport styles from './style.scss';\n\nconst CHIP_OFFSET_TO_TOUCH_POSITION = 32;\nconst BLOCK_OPACITY_ANIMATION_CONFIG = { duration: 350 };\nconst BLOCK_OPACITY_ANIMATION_DELAY = 250;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 500;\nconst DEFAULT_IOS_LONG_PRESS_MIN_DURATION =\n\tDEFAULT_LONG_PRESS_MIN_DURATION - 50;\n\n/**\n * Block draggable wrapper component\n *\n * This component handles all the interactions for dragging blocks.\n * It relies on the block list and its context for dragging, hence it\n * should be rendered between the `BlockListProvider` component and the\n * block list rendering. It also requires listening to scroll events,\n * therefore for this purpose, it returns the `onScroll` event handler\n * that should be attached to the list that renders the blocks.\n *\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {boolean} props.isRTL Check if current locale is RTL.\n *\n * @return {Function} Render function that passes `onScroll` event handler.\n */\nconst BlockDraggableWrapper = ( { children, isRTL } ) => {\n\tconst [ draggedBlockIcon, setDraggedBlockIcon ] = useState();\n\n\tconst { selectBlock, startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { scrollRef } = useBlockListContext();\n\tconst animatedScrollRef = useAnimatedRef();\n\tconst { left, right } = useSafeAreaInsets();\n\tconst { width } = useSafeAreaFrame();\n\tconst safeAreaOffset = left + right;\n\tconst contentWidth = width - safeAreaOffset;\n\tanimatedScrollRef( scrollRef );\n\n\tconst scroll = {\n\t\toffsetY: useSharedValue( 0 ),\n\t};\n\tconst chip = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t\twidth: useSharedValue( 0 ),\n\t\theight: useSharedValue( 0 ),\n\t};\n\tconst currentYPosition = useSharedValue( 0 );\n\tconst isDragging = useSharedValue( false );\n\n\tconst [\n\t\tstartScrolling,\n\t\tscrollOnDragOver,\n\t\tstopScrolling,\n\t\tdraggingScrollHandler,\n\t] = useScrollWhenDragging();\n\n\tconst scrollHandler = ( event ) => {\n\t\t'worklet';\n\t\tconst { contentOffset } = event;\n\t\tscroll.offsetY.value = contentOffset.y;\n\n\t\tdraggingScrollHandler( event );\n\t};\n\n\tconst { onBlockDragOver, onBlockDragEnd, onBlockDrop, targetBlockIndex } =\n\t\tuseBlockDropZone();\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.value ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tconst setDraggedBlockIconByClientId = ( clientId ) => {\n\t\tconst blockName = select( blockEditorStore ).getBlockName( clientId );\n\t\tconst blockIcon = getBlockType( blockName )?.icon;\n\t\tif ( blockIcon ) {\n\t\t\tsetDraggedBlockIcon( blockIcon );\n\t\t}\n\t};\n\n\tconst onStartDragging = ( { clientId, position } ) => {\n\t\tif ( clientId ) {\n\t\t\tstartDraggingBlocks( [ clientId ] );\n\t\t\tsetDraggedBlockIconByClientId( clientId );\n\t\t\trunOnUI( startScrolling )( position.y );\n\t\t\tgenerateHapticFeedback();\n\t\t} else {\n\t\t\t// We stop dragging if no block is found.\n\t\t\trunOnUI( stopDragging )();\n\t\t}\n\t};\n\n\tconst onStopDragging = ( { clientId } ) => {\n\t\tif ( clientId ) {\n\t\t\tonBlockDrop( {\n\t\t\t\t// Dropping is only allowed at root level\n\t\t\t\tsrcRootClientId: '',\n\t\t\t\tsrcClientIds: [ clientId ],\n\t\t\t\ttype: 'block',\n\t\t\t} );\n\t\t\tselectBlock( clientId );\n\t\t\tsetDraggedBlockIcon( undefined );\n\t\t}\n\t\tonBlockDragEnd();\n\t\tstopDraggingBlocks();\n\t};\n\n\tconst onChipLayout = ( { nativeEvent: { layout } } ) => {\n\t\tif ( layout.width > 0 ) {\n\t\t\tchip.width.value = layout.width;\n\t\t}\n\t\tif ( layout.height > 0 ) {\n\t\t\tchip.height.value = layout.height;\n\t\t}\n\t};\n\n\tconst startDragging = ( { x, y, id } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\tisDragging.value = true;\n\n\t\trunOnJS( onStartDragging )( { clientId: id, position: dragPosition } );\n\t};\n\n\tconst updateDragging = ( { x, y } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\trunOnJS( onBlockDragOver )( { x, y: y + scroll.offsetY.value } );\n\n\t\t// Update scrolling velocity\n\t\tscrollOnDragOver( dragPosition.y );\n\t};\n\n\tconst stopDragging = ( { id } ) => {\n\t\t'worklet';\n\t\tisDragging.value = false;\n\n\t\tstopScrolling();\n\t\trunOnJS( onStopDragging )( { clientId: id } );\n\t};\n\n\tconst chipDynamicStyles = useAnimatedStyle( () => {\n\t\tconst chipOffset = chip.width.value / 2;\n\t\tconst translateX = ! isRTL\n\t\t\t? chip.x.value - chipOffset\n\t\t\t: -( contentWidth - ( chip.x.value + chipOffset ) );\n\n\t\treturn {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateX,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateY:\n\t\t\t\t\t\tchip.y.value -\n\t\t\t\t\t\tchip.height.value -\n\t\t\t\t\t\tCHIP_OFFSET_TO_TOUCH_POSITION,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t} );\n\tconst chipStyles = [\n\t\tchipDynamicStyles,\n\t\tstyles[ 'draggable-chip__wrapper' ],\n\t];\n\n\tconst exitingAnimation = ( { currentHeight, currentWidth } ) => {\n\t\t'worklet';\n\t\tconst translateX = ! isRTL ? 0 : currentWidth * -1;\n\t\tconst duration = 150;\n\t\tconst animations = {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: withTiming( currentHeight, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateX: withTiming( translateX, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{ scale: withTiming( 0, { duration } ) },\n\t\t\t],\n\t\t};\n\t\tconst initialValues = {\n\t\t\ttransform: [ { translateY: 0 }, { translateX }, { scale: 1 } ],\n\t\t};\n\t\treturn {\n\t\t\tinitialValues,\n\t\t\tanimations,\n\t\t};\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DroppingInsertionPoint\n\t\t\t\tscroll={ scroll }\n\t\t\t\tcurrentYPosition={ currentYPosition }\n\t\t\t\tisDragging={ isDragging }\n\t\t\t\ttargetBlockIndex={ targetBlockIndex }\n\t\t\t/>\n\t\t\t<Draggable\n\t\t\t\tonDragStart={ startDragging }\n\t\t\t\tonDragOver={ updateDragging }\n\t\t\t\tonDragEnd={ stopDragging }\n\t\t\t\ttestID=\"block-draggable-wrapper\"\n\t\t\t>\n\t\t\t\t{ children( { onScroll: scrollHandler } ) }\n\t\t\t</Draggable>\n\t\t\t<Animated.View\n\t\t\t\tonLayout={ onChipLayout }\n\t\t\t\tstyle={ chipStyles }\n\t\t\t\tpointerEvents=\"none\"\n\t\t\t>\n\t\t\t\t{ draggedBlockIcon && (\n\t\t\t\t\t<Animated.View\n\t\t\t\t\t\tentering={ ZoomInEasyDown.duration( 200 ) }\n\t\t\t\t\t\texiting={ exitingAnimation }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DraggableChip icon={ draggedBlockIcon } />\n\t\t\t\t\t</Animated.View>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\n/**\n * Block draggable component\n *\n * This component serves for animating the block when it is being dragged.\n * Hence, it should be wrapped around the rendering of a block.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {string} props.clientId Client id of the block.\n * @param {string} [props.draggingClientId] Client id to use for dragging. If not defined, the value from `clientId` will be used.\n * @param {boolean} [props.enabled] Enables the draggable trigger.\n * @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.\n *\n * @return {Function} Render function which includes the parameter `isDraggable` to determine if the block can be dragged.\n */\nconst BlockDraggable = ( {\n\tclientId,\n\tchildren,\n\tdraggingClientId,\n\tenabled = true,\n\ttestID,\n} ) => {\n\tconst wasBeingDragged = useRef( false );\n\tconst [ isEditingText, setIsEditingText ] = useState( false );\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =\n\t\tuseState( false );\n\n\tconst draggingAnimation = {\n\t\topacity: useSharedValue( 1 ),\n\t};\n\n\tconst startDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withTiming(\n\t\t\t0.4,\n\t\t\tBLOCK_OPACITY_ANIMATION_CONFIG\n\t\t);\n\t};\n\n\tconst stopDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withDelay(\n\t\t\tBLOCK_OPACITY_ANIMATION_DELAY,\n\t\t\twithTiming( 1, BLOCK_OPACITY_ANIMATION_CONFIG )\n\t\t);\n\t};\n\n\tconst { isDraggable, isBeingDragged, isBlockSelected } = useSelect(\n\t\t( _select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = _select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst templateLock = rootClientId\n\t\t\t\t? getTemplateLock( rootClientId )\n\t\t\t\t: null;\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisBeingDragged: isBlockBeingDragged( clientId ),\n\t\t\t\tisDraggable: 'all' !== templateLock,\n\t\t\t\tisBlockSelected:\n\t\t\t\t\tselectedBlockClientId && selectedBlockClientId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isBeingDragged !== wasBeingDragged.current ) {\n\t\t\tif ( isBeingDragged ) {\n\t\t\t\tstartDraggingBlock();\n\t\t\t} else {\n\t\t\t\tstopDraggingBlock();\n\t\t\t}\n\t\t}\n\t\twasBeingDragged.current = isBeingDragged;\n\t}, [ isBeingDragged ] );\n\n\tconst onFocusChangeAztec = useCallback( ( { isFocused } ) => {\n\t\tsetIsEditingText( isFocused );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\tlet mounted = true;\n\n\t\tconst isAnyAztecInputFocused = RCTAztecView.InputState.isFocused();\n\t\tif ( isAnyAztecInputFocused ) {\n\t\t\tsetIsEditingText( isAnyAztecInputFocused );\n\t\t}\n\n\t\tRCTAztecView.InputState.addFocusChangeListener( onFocusChangeAztec );\n\n\t\tconst screenReaderChangedListener = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\tsetIsScreenReaderEnabled\n\t\t);\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tif ( mounted ) {\n\t\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tmounted = false;\n\n\t\t\tRCTAztecView.InputState.removeFocusChangeListener(\n\t\t\t\tonFocusChangeAztec\n\t\t\t);\n\n\t\t\tscreenReaderChangedListener.remove();\n\t\t};\n\t}, [] );\n\n\tconst onLongPressDraggable = useCallback( () => {\n\t\t// Ensure that no text input is focused when starting the dragging gesture in order to prevent conflicts with text editing.\n\t\tRCTAztecView.InputState.blurCurrentFocusedElement();\n\t}, [] );\n\n\tconst animatedWrapperStyles = useAnimatedStyle( () => {\n\t\treturn {\n\t\t\topacity: draggingAnimation.opacity.value,\n\t\t};\n\t} );\n\tconst wrapperStyles = [\n\t\tanimatedWrapperStyles,\n\t\tstyles[ 'draggable-wrapper__container' ],\n\t];\n\n\tconst canDragBlock =\n\t\tenabled &&\n\t\t! isScreenReaderEnabled &&\n\t\t( ! isBlockSelected || ! isEditingText );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { isDraggable: false } );\n\t}\n\n\treturn (\n\t\t<DraggableTrigger\n\t\t\tid={ draggingClientId || clientId }\n\t\t\tenabled={ enabled && canDragBlock }\n\t\t\tminDuration={ Platform.select( {\n\t\t\t\t// On iOS, using a lower min duration than the default\n\t\t\t\t// value prevents the long-press gesture from being\n\t\t\t\t// triggered in underneath elements. This is required to\n\t\t\t\t// prevent enabling text editing when dragging is available.\n\t\t\t\tios: canDragBlock\n\t\t\t\t\t? DEFAULT_IOS_LONG_PRESS_MIN_DURATION\n\t\t\t\t\t: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t\tandroid: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t} ) }\n\t\t\tonLongPress={ onLongPressDraggable }\n\t\t\ttestID={ testID }\n\t\t>\n\t\t\t<Animated.View style={ wrapperStyles }>\n\t\t\t\t{ children( { isDraggable: true } ) }\n\t\t\t</Animated.View>\n\t\t</DraggableTrigger>\n\t);\n};\n\nexport { BlockDraggableWrapper };\nexport default BlockDraggable;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-draggable/index.native.js"],"names":["CHIP_OFFSET_TO_TOUCH_POSITION","BLOCK_OPACITY_ANIMATION_CONFIG","duration","BLOCK_OPACITY_ANIMATION_DELAY","DEFAULT_LONG_PRESS_MIN_DURATION","DEFAULT_IOS_LONG_PRESS_MIN_DURATION","BlockDraggableWrapper","children","isRTL","draggedBlockIcon","setDraggedBlockIcon","selectBlock","startDraggingBlocks","stopDraggingBlocks","blockEditorStore","scrollRef","animatedScrollRef","left","right","width","safeAreaOffset","contentWidth","scroll","offsetY","chip","x","y","height","currentYPosition","isDragging","startScrolling","scrollOnDragOver","stopScrolling","draggingScrollHandler","scrollHandler","event","contentOffset","value","onBlockDragOver","onBlockDragEnd","onBlockDrop","targetBlockIndex","setDraggedBlockIconByClientId","clientId","blockName","getBlockName","blockIcon","icon","onStartDragging","position","stopDragging","onStopDragging","srcRootClientId","srcClientIds","type","undefined","onChipLayout","nativeEvent","layout","startDragging","id","dragPosition","updateDragging","chipDynamicStyles","chipOffset","translateX","transform","translateY","chipStyles","styles","exitingAnimation","currentHeight","currentWidth","animations","scale","initialValues","onScroll","ZoomInEasyDown","useIsScreenReaderEnabled","isScreenReaderEnabled","setIsScreenReaderEnabled","mounted","changeListener","AccessibilityInfo","addEventListener","enabled","then","screenReaderEnabled","remove","useIsEditingText","isEditingText","setIsEditingText","RCTAztecView","InputState","isFocused","onFocusChangeAztec","addFocusChangeListener","removeFocusChangeListener","BlockDraggable","draggingClientId","testID","wasBeingDragged","draggingAnimation","opacity","startDraggingBlock","stopDraggingBlock","isDraggable","isBeingDragged","isBlockSelected","_select","getBlockRootClientId","getTemplateLock","isBlockBeingDragged","getSelectedBlockClientId","rootClientId","templateLock","selectedBlockClientId","current","onLongPressDraggable","blurCurrentFocusedElement","animatedWrapperStyles","wrapperStyles","canDragBlock","Platform","select","ios","android"],"mappings":";;;;;;;;;AAwBA;;AArBA;;AACA;;AAIA;;AAcA;;AACA;;AAQA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AA5CA;AACA;AACA;;AAiBA;AACA;AACA;;AAcA;AACA;AACA;AASA,MAAMA,6BAA6B,GAAG,EAAtC;AACA,MAAMC,8BAA8B,GAAG;AAAEC,EAAAA,QAAQ,EAAE;AAAZ,CAAvC;AACA,MAAMC,6BAA6B,GAAG,GAAtC;AACA,MAAMC,+BAA+B,GAAG,GAAxC;AACA,MAAMC,mCAAmC,GACxCD,+BAA+B,GAAG,EADnC;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAME,qBAAqB,GAAG,QAA2B;AAAA,MAAzB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAyB;AACxD,QAAM,CAAEC,gBAAF,EAAoBC,mBAApB,IAA4C,wBAAlD;AAEA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,mBAAf;AAAoCC,IAAAA;AAApC,MACL,uBAAaC,YAAb,CADD;AAGA,QAAM;AAAEC,IAAAA;AAAF,MAAgB,4CAAtB;AACA,QAAMC,iBAAiB,GAAG,4CAA1B;AACA,QAAM;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,MAAkB,oDAAxB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAY,mDAAlB;AACA,QAAMC,cAAc,GAAGH,IAAI,GAAGC,KAA9B;AACA,QAAMG,YAAY,GAAGF,KAAK,GAAGC,cAA7B;AACAJ,E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from 'react-native';\nimport {\n\tuseSafeAreaInsets,\n\tuseSafeAreaFrame,\n} from 'react-native-safe-area-context';\nimport Animated, {\n\trunOnJS,\n\trunOnUI,\n\tuseAnimatedRef,\n\tuseAnimatedStyle,\n\tuseSharedValue,\n\twithDelay,\n\twithTiming,\n\tZoomInEasyDown,\n} from 'react-native-reanimated';\n\n/**\n * WordPress dependencies\n */\nimport { Draggable, DraggableTrigger } from '@wordpress/components';\nimport { select, useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n\tPlatform,\n} from '@wordpress/element';\nimport { getBlockType } from '@wordpress/blocks';\nimport { generateHapticFeedback } from '@wordpress/react-native-bridge';\nimport RCTAztecView from '@wordpress/react-native-aztec';\n\n/**\n * Internal dependencies\n */\nimport useScrollWhenDragging from './use-scroll-when-dragging';\nimport DraggableChip from './draggable-chip';\nimport { store as blockEditorStore } from '../../store';\nimport { useBlockListContext } from '../block-list/block-list-context';\nimport DroppingInsertionPoint from './dropping-insertion-point';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport styles from './style.scss';\n\nconst CHIP_OFFSET_TO_TOUCH_POSITION = 32;\nconst BLOCK_OPACITY_ANIMATION_CONFIG = { duration: 350 };\nconst BLOCK_OPACITY_ANIMATION_DELAY = 250;\nconst DEFAULT_LONG_PRESS_MIN_DURATION = 500;\nconst DEFAULT_IOS_LONG_PRESS_MIN_DURATION =\n\tDEFAULT_LONG_PRESS_MIN_DURATION - 50;\n\n/**\n * Block draggable wrapper component\n *\n * This component handles all the interactions for dragging blocks.\n * It relies on the block list and its context for dragging, hence it\n * should be rendered between the `BlockListProvider` component and the\n * block list rendering. It also requires listening to scroll events,\n * therefore for this purpose, it returns the `onScroll` event handler\n * that should be attached to the list that renders the blocks.\n *\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {boolean} props.isRTL Check if current locale is RTL.\n *\n * @return {Function} Render function that passes `onScroll` event handler.\n */\nconst BlockDraggableWrapper = ( { children, isRTL } ) => {\n\tconst [ draggedBlockIcon, setDraggedBlockIcon ] = useState();\n\n\tconst { selectBlock, startDraggingBlocks, stopDraggingBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { scrollRef } = useBlockListContext();\n\tconst animatedScrollRef = useAnimatedRef();\n\tconst { left, right } = useSafeAreaInsets();\n\tconst { width } = useSafeAreaFrame();\n\tconst safeAreaOffset = left + right;\n\tconst contentWidth = width - safeAreaOffset;\n\tanimatedScrollRef( scrollRef );\n\n\tconst scroll = {\n\t\toffsetY: useSharedValue( 0 ),\n\t};\n\tconst chip = {\n\t\tx: useSharedValue( 0 ),\n\t\ty: useSharedValue( 0 ),\n\t\twidth: useSharedValue( 0 ),\n\t\theight: useSharedValue( 0 ),\n\t};\n\tconst currentYPosition = useSharedValue( 0 );\n\tconst isDragging = useSharedValue( false );\n\n\tconst [\n\t\tstartScrolling,\n\t\tscrollOnDragOver,\n\t\tstopScrolling,\n\t\tdraggingScrollHandler,\n\t] = useScrollWhenDragging();\n\n\tconst scrollHandler = ( event ) => {\n\t\t'worklet';\n\t\tconst { contentOffset } = event;\n\t\tscroll.offsetY.value = contentOffset.y;\n\n\t\tdraggingScrollHandler( event );\n\t};\n\n\tconst { onBlockDragOver, onBlockDragEnd, onBlockDrop, targetBlockIndex } =\n\t\tuseBlockDropZone();\n\n\t// Stop dragging blocks if the block draggable is unmounted.\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tif ( isDragging.value ) {\n\t\t\t\tstopDraggingBlocks();\n\t\t\t}\n\t\t};\n\t}, [] );\n\n\tconst setDraggedBlockIconByClientId = ( clientId ) => {\n\t\tconst blockName = select( blockEditorStore ).getBlockName( clientId );\n\t\tconst blockIcon = getBlockType( blockName )?.icon;\n\t\tif ( blockIcon ) {\n\t\t\tsetDraggedBlockIcon( blockIcon );\n\t\t}\n\t};\n\n\tconst onStartDragging = ( { clientId, position } ) => {\n\t\tif ( clientId ) {\n\t\t\tstartDraggingBlocks( [ clientId ] );\n\t\t\tsetDraggedBlockIconByClientId( clientId );\n\t\t\trunOnUI( startScrolling )( position.y );\n\t\t\tgenerateHapticFeedback();\n\t\t} else {\n\t\t\t// We stop dragging if no block is found.\n\t\t\trunOnUI( stopDragging )();\n\t\t}\n\t};\n\n\tconst onStopDragging = ( { clientId } ) => {\n\t\tif ( clientId ) {\n\t\t\tonBlockDrop( {\n\t\t\t\t// Dropping is only allowed at root level\n\t\t\t\tsrcRootClientId: '',\n\t\t\t\tsrcClientIds: [ clientId ],\n\t\t\t\ttype: 'block',\n\t\t\t} );\n\t\t\tselectBlock( clientId );\n\t\t\tsetDraggedBlockIcon( undefined );\n\t\t}\n\t\tonBlockDragEnd();\n\t\tstopDraggingBlocks();\n\t};\n\n\tconst onChipLayout = ( { nativeEvent: { layout } } ) => {\n\t\tif ( layout.width > 0 ) {\n\t\t\tchip.width.value = layout.width;\n\t\t}\n\t\tif ( layout.height > 0 ) {\n\t\t\tchip.height.value = layout.height;\n\t\t}\n\t};\n\n\tconst startDragging = ( { x, y, id } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\tisDragging.value = true;\n\n\t\trunOnJS( onStartDragging )( { clientId: id, position: dragPosition } );\n\t};\n\n\tconst updateDragging = ( { x, y } ) => {\n\t\t'worklet';\n\t\tconst dragPosition = { x, y };\n\t\tchip.x.value = dragPosition.x;\n\t\tchip.y.value = dragPosition.y;\n\t\tcurrentYPosition.value = dragPosition.y;\n\n\t\trunOnJS( onBlockDragOver )( { x, y: y + scroll.offsetY.value } );\n\n\t\t// Update scrolling velocity\n\t\tscrollOnDragOver( dragPosition.y );\n\t};\n\n\tconst stopDragging = ( { id } ) => {\n\t\t'worklet';\n\t\tisDragging.value = false;\n\n\t\tstopScrolling();\n\t\trunOnJS( onStopDragging )( { clientId: id } );\n\t};\n\n\tconst chipDynamicStyles = useAnimatedStyle( () => {\n\t\tconst chipOffset = chip.width.value / 2;\n\t\tconst translateX = ! isRTL\n\t\t\t? chip.x.value - chipOffset\n\t\t\t: -( contentWidth - ( chip.x.value + chipOffset ) );\n\n\t\treturn {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateX,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateY:\n\t\t\t\t\t\tchip.y.value -\n\t\t\t\t\t\tchip.height.value -\n\t\t\t\t\t\tCHIP_OFFSET_TO_TOUCH_POSITION,\n\t\t\t\t},\n\t\t\t],\n\t\t};\n\t} );\n\tconst chipStyles = [\n\t\tchipDynamicStyles,\n\t\tstyles[ 'draggable-chip__wrapper' ],\n\t];\n\n\tconst exitingAnimation = ( { currentHeight, currentWidth } ) => {\n\t\t'worklet';\n\t\tconst translateX = ! isRTL ? 0 : currentWidth * -1;\n\t\tconst duration = 150;\n\t\tconst animations = {\n\t\t\ttransform: [\n\t\t\t\t{\n\t\t\t\t\ttranslateY: withTiming( currentHeight, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttranslateX: withTiming( translateX, {\n\t\t\t\t\t\tduration,\n\t\t\t\t\t} ),\n\t\t\t\t},\n\t\t\t\t{ scale: withTiming( 0, { duration } ) },\n\t\t\t],\n\t\t};\n\t\tconst initialValues = {\n\t\t\ttransform: [ { translateY: 0 }, { translateX }, { scale: 1 } ],\n\t\t};\n\t\treturn {\n\t\t\tinitialValues,\n\t\t\tanimations,\n\t\t};\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<DroppingInsertionPoint\n\t\t\t\tscroll={ scroll }\n\t\t\t\tcurrentYPosition={ currentYPosition }\n\t\t\t\tisDragging={ isDragging }\n\t\t\t\ttargetBlockIndex={ targetBlockIndex }\n\t\t\t/>\n\t\t\t<Draggable\n\t\t\t\tonDragStart={ startDragging }\n\t\t\t\tonDragOver={ updateDragging }\n\t\t\t\tonDragEnd={ stopDragging }\n\t\t\t\ttestID=\"block-draggable-wrapper\"\n\t\t\t>\n\t\t\t\t{ children( { onScroll: scrollHandler } ) }\n\t\t\t</Draggable>\n\t\t\t<Animated.View\n\t\t\t\tonLayout={ onChipLayout }\n\t\t\t\tstyle={ chipStyles }\n\t\t\t\tpointerEvents=\"none\"\n\t\t\t>\n\t\t\t\t{ draggedBlockIcon && (\n\t\t\t\t\t<Animated.View\n\t\t\t\t\t\tentering={ ZoomInEasyDown.duration( 200 ) }\n\t\t\t\t\t\texiting={ exitingAnimation }\n\t\t\t\t\t>\n\t\t\t\t\t\t<DraggableChip icon={ draggedBlockIcon } />\n\t\t\t\t\t</Animated.View>\n\t\t\t\t) }\n\t\t\t</Animated.View>\n\t\t</>\n\t);\n};\n\nfunction useIsScreenReaderEnabled() {\n\tconst [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =\n\t\tuseState( false );\n\n\tuseEffect( () => {\n\t\tlet mounted = true;\n\n\t\tconst changeListener = AccessibilityInfo.addEventListener(\n\t\t\t'screenReaderChanged',\n\t\t\t( enabled ) => setIsScreenReaderEnabled( enabled )\n\t\t);\n\n\t\tAccessibilityInfo.isScreenReaderEnabled().then(\n\t\t\t( screenReaderEnabled ) => {\n\t\t\t\tif ( mounted && screenReaderEnabled ) {\n\t\t\t\t\tsetIsScreenReaderEnabled( screenReaderEnabled );\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\n\t\treturn () => {\n\t\t\tmounted = false;\n\n\t\t\tchangeListener.remove();\n\t\t};\n\t}, [] );\n\n\treturn isScreenReaderEnabled;\n}\n\nfunction useIsEditingText() {\n\tconst [ isEditingText, setIsEditingText ] = useState( () =>\n\t\tRCTAztecView.InputState.isFocused()\n\t);\n\n\tuseEffect( () => {\n\t\tconst onFocusChangeAztec = ( { isFocused } ) => {\n\t\t\tsetIsEditingText( isFocused );\n\t\t};\n\n\t\tRCTAztecView.InputState.addFocusChangeListener( onFocusChangeAztec );\n\n\t\treturn () => {\n\t\t\tRCTAztecView.InputState.removeFocusChangeListener(\n\t\t\t\tonFocusChangeAztec\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\treturn isEditingText;\n}\n\n/**\n * Block draggable component\n *\n * This component serves for animating the block when it is being dragged.\n * Hence, it should be wrapped around the rendering of a block.\n *\n * @param {Object} props Component props.\n * @param {JSX.Element} props.children Children to be rendered.\n * @param {string} props.clientId Client id of the block.\n * @param {string} [props.draggingClientId] Client id to use for dragging. If not defined, the value from `clientId` will be used.\n * @param {boolean} [props.enabled] Enables the draggable trigger.\n * @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.\n *\n * @return {Function} Render function which includes the parameter `isDraggable` to determine if the block can be dragged.\n */\nconst BlockDraggable = ( {\n\tclientId,\n\tchildren,\n\tdraggingClientId,\n\tenabled = true,\n\ttestID,\n} ) => {\n\tconst wasBeingDragged = useRef( false );\n\tconst isEditingText = useIsEditingText();\n\tconst isScreenReaderEnabled = useIsScreenReaderEnabled();\n\n\tconst draggingAnimation = {\n\t\topacity: useSharedValue( 1 ),\n\t};\n\n\tconst startDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withTiming(\n\t\t\t0.4,\n\t\t\tBLOCK_OPACITY_ANIMATION_CONFIG\n\t\t);\n\t};\n\n\tconst stopDraggingBlock = () => {\n\t\tdraggingAnimation.opacity.value = withDelay(\n\t\t\tBLOCK_OPACITY_ANIMATION_DELAY,\n\t\t\twithTiming( 1, BLOCK_OPACITY_ANIMATION_CONFIG )\n\t\t);\n\t};\n\n\tconst { isDraggable, isBeingDragged, isBlockSelected } = useSelect(\n\t\t( _select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetTemplateLock,\n\t\t\t\tisBlockBeingDragged,\n\t\t\t\tgetSelectedBlockClientId,\n\t\t\t} = _select( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\tconst templateLock = rootClientId\n\t\t\t\t? getTemplateLock( rootClientId )\n\t\t\t\t: null;\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\n\t\t\treturn {\n\t\t\t\tisBeingDragged: isBlockBeingDragged( clientId ),\n\t\t\t\tisDraggable: 'all' !== templateLock,\n\t\t\t\tisBlockSelected:\n\t\t\t\t\tselectedBlockClientId && selectedBlockClientId === clientId,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( isBeingDragged !== wasBeingDragged.current ) {\n\t\t\tif ( isBeingDragged ) {\n\t\t\t\tstartDraggingBlock();\n\t\t\t} else {\n\t\t\t\tstopDraggingBlock();\n\t\t\t}\n\t\t}\n\t\twasBeingDragged.current = isBeingDragged;\n\t}, [ isBeingDragged ] );\n\n\tconst onLongPressDraggable = useCallback( () => {\n\t\t// Ensure that no text input is focused when starting the dragging gesture in order to prevent conflicts with text editing.\n\t\tRCTAztecView.InputState.blurCurrentFocusedElement();\n\t}, [] );\n\n\tconst animatedWrapperStyles = useAnimatedStyle( () => {\n\t\treturn {\n\t\t\topacity: draggingAnimation.opacity.value,\n\t\t};\n\t} );\n\tconst wrapperStyles = [\n\t\tanimatedWrapperStyles,\n\t\tstyles[ 'draggable-wrapper__container' ],\n\t];\n\n\tconst canDragBlock =\n\t\tenabled &&\n\t\t! isScreenReaderEnabled &&\n\t\t( ! isBlockSelected || ! isEditingText );\n\n\tif ( ! isDraggable ) {\n\t\treturn children( { isDraggable: false } );\n\t}\n\n\treturn (\n\t\t<DraggableTrigger\n\t\t\tid={ draggingClientId || clientId }\n\t\t\tenabled={ enabled && canDragBlock }\n\t\t\tminDuration={ Platform.select( {\n\t\t\t\t// On iOS, using a lower min duration than the default\n\t\t\t\t// value prevents the long-press gesture from being\n\t\t\t\t// triggered in underneath elements. This is required to\n\t\t\t\t// prevent enabling text editing when dragging is available.\n\t\t\t\tios: canDragBlock\n\t\t\t\t\t? DEFAULT_IOS_LONG_PRESS_MIN_DURATION\n\t\t\t\t\t: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t\tandroid: DEFAULT_LONG_PRESS_MIN_DURATION,\n\t\t\t} ) }\n\t\t\tonLongPress={ onLongPressDraggable }\n\t\t\ttestID={ testID }\n\t\t>\n\t\t\t<Animated.View style={ wrapperStyles }>\n\t\t\t\t{ children( { isDraggable: true } ) }\n\t\t\t</Animated.View>\n\t\t</DraggableTrigger>\n\t);\n};\n\nexport { BlockDraggableWrapper };\nexport default BlockDraggable;\n"]}
|
|
@@ -13,8 +13,6 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
16
|
var _components = require("@wordpress/components");
|
|
19
17
|
|
|
20
18
|
var _blocks = require("@wordpress/blocks");
|
|
@@ -52,7 +50,10 @@ const Edit = props => {
|
|
|
52
50
|
const blockContext = (0, _element.useContext)(_blockContext.default); // Assign context values using the block type's declared context needs.
|
|
53
51
|
|
|
54
52
|
const context = (0, _element.useMemo)(() => {
|
|
55
|
-
return blockType && blockType.usesContext ? (
|
|
53
|
+
return blockType && blockType.usesContext ? Object.fromEntries(Object.entries(blockContext).filter(_ref => {
|
|
54
|
+
let [key] = _ref;
|
|
55
|
+
return blockType.usesContext.includes(key);
|
|
56
|
+
})) : DEFAULT_BLOCK_CONTEXT;
|
|
56
57
|
}, [blockType, blockContext]);
|
|
57
58
|
|
|
58
59
|
if (!blockType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-edit/edit.js"],"names":["DEFAULT_BLOCK_CONTEXT","Edit","props","attributes","name","blockType","blockContext","BlockContext","context","usesContext","Component","edit","save","apiVersion","generatedClassName","className"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-edit/edit.js"],"names":["DEFAULT_BLOCK_CONTEXT","Edit","props","attributes","name","blockType","blockContext","BlockContext","context","usesContext","Object","fromEntries","entries","filter","key","includes","Component","edit","save","apiVersion","generatedClassName","className"],"mappings":";;;;;;;;;AAcA;;;;AAXA;;AAKA;;AACA;;AAUA;;AAnBA;AACA;AACA;;AAGA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG,EAA9B;;AAEO,MAAMC,IAAI,GAAKC,KAAF,IAAa;AAChC,QAAM;AAAEC,IAAAA,UAAU,GAAG,EAAf;AAAmBC,IAAAA;AAAnB,MAA4BF,KAAlC;AACA,QAAMG,SAAS,GAAG,0BAAcD,IAAd,CAAlB;AACA,QAAME,YAAY,GAAG,yBAAYC,qBAAZ,CAArB,CAHgC,CAKhC;;AACA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,WAAOH,SAAS,IAAIA,SAAS,CAACI,WAAvB,GACJC,MAAM,CAACC,WAAP,CACAD,MAAM,CAACE,OAAP,CAAgBN,YAAhB,EAA+BO,MAA/B,CAAuC;AAAA,UAAE,CAAEC,GAAF,CAAF;AAAA,aACtCT,SAAS,CAACI,WAAV,CAAsBM,QAAtB,CAAgCD,GAAhC,CADsC;AAAA,KAAvC,CADA,CADI,GAMJd,qBANH;AAOA,GARe,EAQb,CAAEK,SAAF,EAAaC,YAAb,CARa,CAAhB;;AAUA,MAAK,CAAED,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA,GAlB+B,CAoBhC;AACA;AACA;;;AACA,QAAMW,SAAS,GAAGX,SAAS,CAACY,IAAV,IAAkBZ,SAAS,CAACa,IAA9C;;AAEA,MAAKb,SAAS,CAACc,UAAV,GAAuB,CAA5B,EAAgC;AAC/B,WAAO,4BAAC,SAAD,6BAAgBjB,KAAhB;AAAwB,MAAA,OAAO,EAAGM;AAAlC,OAAP;AACA,GA3B+B,CA6BhC;;;AACA,QAAMY,kBAAkB,GAAG,6BAAiBf,SAAjB,EAA4B,WAA5B,EAAyC,IAAzC,IACxB,sCAA0BD,IAA1B,CADwB,GAExB,IAFH;AAGA,QAAMiB,SAAS,GAAG,yBACjBD,kBADiB,EAEjBjB,UAAU,CAACkB,SAFM,EAGjBnB,KAAK,CAACmB,SAHW,CAAlB;AAMA,SACC,4BAAC,SAAD,6BAAgBnB,KAAhB;AAAwB,IAAA,OAAO,EAAGM,OAAlC;AAA4C,IAAA,SAAS,EAAGa;AAAxD,KADD;AAGA,CA1CM;;;;eA4CQ,6BAAa,kBAAb,EAAmCpB,IAAnC,C","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { withFilters } from '@wordpress/components';\nimport {\n\tgetBlockDefaultClassName,\n\thasBlockSupport,\n\tgetBlockType,\n} from '@wordpress/blocks';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockContext from '../block-context';\n\n/**\n * Default value used for blocks which do not define their own context needs,\n * used to guarantee that a block's `context` prop will always be an object. It\n * is assigned as a constant since it is always expected to be an empty object,\n * and in order to avoid unnecessary React reconciliations of a changing object.\n *\n * @type {{}}\n */\nconst DEFAULT_BLOCK_CONTEXT = {};\n\nexport const Edit = ( props ) => {\n\tconst { attributes = {}, name } = props;\n\tconst blockType = getBlockType( name );\n\tconst blockContext = useContext( BlockContext );\n\n\t// Assign context values using the block type's declared context needs.\n\tconst context = useMemo( () => {\n\t\treturn blockType && blockType.usesContext\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries( blockContext ).filter( ( [ key ] ) =>\n\t\t\t\t\t\tblockType.usesContext.includes( key )\n\t\t\t\t\t)\n\t\t\t )\n\t\t\t: DEFAULT_BLOCK_CONTEXT;\n\t}, [ blockType, blockContext ] );\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\t// `edit` and `save` are functions or components describing the markup\n\t// with which a block is displayed. If `blockType` is valid, assign\n\t// them preferentially as the render value for the block.\n\tconst Component = blockType.edit || blockType.save;\n\n\tif ( blockType.apiVersion > 1 ) {\n\t\treturn <Component { ...props } context={ context } />;\n\t}\n\n\t// Generate a class name for the block's editable form.\n\tconst generatedClassName = hasBlockSupport( blockType, 'className', true )\n\t\t? getBlockDefaultClassName( name )\n\t\t: null;\n\tconst className = classnames(\n\t\tgeneratedClassName,\n\t\tattributes.className,\n\t\tprops.className\n\t);\n\n\treturn (\n\t\t<Component { ...props } context={ context } className={ className } />\n\t);\n};\n\nexport default withFilters( 'editor.BlockEdit' )( Edit );\n"]}
|
|
@@ -11,18 +11,12 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
-
var _lodash = require("lodash");
|
|
15
|
-
|
|
16
14
|
var _components = require("@wordpress/components");
|
|
17
15
|
|
|
18
16
|
var _blocks = require("@wordpress/blocks");
|
|
19
17
|
|
|
20
18
|
var _blockContext = _interopRequireDefault(require("../block-context"));
|
|
21
19
|
|
|
22
|
-
/**
|
|
23
|
-
* External dependencies
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
20
|
/**
|
|
27
21
|
* WordPress dependencies
|
|
28
22
|
*/
|
|
@@ -49,7 +43,10 @@ const Edit = props => {
|
|
|
49
43
|
const blockContext = (0, _element.useContext)(_blockContext.default); // Assign context values using the block type's declared context needs.
|
|
50
44
|
|
|
51
45
|
const context = (0, _element.useMemo)(() => {
|
|
52
|
-
return blockType && blockType.usesContext ? (
|
|
46
|
+
return blockType && blockType.usesContext ? Object.fromEntries(Object.entries(blockContext).filter(_ref => {
|
|
47
|
+
let [key] = _ref;
|
|
48
|
+
return blockType.usesContext.includes(key);
|
|
49
|
+
})) : DEFAULT_BLOCK_CONTEXT;
|
|
53
50
|
}, [blockType, blockContext]);
|
|
54
51
|
|
|
55
52
|
if (!blockType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-edit/edit.native.js"],"names":["DEFAULT_BLOCK_CONTEXT","Edit","props","name","blockType","blockContext","BlockContext","context","usesContext","Component","edit"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-edit/edit.native.js"],"names":["DEFAULT_BLOCK_CONTEXT","Edit","props","name","blockType","blockContext","BlockContext","context","usesContext","Object","fromEntries","entries","filter","key","includes","Component","edit"],"mappings":";;;;;;;;;AAKA;;;;AAFA;;AACA;;AAMA;;AAVA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,qBAAqB,GAAG,EAA9B;;AAEO,MAAMC,IAAI,GAAKC,KAAF,IAAa;AAChC,QAAM;AAAEC,IAAAA;AAAF,MAAWD,KAAjB;AACA,QAAME,SAAS,GAAG,0BAAcD,IAAd,CAAlB;AAEA,QAAME,YAAY,GAAG,yBAAYC,qBAAZ,CAArB,CAJgC,CAMhC;;AACA,QAAMC,OAAO,GAAG,sBAAS,MAAM;AAC9B,WAAOH,SAAS,IAAIA,SAAS,CAACI,WAAvB,GACJC,MAAM,CAACC,WAAP,CACAD,MAAM,CAACE,OAAP,CAAgBN,YAAhB,EAA+BO,MAA/B,CAAuC;AAAA,UAAE,CAAEC,GAAF,CAAF;AAAA,aACtCT,SAAS,CAACI,WAAV,CAAsBM,QAAtB,CAAgCD,GAAhC,CADsC;AAAA,KAAvC,CADA,CADI,GAMJb,qBANH;AAOA,GARe,EAQb,CAAEI,SAAF,EAAaC,YAAb,CARa,CAAhB;;AAUA,MAAK,CAAED,SAAP,EAAmB;AAClB,WAAO,IAAP;AACA;;AAED,QAAMW,SAAS,GAAGX,SAAS,CAACY,IAA5B;AAEA,SAAO,4BAAC,SAAD,6BAAgBd,KAAhB;AAAwB,IAAA,OAAO,EAAGK;AAAlC,KAAP;AACA,CAxBM;;;;eA0BQ,6BAAa,kBAAb,EAAmCN,IAAnC,C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { withFilters } from '@wordpress/components';\nimport { getBlockType } from '@wordpress/blocks';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockContext from '../block-context';\n\n/**\n * Default value used for blocks which do not define their own context needs,\n * used to guarantee that a block's `context` prop will always be an object. It\n * is assigned as a constant since it is always expected to be an empty object,\n * and in order to avoid unnecessary React reconciliations of a changing object.\n *\n * @type {{}}\n */\nconst DEFAULT_BLOCK_CONTEXT = {};\n\nexport const Edit = ( props ) => {\n\tconst { name } = props;\n\tconst blockType = getBlockType( name );\n\n\tconst blockContext = useContext( BlockContext );\n\n\t// Assign context values using the block type's declared context needs.\n\tconst context = useMemo( () => {\n\t\treturn blockType && blockType.usesContext\n\t\t\t? Object.fromEntries(\n\t\t\t\t\tObject.entries( blockContext ).filter( ( [ key ] ) =>\n\t\t\t\t\t\tblockType.usesContext.includes( key )\n\t\t\t\t\t)\n\t\t\t )\n\t\t\t: DEFAULT_BLOCK_CONTEXT;\n\t}, [ blockType, blockContext ] );\n\n\tif ( ! blockType ) {\n\t\treturn null;\n\t}\n\n\tconst Component = blockType.edit;\n\n\treturn <Component { ...props } context={ context } />;\n};\n\nexport default withFilters( 'editor.BlockEdit' )( Edit );\n"]}
|