@wordpress/block-editor 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/autocompleters/block.js +13 -5
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-breadcrumb/index.js +6 -3
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-editing-mode/index.js +84 -0
- package/build/components/block-editing-mode/index.js.map +1 -0
- package/build/components/block-list/block-list-block-context.js +15 -0
- package/build/components/block-list/block-list-block-context.js.map +1 -0
- package/build/components/block-list/block.js +29 -37
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +14 -22
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list/index.native.js +107 -108
- package/build/components/block-list/index.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +2 -2
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +7 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-list-appender/index.js +15 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +19 -4
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-styles/preview-panel.js +1 -2
- package/build/components/block-styles/preview-panel.js.map +1 -1
- package/build/components/block-switcher/block-transformations-menu.js +8 -0
- package/build/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build/components/block-switcher/block-variation-transformations.js +125 -0
- package/build/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build/components/block-switcher/index.js +34 -12
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +9 -7
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/block-contextual-toolbar.js +5 -3
- package/build/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +11 -5
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.js +7 -2
- package/build/components/convert-to-group-buttons/index.js.map +1 -1
- package/build/components/convert-to-group-buttons/index.native.js +87 -3
- package/build/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js +23 -37
- package/build/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +3 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/iframe/index.js +14 -7
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +2 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +7 -7
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +3 -7
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-results.js +19 -6
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/list-view/appender.js +6 -1
- package/build/components/list-view/appender.js.map +1 -1
- package/build/components/list-view/block-contents.js +4 -2
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +21 -25
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +1 -3
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/index.js +14 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +27 -3
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/publish-date-time-picker/index.js +0 -2
- package/build/components/publish-date-time-picker/index.js.map +1 -1
- package/build/components/url-input/index.js +3 -0
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +25 -15
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-resize-canvas/index.js +8 -1
- package/build/components/use-resize-canvas/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +13 -7
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/align.js +3 -7
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/behaviors.js +115 -0
- package/build/hooks/behaviors.js.map +1 -0
- package/build/hooks/dimensions.js +0 -30
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +4 -8
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +8 -9
- package/build/hooks/layout.js.map +1 -1
- package/build/private-apis.js +4 -7
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +46 -0
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +88 -0
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +36 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +28 -18
- package/build/store/selectors.js.map +1 -1
- package/build/utils/order-inserter-block-items.js +41 -0
- package/build/utils/order-inserter-block-items.js.map +1 -0
- package/build-module/autocompleters/block.js +12 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +5 -3
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-editing-mode/index.js +72 -0
- package/build-module/components/block-editing-mode/index.js.map +1 -0
- package/build-module/components/block-list/block-list-block-context.js +6 -0
- package/build-module/components/block-list/block-list-block-context.js.map +1 -0
- package/build-module/components/block-list/block.js +26 -34
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +14 -22
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list/index.native.js +108 -110
- package/build-module/components/block-list/index.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -1
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +6 -5
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +15 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +18 -4
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-styles/preview-panel.js +1 -2
- package/build-module/components/block-styles/preview-panel.js.map +1 -1
- package/build-module/components/block-switcher/block-transformations-menu.js +7 -0
- package/build-module/components/block-switcher/block-transformations-menu.js.map +1 -1
- package/build-module/components/block-switcher/block-variation-transformations.js +108 -0
- package/build-module/components/block-switcher/block-variation-transformations.js.map +1 -0
- package/build-module/components/block-switcher/index.js +33 -12
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +3 -3
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +8 -7
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/block-contextual-toolbar.js +4 -3
- package/build-module/components/block-tools/block-contextual-toolbar.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -5
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.js +7 -2
- package/build-module/components/convert-to-group-buttons/index.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/index.native.js +76 -1
- package/build-module/components/convert-to-group-buttons/index.native.js.map +1 -1
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js +22 -36
- package/build-module/components/convert-to-group-buttons/use-convert-to-group-button-props.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/iframe/index.js +15 -8
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +2 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +7 -6
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +13 -5
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -7
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -4
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-results.js +16 -6
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/list-view/appender.js +6 -2
- package/build-module/components/list-view/appender.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +4 -2
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +20 -25
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +1 -3
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/index.js +15 -8
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +26 -3
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/publish-date-time-picker/index.js +0 -2
- package/build-module/components/publish-date-time-picker/index.js.map +1 -1
- package/build-module/components/url-input/index.js +3 -0
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +25 -16
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-resize-canvas/index.js +8 -1
- package/build-module/components/use-resize-canvas/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +13 -7
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/align.js +3 -6
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/behaviors.js +97 -0
- package/build-module/hooks/behaviors.js.map +1 -0
- package/build-module/hooks/dimensions.js +0 -28
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +3 -6
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +7 -9
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/private-apis.js +3 -5
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +42 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +79 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +34 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +26 -17
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/order-inserter-block-items.js +32 -0
- package/build-module/utils/order-inserter-block-items.js.map +1 -0
- package/build-style/content-rtl.css +32 -13
- package/build-style/content.css +32 -13
- package/build-style/default-editor-styles-rtl.css +1 -1
- package/build-style/default-editor-styles.css +1 -1
- package/build-style/style-rtl.css +19 -64
- package/build-style/style.css +20 -64
- package/package.json +32 -31
- package/src/autocompleters/block.js +15 -7
- package/src/components/block-breadcrumb/index.js +11 -3
- package/src/components/block-editing-mode/index.js +71 -0
- package/src/components/block-list/block-list-block-context.js +6 -0
- package/src/components/block-list/block.js +38 -56
- package/src/components/block-list/block.native.js +30 -41
- package/src/components/block-list/content.scss +5 -5
- package/src/components/block-list/index.native.js +164 -153
- package/src/components/block-list/test/index.native.js +2 -2
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-in-between-inserter.js +7 -3
- package/src/components/block-list-appender/index.js +22 -4
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +23 -0
- package/src/components/block-mover/style.scss +1 -0
- package/src/components/block-styles/preview-panel.js +1 -3
- package/src/components/block-switcher/block-transformations-menu.js +12 -0
- package/src/components/block-switcher/block-variation-transformations.js +115 -0
- package/src/components/block-switcher/index.js +38 -5
- package/src/components/block-switcher/pattern-transformations-menu.js +5 -5
- package/src/components/block-switcher/style.scss +6 -5
- package/src/components/block-toolbar/index.js +10 -11
- package/src/components/block-tools/block-contextual-toolbar.js +4 -5
- package/src/components/block-tools/insertion-point.js +23 -9
- package/src/components/button-block-appender/content.scss +22 -0
- package/src/components/convert-to-group-buttons/index.js +9 -2
- package/src/components/convert-to-group-buttons/index.native.js +79 -1
- package/src/components/convert-to-group-buttons/use-convert-to-group-button-props.js +32 -38
- package/src/components/global-styles/dimensions-panel.js +3 -2
- package/src/components/global-styles/style.scss +3 -0
- package/src/components/iframe/index.js +22 -12
- package/src/components/inner-blocks/README.md +5 -0
- package/src/components/inner-blocks/index.js +2 -0
- package/src/components/inner-blocks/index.native.js +16 -6
- package/src/components/inner-blocks/use-nested-settings-update.js +20 -3
- package/src/components/inserter/index.js +1 -9
- package/src/components/inserter/quick-inserter.js +0 -2
- package/src/components/inserter/search-results.js +32 -6
- package/src/components/list-view/appender.js +3 -2
- package/src/components/list-view/block-contents.js +8 -2
- package/src/components/list-view/block.js +29 -35
- package/src/components/list-view/branch.js +1 -7
- package/src/components/list-view/index.js +17 -4
- package/src/components/list-view/style.scss +2 -5
- package/src/components/list-view/use-list-view-client-ids.js +21 -4
- package/src/components/publish-date-time-picker/index.js +0 -2
- package/src/components/url-input/README.md +6 -0
- package/src/components/url-input/index.js +1 -0
- package/src/components/use-block-drop-zone/index.js +31 -17
- package/src/components/use-resize-canvas/index.js +9 -1
- package/src/components/writing-flow/test/index.js +15 -0
- package/src/components/writing-flow/use-arrow-nav.js +17 -4
- package/src/hooks/align.js +3 -11
- package/src/hooks/behaviors.js +104 -0
- package/src/hooks/dimensions.js +0 -40
- package/src/hooks/duotone.js +3 -11
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +10 -18
- package/src/private-apis.js +2 -4
- package/src/store/private-actions.js +39 -0
- package/src/store/private-selectors.js +95 -0
- package/src/store/reducer.js +27 -0
- package/src/store/selectors.js +25 -15
- package/src/store/test/private-actions.js +32 -1
- package/src/store/test/private-selectors.js +158 -0
- package/src/store/test/reducer.js +48 -0
- package/src/style.scss +0 -3
- package/src/utils/order-inserter-block-items.js +26 -0
- package/build/components/block-list/block-list-compact.native.js +0 -75
- package/build/components/block-list/block-list-compact.native.js.map +0 -1
- package/build/components/off-canvas-editor/appender.js +0 -125
- package/build/components/off-canvas-editor/appender.js.map +0 -1
- package/build/components/off-canvas-editor/block-contents.js +0 -141
- package/build/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build/components/off-canvas-editor/block-select-button.js +0 -126
- package/build/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build/components/off-canvas-editor/block.js +0 -297
- package/build/components/off-canvas-editor/block.js.map +0 -1
- package/build/components/off-canvas-editor/branch.js +0 -197
- package/build/components/off-canvas-editor/branch.js.map +0 -1
- package/build/components/off-canvas-editor/context.js +0 -19
- package/build/components/off-canvas-editor/context.js.map +0 -1
- package/build/components/off-canvas-editor/drop-indicator.js +0 -118
- package/build/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build/components/off-canvas-editor/expander.js +0 -41
- package/build/components/off-canvas-editor/expander.js.map +0 -1
- package/build/components/off-canvas-editor/index.js +0 -236
- package/build/components/off-canvas-editor/index.js.map +0 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +0 -148
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build/components/off-canvas-editor/leaf.js +0 -60
- package/build/components/off-canvas-editor/leaf.js.map +0 -1
- package/build/components/off-canvas-editor/link-ui.js +0 -186
- package/build/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build/components/off-canvas-editor/update-attributes.js +0 -108
- package/build/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build/components/off-canvas-editor/use-block-selection.js +0 -139
- package/build/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build/components/off-canvas-editor/use-inserted-block.js +0 -58
- package/build/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-client-ids.js +0 -33
- package/build/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js +0 -235
- package/build/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -60
- package/build/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build/components/off-canvas-editor/utils.js +0 -60
- package/build/components/off-canvas-editor/utils.js.map +0 -1
- package/build-module/components/block-list/block-list-compact.native.js +0 -60
- package/build-module/components/block-list/block-list-compact.native.js.map +0 -1
- package/build-module/components/off-canvas-editor/appender.js +0 -108
- package/build-module/components/off-canvas-editor/appender.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-contents.js +0 -121
- package/build-module/components/off-canvas-editor/block-contents.js.map +0 -1
- package/build-module/components/off-canvas-editor/block-select-button.js +0 -107
- package/build-module/components/off-canvas-editor/block-select-button.js.map +0 -1
- package/build-module/components/off-canvas-editor/block.js +0 -273
- package/build-module/components/off-canvas-editor/block.js.map +0 -1
- package/build-module/components/off-canvas-editor/branch.js +0 -179
- package/build-module/components/off-canvas-editor/branch.js.map +0 -1
- package/build-module/components/off-canvas-editor/context.js +0 -7
- package/build-module/components/off-canvas-editor/context.js.map +0 -1
- package/build-module/components/off-canvas-editor/drop-indicator.js +0 -111
- package/build-module/components/off-canvas-editor/drop-indicator.js.map +0 -1
- package/build-module/components/off-canvas-editor/expander.js +0 -32
- package/build-module/components/off-canvas-editor/expander.js.map +0 -1
- package/build-module/components/off-canvas-editor/index.js +0 -213
- package/build-module/components/off-canvas-editor/index.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +0 -130
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +0 -1
- package/build-module/components/off-canvas-editor/leaf.js +0 -45
- package/build-module/components/off-canvas-editor/leaf.js.map +0 -1
- package/build-module/components/off-canvas-editor/link-ui.js +0 -166
- package/build-module/components/off-canvas-editor/link-ui.js.map +0 -1
- package/build-module/components/off-canvas-editor/update-attributes.js +0 -97
- package/build-module/components/off-canvas-editor/update-attributes.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-block-selection.js +0 -124
- package/build-module/components/off-canvas-editor/use-block-selection.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js +0 -24
- package/build-module/components/off-canvas-editor/use-list-view-client-ids.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js +0 -220
- package/build-module/components/off-canvas-editor/use-list-view-drop-zone.js.map +0 -1
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -50
- package/build-module/components/off-canvas-editor/use-list-view-expand-selected-item.js.map +0 -1
- package/build-module/components/off-canvas-editor/utils.js +0 -44
- package/build-module/components/off-canvas-editor/utils.js.map +0 -1
- package/src/components/block-list/block-list-compact.native.js +0 -63
- package/src/components/off-canvas-editor/README.md +0 -5
- package/src/components/off-canvas-editor/appender.js +0 -124
- package/src/components/off-canvas-editor/block-contents.js +0 -156
- package/src/components/off-canvas-editor/block-select-button.js +0 -128
- package/src/components/off-canvas-editor/block.js +0 -347
- package/src/components/off-canvas-editor/branch.js +0 -238
- package/src/components/off-canvas-editor/context.js +0 -8
- package/src/components/off-canvas-editor/drop-indicator.js +0 -126
- package/src/components/off-canvas-editor/expander.js +0 -26
- package/src/components/off-canvas-editor/index.js +0 -271
- package/src/components/off-canvas-editor/leaf-more-menu.js +0 -158
- package/src/components/off-canvas-editor/leaf.js +0 -52
- package/src/components/off-canvas-editor/link-ui.js +0 -167
- package/src/components/off-canvas-editor/style.scss +0 -34
- package/src/components/off-canvas-editor/test/use-inserted-block.js +0 -108
- package/src/components/off-canvas-editor/test/utils.js +0 -50
- package/src/components/off-canvas-editor/update-attributes.js +0 -99
- package/src/components/off-canvas-editor/use-block-selection.js +0 -169
- package/src/components/off-canvas-editor/use-inserted-block.js +0 -47
- package/src/components/off-canvas-editor/use-list-view-client-ids.js +0 -29
- package/src/components/off-canvas-editor/use-list-view-drop-zone.js +0 -260
- package/src/components/off-canvas-editor/use-list-view-expand-selected-item.js +0 -58
- package/src/components/off-canvas-editor/utils.js +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/dimensions-panel.js"],"names":["classnames","__","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalBoxControl","BoxControl","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalView","View","Icon","positionCenter","stretchWide","useCallback","Platform","getValueFromVariable","SpacingSizesControl","HeightControl","ChildLayoutControl","cleanEmptyObject","setImmutably","AXIAL_SIDES","useHasDimensionsPanel","settings","hasContentSize","useHasContentSize","hasWideSize","useHasWideSize","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","hasMinHeight","useHasMinHeight","hasChildLayout","useHasChildLayout","OS","layout","contentSize","wideSize","spacing","padding","margin","blockGap","dimensions","minHeight","type","parentLayoutType","default","defaultParentLayoutType","allowSizingOnChildren","parentLayout","support","useHasSpacingPresets","custom","theme","defaultPresets","spacingSizes","presets","length","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","splitGapValue","DimensionsToolsPanel","resetAllFilter","onChange","panelId","children","resetAll","updatedValue","DEFAULT_CONTROLS","childLayout","DimensionsPanel","as","Wrapper","inheritedValue","defaultControls","onVisualize","includeLayoutControls","decodeValue","rawValue","showSpacingPresetsControl","units","availableUnits","showContentSizeControl","contentSizeValue","setContentSizeValue","newValue","undefined","hasUserSetContentSizeValue","resetContentSizeValue","showWideSizeControl","wideSizeValue","setWideSizeValue","hasUserSetWideSizeValue","resetWideSizeValue","showPaddingControl","rawPadding","paddingValues","paddingSides","Array","isArray","isAxialPadding","some","includes","setPaddingValues","newPaddingValues","hasPaddingValue","Object","keys","resetPaddingValue","onMouseOverPadding","showMarginControl","rawMargin","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","hasMarginValue","resetMarginValue","onMouseOverMargin","showGapControl","gapValue","gapValues","gapSides","isAxialGap","setGapValue","newGapValue","setGapValues","nextBoxGapValue","hasOwnProperty","resetGapValue","hasGapValue","showMinHeightControl","minHeightValue","setMinHeightValue","resetMinHeightValue","hasMinHeightValue","showChildLayoutControl","orientation","childLayoutOrientationLabel","setChildLayout","newChildLayout","resetChildLayoutValue","selfStretch","flexSize","hasChildLayoutValue","previousValue","onMouseLeaveControls","nextContentSize","nextWideSize"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,wBAAwB,IAAIC,UAH7B,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,yBAAyB,IAAIC,WAN9B,EAOCC,4BAA4B,IAAIC,cAPjC,EAQCC,kBAAkB,IAAIC,IARvB,QASO,uBATP;AAUA,SAASC,IAAT,EAAeC,cAAf,EAA+BC,WAA/B,QAAkD,kBAAlD;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,SAArC;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,SAASC,gBAAT,QAAiC,mBAAjC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA,MAAMC,WAAW,GAAG,CAAE,YAAF,EAAgB,UA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,EAAE,CAAE,aAAF,CADX;AAEC,IAAA,KAAK,EAAG0J,cAFT;AAGC,IAAA,QAAQ,EAAGC;AAHZ,IATD,CAvMF,EAuNGG,sBAAsB,IACvB,cAAC,MAAD;AACC,IAAA,EAAE,EAAG1J,cADN;AAEC,IAAA,OAAO,EAAG,CAFX;AAGC,IAAA,QAAQ,EAAGkK,mBAHZ;AAIC,IAAA,KAAK,EAAGN,2BAJT;AAKC,IAAA,UAAU,EAAGG,qBALd;AAMC,IAAA,gBAAgB,2BACfpE,eAAe,CAACL,WADD,yEAEfD,gBAAgB,CAACC,WARnB;AAUC,IAAA,OAAO,EAAGL;AAVX,KAYC,cAAC,kBAAD;AACC,IAAA,KAAK,EAAGK,WADT;AAEC,IAAA,QAAQ,EAAGuE,cAFZ;AAGC,IAAA,YAAY,EAAGnI,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAE8B;AAH1B,IAZD,CAxNF,CADD;AA8OA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalView as View,\n} from '@wordpress/components';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\nimport { useCallback, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable } from './utils';\nimport SpacingSizesControl from '../spacing-sizes-control';\nimport HeightControl from '../height-control';\nimport ChildLayoutControl from '../child-layout-control';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport { setImmutably } from '../../utils/object';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( settings ) {\n\tconst hasContentSize = useHasContentSize( settings );\n\tconst hasWideSize = useHasWideSize( settings );\n\tconst hasPadding = useHasPadding( settings );\n\tconst hasMargin = useHasMargin( settings );\n\tconst hasGap = useHasGap( settings );\n\tconst hasMinHeight = useHasMinHeight( settings );\n\tconst hasChildLayout = useHasChildLayout( settings );\n\n\treturn (\n\t\tPlatform.OS === 'web' &&\n\t\t( hasContentSize ||\n\t\t\thasWideSize ||\n\t\t\thasPadding ||\n\t\t\thasMargin ||\n\t\t\thasGap ||\n\t\t\thasMinHeight ||\n\t\t\thasChildLayout )\n\t);\n}\n\nfunction useHasContentSize( settings ) {\n\treturn settings?.layout?.contentSize;\n}\n\nfunction useHasWideSize( settings ) {\n\treturn settings?.layout?.wideSize;\n}\n\nfunction useHasPadding( settings ) {\n\treturn settings?.spacing?.padding;\n}\n\nfunction useHasMargin( settings ) {\n\treturn settings?.spacing?.margin;\n}\n\nfunction useHasGap( settings ) {\n\treturn settings?.spacing?.blockGap;\n}\n\nfunction useHasMinHeight( settings ) {\n\treturn settings?.dimensions?.minHeight;\n}\n\nfunction useHasChildLayout( settings ) {\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tdefault: { type: defaultParentLayoutType = 'default' } = {},\n\t\tallowSizingOnChildren = false,\n\t} = settings?.parentLayout ?? {};\n\n\tconst support =\n\t\t( defaultParentLayoutType === 'flex' || parentLayoutType === 'flex' ) &&\n\t\tallowSizingOnChildren;\n\n\treturn !! settings?.layout && support;\n}\n\nfunction useHasSpacingPresets( settings ) {\n\tconst {\n\t\tcustom,\n\t\ttheme,\n\t\tdefault: defaultPresets,\n\t} = settings?.spacing?.spacingSizes || {};\n\tconst presets = custom ?? theme ?? defaultPresets ?? [];\n\n\treturn presets.length > 0;\n}\n\nfunction filterValuesBySides( values, sides ) {\n\tif ( ! sides ) {\n\t\t// If no custom side configuration all sides are opted into by default.\n\t\treturn values;\n\t}\n\n\t// Only include sides opted into within filtered values.\n\tconst filteredValues = {};\n\tsides.forEach( ( side ) => {\n\t\tif ( side === 'vertical' ) {\n\t\t\tfilteredValues.top = values.top;\n\t\t\tfilteredValues.bottom = values.bottom;\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tfilteredValues.left = values.left;\n\t\t\tfilteredValues.right = values.right;\n\t\t}\n\t\tfilteredValues[ side ] = values?.[ side ];\n\t} );\n\n\treturn filteredValues;\n}\n\nfunction splitStyleValue( value ) {\n\t// Check for shorthand value (a string value).\n\tif ( value && typeof value === 'string' ) {\n\t\t// Convert to value for individual sides for BoxControl.\n\t\treturn {\n\t\t\ttop: value,\n\t\t\tright: value,\n\t\t\tbottom: value,\n\t\t\tleft: value,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nfunction splitGapValue( value ) {\n\t// Check for shorthand value (a string value).\n\tif ( value && typeof value === 'string' ) {\n\t\t// If the value is a string, treat it as a single side (top) for the spacing controls.\n\t\treturn {\n\t\t\ttop: value,\n\t\t};\n\t}\n\n\tif ( value ) {\n\t\treturn {\n\t\t\t...value,\n\t\t\tright: value?.left,\n\t\t\tbottom: value?.top,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nfunction DimensionsToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tcontentSize: true,\n\twideSize: true,\n\tpadding: true,\n\tmargin: true,\n\tblockGap: true,\n\tminHeight: true,\n\tchildLayout: true,\n};\n\nexport default function DimensionsPanel( {\n\tas: Wrapper = DimensionsToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tonVisualize = () => {},\n\t// Special case because the layout controls are not part of the dimensions panel\n\t// in global styles but not in block inspector.\n\tincludeLayoutControls = false,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\tconst showSpacingPresetsControl = useHasSpacingPresets( settings );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: settings?.spacing?.units || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\t// Content Size\n\tconst showContentSizeControl =\n\t\tuseHasContentSize( settings ) && includeLayoutControls;\n\tconst contentSizeValue = decodeValue( inheritedValue?.layout?.contentSize );\n\tconst setContentSizeValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'layout', 'contentSize' ],\n\t\t\t\tnewValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasUserSetContentSizeValue = () => !! value?.layout?.contentSize;\n\tconst resetContentSizeValue = () => setContentSizeValue( undefined );\n\n\t// Wide Size\n\tconst showWideSizeControl =\n\t\tuseHasWideSize( settings ) && includeLayoutControls;\n\tconst wideSizeValue = decodeValue( inheritedValue?.layout?.wideSize );\n\tconst setWideSizeValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'layout', 'wideSize' ],\n\t\t\t\tnewValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasUserSetWideSizeValue = () => !! value?.layout?.wideSize;\n\tconst resetWideSizeValue = () => setWideSizeValue( undefined );\n\n\t// Padding\n\tconst showPaddingControl = useHasPadding( settings );\n\tconst rawPadding = decodeValue( inheritedValue?.spacing?.padding );\n\tconst paddingValues = splitStyleValue( rawPadding );\n\tconst paddingSides = Array.isArray( settings?.spacing?.padding )\n\t\t? settings?.spacing?.padding\n\t\t: settings?.spacing?.padding?.sides;\n\tconst isAxialPadding =\n\t\tpaddingSides &&\n\t\tpaddingSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setPaddingValues = ( newPaddingValues ) => {\n\t\tconst padding = filterValuesBySides( newPaddingValues, paddingSides );\n\t\tonChange( setImmutably( value, [ 'spacing', 'padding' ], padding ) );\n\t};\n\tconst hasPaddingValue = () =>\n\t\t!! value?.spacing?.padding &&\n\t\tObject.keys( value?.spacing?.padding ).length;\n\tconst resetPaddingValue = () => setPaddingValues( undefined );\n\tconst onMouseOverPadding = () => onVisualize( 'padding' );\n\n\t// Margin\n\tconst showMarginControl = useHasMargin( settings );\n\tconst rawMargin = decodeValue( inheritedValue?.spacing?.margin );\n\tconst marginValues = splitStyleValue( rawMargin );\n\tconst marginSides = Array.isArray( settings?.spacing?.margin )\n\t\t? settings?.spacing?.margin\n\t\t: settings?.spacing?.margin?.sides;\n\tconst isAxialMargin =\n\t\tmarginSides &&\n\t\tmarginSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setMarginValues = ( newMarginValues ) => {\n\t\tconst margin = filterValuesBySides( newMarginValues, marginSides );\n\t\tonChange( setImmutably( value, [ 'spacing', 'margin' ], margin ) );\n\t};\n\tconst hasMarginValue = () =>\n\t\t!! value?.spacing?.margin &&\n\t\tObject.keys( value?.spacing?.margin ).length;\n\tconst resetMarginValue = () => setMarginValues( undefined );\n\tconst onMouseOverMargin = () => onVisualize( 'margin' );\n\n\t// Block Gap\n\tconst showGapControl = useHasGap( settings );\n\tconst gapValue = decodeValue( inheritedValue?.spacing?.blockGap );\n\tconst gapValues = splitGapValue( gapValue );\n\tconst gapSides = Array.isArray( settings?.spacing?.blockGap )\n\t\t? settings?.spacing?.blockGap\n\t\t: settings?.spacing?.blockGap?.sides;\n\tconst isAxialGap =\n\t\tgapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setGapValue = ( newGapValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably( value, [ 'spacing', 'blockGap' ], newGapValue )\n\t\t);\n\t};\n\tconst setGapValues = ( nextBoxGapValue ) => {\n\t\tif ( ! nextBoxGapValue ) {\n\t\t\tsetGapValue( null );\n\t\t}\n\t\t// If axial gap is not enabled, treat the 'top' value as the shorthand gap value.\n\t\tif ( ! isAxialGap && nextBoxGapValue?.hasOwnProperty( 'top' ) ) {\n\t\t\tsetGapValue( nextBoxGapValue.top );\n\t\t} else {\n\t\t\tsetGapValue( {\n\t\t\t\ttop: nextBoxGapValue?.top,\n\t\t\t\tleft: nextBoxGapValue?.left,\n\t\t\t} );\n\t\t}\n\t};\n\tconst resetGapValue = () => setGapValue( undefined );\n\tconst hasGapValue = () => !! value?.spacing?.blockGap;\n\n\t// Min Height\n\tconst showMinHeightControl = useHasMinHeight( settings );\n\tconst minHeightValue = decodeValue( inheritedValue?.dimensions?.minHeight );\n\tconst setMinHeightValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably( value, [ 'dimensions', 'minHeight' ], newValue )\n\t\t);\n\t};\n\tconst resetMinHeightValue = () => {\n\t\tsetMinHeightValue( undefined );\n\t};\n\tconst hasMinHeightValue = () => !! value?.dimensions?.minHeight;\n\n\t// Child Layout\n\tconst showChildLayoutControl = useHasChildLayout( settings );\n\tconst childLayout = inheritedValue?.layout;\n\tconst { orientation = 'horizontal' } = settings?.parentLayout ?? {};\n\tconst childLayoutOrientationLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst setChildLayout = ( newChildLayout ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tlayout: {\n\t\t\t\t...value?.layout,\n\t\t\t\t...newChildLayout,\n\t\t\t},\n\t\t} );\n\t};\n\tconst resetChildLayoutValue = () => {\n\t\tsetChildLayout( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\tconst hasChildLayoutValue = () => !! value?.layout;\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tlayout: cleanEmptyObject( {\n\t\t\t\t...previousValue?.layout,\n\t\t\t\tcontentSize: undefined,\n\t\t\t\twideSize: undefined,\n\t\t\t\tselfStretch: undefined,\n\t\t\t\tflexSize: undefined,\n\t\t\t} ),\n\t\t\tspacing: {\n\t\t\t\t...previousValue?.spacing,\n\t\t\t\tpadding: undefined,\n\t\t\t\tmargin: undefined,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\t...previousValue?.dimensions,\n\t\t\t\tminHeight: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst onMouseLeaveControls = () => onVisualize( false );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ ( showContentSizeControl || showWideSizeControl ) && (\n\t\t\t\t<span className=\"span-columns\">\n\t\t\t\t\t{ __( 'Set the width of the main content area.' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ showContentSizeControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Content size' ) }\n\t\t\t\t\thasValue={ hasUserSetContentSizeValue }\n\t\t\t\t\tonDeselect={ resetContentSizeValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.contentSize ??\n\t\t\t\t\t\tDEFAULT_CONTROLS.contentSize\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HStack alignment=\"flex-end\" justify=\"flex-start\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSizeValue || '' }\n\t\t\t\t\t\t\tonChange={ ( nextContentSize ) => {\n\t\t\t\t\t\t\t\tsetContentSizeValue( nextContentSize );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</HStack>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showWideSizeControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Wide size' ) }\n\t\t\t\t\thasValue={ hasUserSetWideSizeValue }\n\t\t\t\t\tonDeselect={ resetWideSizeValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.wideSize ?? DEFAULT_CONTROLS.wideSize\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HStack alignment=\"flex-end\" justify=\"flex-start\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSizeValue || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWideSize ) => {\n\t\t\t\t\t\t\t\tsetWideSizeValue( nextWideSize );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</HStack>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showPaddingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasPaddingValue }\n\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\tonDeselect={ resetPaddingValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.padding ?? DEFAULT_CONTROLS.padding\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl && (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverPadding }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverPadding }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMarginControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMarginValue }\n\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\tonDeselect={ resetMarginValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.margin ?? DEFAULT_CONTROLS.margin\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl && (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverMargin }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverMargin }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showGapControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\tonDeselect={ resetGapValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.blockGap ?? DEFAULT_CONTROLS.blockGap\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl &&\n\t\t\t\t\t\t( isAxialGap ? (\n\t\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\tonChange={ setGapValues }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tsides={ gapSides }\n\t\t\t\t\t\t\t\tvalues={ gapValues }\n\t\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\t\tsplitOnAxis={ isAxialGap }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\tonChange={ setGapValue }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tvalue={ gapValue }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ setGapValues }\n\t\t\t\t\t\t\tsides={ isAxialGap ? gapSides : [ 'top' ] } // Use 'top' as the shorthand property in non-axial configurations.\n\t\t\t\t\t\t\tvalues={ gapValues }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialGap }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMinHeightControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMinHeightValue }\n\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\tonDeselect={ resetMinHeightValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.minHeight ?? DEFAULT_CONTROLS.minHeight\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HeightControl\n\t\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\t\tvalue={ minHeightValue }\n\t\t\t\t\t\tonChange={ setMinHeightValue }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showChildLayoutControl && (\n\t\t\t\t<VStack\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\thasValue={ hasChildLayoutValue }\n\t\t\t\t\tlabel={ childLayoutOrientationLabel }\n\t\t\t\t\tonDeselect={ resetChildLayoutValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.childLayout ??\n\t\t\t\t\t\tDEFAULT_CONTROLS.childLayout\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ChildLayoutControl\n\t\t\t\t\t\tvalue={ childLayout }\n\t\t\t\t\t\tonChange={ setChildLayout }\n\t\t\t\t\t\tparentLayout={ settings?.parentLayout }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/global-styles/dimensions-panel.js"],"names":["classnames","__","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__experimentalBoxControl","BoxControl","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalUnitControl","UnitControl","__experimentalUseCustomUnits","useCustomUnits","__experimentalView","View","Icon","positionCenter","stretchWide","useCallback","Platform","getValueFromVariable","SpacingSizesControl","HeightControl","ChildLayoutControl","cleanEmptyObject","setImmutably","AXIAL_SIDES","useHasDimensionsPanel","settings","hasContentSize","useHasContentSize","hasWideSize","useHasWideSize","hasPadding","useHasPadding","hasMargin","useHasMargin","hasGap","useHasGap","hasMinHeight","useHasMinHeight","hasChildLayout","useHasChildLayout","OS","layout","contentSize","wideSize","spacing","padding","margin","blockGap","dimensions","minHeight","type","parentLayoutType","default","defaultParentLayoutType","allowSizingOnChildren","parentLayout","support","useHasSpacingPresets","custom","theme","defaultPresets","spacingSizes","presets","length","filterValuesBySides","values","sides","filteredValues","forEach","side","top","bottom","left","right","splitStyleValue","value","splitGapValue","DimensionsToolsPanel","resetAllFilter","onChange","panelId","children","resetAll","updatedValue","DEFAULT_CONTROLS","childLayout","DimensionsPanel","as","Wrapper","inheritedValue","defaultControls","onVisualize","includeLayoutControls","decodeValue","rawValue","showSpacingPresetsControl","units","availableUnits","showContentSizeControl","contentSizeValue","setContentSizeValue","newValue","undefined","hasUserSetContentSizeValue","resetContentSizeValue","showWideSizeControl","wideSizeValue","setWideSizeValue","hasUserSetWideSizeValue","resetWideSizeValue","showPaddingControl","rawPadding","paddingValues","paddingSides","Array","isArray","isAxialPadding","some","includes","setPaddingValues","newPaddingValues","hasPaddingValue","Object","keys","resetPaddingValue","onMouseOverPadding","showMarginControl","rawMargin","marginValues","marginSides","isAxialMargin","setMarginValues","newMarginValues","hasMarginValue","resetMarginValue","onMouseOverMargin","showGapControl","gapValue","gapValues","gapSides","isAxialGap","setGapValue","newGapValue","setGapValues","nextBoxGapValue","hasOwnProperty","resetGapValue","hasGapValue","showMinHeightControl","minHeightValue","setMinHeightValue","resetMinHeightValue","hasMinHeightValue","showChildLayoutControl","orientation","childLayoutOrientationLabel","setChildLayout","newChildLayout","resetChildLayoutValue","selfStretch","flexSize","hasChildLayoutValue","previousValue","onMouseLeaveControls","nextContentSize","nextWideSize"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,wBAAwB,IAAIC,UAD7B,EAECC,4BAA4B,IAAIC,cAFjC,EAGCC,wBAAwB,IAAIC,UAH7B,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,oBAAoB,IAAIC,MALzB,EAMCC,yBAAyB,IAAIC,WAN9B,EAOCC,4BAA4B,IAAIC,cAPjC,EAQCC,kBAAkB,IAAIC,IARvB,QASO,uBATP;AAUA,SAASC,IAAT,EAAeC,cAAf,EAA+BC,WAA/B,QAAkD,kBAAlD;AACA,SAASC,WAAT,EAAsBC,QAAtB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASC,oBAAT,QAAqC,SAArC;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B,yBAA/B;AACA,SAASC,gBAAT,QAAiC,mBAAjC;AACA,SAASC,YAAT,QAA6B,oBAA7B;AAEA,MAAMC,WAAW,GAAG,CAAE,YAAF,EAAgB,UAAhB,CAApB;AAEA,OAAO,SAASC,qBAAT,CAAgCC,QAAhC,EAA2C;AACjD,QAAMC,cAAc,GAAGC,iBAAiB,CAAEF,QAAF,CAAxC;AACA,QAAMG,WAAW,GAAGC,cAAc,CAAEJ,QAAF,CAAlC;AACA,QAAMK,UAAU,GAAGC,aAAa,CAAEN,QAAF,CAAhC;AACA,QAAMO,SAAS,GAAGC,YAAY,CAAER,QAAF,CAA9B;AACA,QAAMS,MAAM,GAAGC,SAAS,CAAEV,QAAF,CAAxB;AACA,QAAMW,YAAY,GAAGC,eAAe,CAAEZ,QAAF,CAApC;A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fD,gBAAgB,CAACC,WARnB;AAUC,IAAA,OAAO,EAAGL;AAVX,KAYC,cAAC,kBAAD;AACC,IAAA,KAAK,EAAGK,WADT;AAEC,IAAA,QAAQ,EAAGuE,cAFZ;AAGC,IAAA,YAAY,EAAGnI,QAAH,aAAGA,QAAH,uBAAGA,QAAQ,CAAE8B;AAH1B,IAZD,CAxNF,CADD;AA8OA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalBoxControl as BoxControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalView as View,\n} from '@wordpress/components';\nimport { Icon, positionCenter, stretchWide } from '@wordpress/icons';\nimport { useCallback, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getValueFromVariable } from './utils';\nimport SpacingSizesControl from '../spacing-sizes-control';\nimport HeightControl from '../height-control';\nimport ChildLayoutControl from '../child-layout-control';\nimport { cleanEmptyObject } from '../../hooks/utils';\nimport { setImmutably } from '../../utils/object';\n\nconst AXIAL_SIDES = [ 'horizontal', 'vertical' ];\n\nexport function useHasDimensionsPanel( settings ) {\n\tconst hasContentSize = useHasContentSize( settings );\n\tconst hasWideSize = useHasWideSize( settings );\n\tconst hasPadding = useHasPadding( settings );\n\tconst hasMargin = useHasMargin( settings );\n\tconst hasGap = useHasGap( settings );\n\tconst hasMinHeight = useHasMinHeight( settings );\n\tconst hasChildLayout = useHasChildLayout( settings );\n\n\treturn (\n\t\tPlatform.OS === 'web' &&\n\t\t( hasContentSize ||\n\t\t\thasWideSize ||\n\t\t\thasPadding ||\n\t\t\thasMargin ||\n\t\t\thasGap ||\n\t\t\thasMinHeight ||\n\t\t\thasChildLayout )\n\t);\n}\n\nfunction useHasContentSize( settings ) {\n\treturn settings?.layout?.contentSize;\n}\n\nfunction useHasWideSize( settings ) {\n\treturn settings?.layout?.wideSize;\n}\n\nfunction useHasPadding( settings ) {\n\treturn settings?.spacing?.padding;\n}\n\nfunction useHasMargin( settings ) {\n\treturn settings?.spacing?.margin;\n}\n\nfunction useHasGap( settings ) {\n\treturn settings?.spacing?.blockGap;\n}\n\nfunction useHasMinHeight( settings ) {\n\treturn settings?.dimensions?.minHeight;\n}\n\nfunction useHasChildLayout( settings ) {\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tdefault: { type: defaultParentLayoutType = 'default' } = {},\n\t\tallowSizingOnChildren = false,\n\t} = settings?.parentLayout ?? {};\n\n\tconst support =\n\t\t( defaultParentLayoutType === 'flex' || parentLayoutType === 'flex' ) &&\n\t\tallowSizingOnChildren;\n\n\treturn !! settings?.layout && support;\n}\n\nfunction useHasSpacingPresets( settings ) {\n\tconst {\n\t\tcustom,\n\t\ttheme,\n\t\tdefault: defaultPresets,\n\t} = settings?.spacing?.spacingSizes || {};\n\tconst presets = custom ?? theme ?? defaultPresets ?? [];\n\n\treturn presets.length > 0;\n}\n\nfunction filterValuesBySides( values, sides ) {\n\t// If no custom side configuration, all sides are opted into by default.\n\t// Without any values, we have nothing to filter either.\n\tif ( ! sides || ! values ) {\n\t\treturn values;\n\t}\n\n\t// Only include sides opted into within filtered values.\n\tconst filteredValues = {};\n\tsides.forEach( ( side ) => {\n\t\tif ( side === 'vertical' ) {\n\t\t\tfilteredValues.top = values.top;\n\t\t\tfilteredValues.bottom = values.bottom;\n\t\t}\n\t\tif ( side === 'horizontal' ) {\n\t\t\tfilteredValues.left = values.left;\n\t\t\tfilteredValues.right = values.right;\n\t\t}\n\t\tfilteredValues[ side ] = values?.[ side ];\n\t} );\n\n\treturn filteredValues;\n}\n\nfunction splitStyleValue( value ) {\n\t// Check for shorthand value (a string value).\n\tif ( value && typeof value === 'string' ) {\n\t\t// Convert to value for individual sides for BoxControl.\n\t\treturn {\n\t\t\ttop: value,\n\t\t\tright: value,\n\t\t\tbottom: value,\n\t\t\tleft: value,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nfunction splitGapValue( value ) {\n\t// Check for shorthand value (a string value).\n\tif ( value && typeof value === 'string' ) {\n\t\t// If the value is a string, treat it as a single side (top) for the spacing controls.\n\t\treturn {\n\t\t\ttop: value,\n\t\t};\n\t}\n\n\tif ( value ) {\n\t\treturn {\n\t\t\t...value,\n\t\t\tright: value?.left,\n\t\t\tbottom: value?.top,\n\t\t};\n\t}\n\n\treturn value;\n}\n\nfunction DimensionsToolsPanel( {\n\tresetAllFilter,\n\tonChange,\n\tvalue,\n\tpanelId,\n\tchildren,\n} ) {\n\tconst resetAll = () => {\n\t\tconst updatedValue = resetAllFilter( value );\n\t\tonChange( updatedValue );\n\t};\n\n\treturn (\n\t\t<ToolsPanel\n\t\t\tlabel={ __( 'Dimensions' ) }\n\t\t\tresetAll={ resetAll }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ children }\n\t\t</ToolsPanel>\n\t);\n}\n\nconst DEFAULT_CONTROLS = {\n\tcontentSize: true,\n\twideSize: true,\n\tpadding: true,\n\tmargin: true,\n\tblockGap: true,\n\tminHeight: true,\n\tchildLayout: true,\n};\n\nexport default function DimensionsPanel( {\n\tas: Wrapper = DimensionsToolsPanel,\n\tvalue,\n\tonChange,\n\tinheritedValue = value,\n\tsettings,\n\tpanelId,\n\tdefaultControls = DEFAULT_CONTROLS,\n\tonVisualize = () => {},\n\t// Special case because the layout controls are not part of the dimensions panel\n\t// in global styles but not in block inspector.\n\tincludeLayoutControls = false,\n} ) {\n\tconst decodeValue = ( rawValue ) =>\n\t\tgetValueFromVariable( { settings }, '', rawValue );\n\n\tconst showSpacingPresetsControl = useHasSpacingPresets( settings );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: settings?.spacing?.units || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vw',\n\t\t],\n\t} );\n\n\t// Content Size\n\tconst showContentSizeControl =\n\t\tuseHasContentSize( settings ) && includeLayoutControls;\n\tconst contentSizeValue = decodeValue( inheritedValue?.layout?.contentSize );\n\tconst setContentSizeValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'layout', 'contentSize' ],\n\t\t\t\tnewValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasUserSetContentSizeValue = () => !! value?.layout?.contentSize;\n\tconst resetContentSizeValue = () => setContentSizeValue( undefined );\n\n\t// Wide Size\n\tconst showWideSizeControl =\n\t\tuseHasWideSize( settings ) && includeLayoutControls;\n\tconst wideSizeValue = decodeValue( inheritedValue?.layout?.wideSize );\n\tconst setWideSizeValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably(\n\t\t\t\tvalue,\n\t\t\t\t[ 'layout', 'wideSize' ],\n\t\t\t\tnewValue || undefined\n\t\t\t)\n\t\t);\n\t};\n\tconst hasUserSetWideSizeValue = () => !! value?.layout?.wideSize;\n\tconst resetWideSizeValue = () => setWideSizeValue( undefined );\n\n\t// Padding\n\tconst showPaddingControl = useHasPadding( settings );\n\tconst rawPadding = decodeValue( inheritedValue?.spacing?.padding );\n\tconst paddingValues = splitStyleValue( rawPadding );\n\tconst paddingSides = Array.isArray( settings?.spacing?.padding )\n\t\t? settings?.spacing?.padding\n\t\t: settings?.spacing?.padding?.sides;\n\tconst isAxialPadding =\n\t\tpaddingSides &&\n\t\tpaddingSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setPaddingValues = ( newPaddingValues ) => {\n\t\tconst padding = filterValuesBySides( newPaddingValues, paddingSides );\n\t\tonChange( setImmutably( value, [ 'spacing', 'padding' ], padding ) );\n\t};\n\tconst hasPaddingValue = () =>\n\t\t!! value?.spacing?.padding &&\n\t\tObject.keys( value?.spacing?.padding ).length;\n\tconst resetPaddingValue = () => setPaddingValues( undefined );\n\tconst onMouseOverPadding = () => onVisualize( 'padding' );\n\n\t// Margin\n\tconst showMarginControl = useHasMargin( settings );\n\tconst rawMargin = decodeValue( inheritedValue?.spacing?.margin );\n\tconst marginValues = splitStyleValue( rawMargin );\n\tconst marginSides = Array.isArray( settings?.spacing?.margin )\n\t\t? settings?.spacing?.margin\n\t\t: settings?.spacing?.margin?.sides;\n\tconst isAxialMargin =\n\t\tmarginSides &&\n\t\tmarginSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setMarginValues = ( newMarginValues ) => {\n\t\tconst margin = filterValuesBySides( newMarginValues, marginSides );\n\t\tonChange( setImmutably( value, [ 'spacing', 'margin' ], margin ) );\n\t};\n\tconst hasMarginValue = () =>\n\t\t!! value?.spacing?.margin &&\n\t\tObject.keys( value?.spacing?.margin ).length;\n\tconst resetMarginValue = () => setMarginValues( undefined );\n\tconst onMouseOverMargin = () => onVisualize( 'margin' );\n\n\t// Block Gap\n\tconst showGapControl = useHasGap( settings );\n\tconst gapValue = decodeValue( inheritedValue?.spacing?.blockGap );\n\tconst gapValues = splitGapValue( gapValue );\n\tconst gapSides = Array.isArray( settings?.spacing?.blockGap )\n\t\t? settings?.spacing?.blockGap\n\t\t: settings?.spacing?.blockGap?.sides;\n\tconst isAxialGap =\n\t\tgapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) );\n\tconst setGapValue = ( newGapValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably( value, [ 'spacing', 'blockGap' ], newGapValue )\n\t\t);\n\t};\n\tconst setGapValues = ( nextBoxGapValue ) => {\n\t\tif ( ! nextBoxGapValue ) {\n\t\t\tsetGapValue( null );\n\t\t}\n\t\t// If axial gap is not enabled, treat the 'top' value as the shorthand gap value.\n\t\tif ( ! isAxialGap && nextBoxGapValue?.hasOwnProperty( 'top' ) ) {\n\t\t\tsetGapValue( nextBoxGapValue.top );\n\t\t} else {\n\t\t\tsetGapValue( {\n\t\t\t\ttop: nextBoxGapValue?.top,\n\t\t\t\tleft: nextBoxGapValue?.left,\n\t\t\t} );\n\t\t}\n\t};\n\tconst resetGapValue = () => setGapValue( undefined );\n\tconst hasGapValue = () => !! value?.spacing?.blockGap;\n\n\t// Min Height\n\tconst showMinHeightControl = useHasMinHeight( settings );\n\tconst minHeightValue = decodeValue( inheritedValue?.dimensions?.minHeight );\n\tconst setMinHeightValue = ( newValue ) => {\n\t\tonChange(\n\t\t\tsetImmutably( value, [ 'dimensions', 'minHeight' ], newValue )\n\t\t);\n\t};\n\tconst resetMinHeightValue = () => {\n\t\tsetMinHeightValue( undefined );\n\t};\n\tconst hasMinHeightValue = () => !! value?.dimensions?.minHeight;\n\n\t// Child Layout\n\tconst showChildLayoutControl = useHasChildLayout( settings );\n\tconst childLayout = inheritedValue?.layout;\n\tconst { orientation = 'horizontal' } = settings?.parentLayout ?? {};\n\tconst childLayoutOrientationLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst setChildLayout = ( newChildLayout ) => {\n\t\tonChange( {\n\t\t\t...value,\n\t\t\tlayout: {\n\t\t\t\t...value?.layout,\n\t\t\t\t...newChildLayout,\n\t\t\t},\n\t\t} );\n\t};\n\tconst resetChildLayoutValue = () => {\n\t\tsetChildLayout( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\tconst hasChildLayoutValue = () => !! value?.layout;\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tlayout: cleanEmptyObject( {\n\t\t\t\t...previousValue?.layout,\n\t\t\t\tcontentSize: undefined,\n\t\t\t\twideSize: undefined,\n\t\t\t\tselfStretch: undefined,\n\t\t\t\tflexSize: undefined,\n\t\t\t} ),\n\t\t\tspacing: {\n\t\t\t\t...previousValue?.spacing,\n\t\t\t\tpadding: undefined,\n\t\t\t\tmargin: undefined,\n\t\t\t\tblockGap: undefined,\n\t\t\t},\n\t\t\tdimensions: {\n\t\t\t\t...previousValue?.dimensions,\n\t\t\t\tminHeight: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst onMouseLeaveControls = () => onVisualize( false );\n\n\treturn (\n\t\t<Wrapper\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tvalue={ value }\n\t\t\tonChange={ onChange }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t{ ( showContentSizeControl || showWideSizeControl ) && (\n\t\t\t\t<span className=\"span-columns\">\n\t\t\t\t\t{ __( 'Set the width of the main content area.' ) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t\t{ showContentSizeControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Content size' ) }\n\t\t\t\t\thasValue={ hasUserSetContentSizeValue }\n\t\t\t\t\tonDeselect={ resetContentSizeValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.contentSize ??\n\t\t\t\t\t\tDEFAULT_CONTROLS.contentSize\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HStack alignment=\"flex-end\" justify=\"flex-start\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Content' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ contentSizeValue || '' }\n\t\t\t\t\t\t\tonChange={ ( nextContentSize ) => {\n\t\t\t\t\t\t\t\tsetContentSizeValue( nextContentSize );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t<Icon icon={ positionCenter } />\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</HStack>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showWideSizeControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\tclassName=\"single-column\"\n\t\t\t\t\tlabel={ __( 'Wide size' ) }\n\t\t\t\t\thasValue={ hasUserSetWideSizeValue }\n\t\t\t\t\tonDeselect={ resetWideSizeValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.wideSize ?? DEFAULT_CONTROLS.wideSize\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HStack alignment=\"flex-end\" justify=\"flex-start\">\n\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\tlabel={ __( 'Wide' ) }\n\t\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\tvalue={ wideSizeValue || '' }\n\t\t\t\t\t\t\tonChange={ ( nextWideSize ) => {\n\t\t\t\t\t\t\t\tsetWideSizeValue( nextWideSize );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<View>\n\t\t\t\t\t\t\t<Icon icon={ stretchWide } />\n\t\t\t\t\t\t</View>\n\t\t\t\t\t</HStack>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showPaddingControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasPaddingValue }\n\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\tonDeselect={ resetPaddingValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.padding ?? DEFAULT_CONTROLS.padding\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl && (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverPadding }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tvalues={ paddingValues }\n\t\t\t\t\t\t\tonChange={ setPaddingValues }\n\t\t\t\t\t\t\tlabel={ __( 'Padding' ) }\n\t\t\t\t\t\t\tsides={ paddingSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialPadding }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverPadding }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMarginControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMarginValue }\n\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\tonDeselect={ resetMarginValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.margin ?? DEFAULT_CONTROLS.margin\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl && (\n\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverMargin }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tvalues={ marginValues }\n\t\t\t\t\t\t\tonChange={ setMarginValues }\n\t\t\t\t\t\t\tlabel={ __( 'Margin' ) }\n\t\t\t\t\t\t\tsides={ marginSides }\n\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialMargin }\n\t\t\t\t\t\t\tonMouseOver={ onMouseOverMargin }\n\t\t\t\t\t\t\tonMouseOut={ onMouseLeaveControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showGapControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasGapValue }\n\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\tonDeselect={ resetGapValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.blockGap ?? DEFAULT_CONTROLS.blockGap\n\t\t\t\t\t}\n\t\t\t\t\tclassName={ classnames( {\n\t\t\t\t\t\t'tools-panel-item-spacing': showSpacingPresetsControl,\n\t\t\t\t\t} ) }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t{ ! showSpacingPresetsControl &&\n\t\t\t\t\t\t( isAxialGap ? (\n\t\t\t\t\t\t\t<BoxControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\tonChange={ setGapValues }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tsides={ gapSides }\n\t\t\t\t\t\t\t\tvalues={ gapValues }\n\t\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\t\tsplitOnAxis={ isAxialGap }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<UnitControl\n\t\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\t\t__unstableInputWidth=\"80px\"\n\t\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\t\tonChange={ setGapValue }\n\t\t\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\t\t\tvalue={ gapValue }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t{ showSpacingPresetsControl && (\n\t\t\t\t\t\t<SpacingSizesControl\n\t\t\t\t\t\t\tlabel={ __( 'Block spacing' ) }\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tonChange={ setGapValues }\n\t\t\t\t\t\t\tsides={ isAxialGap ? gapSides : [ 'top' ] } // Use 'top' as the shorthand property in non-axial configurations.\n\t\t\t\t\t\t\tvalues={ gapValues }\n\t\t\t\t\t\t\tallowReset={ false }\n\t\t\t\t\t\t\tsplitOnAxis={ isAxialGap }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showMinHeightControl && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasMinHeightValue }\n\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\tonDeselect={ resetMinHeightValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.minHeight ?? DEFAULT_CONTROLS.minHeight\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<HeightControl\n\t\t\t\t\t\tlabel={ __( 'Min. height' ) }\n\t\t\t\t\t\tvalue={ minHeightValue }\n\t\t\t\t\t\tonChange={ setMinHeightValue }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showChildLayoutControl && (\n\t\t\t\t<VStack\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\thasValue={ hasChildLayoutValue }\n\t\t\t\t\tlabel={ childLayoutOrientationLabel }\n\t\t\t\t\tonDeselect={ resetChildLayoutValue }\n\t\t\t\t\tisShownByDefault={\n\t\t\t\t\t\tdefaultControls.childLayout ??\n\t\t\t\t\t\tDEFAULT_CONTROLS.childLayout\n\t\t\t\t\t}\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<ChildLayoutControl\n\t\t\t\t\t\tvalue={ childLayout }\n\t\t\t\t\t\tonChange={ setChildLayout }\n\t\t\t\t\t\tparentLayout={ settings?.parentLayout }\n\t\t\t\t\t/>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Wrapper>\n\t);\n}\n"]}
|
|
@@ -9,7 +9,7 @@ import classnames from 'classnames';
|
|
|
9
9
|
* WordPress dependencies
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { useState, createPortal, forwardRef, useMemo, useReducer, renderToString } from '@wordpress/element';
|
|
12
|
+
import { useState, createPortal, forwardRef, useMemo, useReducer, renderToString, useEffect } from '@wordpress/element';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
14
14
|
import { useResizeObserver, useMergeRefs, useRefEffect, useDisabled } from '@wordpress/compose';
|
|
15
15
|
import { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';
|
|
@@ -219,9 +219,16 @@ function Iframe(_ref2) {
|
|
|
219
219
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
220
220
|
// content.
|
|
221
221
|
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
const src = useMemo(() => {
|
|
223
|
+
const html = '<!doctype html>' + renderToString(styleAssets);
|
|
224
|
+
const blob = new window.Blob([html], {
|
|
225
|
+
type: 'text/html'
|
|
226
|
+
});
|
|
227
|
+
return URL.createObjectURL(blob);
|
|
228
|
+
}, []);
|
|
229
|
+
useEffect(() => () => {
|
|
230
|
+
URL.revokeObjectURL(src);
|
|
231
|
+
}); // We need to counter the margin created by scaling the iframe. If the scale
|
|
225
232
|
// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the
|
|
226
233
|
// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).
|
|
227
234
|
|
|
@@ -229,9 +236,9 @@ function Iframe(_ref2) {
|
|
|
229
236
|
return createElement(Fragment, null, tabIndex >= 0 && before, createElement("iframe", _extends({}, props, {
|
|
230
237
|
style: { ...props.style,
|
|
231
238
|
height: expand ? contentHeight : (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.height,
|
|
232
|
-
marginTop: scale ? -marginFromScaling + frameSize : (_props$style2 = props.style) === null || _props$style2 === void 0 ? void 0 : _props$style2.marginTop,
|
|
233
|
-
marginBottom: scale ? -marginFromScaling + frameSize : (_props$style3 = props.style) === null || _props$style3 === void 0 ? void 0 : _props$style3.marginBottom,
|
|
234
|
-
transform: scale ? `scale( ${scale} )` : (_props$style4 = props.style) === null || _props$style4 === void 0 ? void 0 : _props$style4.transform,
|
|
239
|
+
marginTop: scale !== 1 ? -marginFromScaling + frameSize : (_props$style2 = props.style) === null || _props$style2 === void 0 ? void 0 : _props$style2.marginTop,
|
|
240
|
+
marginBottom: scale !== 1 ? -marginFromScaling + frameSize : (_props$style3 = props.style) === null || _props$style3 === void 0 ? void 0 : _props$style3.marginBottom,
|
|
241
|
+
transform: scale !== 1 ? `scale( ${scale} )` : (_props$style4 = props.style) === null || _props$style4 === void 0 ? void 0 : _props$style4.transform,
|
|
235
242
|
transition: 'all .3s'
|
|
236
243
|
},
|
|
237
244
|
ref: useMergeRefs([ref, setRef]),
|
|
@@ -239,7 +246,7 @@ function Iframe(_ref2) {
|
|
|
239
246
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
240
247
|
// content.
|
|
241
248
|
,
|
|
242
|
-
|
|
249
|
+
src: src,
|
|
243
250
|
title: __('Editor canvas')
|
|
244
251
|
}), iframeDocument && createPortal(createElement(Fragment, null, createElement("head", {
|
|
245
252
|
ref: headRef
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"names":["classnames","useState","createPortal","forwardRef","useMemo","useReducer","renderToString","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","useCompatibilityStyles","store","blockEditorStore","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","useParsedAssets","html","document","implementation","createHTMLDocument","body","innerHTML","Array","from","children","loadScript","head","id","src","Promise","resolve","reject","script","ownerDocument","createElement","onload","onerror","appendChild","Iframe","contentRef","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","assets","select","getSettings","__unstableResolvedAssets","forceRender","iframeDocument","setIframeDocument","bodyClasses","setBodyClasses","styles","styleIds","map","style","compatStyles","neededCompatStyles","filter","includes","scripts","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","iFrameDocument","preventFileDropDefault","setDocumentIfReady","contentDocument","readyState","documentElement","classList","startsWith","dir","removeChild","removeEventListener","headRef","element","reduce","promise","then","finally","disabledRef","isDisabled","bodyRef","styleAssets","tagName","href","rel","media","textContent","TagName","toLowerCase","srcDoc","marginFromScaling","marginTop","marginBottom","transform","transition","IframeIfReady","isInitialised","__internalIsInitialized"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,UAHD,EAICC,OAJD,EAKCC,UALD,EAMCC,cAND,QAOO,oBAPP;AAQA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,iBADD,EAECC,YAFD,EAGCC,YAHD,EAICC,WAJD,QAKO,oBALP;AAMA,SAASC,2BAA2B,IAAIC,aAAxC,QAA6D,uBAA7D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAASC,sBAAT,QAAuC,4BAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,GAAvB,EAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAAkBD,GAAxB;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAmBD,WAAzB;;AAEA,WAASE,WAAT,CAAsBC,KAAtB,EAA8B;AAC7B,UAAMC,SAAS,GAAGC,MAAM,CAACC,cAAP,CAAuBH,KAAvB,CAAlB;AACA,UAAMI,eAAe,GAAGH,SAAS,CAACI,WAAV,CAAsBC,IAA9C;AACA,UAAMC,WAAW,GAAGC,MAAM,CAAEJ,eAAF,CAA1B;AAEA,UAAMK,IAAI,GAAG,EAAb;;AAEA,SAAM,MAAMC,GAAZ,IAAmBV,KAAnB,EAA2B;AAC1BS,MAAAA,IAAI,CAAEC,GAAF,CAAJ,GAAcV,KAAK,CAAEU,GAAF,CAAnB;AACA;;AAED,QAAKV,KAAK,YAAYH,WAAW,CAACc,UAAlC,EAA+C;AAC9C,YAAMC,IA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B,CADoC,CAOpC;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SAAO,cAAC,MAAD,eAAa/D,KAAb;AAAqB,IAAA,YAAY,EAAGD;AAApC,KAAP;AACA;;AAED,eAAe9E,UAAU,CAAE6I,aAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\trenderToString,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction useParsedAssets( html ) {\n\treturn useMemo( () => {\n\t\tconst doc = document.implementation.createHTMLDocument( '' );\n\t\tdoc.body.innerHTML = html;\n\t\treturn Array.from( doc.body.children );\n\t}, [ html ] );\n}\n\nasync function loadScript( head, { id, src } ) {\n\treturn new Promise( ( resolve, reject ) => {\n\t\tconst script = head.ownerDocument.createElement( 'script' );\n\t\tscript.id = id;\n\t\tif ( src ) {\n\t\t\tscript.src = src;\n\t\t\tscript.onload = () => resolve();\n\t\t\tscript.onerror = () => reject();\n\t\t} else {\n\t\t\tresolve();\n\t\t}\n\t\thead.appendChild( script );\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\thead,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst assets = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__unstableResolvedAssets,\n\t\t[]\n\t);\n\tconst [ , forceRender ] = useReducer( () => ( {} ) );\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst styles = useParsedAssets( assets?.styles );\n\tconst styleIds = styles.map( ( style ) => style.id );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst neededCompatStyles = compatStyles.filter(\n\t\t( style ) => ! styleIds.includes( style.id )\n\t);\n\tconst scripts = useParsedAssets( assets?.scripts );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction setDocumentIfReady() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { readyState, documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tif ( readyState !== 'interactive' && readyState !== 'complete' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tsetIframeDocument( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\t\t\tdocumentElement.removeChild( contentDocument.head );\n\t\t\tdocumentElement.removeChild( contentDocument.body );\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Document set with srcDoc is not immediately ready.\n\t\tnode.addEventListener( 'load', setDocumentIfReady );\n\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'load', setDocumentIfReady );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst headRef = useRefEffect( ( element ) => {\n\t\tscripts\n\t\t\t.reduce(\n\t\t\t\t( promise, script ) =>\n\t\t\t\t\tpromise.then( () => loadScript( element, script ) ),\n\t\t\t\tPromise.resolve()\n\t\t\t)\n\t\t\t.finally( () => {\n\t\t\t\t// When script are loaded, re-render blocks to allow them\n\t\t\t\t// to initialise.\n\t\t\t\tforceRender();\n\t\t\t} );\n\t}, [] );\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\tconst styleAssets = (\n\t\t<>\n\t\t\t<style>{ 'html{height:auto!important;}body{margin:0}' }</style>\n\t\t\t{ [ ...styles, ...neededCompatStyles ].map(\n\t\t\t\t( { tagName, href, id, rel, media, textContent } ) => {\n\t\t\t\t\tconst TagName = tagName.toLowerCase();\n\n\t\t\t\t\tif ( TagName === 'style' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TagName { ...{ id } } key={ id }>\n\t\t\t\t\t\t\t\t{ textContent }\n\t\t\t\t\t\t\t</TagName>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TagName { ...{ href, id, rel, media } } key={ id } />\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst srcDoc = useMemo( () => {\n\t\treturn '<!doctype html>' + renderToString( styleAssets );\n\t}, [] );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop: scale\n\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom: scale\n\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform: scale\n\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrcDoc={ srcDoc }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<head ref={ headRef }>\n\t\t\t\t\t\t\t\t{ styleAssets }\n\t\t\t\t\t\t\t\t{ head }\n\t\t\t\t\t\t\t</head>\n\t\t\t\t\t\t\t<body\n\t\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t\t</body>\n\t\t\t\t\t\t</>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/iframe/index.js"],"names":["classnames","useState","createPortal","forwardRef","useMemo","useReducer","renderToString","useEffect","__","useResizeObserver","useMergeRefs","useRefEffect","useDisabled","__experimentalStyleProvider","StyleProvider","useSelect","useBlockSelectionClearer","useWritingFlow","useCompatibilityStyles","store","blockEditorStore","bubbleEvents","doc","defaultView","frameElement","bubbleEvent","event","prototype","Object","getPrototypeOf","constructorName","constructor","name","Constructor","window","init","key","MouseEvent","rect","getBoundingClientRect","clientX","left","clientY","top","newEvent","type","cancelled","dispatchEvent","preventDefault","eventTypes","addEventListener","useParsedAssets","html","document","implementation","createHTMLDocument","body","innerHTML","Array","from","children","loadScript","head","id","src","Promise","resolve","reject","script","ownerDocument","createElement","onload","onerror","appendChild","Iframe","contentRef","tabIndex","scale","frameSize","expand","readonly","forwardedRef","ref","props","assets","select","getSettings","__unstableResolvedAssets","forceRender","iframeDocument","setIframeDocument","bodyClasses","setBodyClasses","styles","styleIds","map","style","compatStyles","neededCompatStyles","filter","includes","scripts","clearerRef","before","writingFlowRef","after","contentResizeListener","height","contentHeight","setRef","node","iFrameDocument","preventFileDropDefault","setDocumentIfReady","contentDocument","readyState","documentElement","classList","startsWith","dir","removeChild","removeEventListener","headRef","element","reduce","promise","then","finally","disabledRef","isDisabled","bodyRef","styleAssets","tagName","href","rel","media","textContent","TagName","toLowerCase","blob","Blob","URL","createObjectURL","revokeObjectURL","marginFromScaling","marginTop","marginBottom","transform","transition","IframeIfReady","isInitialised","__internalIsInitialized"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,UAHD,EAICC,OAJD,EAKCC,UALD,EAMCC,cAND,EAOCC,SAPD,QAQO,oBARP;AASA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,iBADD,EAECC,YAFD,EAGCC,YAHD,EAICC,WAJD,QAKO,oBALP;AAMA,SAASC,2BAA2B,IAAIC,aAAxC,QAA6D,uBAA7D;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,wBAAT,QAAyC,4BAAzC;AACA,SAASC,cAAT,QAA+B,iBAA/B;AACA,SAASC,sBAAT,QAAuC,4BAAvC;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,YAAT,CAAuBC,GAAvB,EAA6B;AAC5B,QAAM;AAAEC,IAAAA;AAAF,MAAkBD,GAAxB;AACA,QAAM;AAAEE,IAAAA;AAAF,MAAmBD,WAAzB;;AAEA,WAASE,WAAT,CAAsBC,KAAtB,EAA8B;AAC7B,UAAMC,SAAS,GAAGC,MAAM,CAACC,cAAP,CAAuBH,KAAvB,CAAlB;AACA,UA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BP;AAyBC,IAAA,KAAK,EAAGxD,EAAE,CAAE,eAAF;AAzBX,MA2BGiF,cAAc,IACfvF,YAAY,CACX,8BACC;AAAM,IAAA,GAAG,EAAGwH;AAAZ,KACGS,WADH,EAEGrE,IAFH,CADD,EAKC;AACC,IAAA,GAAG,EAAGoE,OADP;AAEC,IAAA,SAAS,EAAGlI,UAAU,CACrB,2BADqB,EAErB,uBAFqB,EAGrB,GAAG2F,WAHkB;AAFvB,KAQGe,qBARH,EASC,cAAC,aAAD;AAAe,IAAA,QAAQ,EAAGjB;AAA1B,KACG7B,QADH,CATD,CALD,CADW,EAoBX6B,cAAc,CAAC2B,eApBJ,CA5Bd,CAFD,EAqDGxC,QAAQ,IAAI,CAAZ,IAAiB6B,KArDpB,CADD;AAyDA;;AAED,SAAS4C,aAAT,CAAwBlE,KAAxB,EAA+BD,GAA/B,EAAqC;AACpC,QAAMoE,aAAa,GAAGvI,SAAS,CAC5BsE,MAAF,IACCA,MAAM,CAAEjE,gBAAF,CAAN,CAA2BkE,WAA3B,GAAyCiE,uBAFZ,EAG9B,EAH8B,CAA/B,CADoC,CAOpC;AACA;AACA;AACA;AACA;;AACA,MAAK,CAAED,aAAP,EAAuB;AACtB,WAAO,IAAP;AACA;;AAED,SAAO,cAAC,MAAD,eAAanE,KAAb;AAAqB,IAAA,YAAY,EAAGD;AAApC,KAAP;AACA;;AAED,eAAe/E,UAAU,CAAEkJ,aAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tuseState,\n\tcreatePortal,\n\tforwardRef,\n\tuseMemo,\n\tuseReducer,\n\trenderToString,\n\tuseEffect,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseResizeObserver,\n\tuseMergeRefs,\n\tuseRefEffect,\n\tuseDisabled,\n} from '@wordpress/compose';\nimport { __experimentalStyleProvider as StyleProvider } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useBlockSelectionClearer } from '../block-selection-clearer';\nimport { useWritingFlow } from '../writing-flow';\nimport { useCompatibilityStyles } from './use-compatibility-styles';\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * Bubbles some event types (keydown, keypress, and dragover) to parent document\n * document to ensure that the keyboard shortcuts and drag and drop work.\n *\n * Ideally, we should remove event bubbling in the future. Keyboard shortcuts\n * should be context dependent, e.g. actions on blocks like Cmd+A should not\n * work globally outside the block editor.\n *\n * @param {Document} doc Document to attach listeners to.\n */\nfunction bubbleEvents( doc ) {\n\tconst { defaultView } = doc;\n\tconst { frameElement } = defaultView;\n\n\tfunction bubbleEvent( event ) {\n\t\tconst prototype = Object.getPrototypeOf( event );\n\t\tconst constructorName = prototype.constructor.name;\n\t\tconst Constructor = window[ constructorName ];\n\n\t\tconst init = {};\n\n\t\tfor ( const key in event ) {\n\t\t\tinit[ key ] = event[ key ];\n\t\t}\n\n\t\tif ( event instanceof defaultView.MouseEvent ) {\n\t\t\tconst rect = frameElement.getBoundingClientRect();\n\t\t\tinit.clientX += rect.left;\n\t\t\tinit.clientY += rect.top;\n\t\t}\n\n\t\tconst newEvent = new Constructor( event.type, init );\n\t\tconst cancelled = ! frameElement.dispatchEvent( newEvent );\n\n\t\tif ( cancelled ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n\n\tconst eventTypes = [ 'dragover', 'mousemove' ];\n\n\tfor ( const name of eventTypes ) {\n\t\tdoc.addEventListener( name, bubbleEvent );\n\t}\n}\n\nfunction useParsedAssets( html ) {\n\treturn useMemo( () => {\n\t\tconst doc = document.implementation.createHTMLDocument( '' );\n\t\tdoc.body.innerHTML = html;\n\t\treturn Array.from( doc.body.children );\n\t}, [ html ] );\n}\n\nasync function loadScript( head, { id, src } ) {\n\treturn new Promise( ( resolve, reject ) => {\n\t\tconst script = head.ownerDocument.createElement( 'script' );\n\t\tscript.id = id;\n\t\tif ( src ) {\n\t\t\tscript.src = src;\n\t\t\tscript.onload = () => resolve();\n\t\t\tscript.onerror = () => reject();\n\t\t} else {\n\t\t\tresolve();\n\t\t}\n\t\thead.appendChild( script );\n\t} );\n}\n\nfunction Iframe( {\n\tcontentRef,\n\tchildren,\n\thead,\n\ttabIndex = 0,\n\tscale = 1,\n\tframeSize = 0,\n\texpand = false,\n\treadonly,\n\tforwardedRef: ref,\n\t...props\n} ) {\n\tconst assets = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__unstableResolvedAssets,\n\t\t[]\n\t);\n\tconst [ , forceRender ] = useReducer( () => ( {} ) );\n\tconst [ iframeDocument, setIframeDocument ] = useState();\n\tconst [ bodyClasses, setBodyClasses ] = useState( [] );\n\tconst styles = useParsedAssets( assets?.styles );\n\tconst styleIds = styles.map( ( style ) => style.id );\n\tconst compatStyles = useCompatibilityStyles();\n\tconst neededCompatStyles = compatStyles.filter(\n\t\t( style ) => ! styleIds.includes( style.id )\n\t);\n\tconst scripts = useParsedAssets( assets?.scripts );\n\tconst clearerRef = useBlockSelectionClearer();\n\tconst [ before, writingFlowRef, after ] = useWritingFlow();\n\tconst [ contentResizeListener, { height: contentHeight } ] =\n\t\tuseResizeObserver();\n\tconst setRef = useRefEffect( ( node ) => {\n\t\tlet iFrameDocument;\n\t\t// Prevent the default browser action for files dropped outside of dropzones.\n\t\tfunction preventFileDropDefault( event ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t\tfunction setDocumentIfReady() {\n\t\t\tconst { contentDocument, ownerDocument } = node;\n\t\t\tconst { readyState, documentElement } = contentDocument;\n\t\t\tiFrameDocument = contentDocument;\n\n\t\t\tif ( readyState !== 'interactive' && readyState !== 'complete' ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tbubbleEvents( contentDocument );\n\t\t\tsetIframeDocument( contentDocument );\n\t\t\tclearerRef( documentElement );\n\n\t\t\t// Ideally ALL classes that are added through get_body_class should\n\t\t\t// be added in the editor too, which we'll somehow have to get from\n\t\t\t// the server in the future (which will run the PHP filters).\n\t\t\tsetBodyClasses(\n\t\t\t\tArray.from( ownerDocument.body.classList ).filter(\n\t\t\t\t\t( name ) =>\n\t\t\t\t\t\tname.startsWith( 'admin-color-' ) ||\n\t\t\t\t\t\tname.startsWith( 'post-type-' ) ||\n\t\t\t\t\t\tname === 'wp-embed-responsive'\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tcontentDocument.dir = ownerDocument.dir;\n\t\t\tdocumentElement.removeChild( contentDocument.head );\n\t\t\tdocumentElement.removeChild( contentDocument.body );\n\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\tiFrameDocument.addEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault,\n\t\t\t\tfalse\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\n\t\t// Document set with srcDoc is not immediately ready.\n\t\tnode.addEventListener( 'load', setDocumentIfReady );\n\n\t\treturn () => {\n\t\t\tnode.removeEventListener( 'load', setDocumentIfReady );\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'dragover',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t\tiFrameDocument?.removeEventListener(\n\t\t\t\t'drop',\n\t\t\t\tpreventFileDropDefault\n\t\t\t);\n\t\t};\n\t}, [] );\n\n\tconst headRef = useRefEffect( ( element ) => {\n\t\tscripts\n\t\t\t.reduce(\n\t\t\t\t( promise, script ) =>\n\t\t\t\t\tpromise.then( () => loadScript( element, script ) ),\n\t\t\t\tPromise.resolve()\n\t\t\t)\n\t\t\t.finally( () => {\n\t\t\t\t// When script are loaded, re-render blocks to allow them\n\t\t\t\t// to initialise.\n\t\t\t\tforceRender();\n\t\t\t} );\n\t}, [] );\n\tconst disabledRef = useDisabled( { isDisabled: ! readonly } );\n\tconst bodyRef = useMergeRefs( [\n\t\tcontentRef,\n\t\tclearerRef,\n\t\twritingFlowRef,\n\t\tdisabledRef,\n\t] );\n\n\tconst styleAssets = (\n\t\t<>\n\t\t\t<style>{ 'html{height:auto!important;}body{margin:0}' }</style>\n\t\t\t{ [ ...styles, ...neededCompatStyles ].map(\n\t\t\t\t( { tagName, href, id, rel, media, textContent } ) => {\n\t\t\t\t\tconst TagName = tagName.toLowerCase();\n\n\t\t\t\t\tif ( TagName === 'style' ) {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TagName { ...{ id } } key={ id }>\n\t\t\t\t\t\t\t\t{ textContent }\n\t\t\t\t\t\t\t</TagName>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<TagName { ...{ href, id, rel, media } } key={ id } />\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t) }\n\t\t</>\n\t);\n\n\t// Correct doctype is required to enable rendering in standards\n\t// mode. Also preload the styles to avoid a flash of unstyled\n\t// content.\n\tconst src = useMemo( () => {\n\t\tconst html = '<!doctype html>' + renderToString( styleAssets );\n\t\tconst blob = new window.Blob( [ html ], { type: 'text/html' } );\n\t\treturn URL.createObjectURL( blob );\n\t}, [] );\n\n\tuseEffect( () => () => {\n\t\tURL.revokeObjectURL( src );\n\t} );\n\n\t// We need to counter the margin created by scaling the iframe. If the scale\n\t// is e.g. 0.45, then the top + bottom margin is 0.55 (1 - scale). Just the\n\t// top or bottom margin is 0.55 / 2 ((1 - scale) / 2).\n\tconst marginFromScaling = ( contentHeight * ( 1 - scale ) ) / 2;\n\n\treturn (\n\t\t<>\n\t\t\t{ tabIndex >= 0 && before }\n\t\t\t<iframe\n\t\t\t\t{ ...props }\n\t\t\t\tstyle={ {\n\t\t\t\t\t...props.style,\n\t\t\t\t\theight: expand ? contentHeight : props.style?.height,\n\t\t\t\t\tmarginTop:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginTop,\n\t\t\t\t\tmarginBottom:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? -marginFromScaling + frameSize\n\t\t\t\t\t\t\t: props.style?.marginBottom,\n\t\t\t\t\ttransform:\n\t\t\t\t\t\tscale !== 1\n\t\t\t\t\t\t\t? `scale( ${ scale } )`\n\t\t\t\t\t\t\t: props.style?.transform,\n\t\t\t\t\ttransition: 'all .3s',\n\t\t\t\t} }\n\t\t\t\tref={ useMergeRefs( [ ref, setRef ] ) }\n\t\t\t\ttabIndex={ tabIndex }\n\t\t\t\t// Correct doctype is required to enable rendering in standards\n\t\t\t\t// mode. Also preload the styles to avoid a flash of unstyled\n\t\t\t\t// content.\n\t\t\t\tsrc={ src }\n\t\t\t\ttitle={ __( 'Editor canvas' ) }\n\t\t\t>\n\t\t\t\t{ iframeDocument &&\n\t\t\t\t\tcreatePortal(\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<head ref={ headRef }>\n\t\t\t\t\t\t\t\t{ styleAssets }\n\t\t\t\t\t\t\t\t{ head }\n\t\t\t\t\t\t\t</head>\n\t\t\t\t\t\t\t<body\n\t\t\t\t\t\t\t\tref={ bodyRef }\n\t\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t\t'block-editor-iframe__body',\n\t\t\t\t\t\t\t\t\t'editor-styles-wrapper',\n\t\t\t\t\t\t\t\t\t...bodyClasses\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ contentResizeListener }\n\t\t\t\t\t\t\t\t<StyleProvider document={ iframeDocument }>\n\t\t\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t\t\t</StyleProvider>\n\t\t\t\t\t\t\t</body>\n\t\t\t\t\t\t</>,\n\t\t\t\t\t\tiframeDocument.documentElement\n\t\t\t\t\t) }\n\t\t\t</iframe>\n\t\t\t{ tabIndex >= 0 && after }\n\t\t</>\n\t);\n}\n\nfunction IframeIfReady( props, ref ) {\n\tconst isInitialised = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getSettings().__internalIsInitialized,\n\t\t[]\n\t);\n\n\t// We shouldn't render the iframe until the editor settings are initialised.\n\t// The initial settings are needed to get the styles for the srcDoc, which\n\t// cannot be changed after the iframe is mounted. srcDoc is used to to set\n\t// the initial iframe HTML, which is required to avoid a flash of unstyled\n\t// content.\n\tif ( ! isInitialised ) {\n\t\treturn null;\n\t}\n\n\treturn <Iframe { ...props } forwardedRef={ ref } />;\n}\n\nexport default forwardRef( IframeIfReady );\n"]}
|
|
@@ -43,6 +43,7 @@ function UncontrolledInnerBlocks(props) {
|
|
|
43
43
|
const {
|
|
44
44
|
clientId,
|
|
45
45
|
allowedBlocks,
|
|
46
|
+
prioritizedInserterBlocks,
|
|
46
47
|
__experimentalDefaultBlock,
|
|
47
48
|
__experimentalDirectInsert,
|
|
48
49
|
template,
|
|
@@ -56,7 +57,7 @@ function UncontrolledInnerBlocks(props) {
|
|
|
56
57
|
placeholder,
|
|
57
58
|
layout
|
|
58
59
|
} = props;
|
|
59
|
-
useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
|
|
60
|
+
useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
|
|
60
61
|
useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection);
|
|
61
62
|
const context = useBlockContext(clientId);
|
|
62
63
|
const name = useSelect(select => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"names":["classnames","useViewportMatch","useMergeRefs","forwardRef","useMemo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","useSetting","EMPTY_OBJECT","UncontrolledInnerBlocks","props","clientId","allowedBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","context","name","select","getBlock","defaultLayoutBlockSupport","allowSizingOnChildren","defaultLayout","usedLayout","memoedLayout","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","__unstableLayoutClassNames","layoutClassNames","isSmallScreen","hasOverlay","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","blockName","enableClickThrough","hasBlockSupport","blockDropZoneRef","rootClientId","InnerBlocks","value","onChange","className","children","save","Content"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,EAA2BC,YAA3B,QAA+C,oBAA/C;AACA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,oBAApC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,eADD,EAECC,KAAK,IAAIC,WAFV,EAGCC,6BAA6B,IAAIC,mBAHlC,QAIO,mBAJP;AAMA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,SAASC,cAAT,QAA+B,eAA/B;AACA,SAASC,oBAAT,QAAqC,kBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,gBAAP,MAA6B,wBAA7B;AAC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,QAAMhB,gBAAgB,GAAG;AACxBnB,IAAAA,6BADwB;AAExBM,IAAAA,MAFwB;AAGxB,OAAGe;AAHqB,GAAzB;AAKA,QAAMgB,WAAW,GAChBlB,gBAAgB,CAACmB,KAAjB,IAA0BnB,gBAAgB,CAACoB,QAA3C,GACGvB,qBADH,GAEG1B,uBAHJ;AAKA,SAAO,EACN,GAAGC,KADG;AAEN2B,IAAAA,GAFM;AAGNsB,IAAAA,SAAS,EAAE1E,UAAU,CACpByB,KAAK,CAACiD,SADc,EAEpB,iCAFoB,EAGpBlB,iCAAiC,GAAG,EAAH,GAAQG,gBAHrB,EAIpB;AACC,qBAAeE;AADhB,KAJoB,CAHf;AAWNc,IAAAA,QAAQ,EAAEjD,QAAQ,GACjB,cAAC,WAAD,eAAkB2B,gBAAlB;AAAqC,MAAA,QAAQ,EAAG3B;AAAhD,OADiB,GAGjB,cAAC,cAAD,EAAqB6B,OAArB;AAdK,GAAP;AAiBA;AAEDD,mBAAmB,CAACsB,IAApB,GAA2BlE,mBAA3B,C,CAEA;;AACAyC,oBAAoB,CAACvC,oBAArB,GAA4CA,oBAA5C;AACAuC,oBAAoB,CAACxC,mBAArB,GAA2CA,mBAA3C;;AAEAwC,oBAAoB,CAAC0B,OAArB,GAA+B,MAAMvB,mBAAmB,CAACsB,IAApB,GAA2BD,QAAhE;AAEA;AACA;AACA;;;AACA,eAAexB,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport useSetting from '../use-setting';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst context = useBlockContext( clientId );\n\tconst name = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlock( clientId )?.name;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, '__experimentalLayout' ) || EMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\n\tconst defaultLayout = useSetting( 'layout' ) || EMPTY_OBJECT;\n\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t<BlockListItems\n\t\t\t\trootClientId={ clientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\t\t__experimentalLayout={ memoedLayout }\n\t\t\t\twrapperRef={ wrapperRef }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t/>\n\t\t</BlockContextProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst { __unstableDisableLayoutClassNames, __unstableDisableDropZone } =\n\t\toptions;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst isSmallScreen = useViewportMatch( 'medium', '<' );\n\tconst { __experimentalCaptureToolbars, hasOverlay } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation' || isSmallScreen;\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: select(\n\t\t\t\t\tblocksStore\n\t\t\t\t).hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSmallScreen ]\n\t);\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\trootClientId: clientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ? null : blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.js"],"names":["classnames","useViewportMatch","useMergeRefs","forwardRef","useMemo","useSelect","getBlockSupport","store","blocksStore","__unstableGetInnerBlocksProps","getInnerBlocksProps","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockListItems","BlockContextProvider","useBlockEditContext","useBlockSync","blockEditorStore","useBlockDropZone","useSetting","EMPTY_OBJECT","UncontrolledInnerBlocks","props","clientId","allowedBlocks","prioritizedInserterBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","wrapperRef","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","__experimentalAppenderTagName","renderAppender","orientation","placeholder","layout","context","name","select","getBlock","defaultLayoutBlockSupport","allowSizingOnChildren","defaultLayout","usedLayout","memoedLayout","ControlledInnerBlocks","ForwardedInnerBlocks","ref","innerBlocksProps","useInnerBlocksProps","options","__unstableDisableLayoutClassNames","__unstableDisableDropZone","__unstableLayoutClassNames","layoutClassNames","isSmallScreen","hasOverlay","getBlockName","isBlockSelected","hasSelectedInnerBlock","__unstableGetEditorMode","blockName","enableClickThrough","hasBlockSupport","blockDropZoneRef","rootClientId","InnerBlocks","value","onChange","className","children","save","Content"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,gBAAT,EAA2BC,YAA3B,QAA+C,oBAA/C;AACA,SAASC,UAAT,EAAqBC,OAArB,QAAoC,oBAApC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,eADD,EAECC,KAAK,IAAIC,WAFV,EAGCC,6BAA6B,IAAIC,mBAHlC,QAIO,mBAJP;AAMA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AACA,SAASC,cAAT,QAA+B,eAA/B;AACA,SAASC,oBAAT,QAAqC,kBAArC;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AACA,SAASZ,KAAK,IAAIa,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,gBAAP,MAA6B,wBAA7B;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AAEA,MAAMC,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,uBAAT,CAAkCC,KAAlC,EAA0C;AACzC,QAAM;AACLC,IAAAA,QADK;AAELC,IAAAA,aAFK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BnB,gBAAgB,CAACoB,QAA3C,GACGvB,qBADH,GAEG3B,uBAHJ;AAKA,SAAO,EACN,GAAGC,KADG;AAEN4B,IAAAA,GAFM;AAGNsB,IAAAA,SAAS,EAAE3E,UAAU,CACpByB,KAAK,CAACkD,SADc,EAEpB,iCAFoB,EAGpBlB,iCAAiC,GAAG,EAAH,GAAQG,gBAHrB,EAIpB;AACC,qBAAeE;AADhB,KAJoB,CAHf;AAWNc,IAAAA,QAAQ,EAAElD,QAAQ,GACjB,cAAC,WAAD,eAAkB4B,gBAAlB;AAAqC,MAAA,QAAQ,EAAG5B;AAAhD,OADiB,GAGjB,cAAC,cAAD,EAAqB8B,OAArB;AAdK,GAAP;AAiBA;AAEDD,mBAAmB,CAACsB,IAApB,GAA2BnE,mBAA3B,C,CAEA;;AACA0C,oBAAoB,CAACxC,oBAArB,GAA4CA,oBAA5C;AACAwC,oBAAoB,CAACzC,mBAArB,GAA2CA,mBAA3C;;AAEAyC,oBAAoB,CAAC0B,OAArB,GAA+B,MAAMvB,mBAAmB,CAACsB,IAApB,GAA2BD,QAAhE;AAEA;AACA;AACA;;;AACA,eAAexB,oBAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useViewportMatch, useMergeRefs } from '@wordpress/compose';\nimport { forwardRef, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tgetBlockSupport,\n\tstore as blocksStore,\n\t__unstableGetInnerBlocksProps as getInnerBlocksProps,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\nimport { BlockListItems } from '../block-list';\nimport { BlockContextProvider } from '../block-context';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { store as blockEditorStore } from '../../store';\nimport useBlockDropZone from '../use-block-drop-zone';\nimport useSetting from '../use-setting';\n\nconst EMPTY_OBJECT = {};\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\twrapperRef,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\t__experimentalAppenderTagName,\n\t\trenderAppender,\n\t\torientation,\n\t\tplaceholder,\n\t\tlayout,\n\t} = props;\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst context = useBlockContext( clientId );\n\tconst name = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlock( clientId )?.name;\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst defaultLayoutBlockSupport =\n\t\tgetBlockSupport( name, '__experimentalLayout' ) || EMPTY_OBJECT;\n\n\tconst { allowSizingOnChildren = false } = defaultLayoutBlockSupport;\n\n\tconst defaultLayout = useSetting( 'layout' ) || EMPTY_OBJECT;\n\n\tconst usedLayout = layout || defaultLayoutBlockSupport;\n\n\tconst memoedLayout = useMemo(\n\t\t() => ( {\n\t\t\t// Default layout will know about any content/wide size defined by the theme.\n\t\t\t...defaultLayout,\n\t\t\t...usedLayout,\n\t\t\t...( allowSizingOnChildren && {\n\t\t\t\tallowSizingOnChildren: true,\n\t\t\t} ),\n\t\t} ),\n\t\t[ defaultLayout, usedLayout, allowSizingOnChildren ]\n\t);\n\n\t// This component needs to always be synchronous as it's the one changing\n\t// the async mode depending on the block selection.\n\treturn (\n\t\t<BlockContextProvider value={ context }>\n\t\t\t<BlockListItems\n\t\t\t\trootClientId={ clientId }\n\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t__experimentalAppenderTagName={ __experimentalAppenderTagName }\n\t\t\t\t__experimentalLayout={ memoedLayout }\n\t\t\t\twrapperRef={ wrapperRef }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t/>\n\t\t</BlockContextProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\nconst ForwardedInnerBlocks = forwardRef( ( props, ref ) => {\n\tconst innerBlocksProps = useInnerBlocksProps( { ref }, props );\n\treturn (\n\t\t<div className=\"block-editor-inner-blocks\">\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</div>\n\t);\n} );\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst { __unstableDisableLayoutClassNames, __unstableDisableDropZone } =\n\t\toptions;\n\tconst {\n\t\tclientId,\n\t\tlayout = null,\n\t\t__unstableLayoutClassNames: layoutClassNames = '',\n\t} = useBlockEditContext();\n\tconst isSmallScreen = useViewportMatch( 'medium', '<' );\n\tconst { __experimentalCaptureToolbars, hasOverlay } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! clientId ) {\n\t\t\t\treturn {};\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\t__unstableGetEditorMode,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst blockName = getBlockName( clientId );\n\t\t\tconst enableClickThrough =\n\t\t\t\t__unstableGetEditorMode() === 'navigation' || isSmallScreen;\n\t\t\treturn {\n\t\t\t\t__experimentalCaptureToolbars: select(\n\t\t\t\t\tblocksStore\n\t\t\t\t).hasBlockSupport(\n\t\t\t\t\tblockName,\n\t\t\t\t\t'__experimentalExposeControlsToChildren',\n\t\t\t\t\tfalse\n\t\t\t\t),\n\t\t\t\thasOverlay:\n\t\t\t\t\tblockName !== 'core/template' &&\n\t\t\t\t\t! isBlockSelected( clientId ) &&\n\t\t\t\t\t! hasSelectedInnerBlock( clientId, true ) &&\n\t\t\t\t\tenableClickThrough,\n\t\t\t};\n\t\t},\n\t\t[ clientId, isSmallScreen ]\n\t);\n\n\tconst blockDropZoneRef = useBlockDropZone( {\n\t\trootClientId: clientId,\n\t} );\n\n\tconst ref = useMergeRefs( [\n\t\tprops.ref,\n\t\t__unstableDisableDropZone ? null : blockDropZoneRef,\n\t] );\n\n\tconst innerBlocksProps = {\n\t\t__experimentalCaptureToolbars,\n\t\tlayout,\n\t\t...options,\n\t};\n\tconst InnerBlocks =\n\t\tinnerBlocksProps.value && innerBlocksProps.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tclassName: classnames(\n\t\t\tprops.className,\n\t\t\t'block-editor-block-list__layout',\n\t\t\t__unstableDisableLayoutClassNames ? '' : layoutClassNames,\n\t\t\t{\n\t\t\t\t'has-overlay': hasOverlay,\n\t\t\t}\n\t\t),\n\t\tchildren: clientId ? (\n\t\t\t<InnerBlocks { ...innerBlocksProps } clientId={ clientId } />\n\t\t) : (\n\t\t\t<BlockListItems { ...options } />\n\t\t),\n\t};\n}\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\n// Expose default appender placeholders as components.\nForwardedInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nForwardedInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nForwardedInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default ForwardedInnerBlocks;\n"]}
|
|
@@ -20,7 +20,6 @@ import useBlockContext from './use-block-context';
|
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
import BlockList from '../block-list';
|
|
23
|
-
import BlockListCompact from '../block-list/block-list-compact';
|
|
24
23
|
import { useBlockEditContext } from '../block-edit/context';
|
|
25
24
|
import useBlockSync from '../provider/use-block-sync';
|
|
26
25
|
import { BlockContextProvider } from '../block-context';
|
|
@@ -71,9 +70,13 @@ function UncontrolledInnerBlocks(props) {
|
|
|
71
70
|
const {
|
|
72
71
|
clientId,
|
|
73
72
|
allowedBlocks,
|
|
73
|
+
prioritizedInserterBlocks,
|
|
74
|
+
__experimentalDefaultBlock,
|
|
75
|
+
__experimentalDirectInsert,
|
|
74
76
|
template,
|
|
75
77
|
templateLock,
|
|
76
78
|
templateInsertUpdatesSelection,
|
|
79
|
+
__experimentalCaptureToolbars: captureToolbars,
|
|
77
80
|
orientation,
|
|
78
81
|
renderAppender,
|
|
79
82
|
renderFooterAppender,
|
|
@@ -89,18 +92,16 @@ function UncontrolledInnerBlocks(props) {
|
|
|
89
92
|
filterInnerBlocks,
|
|
90
93
|
blockWidth,
|
|
91
94
|
__experimentalLayout: layout = defaultLayout,
|
|
92
|
-
gridProperties
|
|
93
|
-
useCompactList
|
|
95
|
+
gridProperties
|
|
94
96
|
} = props;
|
|
95
97
|
const context = useBlockContext(clientId);
|
|
96
|
-
useNestedSettingsUpdate(clientId, allowedBlocks, templateLock);
|
|
98
|
+
useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout);
|
|
97
99
|
useInnerBlockTemplateSync(clientId, template, templateLock, templateInsertUpdatesSelection);
|
|
98
|
-
const BlockListComponent = useCompactList ? BlockListCompact : BlockList;
|
|
99
100
|
return createElement(LayoutProvider, {
|
|
100
101
|
value: layout
|
|
101
102
|
}, createElement(BlockContextProvider, {
|
|
102
103
|
value: context
|
|
103
|
-
}, createElement(
|
|
104
|
+
}, createElement(BlockList, {
|
|
104
105
|
marginVertical: marginVertical,
|
|
105
106
|
marginHorizontal: marginHorizontal,
|
|
106
107
|
rootClientId: clientId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.native.js"],"names":["__unstableGetInnerBlocksProps","getInnerBlocksProps","useRef","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockList","BlockListCompact","useBlockEditContext","useBlockSync","BlockContextProvider","defaultLayout","LayoutProvider","useInnerBlocksProps","props","options","fallbackRef","clientId","ref","InnerBlocks","value","onChange","ControlledInnerBlocks","UncontrolledInnerBlocks","children","allowedBlocks","template","templateLock","templateInsertUpdatesSelection","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","__experimentalLayout","layout","gridProperties","useCompactList","context","BlockListComponent","allProps","save","Content"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,6BAA6B,IAAIC,mBAA1C,QAAqE,mBAArE;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,OAAOC,gBAAP,MAA6B,kCAA7B;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AACA,SAASC,oBAAT,QAAqC,kBAArC;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,sBAA9C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,GAAyD;AAAA,MAA3BC,KAA2B,uEAAnB,EAAmB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC/D,QAAMC,WAAW,GAAGhB,MAAM,EAA1B;AACA,QAAM;AAAEiB,IAAAA;AAAF,MAAeT,mBAAmB,EAAxC;AAEA,QAAMU,GAAG,GAAGJ,KAAK,CAACI,GAAN,IAAaF,WAAzB;AACA,QAAMG,WAAW,GAChBJ,OAAO,CAACK,KAAR,IAAiBL,OAAO,CAACM,QAAzB,GACGC,qBADH,GAEGC,uBAHJ;AAKA,SAAO,EACN,GAAGT,KADG;AAENI,IAAAA,GAFM;AAGNM,IAAAA,QAAQ,EACP,cAAC,WAAD,eACMT,OADN;AAEC,MAAA,QAAQ,EAAGE,QAFZ;AAGC,MAAA,UAAU,EAAGC;AAHd;AAJK,GAAP;AA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stableGetInnerBlocksProps as getInnerBlocksProps } from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport BlockListCompact from '../block-list/block-list-compact';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { BlockContextProvider } from '../block-context';\nimport { defaultLayout, LayoutProvider } from '../block-list/layout';\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst fallbackRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\n\tconst ref = props.ref || fallbackRef;\n\tconst InnerBlocks =\n\t\toptions.value && options.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tchildren: (\n\t\t\t<InnerBlocks\n\t\t\t\t{ ...options }\n\t\t\t\tclientId={ clientId }\n\t\t\t\twrapperRef={ ref }\n\t\t\t/>\n\t\t),\n\t};\n}\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\torientation,\n\t\trenderAppender,\n\t\trenderFooterAppender,\n\t\tparentWidth,\n\t\thorizontal,\n\t\tcontentResizeMode,\n\t\tcontentStyle,\n\t\tonAddBlock,\n\t\tonDeleteBlock,\n\t\tmarginVertical,\n\t\tmarginHorizontal,\n\t\thorizontalAlignment,\n\t\tfilterInnerBlocks,\n\t\tblockWidth,\n\t\t__experimentalLayout: layout = defaultLayout,\n\t\tgridProperties,\n\t\tuseCompactList,\n\t} = props;\n\n\tconst context = useBlockContext( clientId );\n\n\tuseNestedSettingsUpdate( clientId, allowedBlocks, templateLock );\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\tconst BlockListComponent = useCompactList ? BlockListCompact : BlockList;\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t<BlockListComponent\n\t\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\t\t\twithFooter={ false }\n\t\t\t\t\torientation={ orientation }\n\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\thorizontalAlignment={ horizontalAlignment }\n\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\t\tfilterInnerBlocks={ filterInnerBlocks }\n\t\t\t\t\tgridProperties={ gridProperties }\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</BlockContextProvider>\n\t\t</LayoutProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\n/**\n * Wrapped InnerBlocks component which detects whether to use the controlled or\n * uncontrolled variations of the InnerBlocks component. This is the component\n * which should be used throughout the application.\n *\n * @param {Object} props The component props.\n */\nconst InnerBlocks = ( props ) => {\n\tconst { clientId } = useBlockEditContext();\n\n\tconst allProps = {\n\t\tclientId,\n\t\t...props,\n\t};\n\n\t// Detects if the InnerBlocks should be controlled by an incoming value.\n\treturn props.value && props.onChange ? (\n\t\t<ControlledInnerBlocks { ...allProps } />\n\t) : (\n\t\t<UncontrolledInnerBlocks { ...allProps } />\n\t);\n};\n\n// Expose default appender placeholders as components.\nInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\nInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default InnerBlocks;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/inner-blocks/index.native.js"],"names":["__unstableGetInnerBlocksProps","getInnerBlocksProps","useRef","ButtonBlockAppender","DefaultBlockAppender","useNestedSettingsUpdate","useInnerBlockTemplateSync","useBlockContext","BlockList","useBlockEditContext","useBlockSync","BlockContextProvider","defaultLayout","LayoutProvider","useInnerBlocksProps","props","options","fallbackRef","clientId","ref","InnerBlocks","value","onChange","ControlledInnerBlocks","UncontrolledInnerBlocks","children","allowedBlocks","prioritizedInserterBlocks","__experimentalDefaultBlock","__experimentalDirectInsert","template","templateLock","templateInsertUpdatesSelection","__experimentalCaptureToolbars","captureToolbars","orientation","renderAppender","renderFooterAppender","parentWidth","horizontal","contentResizeMode","contentStyle","onAddBlock","onDeleteBlock","marginVertical","marginHorizontal","horizontalAlignment","filterInnerBlocks","blockWidth","__experimentalLayout","layout","gridProperties","context","allProps","save","Content"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,6BAA6B,IAAIC,mBAA1C,QAAqE,mBAArE;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,yBAAP,MAAsC,iCAAtC;AACA,OAAOC,eAAP,MAA4B,qBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,SAASC,mBAAT,QAAoC,uBAApC;AACA,OAAOC,YAAP,MAAyB,4BAAzB;AACA,SAASC,oBAAT,QAAqC,kBAArC;AACA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,sBAA9C;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,GAAyD;AAAA,MAA3BC,KAA2B,uEAAnB,EAAmB;AAAA,MAAfC,OAAe,uEAAL,EAAK;AAC/D,QAAMC,WAAW,GAAGf,MAAM,EAA1B;AACA,QAAM;AAAEgB,IAAAA;AAAF,MAAeT,mBAAmB,EAAxC;AAEA,QAAMU,GAAG,GAAGJ,KAAK,CAACI,GAAN,IAAaF,WAAzB;AACA,QAAMG,WAAW,GAChBJ,OAAO,CAACK,KAAR,IAAiBL,OAAO,CAACM,QAAzB,GAC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A,CAdD,C,CAgBA;;;AACAjC,WAAW,CAAChB,oBAAZ,GAAmCA,oBAAnC;AACAgB,WAAW,CAACjB,mBAAZ,GAAkCA,mBAAlC;AAEAW,mBAAmB,CAACwC,IAApB,GAA2BrD,mBAA3B;;AAEAmB,WAAW,CAACmC,OAAZ,GAAsB,MAAMzC,mBAAmB,CAACwC,IAApB,GAA2B7B,QAAvD;AAEA;AACA;AACA;;;AACA,eAAeL,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __unstableGetInnerBlocksProps as getInnerBlocksProps } from '@wordpress/blocks';\nimport { useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport ButtonBlockAppender from './button-block-appender';\nimport DefaultBlockAppender from './default-block-appender';\nimport useNestedSettingsUpdate from './use-nested-settings-update';\nimport useInnerBlockTemplateSync from './use-inner-block-template-sync';\nimport useBlockContext from './use-block-context';\n\n/**\n * Internal dependencies\n */\nimport BlockList from '../block-list';\nimport { useBlockEditContext } from '../block-edit/context';\nimport useBlockSync from '../provider/use-block-sync';\nimport { BlockContextProvider } from '../block-context';\nimport { defaultLayout, LayoutProvider } from '../block-list/layout';\n\n/**\n * This hook is used to lightly mark an element as an inner blocks wrapper\n * element. Call this hook and pass the returned props to the element to mark as\n * an inner blocks wrapper, automatically rendering inner blocks as children. If\n * you define a ref for the element, it is important to pass the ref to this\n * hook, which the hook in turn will pass to the component through the props it\n * returns. Optionally, you can also pass any other props through this hook, and\n * they will be merged and returned.\n *\n * @param {Object} props Optional. Props to pass to the element. Must contain\n * the ref if one is defined.\n * @param {Object} options Optional. Inner blocks options.\n *\n * @see https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport function useInnerBlocksProps( props = {}, options = {} ) {\n\tconst fallbackRef = useRef();\n\tconst { clientId } = useBlockEditContext();\n\n\tconst ref = props.ref || fallbackRef;\n\tconst InnerBlocks =\n\t\toptions.value && options.onChange\n\t\t\t? ControlledInnerBlocks\n\t\t\t: UncontrolledInnerBlocks;\n\n\treturn {\n\t\t...props,\n\t\tref,\n\t\tchildren: (\n\t\t\t<InnerBlocks\n\t\t\t\t{ ...options }\n\t\t\t\tclientId={ clientId }\n\t\t\t\twrapperRef={ ref }\n\t\t\t/>\n\t\t),\n\t};\n}\n\n/**\n * InnerBlocks is a component which allows a single block to have multiple blocks\n * as children. The UncontrolledInnerBlocks component is used whenever the inner\n * blocks are not controlled by another entity. In other words, it is normally\n * used for inner blocks in the post editor\n *\n * @param {Object} props The component props.\n */\nfunction UncontrolledInnerBlocks( props ) {\n\tconst {\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection,\n\t\t__experimentalCaptureToolbars: captureToolbars,\n\t\torientation,\n\t\trenderAppender,\n\t\trenderFooterAppender,\n\t\tparentWidth,\n\t\thorizontal,\n\t\tcontentResizeMode,\n\t\tcontentStyle,\n\t\tonAddBlock,\n\t\tonDeleteBlock,\n\t\tmarginVertical,\n\t\tmarginHorizontal,\n\t\thorizontalAlignment,\n\t\tfilterInnerBlocks,\n\t\tblockWidth,\n\t\t__experimentalLayout: layout = defaultLayout,\n\t\tgridProperties,\n\t} = props;\n\n\tconst context = useBlockContext( clientId );\n\n\tuseNestedSettingsUpdate(\n\t\tclientId,\n\t\tallowedBlocks,\n\t\tprioritizedInserterBlocks,\n\t\t__experimentalDefaultBlock,\n\t\t__experimentalDirectInsert,\n\t\ttemplateLock,\n\t\tcaptureToolbars,\n\t\torientation,\n\t\tlayout\n\t);\n\n\tuseInnerBlockTemplateSync(\n\t\tclientId,\n\t\ttemplate,\n\t\ttemplateLock,\n\t\ttemplateInsertUpdatesSelection\n\t);\n\n\treturn (\n\t\t<LayoutProvider value={ layout }>\n\t\t\t<BlockContextProvider value={ context }>\n\t\t\t\t<BlockList\n\t\t\t\t\tmarginVertical={ marginVertical }\n\t\t\t\t\tmarginHorizontal={ marginHorizontal }\n\t\t\t\t\trootClientId={ clientId }\n\t\t\t\t\trenderAppender={ renderAppender }\n\t\t\t\t\trenderFooterAppender={ renderFooterAppender }\n\t\t\t\t\twithFooter={ false }\n\t\t\t\t\torientation={ orientation }\n\t\t\t\t\tparentWidth={ parentWidth }\n\t\t\t\t\thorizontalAlignment={ horizontalAlignment }\n\t\t\t\t\thorizontal={ horizontal }\n\t\t\t\t\tcontentResizeMode={ contentResizeMode }\n\t\t\t\t\tcontentStyle={ contentStyle }\n\t\t\t\t\tonAddBlock={ onAddBlock }\n\t\t\t\t\tonDeleteBlock={ onDeleteBlock }\n\t\t\t\t\tfilterInnerBlocks={ filterInnerBlocks }\n\t\t\t\t\tgridProperties={ gridProperties }\n\t\t\t\t\tblockWidth={ blockWidth }\n\t\t\t\t/>\n\t\t\t</BlockContextProvider>\n\t\t</LayoutProvider>\n\t);\n}\n\n/**\n * The controlled inner blocks component wraps the uncontrolled inner blocks\n * component with the blockSync hook. This keeps the innerBlocks of the block in\n * the block-editor store in sync with the blocks of the controlling entity. An\n * example of an inner block controller is a template part block, which provides\n * its own blocks from the template part entity data source.\n *\n * @param {Object} props The component props.\n */\nfunction ControlledInnerBlocks( props ) {\n\tuseBlockSync( props );\n\treturn <UncontrolledInnerBlocks { ...props } />;\n}\n\n/**\n * Wrapped InnerBlocks component which detects whether to use the controlled or\n * uncontrolled variations of the InnerBlocks component. This is the component\n * which should be used throughout the application.\n *\n * @param {Object} props The component props.\n */\nconst InnerBlocks = ( props ) => {\n\tconst { clientId } = useBlockEditContext();\n\n\tconst allProps = {\n\t\tclientId,\n\t\t...props,\n\t};\n\n\t// Detects if the InnerBlocks should be controlled by an incoming value.\n\treturn props.value && props.onChange ? (\n\t\t<ControlledInnerBlocks { ...allProps } />\n\t) : (\n\t\t<UncontrolledInnerBlocks { ...allProps } />\n\t);\n};\n\n// Expose default appender placeholders as components.\nInnerBlocks.DefaultBlockAppender = DefaultBlockAppender;\nInnerBlocks.ButtonBlockAppender = ButtonBlockAppender;\n\nuseInnerBlocksProps.save = getInnerBlocksProps;\n\nInnerBlocks.Content = () => useInnerBlocksProps.save().children;\n\n/**\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/inner-blocks/README.md\n */\nexport default InnerBlocks;\n"]}
|
|
@@ -23,6 +23,7 @@ const pendingSettingsUpdates = new WeakMap();
|
|
|
23
23
|
* @param {string} clientId The client ID of the block to update.
|
|
24
24
|
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
25
25
|
* in inner blocks.
|
|
26
|
+
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
26
27
|
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
27
28
|
* @param {?Function|boolean} __experimentalDirectInsert If a default block should be inserted directly by the
|
|
28
29
|
* appender.
|
|
@@ -36,7 +37,7 @@ const pendingSettingsUpdates = new WeakMap();
|
|
|
36
37
|
* @param {Object} layout The layout object for the block container.
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
|
-
export default function useNestedSettingsUpdate(clientId, allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
|
|
40
|
+
export default function useNestedSettingsUpdate(clientId, allowedBlocks, prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, captureToolbars, orientation, layout) {
|
|
40
41
|
const {
|
|
41
42
|
updateBlockListSettings
|
|
42
43
|
} = useDispatch(blockEditorStore);
|
|
@@ -50,14 +51,21 @@ export default function useNestedSettingsUpdate(clientId, allowedBlocks, __exper
|
|
|
50
51
|
blockListSettings: select(blockEditorStore).getBlockListSettings(clientId),
|
|
51
52
|
parentLock: select(blockEditorStore).getTemplateLock(rootClientId)
|
|
52
53
|
};
|
|
53
|
-
}, [clientId]); // Memoize
|
|
54
|
-
// render
|
|
54
|
+
}, [clientId]); // Memoize allowedBlocks and prioritisedInnerBlocks based on the contents
|
|
55
|
+
// of the arrays. Implementors often pass a new array on every render,
|
|
56
|
+
// and the contents of the arrays are just strings, so the entire array
|
|
57
|
+
// can be passed as dependencies.
|
|
55
58
|
|
|
56
|
-
const _allowedBlocks = useMemo(() => allowedBlocks,
|
|
59
|
+
const _allowedBlocks = useMemo(() => allowedBlocks, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
+
allowedBlocks);
|
|
61
|
+
|
|
62
|
+
const _prioritizedInserterBlocks = useMemo(() => prioritizedInserterBlocks, // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
63
|
+
prioritizedInserterBlocks);
|
|
57
64
|
|
|
58
65
|
useLayoutEffect(() => {
|
|
59
66
|
const newSettings = {
|
|
60
67
|
allowedBlocks: _allowedBlocks,
|
|
68
|
+
prioritizedInserterBlocks: _prioritizedInserterBlocks,
|
|
61
69
|
templateLock: templateLock === undefined || parentLock === 'contentOnly' ? parentLock : templateLock
|
|
62
70
|
}; // These values are not defined for RN, so only include them if they
|
|
63
71
|
// are defined.
|
|
@@ -108,6 +116,6 @@ export default function useNestedSettingsUpdate(clientId, allowedBlocks, __exper
|
|
|
108
116
|
}
|
|
109
117
|
});
|
|
110
118
|
}
|
|
111
|
-
}, [clientId, blockListSettings, _allowedBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings, layout, registry]);
|
|
119
|
+
}, [clientId, blockListSettings, _allowedBlocks, _prioritizedInserterBlocks, __experimentalDefaultBlock, __experimentalDirectInsert, templateLock, parentLock, captureToolbars, orientation, updateBlockListSettings, layout, registry]);
|
|
112
120
|
}
|
|
113
121
|
//# sourceMappingURL=use-nested-settings-update.js.map
|