@wordpress/block-editor 15.21.0 → 15.22.1-next.v.202606191442.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 +23 -1
- package/build/components/block-card/index.cjs +4 -5
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-compare/index.cjs +2 -2
- package/build/components/block-compare/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +3 -4
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-mover/mover-description.cjs +6 -6
- package/build/components/block-mover/mover-description.cjs.map +1 -1
- package/build/components/block-patterns-list/index.cjs +1 -1
- package/build/components/block-patterns-list/index.cjs.map +2 -2
- package/build/components/block-patterns-paging/index.cjs +4 -4
- package/build/components/block-patterns-paging/index.cjs.map +2 -2
- package/build/components/block-popover/use-popover-scroll.cjs.map +1 -1
- package/build/components/block-quick-navigation/index.cjs +7 -5
- package/build/components/block-quick-navigation/index.cjs.map +2 -2
- package/build/components/block-switcher/block-transformations-menu.cjs +16 -15
- package/build/components/block-switcher/block-transformations-menu.cjs.map +2 -2
- package/build/components/block-switcher/index.cjs +4 -4
- package/build/components/block-switcher/index.cjs.map +2 -2
- package/build/components/block-toolbar/edit-section-button.cjs.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs +10 -4
- package/build/components/block-tools/use-block-toolbar-popover-props.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs +51 -19
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +4 -5
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/scale-tool.cjs +1 -1
- package/build/components/dimensions-tool/scale-tool.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +23 -15
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/background-panel.cjs +2 -2
- package/build/components/global-styles/background-panel.cjs.map +2 -2
- package/build/components/global-styles/border-panel.cjs +2 -0
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +2 -2
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/grid/grid-item-resizer.cjs.map +1 -1
- package/build/components/grid/grid-visualizer.cjs.map +1 -1
- package/build/components/iframe/index.cjs +6 -3
- package/build/components/iframe/index.cjs.map +3 -3
- package/build/components/image-editor/use-transform-image.cjs.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +3 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +2 -2
- package/build/components/inserter/get-appender-label.cjs.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs +1 -1
- package/build/components/inserter/hooks/use-patterns-state.cjs.map +2 -2
- package/build/components/inserter/index.cjs +179 -220
- package/build/components/inserter/index.cjs.map +3 -3
- package/build/components/inserter/media-tab/media-preview.cjs.map +2 -2
- package/build/components/inserter/search-items.cjs.map +1 -1
- package/build/components/inserter/search-results.cjs +1 -1
- package/build/components/inserter/search-results.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +1 -3
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/line-height-control/index.cjs.map +1 -1
- package/build/components/link-control/index.cjs +1 -1
- package/build/components/link-control/index.cjs.map +1 -1
- package/build/components/link-control/normalize-url.cjs.map +1 -1
- package/build/components/list-view/block-select-button.cjs +10 -12
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +2 -1
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/list-view/utils.cjs.map +1 -1
- package/build/components/preset-input-control/custom-value-controls.cjs.map +2 -2
- package/build/components/provider/index.cjs.map +1 -1
- package/build/components/provider/use-block-sync.cjs +11 -2
- package/build/components/provider/use-block-sync.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/before-input-rules.cjs +5 -5
- package/build/components/rich-text/event-listeners/before-input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/delete.cjs +4 -4
- package/build/components/rich-text/event-listeners/delete.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/enter.cjs +7 -2
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/input-events.cjs +4 -4
- package/build/components/rich-text/event-listeners/input-events.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/input-rules.cjs +17 -4
- package/build/components/rich-text/event-listeners/input-rules.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs +4 -4
- package/build/components/rich-text/event-listeners/insert-replacement-text.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/paste-handler.cjs.map +1 -1
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/remove-browser-shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/shortcuts.cjs +4 -4
- package/build/components/rich-text/event-listeners/shortcuts.cjs.map +3 -3
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs +4 -4
- package/build/components/rich-text/event-listeners/undo-automatic-change.cjs.map +3 -3
- package/build/components/rich-text/index.cjs +1 -23
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/prevent-event-discovery.cjs +1 -1
- package/build/components/rich-text/prevent-event-discovery.cjs.map +1 -1
- package/build/components/use-block-commands/index.cjs +5 -5
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/components/writing-flow/use-tab-nav.cjs.map +1 -1
- package/build/hooks/anchor.cjs +12 -16
- package/build/hooks/anchor.cjs.map +2 -2
- package/build/hooks/background.cjs.map +1 -1
- package/build/hooks/block-fields/index.cjs +13 -2
- package/build/hooks/block-fields/index.cjs.map +2 -2
- package/build/hooks/border.cjs +0 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/color.cjs +1 -4
- package/build/hooks/color.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +13 -5
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/fit-text.cjs +11 -0
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +27 -2
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/list-view.cjs +10 -7
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/position.cjs +19 -22
- package/build/hooks/position.cjs.map +2 -2
- package/build/hooks/spacing-visualizer.cjs.map +1 -1
- package/build/hooks/state-utils.cjs.map +1 -1
- package/build/hooks/style.cjs +42 -2
- package/build/hooks/style.cjs.map +2 -2
- package/build/hooks/supports.cjs +0 -7
- package/build/hooks/supports.cjs.map +2 -2
- package/build/private-apis.cjs +4 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +7 -3
- package/build/store/actions.cjs.map +2 -2
- package/build/store/private-actions.cjs +1 -2
- package/build/store/private-actions.cjs.map +2 -2
- package/build/store/private-selectors.cjs +42 -2
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/store/reducer.cjs +14 -6
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +60 -41
- package/build/store/selectors.cjs.map +2 -2
- package/build/utils/dom.cjs.map +1 -1
- package/build/utils/selection.cjs +1 -1
- package/build-module/components/block-card/index.mjs +5 -6
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-compare/index.mjs +1 -1
- package/build-module/components/block-compare/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +3 -5
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-mover/mover-description.mjs +6 -6
- package/build-module/components/block-mover/mover-description.mjs.map +1 -1
- package/build-module/components/block-patterns-list/index.mjs +1 -1
- package/build-module/components/block-patterns-list/index.mjs.map +2 -2
- package/build-module/components/block-patterns-paging/index.mjs +4 -4
- package/build-module/components/block-patterns-paging/index.mjs.map +2 -2
- package/build-module/components/block-popover/use-popover-scroll.mjs.map +1 -1
- package/build-module/components/block-quick-navigation/index.mjs +8 -6
- package/build-module/components/block-quick-navigation/index.mjs.map +2 -2
- package/build-module/components/block-switcher/block-transformations-menu.mjs +16 -15
- package/build-module/components/block-switcher/block-transformations-menu.mjs.map +2 -2
- package/build-module/components/block-switcher/index.mjs +4 -4
- package/build-module/components/block-switcher/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/edit-section-button.mjs.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs +10 -4
- package/build-module/components/block-tools/use-block-toolbar-popover-props.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +51 -19
- package/build-module/components/child-layout-control/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +4 -5
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/scale-tool.mjs +1 -1
- package/build-module/components/dimensions-tool/scale-tool.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +23 -15
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/background-panel.mjs +3 -3
- package/build-module/components/global-styles/background-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -0
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +3 -4
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/grid/grid-item-resizer.mjs.map +1 -1
- package/build-module/components/grid/grid-visualizer.mjs.map +1 -1
- package/build-module/components/iframe/index.mjs +6 -3
- package/build-module/components/iframe/index.mjs.map +2 -2
- package/build-module/components/image-editor/use-transform-image.mjs.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +3 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +2 -2
- package/build-module/components/inserter/get-appender-label.mjs.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.mjs.map +2 -2
- package/build-module/components/inserter/index.mjs +185 -222
- package/build-module/components/inserter/index.mjs.map +3 -3
- package/build-module/components/inserter/media-tab/media-preview.mjs.map +2 -2
- package/build-module/components/inserter/search-items.mjs.map +1 -1
- package/build-module/components/inserter/search-results.mjs +1 -1
- package/build-module/components/inserter/search-results.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +1 -3
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -1
- package/build-module/components/line-height-control/index.mjs.map +1 -1
- package/build-module/components/link-control/index.mjs +1 -1
- package/build-module/components/link-control/index.mjs.map +1 -1
- package/build-module/components/link-control/normalize-url.mjs.map +1 -1
- package/build-module/components/list-view/block-select-button.mjs +10 -12
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +2 -1
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs.map +1 -1
- package/build-module/components/preset-input-control/custom-value-controls.mjs.map +2 -2
- package/build-module/components/provider/index.mjs.map +1 -1
- package/build-module/components/provider/use-block-sync.mjs +11 -2
- package/build-module/components/provider/use-block-sync.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs +5 -5
- package/build-module/components/rich-text/event-listeners/before-input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/delete.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/delete.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +7 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-events.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/input-events.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/input-rules.mjs +17 -4
- package/build-module/components/rich-text/event-listeners/input-rules.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/insert-replacement-text.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/paste-handler.mjs.map +1 -1
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/remove-browser-shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/shortcuts.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs +4 -4
- package/build-module/components/rich-text/event-listeners/undo-automatic-change.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -23
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/prevent-event-discovery.mjs +1 -1
- package/build-module/components/rich-text/prevent-event-discovery.mjs.map +1 -1
- package/build-module/components/use-block-commands/index.mjs +5 -5
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/components/writing-flow/use-tab-nav.mjs.map +1 -1
- package/build-module/hooks/anchor.mjs +12 -16
- package/build-module/hooks/anchor.mjs.map +2 -2
- package/build-module/hooks/background.mjs.map +1 -1
- package/build-module/hooks/block-fields/index.mjs +13 -2
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/border.mjs +1 -4
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/color.mjs +2 -5
- package/build-module/hooks/color.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +13 -6
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/fit-text.mjs +11 -0
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +27 -2
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -7
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/position.mjs +20 -23
- package/build-module/hooks/position.mjs.map +2 -2
- package/build-module/hooks/spacing-visualizer.mjs.map +1 -1
- package/build-module/hooks/state-utils.mjs.map +1 -1
- package/build-module/hooks/style.mjs +44 -3
- package/build-module/hooks/style.mjs.map +2 -2
- package/build-module/hooks/supports.mjs +0 -7
- package/build-module/hooks/supports.mjs.map +2 -2
- package/build-module/private-apis.mjs +8 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +7 -3
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/private-actions.mjs +1 -2
- package/build-module/store/private-actions.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +39 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +14 -6
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +62 -42
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-module/utils/dom.mjs.map +1 -1
- package/build-module/utils/selection.mjs +1 -1
- package/build-style/content-rtl.css +12 -0
- package/build-style/content.css +12 -0
- package/build-style/style-rtl.css +26 -8
- package/build-style/style.css +26 -8
- package/package.json +54 -46
- package/src/components/block-breadcrumb/README.md +2 -2
- package/src/components/block-card/index.js +7 -13
- package/src/components/block-compare/README.md +6 -6
- package/src/components/block-compare/index.js +1 -3
- package/src/components/block-inspector/index.js +2 -10
- package/src/components/block-patterns-list/index.js +1 -2
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-quick-navigation/index.js +7 -7
- package/src/components/block-switcher/block-transformations-menu.js +16 -18
- package/src/components/block-switcher/index.js +4 -4
- package/src/components/block-tools/use-block-toolbar-popover-props.js +10 -4
- package/src/components/block-types-list/README.md +0 -19
- package/src/components/child-layout-control/index.js +65 -20
- package/src/components/child-layout-control/test/index.js +64 -0
- package/src/components/dimensions-tool/index.js +4 -9
- package/src/components/dimensions-tool/scale-tool.js +1 -2
- package/src/components/dimensions-tool/test/index.js +89 -11
- package/src/components/global-styles/advanced-panel.js +5 -1
- package/src/components/global-styles/background-panel.js +3 -3
- package/src/components/global-styles/border-panel.js +2 -0
- package/src/components/global-styles/dimensions-panel.js +13 -15
- package/src/components/global-styles/shadow-panel-components.js +0 -1
- package/src/components/iframe/index.js +8 -3
- package/src/components/inner-blocks/use-inner-block-template-sync.js +3 -1
- package/src/components/inserter/hooks/use-patterns-state.js +1 -1
- package/src/components/inserter/index.js +257 -288
- package/src/components/inserter/media-tab/media-preview.js +0 -1
- package/src/components/inserter/search-results.js +1 -3
- package/src/components/inspector-controls/fill.js +6 -8
- package/src/components/inspector-controls-tabs/index.js +0 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +5 -1
- package/src/components/justify-content-control/README.md +1 -1
- package/src/components/list-view/block-select-button.js +9 -14
- package/src/components/list-view/block.js +1 -0
- package/src/components/media-placeholder/README.md +1 -29
- package/src/components/media-upload/README.md +0 -19
- package/src/components/preset-input-control/custom-value-controls.js +0 -1
- package/src/components/provider/test/use-block-sync.js +40 -0
- package/src/components/provider/use-block-sync.js +12 -2
- package/src/components/rich-text/event-listeners/before-input-rules.js +5 -4
- package/src/components/rich-text/event-listeners/delete.js +9 -4
- package/src/components/rich-text/event-listeners/enter.js +9 -2
- package/src/components/rich-text/event-listeners/input-events.js +13 -4
- package/src/components/rich-text/event-listeners/input-rules.js +20 -4
- package/src/components/rich-text/event-listeners/insert-replacement-text.js +9 -4
- package/src/components/rich-text/event-listeners/remove-browser-shortcuts.js +9 -4
- package/src/components/rich-text/event-listeners/shortcuts.js +13 -4
- package/src/components/rich-text/event-listeners/undo-automatic-change.js +5 -4
- package/src/components/rich-text/index.js +1 -33
- package/src/components/unit-control/README.md +1 -1
- package/src/components/url-popover/README.md +1 -1
- package/src/components/use-block-commands/index.js +5 -5
- package/src/hooks/anchor.js +9 -17
- package/src/hooks/block-fields/index.js +27 -2
- package/src/hooks/border.js +1 -5
- package/src/hooks/color.js +1 -6
- package/src/hooks/dimensions.js +15 -8
- package/src/hooks/fit-text.js +16 -0
- package/src/hooks/layout-child.js +41 -2
- package/src/hooks/list-view.js +10 -11
- package/src/hooks/position.js +23 -27
- package/src/hooks/style.js +80 -2
- package/src/hooks/supports.js +0 -9
- package/src/hooks/test/dimensions.js +71 -0
- package/src/hooks/test/layout-child.js +165 -0
- package/src/hooks/test/style.js +126 -4
- package/src/private-apis.js +8 -0
- package/src/store/actions.js +13 -3
- package/src/store/private-actions.js +1 -4
- package/src/store/private-selectors.js +89 -0
- package/src/store/reducer.js +19 -7
- package/src/store/selectors.js +91 -53
- package/src/store/test/actions.js +21 -0
- package/src/store/test/private-selectors.js +138 -0
- package/src/store/test/reducer.js +46 -0
- package/src/store/test/selectors.js +77 -0
- package/build/components/media-upload-progress/constants.cjs +0 -46
- package/build/components/media-upload-progress/constants.cjs.map +0 -7
- package/build/components/rich-text/native/format-edit.cjs +0 -60
- package/build/components/rich-text/native/format-edit.cjs.map +0 -7
- package/build/components/rich-text/native/index.cjs +0 -28
- package/build/components/rich-text/native/index.cjs.map +0 -7
- package/build/components/rich-text/native/use-format-types.cjs +0 -139
- package/build/components/rich-text/native/use-format-types.cjs.map +0 -7
- package/build-module/components/media-upload-progress/constants.mjs +0 -16
- package/build-module/components/media-upload-progress/constants.mjs.map +0 -7
- package/build-module/components/rich-text/native/format-edit.mjs +0 -39
- package/build-module/components/rich-text/native/format-edit.mjs.map +0 -7
- package/build-module/components/rich-text/native/index.mjs +0 -7
- package/build-module/components/rich-text/native/index.mjs.map +0 -7
- package/build-module/components/rich-text/native/use-format-types.mjs +0 -114
- package/build-module/components/rich-text/native/use-format-types.mjs.map +0 -7
- package/src/components/audio-player/audio-url-parser.native.js +0 -20
- package/src/components/audio-player/index.native.js +0 -225
- package/src/components/audio-player/styles.native.scss +0 -114
- package/src/components/audio-player/test/audio-url-parser.native.js +0 -53
- package/src/components/block-alignment-control/test/index.native.js +0 -37
- package/src/components/block-alignment-control/ui.native.js +0 -86
- package/src/components/block-caption/README.md +0 -104
- package/src/components/block-caption/index.native.js +0 -89
- package/src/components/block-caption/styles.native.scss +0 -7
- package/src/components/block-controls/slot.native.js +0 -33
- package/src/components/block-draggable/draggable-chip.native.js +0 -49
- package/src/components/block-draggable/dropping-insertion-point.native.js +0 -181
- package/src/components/block-draggable/dropping-insertion-point.native.scss +0 -8
- package/src/components/block-draggable/index.native.js +0 -467
- package/src/components/block-draggable/style.native.scss +0 -19
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +0 -73
- package/src/components/block-draggable/test/helpers.native.js +0 -182
- package/src/components/block-draggable/test/index.native.js +0 -419
- package/src/components/block-draggable/use-scroll-when-dragging.native.js +0 -135
- package/src/components/block-edit/edit.native.js +0 -49
- package/src/components/block-edit/test/edit.native.js +0 -65
- package/src/components/block-heading-level-dropdown/index.native.js +0 -68
- package/src/components/block-icon/index.native.js +0 -47
- package/src/components/block-icon/style.native.scss +0 -7
- package/src/components/block-list/block-crash-boundary.native.js +0 -43
- package/src/components/block-list/block-crash-warning.native.js +0 -21
- package/src/components/block-list/block-invalid-warning.native.js +0 -70
- package/src/components/block-list/block-list-context.native.js +0 -172
- package/src/components/block-list/block-list-item-cell.native.js +0 -62
- package/src/components/block-list/block-list-item.native.js +0 -209
- package/src/components/block-list/block-list-item.native.scss +0 -16
- package/src/components/block-list/block-outline.native.js +0 -77
- package/src/components/block-list/block-selection-button.native.js +0 -100
- package/src/components/block-list/block-selection-button.native.scss +0 -34
- package/src/components/block-list/block.native.js +0 -716
- package/src/components/block-list/block.native.scss +0 -62
- package/src/components/block-list/grid-item.native.js +0 -58
- package/src/components/block-list/index.native.js +0 -437
- package/src/components/block-list/insertion-point.native.js +0 -36
- package/src/components/block-list/style.native.scss +0 -117
- package/src/components/block-list/test/block-invalid-warning.native.js +0 -62
- package/src/components/block-list/test/block-list-context.native.js +0 -243
- package/src/components/block-list/test/block-outline.native.js +0 -255
- package/src/components/block-list/test/fixtures/block-list-context.native.js +0 -79
- package/src/components/block-list/test/index.native.js +0 -205
- package/src/components/block-list/use-block-props/index.native.js +0 -10
- package/src/components/block-list/use-scroll-upon-insertion.native.js +0 -52
- package/src/components/block-list-appender/index.native.js +0 -70
- package/src/components/block-list-appender/style.native.scss +0 -8
- package/src/components/block-media-update-progress/README.md +0 -100
- package/src/components/block-media-update-progress/index.native.js +0 -299
- package/src/components/block-media-update-progress/styles.native.scss +0 -9
- package/src/components/block-media-update-progress/test/index.native.js +0 -543
- package/src/components/block-mover/index.native.js +0 -193
- package/src/components/block-mover/mover-description.native.js +0 -155
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +0 -218
- package/src/components/block-mover/test/index.native.js +0 -186
- package/src/components/block-settings/button.native.js +0 -41
- package/src/components/block-settings/container.native.js +0 -91
- package/src/components/block-settings/container.native.scss +0 -4
- package/src/components/block-settings/index.native.js +0 -5
- package/src/components/block-styles/index.native.js +0 -94
- package/src/components/block-styles/preview.native.js +0 -109
- package/src/components/block-styles/style.native.scss +0 -64
- package/src/components/block-switcher/block-transformations-menu.native.js +0 -91
- package/src/components/block-toolbar/block-toolbar-menu.native.js +0 -477
- package/src/components/block-toolbar/index.native.js +0 -126
- package/src/components/block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap +0 -125
- package/src/components/block-toolbar/test/block-toolbar-menu.native.js +0 -405
- package/src/components/block-toolbar/test/index.native.js +0 -36
- package/src/components/block-types-list/index.native.js +0 -175
- package/src/components/block-types-list/style.native.scss +0 -25
- package/src/components/block-variation-picker/index.native.js +0 -107
- package/src/components/block-variation-picker/style.native.scss +0 -32
- package/src/components/button-block-appender/index.native.js +0 -92
- package/src/components/button-block-appender/styles.native.scss +0 -43
- package/src/components/caption/README.md +0 -44
- package/src/components/caption/index.native.js +0 -61
- package/src/components/colors-gradients/panel-color-gradient-settings.native.js +0 -59
- package/src/components/contrast-checker/index.native.js +0 -113
- package/src/components/contrast-checker/style.native.scss +0 -26
- package/src/components/convert-to-group-buttons/index.native.js +0 -79
- package/src/components/default-block-appender/index.native.js +0 -113
- package/src/components/default-block-appender/style.native.scss +0 -18
- package/src/components/floating-toolbar/floatingToolbar.android.scss +0 -4
- package/src/components/floating-toolbar/floatingToolbar.ios.scss +0 -3
- package/src/components/floating-toolbar/index.native.js +0 -141
- package/src/components/floating-toolbar/styles.native.scss +0 -43
- package/src/components/font-sizes/index.native.js +0 -7
- package/src/components/global-styles/color-panel.native.js +0 -207
- package/src/components/global-styles/test/use-global-styles-context.native.js +0 -435
- package/src/components/global-styles/use-global-styles-context.native.js +0 -592
- package/src/components/gradients/index.native.js +0 -2
- package/src/components/image-link-destinations/index.native.js +0 -152
- package/src/components/image-link-destinations/style.native.scss +0 -16
- package/src/components/index.native.js +0 -108
- package/src/components/inner-blocks/constants.native.js +0 -5
- package/src/components/inner-blocks/index.native.js +0 -221
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +0 -124
- package/src/components/inserter/block-types-tab.native.js +0 -76
- package/src/components/inserter/hooks/use-block-type-impressions.native.js +0 -47
- package/src/components/inserter/hooks/use-clipboard-block.native.js +0 -40
- package/src/components/inserter/index.native.js +0 -424
- package/src/components/inserter/menu.native.js +0 -237
- package/src/components/inserter/no-results.native.js +0 -49
- package/src/components/inserter/reusable-blocks-tab.native.js +0 -45
- package/src/components/inserter/search-results.native.js +0 -67
- package/src/components/inserter/style.native.scss +0 -83
- package/src/components/inserter/tabs.native.js +0 -152
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +0 -117
- package/src/components/inserter/test/fixtures/index.native.js +0 -12
- package/src/components/inserter/test/index.native.js +0 -273
- package/src/components/inserter/test/reusable-blocks-tab.native.js +0 -62
- package/src/components/inserter/test/utils.native.js +0 -37
- package/src/components/inserter/utils.native.js +0 -46
- package/src/components/inserter-button/index.native.js +0 -108
- package/src/components/inserter-button/style.native.scss +0 -72
- package/src/components/inspector-controls/fill.native.js +0 -62
- package/src/components/inspector-controls/slot.native.js +0 -35
- package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +0 -31
- package/src/components/line-height-control/index.native.js +0 -28
- package/src/components/media-placeholder/index.native.js +0 -258
- package/src/components/media-placeholder/styles.native.scss +0 -108
- package/src/components/media-replace-flow/index.native.js +0 -12
- package/src/components/media-upload/constants.native.js +0 -14
- package/src/components/media-upload/index.native.js +0 -356
- package/src/components/media-upload/style.native.scss +0 -4
- package/src/components/media-upload/test/index.native.js +0 -172
- package/src/components/media-upload-progress/README.md +0 -100
- package/src/components/media-upload-progress/constants.js +0 -6
- package/src/components/media-upload-progress/index.native.js +0 -233
- package/src/components/media-upload-progress/styles.native.scss +0 -15
- package/src/components/media-upload-progress/test/index.native.js +0 -220
- package/src/components/plain-text/index.native.js +0 -164
- package/src/components/plain-text/style.native.scss +0 -10
- package/src/components/provider/index.native.js +0 -32
- package/src/components/rich-text/embed-handler-picker.native.js +0 -65
- package/src/components/rich-text/file-paste-handler.native.js +0 -3
- package/src/components/rich-text/format-toolbar/index.native.js +0 -21
- package/src/components/rich-text/format-toolbar-container.native.js +0 -16
- package/src/components/rich-text/index.native.js +0 -701
- package/src/components/rich-text/input-event.native.js +0 -10
- package/src/components/rich-text/native/format-edit.js +0 -44
- package/src/components/rich-text/native/get-format-colors.native.js +0 -47
- package/src/components/rich-text/native/index.js +0 -1
- package/src/components/rich-text/native/index.native.js +0 -1389
- package/src/components/rich-text/native/style.native.scss +0 -28
- package/src/components/rich-text/native/test/__snapshots__/index.native.js.snap +0 -79
- package/src/components/rich-text/native/test/index.native.js +0 -345
- package/src/components/rich-text/native/test/performance/rich-text.native.js +0 -44
- package/src/components/rich-text/native/toolbar-button-with-options.native.js +0 -61
- package/src/components/rich-text/native/use-format-types.js +0 -146
- package/src/components/rich-text/remove-browser-shortcuts.native.js +0 -1
- package/src/components/rich-text/shortcut.native.js +0 -10
- package/src/components/ungroup-button/README.md +0 -23
- package/src/components/ungroup-button/index.native.js +0 -77
- package/src/components/unsupported-block-details/index.native.js +0 -187
- package/src/components/unsupported-block-details/style.native.scss +0 -56
- package/src/components/url-input/index.native.js +0 -33
- package/src/components/use-block-drop-zone/index.native.js +0 -207
- package/src/components/use-on-block-drop/index.native.js +0 -115
- package/src/components/use-unsupported-block-editor/index.native.js +0 -59
- package/src/components/video-player/gridicon-play.native.js +0 -13
- package/src/components/video-player/index.native.js +0 -133
- package/src/components/video-player/styles.native.scss +0 -29
- package/src/components/warning/index.native.js +0 -64
- package/src/components/warning/style.native.scss +0 -47
- package/src/hooks/align.native.js +0 -49
- package/src/hooks/custom-class-name.native.js +0 -70
- package/src/hooks/index.native.js +0 -36
- package/src/hooks/layout.native.js +0 -23
- package/src/hooks/test/__snapshots__/align.native.js.snap +0 -73
- package/src/hooks/test/__snapshots__/anchor.native.js.snap +0 -7
- package/src/hooks/test/align.native.js +0 -134
- package/src/hooks/test/anchor.native.js +0 -32
- package/src/hooks/test/use-editor-wrapper-styles.native.js +0 -282
- package/src/hooks/typography.native.js +0 -60
- package/src/hooks/use-editor-wrapper-styles.native.js +0 -250
- package/src/hooks/use-editor-wrapper-styles.native.scss +0 -12
- package/src/index.native.js +0 -6
- package/src/private-apis.native.js +0 -21
- package/src/store/defaults.native.js +0 -23
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import Animated, {
|
|
5
|
-
useSharedValue,
|
|
6
|
-
useAnimatedStyle,
|
|
7
|
-
withTiming,
|
|
8
|
-
useAnimatedReaction,
|
|
9
|
-
runOnJS,
|
|
10
|
-
} from 'react-native-reanimated';
|
|
11
|
-
import {
|
|
12
|
-
useSafeAreaInsets,
|
|
13
|
-
useSafeAreaFrame,
|
|
14
|
-
} from 'react-native-safe-area-context';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
import { useSelect } from '@wordpress/data';
|
|
20
|
-
import { generateHapticFeedback } from '@wordpress/react-native-bridge';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
|
-
import { store as blockEditorStore } from '../../store';
|
|
26
|
-
import { useBlockListContext } from '../block-list/block-list-context';
|
|
27
|
-
import styles from './dropping-insertion-point.scss';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Dropping zone indicator component.
|
|
31
|
-
*
|
|
32
|
-
* This component shows where a block can be dropped when it's being dragged.
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} props Component props.
|
|
35
|
-
* @param {Object} props.scroll Scroll offset object.
|
|
36
|
-
* @param {Object} props.currentYPosition Current Y coordinate position when dragging.
|
|
37
|
-
* @param {import('react-native-reanimated').SharedValue} props.isDragging Whether or not dragging has started.
|
|
38
|
-
* @param {import('react-native-reanimated').SharedValue} props.targetBlockIndex Current block target index.
|
|
39
|
-
*
|
|
40
|
-
* @return {React.JSX.Element} The component to be rendered.
|
|
41
|
-
*/
|
|
42
|
-
export default function DroppingInsertionPoint( {
|
|
43
|
-
scroll,
|
|
44
|
-
currentYPosition,
|
|
45
|
-
isDragging,
|
|
46
|
-
targetBlockIndex,
|
|
47
|
-
} ) {
|
|
48
|
-
const {
|
|
49
|
-
getBlockOrder,
|
|
50
|
-
isBlockBeingDragged,
|
|
51
|
-
isDraggingBlocks,
|
|
52
|
-
getPreviousBlockClientId,
|
|
53
|
-
getNextBlockClientId,
|
|
54
|
-
} = useSelect( blockEditorStore );
|
|
55
|
-
|
|
56
|
-
const { blocksLayouts, findBlockLayoutByClientId } = useBlockListContext();
|
|
57
|
-
const { top, bottom } = useSafeAreaInsets();
|
|
58
|
-
const { height } = useSafeAreaFrame();
|
|
59
|
-
const safeAreaOffset = top + bottom;
|
|
60
|
-
const maxHeight =
|
|
61
|
-
height -
|
|
62
|
-
( safeAreaOffset + styles[ 'dropping-insertion-point' ].height );
|
|
63
|
-
|
|
64
|
-
const blockYPosition = useSharedValue( 0 );
|
|
65
|
-
const opacity = useSharedValue( 0 );
|
|
66
|
-
|
|
67
|
-
useAnimatedReaction(
|
|
68
|
-
() => isDragging.value,
|
|
69
|
-
( value ) => {
|
|
70
|
-
if ( ! value ) {
|
|
71
|
-
opacity.value = 0;
|
|
72
|
-
blockYPosition.value = 0;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
function getSelectedBlockIndicatorPosition( positions ) {
|
|
78
|
-
const currentYPositionWithScroll =
|
|
79
|
-
currentYPosition.value + scroll.offsetY.value;
|
|
80
|
-
const midpoint = ( positions.top + positions.bottom ) / 2;
|
|
81
|
-
|
|
82
|
-
return midpoint < currentYPositionWithScroll
|
|
83
|
-
? positions.bottom
|
|
84
|
-
: positions.top;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function setIndicatorPosition( index ) {
|
|
88
|
-
const insertionPointIndex = index;
|
|
89
|
-
const order = getBlockOrder();
|
|
90
|
-
const isDraggingAnyBlocks = isDraggingBlocks();
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
! isDraggingAnyBlocks ||
|
|
94
|
-
insertionPointIndex === null ||
|
|
95
|
-
! order.length
|
|
96
|
-
) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
let previousClientId = order[ insertionPointIndex - 1 ];
|
|
101
|
-
let nextClientId = order[ insertionPointIndex ];
|
|
102
|
-
|
|
103
|
-
while ( isBlockBeingDragged( previousClientId ) ) {
|
|
104
|
-
previousClientId = getPreviousBlockClientId( previousClientId );
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
while ( isBlockBeingDragged( nextClientId ) ) {
|
|
108
|
-
nextClientId = getNextBlockClientId( nextClientId );
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
const previousElement = previousClientId
|
|
112
|
-
? findBlockLayoutByClientId(
|
|
113
|
-
blocksLayouts.current,
|
|
114
|
-
previousClientId
|
|
115
|
-
)
|
|
116
|
-
: null;
|
|
117
|
-
const nextElement = nextClientId
|
|
118
|
-
? findBlockLayoutByClientId( blocksLayouts.current, nextClientId )
|
|
119
|
-
: null;
|
|
120
|
-
|
|
121
|
-
const previousElementPosition = previousElement
|
|
122
|
-
? previousElement.y + previousElement.height
|
|
123
|
-
: 0;
|
|
124
|
-
const nextElementPosition = nextElement ? nextElement.y : 0;
|
|
125
|
-
|
|
126
|
-
const elementsPositions = {
|
|
127
|
-
top: Math.floor(
|
|
128
|
-
previousElement ? previousElementPosition : nextElementPosition
|
|
129
|
-
),
|
|
130
|
-
bottom: Math.floor(
|
|
131
|
-
nextElement ? nextElementPosition : previousElementPosition
|
|
132
|
-
),
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
const nextPosition =
|
|
136
|
-
elementsPositions.top !== elementsPositions.bottom
|
|
137
|
-
? getSelectedBlockIndicatorPosition( elementsPositions )
|
|
138
|
-
: elementsPositions.top;
|
|
139
|
-
|
|
140
|
-
if ( nextPosition && blockYPosition.value !== nextPosition ) {
|
|
141
|
-
opacity.value = 0;
|
|
142
|
-
blockYPosition.value = nextPosition;
|
|
143
|
-
opacity.value = withTiming( 1 );
|
|
144
|
-
generateHapticFeedback();
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
useAnimatedReaction(
|
|
149
|
-
() => targetBlockIndex.value,
|
|
150
|
-
( value, previous ) => {
|
|
151
|
-
if ( value !== previous ) {
|
|
152
|
-
runOnJS( setIndicatorPosition )( value );
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const animatedStyles = useAnimatedStyle( () => {
|
|
158
|
-
const translationY = blockYPosition.value - scroll.offsetY.value;
|
|
159
|
-
// Prevents overflowing behind the header/footer
|
|
160
|
-
const shouldHideIndicator =
|
|
161
|
-
translationY < 0 || translationY > maxHeight;
|
|
162
|
-
|
|
163
|
-
return {
|
|
164
|
-
opacity: shouldHideIndicator ? 0 : opacity.value,
|
|
165
|
-
transform: [
|
|
166
|
-
{
|
|
167
|
-
translateY: translationY,
|
|
168
|
-
},
|
|
169
|
-
],
|
|
170
|
-
};
|
|
171
|
-
} );
|
|
172
|
-
|
|
173
|
-
const insertionPointStyles = [
|
|
174
|
-
styles[ 'dropping-insertion-point' ],
|
|
175
|
-
animatedStyles,
|
|
176
|
-
];
|
|
177
|
-
|
|
178
|
-
return (
|
|
179
|
-
<Animated.View pointerEvents="none" style={ insertionPointStyles } />
|
|
180
|
-
);
|
|
181
|
-
}
|
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { AccessibilityInfo } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
useSafeAreaInsets,
|
|
7
|
-
useSafeAreaFrame,
|
|
8
|
-
} from 'react-native-safe-area-context';
|
|
9
|
-
import Animated, {
|
|
10
|
-
runOnJS,
|
|
11
|
-
runOnUI,
|
|
12
|
-
useAnimatedStyle,
|
|
13
|
-
useSharedValue,
|
|
14
|
-
withDelay,
|
|
15
|
-
withTiming,
|
|
16
|
-
ZoomInEasyDown,
|
|
17
|
-
} from 'react-native-reanimated';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* WordPress dependencies
|
|
21
|
-
*/
|
|
22
|
-
import { Draggable, DraggableTrigger } from '@wordpress/components';
|
|
23
|
-
import { select, useSelect, useDispatch } from '@wordpress/data';
|
|
24
|
-
import {
|
|
25
|
-
useCallback,
|
|
26
|
-
useEffect,
|
|
27
|
-
useRef,
|
|
28
|
-
useState,
|
|
29
|
-
Platform,
|
|
30
|
-
} from '@wordpress/element';
|
|
31
|
-
import { getBlockType } from '@wordpress/blocks';
|
|
32
|
-
import { generateHapticFeedback } from '@wordpress/react-native-bridge';
|
|
33
|
-
import RCTAztecView from '@wordpress/react-native-aztec';
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Internal dependencies
|
|
37
|
-
*/
|
|
38
|
-
import useScrollWhenDragging from './use-scroll-when-dragging';
|
|
39
|
-
import DraggableChip from './draggable-chip';
|
|
40
|
-
import { store as blockEditorStore } from '../../store';
|
|
41
|
-
import DroppingInsertionPoint from './dropping-insertion-point';
|
|
42
|
-
import useBlockDropZone from '../use-block-drop-zone';
|
|
43
|
-
import styles from './style.scss';
|
|
44
|
-
|
|
45
|
-
const CHIP_OFFSET_TO_TOUCH_POSITION = 32;
|
|
46
|
-
const BLOCK_OPACITY_ANIMATION_CONFIG = { duration: 350 };
|
|
47
|
-
const BLOCK_OPACITY_ANIMATION_DELAY = 250;
|
|
48
|
-
const DEFAULT_LONG_PRESS_MIN_DURATION = 500;
|
|
49
|
-
const DEFAULT_IOS_LONG_PRESS_MIN_DURATION =
|
|
50
|
-
DEFAULT_LONG_PRESS_MIN_DURATION - 50;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Block draggable wrapper component
|
|
54
|
-
*
|
|
55
|
-
* This component handles all the interactions for dragging blocks.
|
|
56
|
-
* It relies on the block list and its context for dragging, hence it
|
|
57
|
-
* should be rendered between the `BlockListProvider` component and the
|
|
58
|
-
* block list rendering. It also requires listening to scroll events,
|
|
59
|
-
* therefore for this purpose, it returns the `onScroll` event handler
|
|
60
|
-
* that should be attached to the list that renders the blocks.
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
* @param {Object} props Component props.
|
|
64
|
-
* @param {React.JSX.Element} props.children Children to be rendered.
|
|
65
|
-
* @param {boolean} props.isRTL Check if current locale is RTL.
|
|
66
|
-
*
|
|
67
|
-
* @return {Function} Render function that passes `onScroll` event handler.
|
|
68
|
-
*/
|
|
69
|
-
const BlockDraggableWrapper = ( { children, isRTL } ) => {
|
|
70
|
-
const [ draggedBlockIcon, setDraggedBlockIcon ] = useState();
|
|
71
|
-
|
|
72
|
-
const { selectBlock, startDraggingBlocks, stopDraggingBlocks } =
|
|
73
|
-
useDispatch( blockEditorStore );
|
|
74
|
-
|
|
75
|
-
const { left, right } = useSafeAreaInsets();
|
|
76
|
-
const { width } = useSafeAreaFrame();
|
|
77
|
-
const safeAreaOffset = left + right;
|
|
78
|
-
const contentWidth = width - safeAreaOffset;
|
|
79
|
-
|
|
80
|
-
const scroll = {
|
|
81
|
-
offsetY: useSharedValue( 0 ),
|
|
82
|
-
};
|
|
83
|
-
const chip = {
|
|
84
|
-
x: useSharedValue( 0 ),
|
|
85
|
-
y: useSharedValue( 0 ),
|
|
86
|
-
width: useSharedValue( 0 ),
|
|
87
|
-
height: useSharedValue( 0 ),
|
|
88
|
-
};
|
|
89
|
-
const currentYPosition = useSharedValue( 0 );
|
|
90
|
-
const isDragging = useSharedValue( false );
|
|
91
|
-
|
|
92
|
-
const [
|
|
93
|
-
startScrolling,
|
|
94
|
-
scrollOnDragOver,
|
|
95
|
-
stopScrolling,
|
|
96
|
-
draggingScrollHandler,
|
|
97
|
-
] = useScrollWhenDragging();
|
|
98
|
-
|
|
99
|
-
const scrollHandler = ( event ) => {
|
|
100
|
-
'worklet';
|
|
101
|
-
const { contentOffset } = event;
|
|
102
|
-
scroll.offsetY.value = contentOffset.y;
|
|
103
|
-
|
|
104
|
-
draggingScrollHandler( event );
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const {
|
|
108
|
-
onBlockDragOverWorklet,
|
|
109
|
-
onBlockDragEnd,
|
|
110
|
-
onBlockDrop,
|
|
111
|
-
targetBlockIndex,
|
|
112
|
-
} = useBlockDropZone();
|
|
113
|
-
|
|
114
|
-
// Stop dragging blocks if the block draggable is unmounted.
|
|
115
|
-
useEffect( () => {
|
|
116
|
-
return () => {
|
|
117
|
-
if ( isDragging.value ) {
|
|
118
|
-
stopDraggingBlocks();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}, [] );
|
|
122
|
-
|
|
123
|
-
const setDraggedBlockIconByClientId = ( clientId ) => {
|
|
124
|
-
const blockName = select( blockEditorStore ).getBlockName( clientId );
|
|
125
|
-
const blockIcon = getBlockType( blockName )?.icon;
|
|
126
|
-
if ( blockIcon ) {
|
|
127
|
-
setDraggedBlockIcon( blockIcon );
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const onStartDragging = ( { clientId, position } ) => {
|
|
132
|
-
if ( clientId ) {
|
|
133
|
-
startDraggingBlocks( [ clientId ] );
|
|
134
|
-
setDraggedBlockIconByClientId( clientId );
|
|
135
|
-
runOnUI( startScrolling )( position.y );
|
|
136
|
-
generateHapticFeedback();
|
|
137
|
-
} else {
|
|
138
|
-
// We stop dragging if no block is found.
|
|
139
|
-
runOnUI( stopDragging )();
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const onStopDragging = ( { clientId } ) => {
|
|
144
|
-
if ( clientId ) {
|
|
145
|
-
onBlockDrop( {
|
|
146
|
-
// Dropping is only allowed at root level
|
|
147
|
-
srcRootClientId: '',
|
|
148
|
-
srcClientIds: [ clientId ],
|
|
149
|
-
type: 'block',
|
|
150
|
-
} );
|
|
151
|
-
selectBlock( clientId );
|
|
152
|
-
setDraggedBlockIcon( undefined );
|
|
153
|
-
}
|
|
154
|
-
onBlockDragEnd();
|
|
155
|
-
stopDraggingBlocks();
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const onChipLayout = ( { nativeEvent: { layout } } ) => {
|
|
159
|
-
if ( layout.width > 0 ) {
|
|
160
|
-
chip.width.value = layout.width;
|
|
161
|
-
}
|
|
162
|
-
if ( layout.height > 0 ) {
|
|
163
|
-
chip.height.value = layout.height;
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const startDragging = ( { x, y, id } ) => {
|
|
168
|
-
'worklet';
|
|
169
|
-
const dragPosition = { x, y };
|
|
170
|
-
chip.x.value = dragPosition.x;
|
|
171
|
-
chip.y.value = dragPosition.y;
|
|
172
|
-
currentYPosition.value = dragPosition.y;
|
|
173
|
-
|
|
174
|
-
isDragging.value = true;
|
|
175
|
-
|
|
176
|
-
runOnJS( onStartDragging )( { clientId: id, position: dragPosition } );
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const updateDragging = ( { x, y } ) => {
|
|
180
|
-
'worklet';
|
|
181
|
-
const dragPosition = { x, y };
|
|
182
|
-
chip.x.value = dragPosition.x;
|
|
183
|
-
chip.y.value = dragPosition.y;
|
|
184
|
-
currentYPosition.value = dragPosition.y;
|
|
185
|
-
|
|
186
|
-
onBlockDragOverWorklet( { x, y: y + scroll.offsetY.value } );
|
|
187
|
-
|
|
188
|
-
// Update scrolling velocity
|
|
189
|
-
scrollOnDragOver( dragPosition.y );
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const stopDragging = ( { id } ) => {
|
|
193
|
-
'worklet';
|
|
194
|
-
isDragging.value = false;
|
|
195
|
-
|
|
196
|
-
stopScrolling();
|
|
197
|
-
runOnJS( onStopDragging )( { clientId: id } );
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const chipDynamicStyles = useAnimatedStyle( () => {
|
|
201
|
-
const chipOffset = chip.width.value / 2;
|
|
202
|
-
const translateX = ! isRTL
|
|
203
|
-
? chip.x.value - chipOffset
|
|
204
|
-
: -( contentWidth - ( chip.x.value + chipOffset ) );
|
|
205
|
-
|
|
206
|
-
return {
|
|
207
|
-
transform: [
|
|
208
|
-
{
|
|
209
|
-
translateX,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
translateY:
|
|
213
|
-
chip.y.value -
|
|
214
|
-
chip.height.value -
|
|
215
|
-
CHIP_OFFSET_TO_TOUCH_POSITION,
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
};
|
|
219
|
-
} );
|
|
220
|
-
const chipStyles = [
|
|
221
|
-
chipDynamicStyles,
|
|
222
|
-
styles[ 'draggable-chip__wrapper' ],
|
|
223
|
-
];
|
|
224
|
-
|
|
225
|
-
const exitingAnimation = ( { currentHeight, currentWidth } ) => {
|
|
226
|
-
'worklet';
|
|
227
|
-
const translateX = ! isRTL ? 0 : currentWidth * -1;
|
|
228
|
-
const duration = 150;
|
|
229
|
-
const animations = {
|
|
230
|
-
transform: [
|
|
231
|
-
{
|
|
232
|
-
translateY: withTiming( currentHeight, {
|
|
233
|
-
duration,
|
|
234
|
-
} ),
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
translateX: withTiming( translateX, {
|
|
238
|
-
duration,
|
|
239
|
-
} ),
|
|
240
|
-
},
|
|
241
|
-
{ scale: withTiming( 0, { duration } ) },
|
|
242
|
-
],
|
|
243
|
-
};
|
|
244
|
-
const initialValues = {
|
|
245
|
-
transform: [ { translateY: 0 }, { translateX }, { scale: 1 } ],
|
|
246
|
-
};
|
|
247
|
-
return {
|
|
248
|
-
initialValues,
|
|
249
|
-
animations,
|
|
250
|
-
};
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
return (
|
|
254
|
-
<>
|
|
255
|
-
<DroppingInsertionPoint
|
|
256
|
-
scroll={ scroll }
|
|
257
|
-
currentYPosition={ currentYPosition }
|
|
258
|
-
isDragging={ isDragging }
|
|
259
|
-
targetBlockIndex={ targetBlockIndex }
|
|
260
|
-
/>
|
|
261
|
-
<Draggable
|
|
262
|
-
onDragStart={ startDragging }
|
|
263
|
-
onDragOver={ updateDragging }
|
|
264
|
-
onDragEnd={ stopDragging }
|
|
265
|
-
testID="block-draggable-wrapper"
|
|
266
|
-
>
|
|
267
|
-
{ children( { onScroll: scrollHandler } ) }
|
|
268
|
-
</Draggable>
|
|
269
|
-
<Animated.View
|
|
270
|
-
onLayout={ onChipLayout }
|
|
271
|
-
style={ chipStyles }
|
|
272
|
-
pointerEvents="none"
|
|
273
|
-
>
|
|
274
|
-
{ draggedBlockIcon && (
|
|
275
|
-
<Animated.View
|
|
276
|
-
entering={ ZoomInEasyDown.duration( 200 ) }
|
|
277
|
-
exiting={ exitingAnimation }
|
|
278
|
-
>
|
|
279
|
-
<DraggableChip icon={ draggedBlockIcon } />
|
|
280
|
-
</Animated.View>
|
|
281
|
-
) }
|
|
282
|
-
</Animated.View>
|
|
283
|
-
</>
|
|
284
|
-
);
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
function useIsScreenReaderEnabled() {
|
|
288
|
-
const [ isScreenReaderEnabled, setIsScreenReaderEnabled ] =
|
|
289
|
-
useState( false );
|
|
290
|
-
|
|
291
|
-
useEffect( () => {
|
|
292
|
-
let mounted = true;
|
|
293
|
-
|
|
294
|
-
const changeListener = AccessibilityInfo.addEventListener(
|
|
295
|
-
'screenReaderChanged',
|
|
296
|
-
( enabled ) => setIsScreenReaderEnabled( enabled )
|
|
297
|
-
);
|
|
298
|
-
|
|
299
|
-
AccessibilityInfo.isScreenReaderEnabled().then(
|
|
300
|
-
( screenReaderEnabled ) => {
|
|
301
|
-
if ( mounted && screenReaderEnabled ) {
|
|
302
|
-
setIsScreenReaderEnabled( screenReaderEnabled );
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
|
|
307
|
-
return () => {
|
|
308
|
-
mounted = false;
|
|
309
|
-
|
|
310
|
-
changeListener.remove();
|
|
311
|
-
};
|
|
312
|
-
}, [] );
|
|
313
|
-
|
|
314
|
-
return isScreenReaderEnabled;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function useIsEditingText() {
|
|
318
|
-
const [ isEditingText, setIsEditingText ] = useState( () =>
|
|
319
|
-
RCTAztecView.InputState.isFocused()
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
useEffect( () => {
|
|
323
|
-
const onFocusChangeAztec = ( { isFocused } ) => {
|
|
324
|
-
setIsEditingText( isFocused );
|
|
325
|
-
};
|
|
326
|
-
|
|
327
|
-
RCTAztecView.InputState.addFocusChangeListener( onFocusChangeAztec );
|
|
328
|
-
|
|
329
|
-
return () => {
|
|
330
|
-
RCTAztecView.InputState.removeFocusChangeListener(
|
|
331
|
-
onFocusChangeAztec
|
|
332
|
-
);
|
|
333
|
-
};
|
|
334
|
-
}, [] );
|
|
335
|
-
|
|
336
|
-
return isEditingText;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
/**
|
|
340
|
-
* Block draggable component
|
|
341
|
-
*
|
|
342
|
-
* This component serves for animating the block when it is being dragged.
|
|
343
|
-
* Hence, it should be wrapped around the rendering of a block.
|
|
344
|
-
*
|
|
345
|
-
* @param {Object} props Component props.
|
|
346
|
-
* @param {React.JSX.Element} props.children Children to be rendered.
|
|
347
|
-
* @param {string} props.clientId Client id of the block.
|
|
348
|
-
* @param {string} [props.draggingClientId] Client id to use for dragging. If not defined, the value from `clientId` will be used.
|
|
349
|
-
* @param {boolean} [props.enabled] Enables the draggable trigger.
|
|
350
|
-
* @param {string} [props.testID] Id used for querying the long-press gesture handler in tests.
|
|
351
|
-
*
|
|
352
|
-
* @return {Function} Render function which includes the parameter `isDraggable` to determine if the block can be dragged.
|
|
353
|
-
*/
|
|
354
|
-
const BlockDraggable = ( {
|
|
355
|
-
clientId,
|
|
356
|
-
children,
|
|
357
|
-
draggingClientId,
|
|
358
|
-
enabled = true,
|
|
359
|
-
testID,
|
|
360
|
-
} ) => {
|
|
361
|
-
const wasBeingDragged = useRef( false );
|
|
362
|
-
const isEditingText = useIsEditingText();
|
|
363
|
-
const isScreenReaderEnabled = useIsScreenReaderEnabled();
|
|
364
|
-
|
|
365
|
-
const draggingAnimation = {
|
|
366
|
-
opacity: useSharedValue( 1 ),
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
const startDraggingBlock = () => {
|
|
370
|
-
draggingAnimation.opacity.value = withTiming(
|
|
371
|
-
0.4,
|
|
372
|
-
BLOCK_OPACITY_ANIMATION_CONFIG
|
|
373
|
-
);
|
|
374
|
-
};
|
|
375
|
-
|
|
376
|
-
const stopDraggingBlock = () => {
|
|
377
|
-
draggingAnimation.opacity.value = withDelay(
|
|
378
|
-
BLOCK_OPACITY_ANIMATION_DELAY,
|
|
379
|
-
withTiming( 1, BLOCK_OPACITY_ANIMATION_CONFIG )
|
|
380
|
-
);
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
const { isDraggable, isBeingDragged, isBlockSelected } = useSelect(
|
|
384
|
-
( _select ) => {
|
|
385
|
-
const {
|
|
386
|
-
getBlockRootClientId,
|
|
387
|
-
getTemplateLock,
|
|
388
|
-
isBlockBeingDragged,
|
|
389
|
-
getSelectedBlockClientId,
|
|
390
|
-
} = _select( blockEditorStore );
|
|
391
|
-
const rootClientId = getBlockRootClientId( clientId );
|
|
392
|
-
const templateLock = rootClientId
|
|
393
|
-
? getTemplateLock( rootClientId )
|
|
394
|
-
: null;
|
|
395
|
-
const selectedBlockClientId = getSelectedBlockClientId();
|
|
396
|
-
|
|
397
|
-
return {
|
|
398
|
-
isBeingDragged: isBlockBeingDragged( clientId ),
|
|
399
|
-
isDraggable: 'all' !== templateLock,
|
|
400
|
-
isBlockSelected:
|
|
401
|
-
selectedBlockClientId && selectedBlockClientId === clientId,
|
|
402
|
-
};
|
|
403
|
-
},
|
|
404
|
-
[ clientId ]
|
|
405
|
-
);
|
|
406
|
-
|
|
407
|
-
useEffect( () => {
|
|
408
|
-
if ( isBeingDragged !== wasBeingDragged.current ) {
|
|
409
|
-
if ( isBeingDragged ) {
|
|
410
|
-
startDraggingBlock();
|
|
411
|
-
} else {
|
|
412
|
-
stopDraggingBlock();
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
wasBeingDragged.current = isBeingDragged;
|
|
416
|
-
}, [ isBeingDragged ] );
|
|
417
|
-
|
|
418
|
-
const onLongPressDraggable = useCallback( () => {
|
|
419
|
-
// Ensure that no text input is focused when starting the dragging gesture in order to prevent conflicts with text editing.
|
|
420
|
-
RCTAztecView.InputState.blurCurrentFocusedElement();
|
|
421
|
-
}, [] );
|
|
422
|
-
|
|
423
|
-
const animatedWrapperStyles = useAnimatedStyle( () => {
|
|
424
|
-
return {
|
|
425
|
-
opacity: draggingAnimation.opacity.value,
|
|
426
|
-
};
|
|
427
|
-
} );
|
|
428
|
-
const wrapperStyles = [
|
|
429
|
-
animatedWrapperStyles,
|
|
430
|
-
styles[ 'draggable-wrapper__container' ],
|
|
431
|
-
];
|
|
432
|
-
|
|
433
|
-
const canDragBlock =
|
|
434
|
-
enabled &&
|
|
435
|
-
! isScreenReaderEnabled &&
|
|
436
|
-
( ! isBlockSelected || ! isEditingText );
|
|
437
|
-
|
|
438
|
-
if ( ! isDraggable ) {
|
|
439
|
-
return children( { isDraggable: false } );
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return (
|
|
443
|
-
<DraggableTrigger
|
|
444
|
-
id={ draggingClientId || clientId }
|
|
445
|
-
enabled={ enabled && canDragBlock }
|
|
446
|
-
minDuration={ Platform.select( {
|
|
447
|
-
// On iOS, using a lower min duration than the default
|
|
448
|
-
// value prevents the long-press gesture from being
|
|
449
|
-
// triggered in underneath elements. This is required to
|
|
450
|
-
// prevent enabling text editing when dragging is available.
|
|
451
|
-
ios: canDragBlock
|
|
452
|
-
? DEFAULT_IOS_LONG_PRESS_MIN_DURATION
|
|
453
|
-
: DEFAULT_LONG_PRESS_MIN_DURATION,
|
|
454
|
-
android: DEFAULT_LONG_PRESS_MIN_DURATION,
|
|
455
|
-
} ) }
|
|
456
|
-
onLongPress={ onLongPressDraggable }
|
|
457
|
-
testID={ testID }
|
|
458
|
-
>
|
|
459
|
-
<Animated.View style={ wrapperStyles }>
|
|
460
|
-
{ children( { isDraggable: true } ) }
|
|
461
|
-
</Animated.View>
|
|
462
|
-
</DraggableTrigger>
|
|
463
|
-
);
|
|
464
|
-
};
|
|
465
|
-
|
|
466
|
-
export { BlockDraggableWrapper };
|
|
467
|
-
export default BlockDraggable;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.draggable-wrapper__container {
|
|
2
|
-
flex: 1;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.draggable-chip__wrapper {
|
|
6
|
-
position: absolute;
|
|
7
|
-
z-index: 10;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.draggable-chip__container {
|
|
11
|
-
flex-direction: row;
|
|
12
|
-
padding: 16px;
|
|
13
|
-
background-color: $gray-0;
|
|
14
|
-
border-radius: 8px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.draggable-chip__container--dark {
|
|
18
|
-
background-color: $app-background-dark-alt;
|
|
19
|
-
}
|