@wordpress/block-editor 10.5.0 → 11.1.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 +18 -0
- package/README.md +2 -1
- package/build/autocompleters/block.js +2 -6
- package/build/autocompleters/block.js.map +1 -1
- package/build/autocompleters/link.js +2 -0
- package/build/autocompleters/link.js.map +1 -1
- package/build/components/alignment-control/ui.js +1 -7
- package/build/components/alignment-control/ui.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-card/index.js +51 -3
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +46 -39
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +4 -3
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-edit/edit.native.js +4 -7
- package/build/components/block-edit/edit.native.js.map +1 -1
- package/build/components/block-icon/index.js +4 -2
- package/build/components/block-icon/index.js.map +1 -1
- package/build/components/block-inspector/index.js +90 -37
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-list-context.native.js +5 -8
- package/build/components/block-list/block-list-context.native.js.map +1 -1
- package/build/components/block-list/block.js +55 -24
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-list/block.native.js +61 -28
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list-appender/index.js +46 -34
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-list-appender/index.native.js +39 -34
- package/build/components/block-list-appender/index.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js +30 -22
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build/components/block-mobile-toolbar/index.native.js +1 -1
- package/build/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +16 -8
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +33 -11
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-preview/auto.js +9 -3
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-preview/index.js +5 -9
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.native.js +1 -3
- package/build/components/block-styles/index.native.js.map +1 -1
- package/build/components/block-styles/utils.js +7 -10
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -1
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +6 -8
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +8 -49
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/selected-block-popover.js +1 -3
- package/build/components/block-tools/selected-block-popover.js.map +1 -1
- package/build/components/block-variation-picker/index.js +2 -3
- package/build/components/block-variation-picker/index.js.map +1 -1
- package/build/components/colors/utils.js +2 -6
- package/build/components/colors/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +0 -3
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +0 -2
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +2 -19
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -3
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build/components/copy-handler/index.js +37 -9
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/font-sizes/fluid-utils.js +5 -2
- package/build/components/font-sizes/fluid-utils.js.map +1 -1
- package/build/components/font-sizes/utils.js +10 -4
- package/build/components/font-sizes/utils.js.map +1 -1
- package/build/components/font-sizes/with-font-sizes.js +11 -6
- package/build/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build/components/gradients/use-gradient.js +2 -8
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/height-control/index.js +115 -0
- package/build/components/height-control/index.js.map +1 -0
- package/build/components/iframe/index.js +22 -101
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +93 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build/components/image-editor/use-save-image.js +2 -0
- package/build/components/image-editor/use-save-image.js.map +1 -1
- package/build/components/image-editor/zoom-dropdown.js +1 -0
- package/build/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +25 -7
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +25 -10
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +25 -46
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/block-types-tab.js +3 -1
- package/build/components/inserter/block-types-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-debounced-input.js +27 -0
- package/build/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build/components/inserter/index.js +20 -6
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +3 -4
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +106 -0
- package/build/components/inserter/media-tab/hooks.js.map +1 -0
- package/build/components/inserter/media-tab/index.js +32 -0
- package/build/components/inserter/media-tab/index.js.map +1 -0
- package/build/components/inserter/media-tab/media-list.js +100 -0
- package/build/components/inserter/media-tab/media-list.js.map +1 -0
- package/build/components/inserter/media-tab/media-panel.js +96 -0
- package/build/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build/components/inserter/media-tab/media-tab.js +120 -0
- package/build/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build/components/inserter/media-tab/utils.js +54 -0
- package/build/components/inserter/media-tab/utils.js.map +1 -0
- package/build/components/inserter/menu.js +35 -12
- package/build/components/inserter/menu.js.map +1 -1
- package/build/components/inserter/mobile-tab-navigation.js +70 -0
- package/build/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build/components/inserter/quick-inserter.js +7 -3
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter/search-items.js +15 -14
- package/build/components/inserter/search-items.js.map +1 -1
- package/build/components/inserter/search-results.js +7 -3
- package/build/components/inserter/search-results.js.map +1 -1
- package/build/components/inserter/tabs.js +16 -2
- package/build/components/inserter/tabs.js.map +1 -1
- package/build/components/inserter-list-item/index.js +4 -1
- package/build/components/inserter-list-item/index.js.map +1 -1
- package/build/components/inspector-controls/groups.js +2 -0
- package/build/components/inspector-controls/groups.js.map +1 -1
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js +46 -0
- package/build/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build/components/inspector-controls-tabs/index.js +71 -0
- package/build/components/inspector-controls-tabs/index.js.map +1 -0
- package/build/components/inspector-controls-tabs/settings-tab.js +28 -0
- package/build/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/styles-tab.js +61 -0
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js +97 -0
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +18 -0
- package/build/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build/components/inspector-controls-tabs/utils.js +37 -0
- package/build/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build/components/link-control/index.js +1 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +0 -1
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/link-control/use-internal-input-value.js +3 -3
- package/build/components/link-control/use-internal-input-value.js.map +1 -1
- package/build/components/list-view/block-select-button.js +1 -1
- package/build/components/list-view/block-select-button.js.map +1 -1
- package/build/components/list-view/block.js +5 -2
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +13 -12
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/media-upload/index.native.js +2 -3
- package/build/components/media-upload/index.native.js.map +1 -1
- package/build/components/off-canvas-editor/appender.js +99 -0
- package/build/components/off-canvas-editor/appender.js.map +1 -0
- package/build/components/off-canvas-editor/block-edit-button.js +50 -0
- package/build/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build/components/off-canvas-editor/block-select-button.js +3 -2
- package/build/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build/components/off-canvas-editor/block.js +82 -38
- package/build/components/off-canvas-editor/block.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +3 -5
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +24 -11
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf.js +1 -1
- package/build/components/off-canvas-editor/leaf.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +185 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build/components/off-canvas-editor/update-attributes.js +108 -0
- package/build/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build/components/off-canvas-editor/use-inserted-block.js +58 -0
- package/build/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build/components/responsive-block-control/label.js.map +1 -1
- package/build/components/rich-text/format-edit.js +12 -10
- package/build/components/rich-text/format-edit.js.map +1 -1
- package/build/components/rich-text/format-toolbar/index.js +8 -4
- package/build/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build/components/rich-text/index.js +3 -3
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +0 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-insert-replacement-text.js +43 -0
- package/build/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build/components/rich-text/use-paste-handler.js +21 -12
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build/components/rich-text/utils.js +1 -19
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/components/spacing-sizes-control/index.js +0 -1
- package/build/components/spacing-sizes-control/index.js.map +1 -1
- package/build/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/typewriter/index.js +1 -1
- package/build/components/typewriter/index.js.map +1 -1
- package/build/components/ungroup-button/index.native.js +4 -2
- package/build/components/ungroup-button/index.native.js.map +1 -1
- package/build/components/url-input/index.js +46 -43
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +2 -2
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-display-information/index.js +8 -4
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-setting/index.js +9 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/index.js +1 -1
- package/build/components/writing-flow/index.js.map +1 -1
- package/build/hooks/border.js +0 -1
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/child-layout.js +209 -0
- package/build/hooks/child-layout.js.map +1 -0
- package/build/hooks/color-panel.js +0 -1
- package/build/hooks/color-panel.js.map +1 -1
- package/build/hooks/color.js +1 -2
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/content-lock-ui.js +1 -1
- package/build/hooks/content-lock-ui.js.map +1 -1
- package/build/hooks/dimensions.js +25 -7
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +4 -4
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/font-size.js +5 -3
- package/build/hooks/font-size.js.map +1 -1
- package/build/hooks/layout.js +57 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/min-height.js +4 -10
- package/build/hooks/min-height.js.map +1 -1
- package/build/hooks/use-typography-props.js +11 -8
- package/build/hooks/use-typography-props.js.map +1 -1
- package/build/store/reducer.js +411 -274
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +58 -48
- package/build/store/selectors.js.map +1 -1
- package/build/utils/pasting.js +6 -11
- package/build/utils/pasting.js.map +1 -1
- package/build/utils/sorting.js +63 -0
- package/build/utils/sorting.js.map +1 -0
- package/build-module/autocompleters/block.js +2 -6
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/autocompleters/link.js +2 -0
- package/build-module/autocompleters/link.js.map +1 -1
- package/build-module/components/alignment-control/ui.js +1 -6
- package/build-module/components/alignment-control/ui.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +4 -3
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -3
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +40 -31
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +4 -2
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-edit/edit.native.js +4 -6
- package/build-module/components/block-edit/edit.native.js.map +1 -1
- package/build-module/components/block-icon/index.js +4 -2
- package/build-module/components/block-icon/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +87 -34
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-list-context.native.js +5 -8
- package/build-module/components/block-list/block-list-context.native.js.map +1 -1
- package/build-module/components/block-list/block.js +55 -25
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-list/block.native.js +61 -28
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +46 -34
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-list-appender/index.native.js +39 -32
- package/build-module/components/block-list-appender/index.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js +31 -24
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +1 -1
- package/build-module/components/block-mobile-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +16 -8
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +35 -13
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +9 -3
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-preview/index.js +5 -8
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.native.js +1 -2
- package/build-module/components/block-styles/index.native.js.map +1 -1
- package/build-module/components/block-styles/utils.js +7 -9
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +6 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +6 -8
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +8 -49
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/selected-block-popover.js +1 -2
- package/build-module/components/block-tools/selected-block-popover.js.map +1 -1
- package/build-module/components/block-variation-picker/index.js +2 -3
- package/build-module/components/block-variation-picker/index.js.map +1 -1
- package/build-module/components/colors/utils.js +3 -7
- package/build-module/components/colors/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +0 -3
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +0 -2
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +4 -19
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
- package/build-module/components/copy-handler/index.js +38 -10
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/font-sizes/fluid-utils.js +5 -2
- package/build-module/components/font-sizes/fluid-utils.js.map +1 -1
- package/build-module/components/font-sizes/utils.js +11 -5
- package/build-module/components/font-sizes/utils.js.map +1 -1
- package/build-module/components/font-sizes/with-font-sizes.js +12 -7
- package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
- package/build-module/components/gradients/use-gradient.js +2 -7
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/height-control/index.js +103 -0
- package/build-module/components/height-control/index.js.map +1 -0
- package/build-module/components/iframe/index.js +21 -101
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +85 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -0
- package/build-module/components/image-editor/use-save-image.js +2 -0
- package/build-module/components/image-editor/use-save-image.js.map +1 -1
- package/build-module/components/image-editor/zoom-dropdown.js +1 -0
- package/build-module/components/image-editor/zoom-dropdown.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +27 -9
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +23 -10
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/build-module/components/inserter/block-patterns-explorer/sidebar.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +27 -49
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.js +3 -2
- package/build-module/components/inserter/block-types-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-debounced-input.js +18 -0
- package/build-module/components/inserter/hooks/use-debounced-input.js.map +1 -0
- package/build-module/components/inserter/hooks/use-insertion-point.js +4 -3
- package/build-module/components/inserter/hooks/use-insertion-point.js.map +1 -1
- package/build-module/components/inserter/index.js +20 -6
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +3 -5
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +92 -0
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -0
- package/build-module/components/inserter/media-tab/index.js +4 -0
- package/build-module/components/inserter/media-tab/index.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-list.js +86 -0
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-panel.js +77 -0
- package/build-module/components/inserter/media-tab/media-panel.js.map +1 -0
- package/build-module/components/inserter/media-tab/media-tab.js +100 -0
- package/build-module/components/inserter/media-tab/media-tab.js.map +1 -0
- package/build-module/components/inserter/media-tab/utils.js +45 -0
- package/build-module/components/inserter/media-tab/utils.js.map +1 -0
- package/build-module/components/inserter/menu.js +33 -12
- package/build-module/components/inserter/menu.js.map +1 -1
- package/build-module/components/inserter/mobile-tab-navigation.js +61 -0
- package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -0
- package/build-module/components/inserter/quick-inserter.js +7 -3
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter/search-items.js +15 -13
- package/build-module/components/inserter/search-items.js.map +1 -1
- package/build-module/components/inserter/search-results.js +7 -4
- package/build-module/components/inserter/search-results.js.map +1 -1
- package/build-module/components/inserter/tabs.js +15 -2
- package/build-module/components/inserter/tabs.js.map +1 -1
- package/build-module/components/inserter-list-item/index.js +5 -2
- package/build-module/components/inserter-list-item/index.js.map +1 -1
- package/build-module/components/inspector-controls/groups.js +2 -0
- package/build-module/components/inspector-controls/groups.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js +32 -0
- package/build-module/components/inspector-controls-tabs/advanced-controls-panel.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/index.js +56 -0
- package/build-module/components/inspector-controls-tabs/index.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js +17 -0
- package/build-module/components/inspector-controls-tabs/settings-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js +46 -0
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js +81 -0
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +8 -0
- package/build-module/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js.map +1 -0
- package/build-module/components/inspector-controls-tabs/utils.js +26 -0
- package/build-module/components/inspector-controls-tabs/utils.js.map +1 -0
- package/build-module/components/link-control/index.js +1 -0
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +0 -1
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/link-control/use-internal-input-value.js +3 -3
- package/build-module/components/link-control/use-internal-input-value.js.map +1 -1
- package/build-module/components/list-view/block-select-button.js +1 -1
- package/build-module/components/list-view/block-select-button.js.map +1 -1
- package/build-module/components/list-view/block.js +5 -2
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +12 -11
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/media-upload/index.native.js +2 -4
- package/build-module/components/media-upload/index.native.js.map +1 -1
- package/build-module/components/off-canvas-editor/appender.js +83 -0
- package/build-module/components/off-canvas-editor/appender.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js +35 -0
- package/build-module/components/off-canvas-editor/block-edit-button.js.map +1 -0
- package/build-module/components/off-canvas-editor/block-select-button.js +3 -2
- package/build-module/components/off-canvas-editor/block-select-button.js.map +1 -1
- package/build-module/components/off-canvas-editor/block.js +83 -41
- package/build-module/components/off-canvas-editor/block.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +3 -4
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +24 -12
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf.js +1 -1
- package/build-module/components/off-canvas-editor/leaf.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +165 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -0
- package/build-module/components/off-canvas-editor/update-attributes.js +97 -0
- package/build-module/components/off-canvas-editor/update-attributes.js.map +1 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/build-module/components/off-canvas-editor/use-inserted-block.js.map +1 -0
- package/build-module/components/responsive-block-control/label.js +1 -2
- package/build-module/components/responsive-block-control/label.js.map +1 -1
- package/build-module/components/rich-text/format-edit.js +12 -9
- package/build-module/components/rich-text/format-edit.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar/index.js +6 -2
- package/build-module/components/rich-text/format-toolbar/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +2 -3
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +0 -2
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-insert-replacement-text.js +33 -0
- package/build-module/components/rich-text/use-insert-replacement-text.js.map +1 -0
- package/build-module/components/rich-text/use-paste-handler.js +22 -12
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js +9 -1
- package/build-module/components/rich-text/use-undo-automatic-change.js.map +1 -1
- package/build-module/components/rich-text/utils.js +1 -16
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/components/spacing-sizes-control/index.js +0 -1
- package/build-module/components/spacing-sizes-control/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/spacing-input-control.js +12 -3
- package/build-module/components/spacing-sizes-control/spacing-input-control.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/typewriter/index.js +1 -1
- package/build-module/components/typewriter/index.js.map +1 -1
- package/build-module/components/ungroup-button/index.native.js +3 -2
- package/build-module/components/ungroup-button/index.native.js.map +1 -1
- package/build-module/components/url-input/index.js +46 -43
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +3 -3
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +9 -5
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +8 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/index.js +1 -1
- package/build-module/components/writing-flow/index.js.map +1 -1
- package/build-module/hooks/border.js +0 -1
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/child-layout.js +189 -0
- package/build-module/hooks/child-layout.js.map +1 -0
- package/build-module/hooks/color-panel.js +0 -1
- package/build-module/hooks/color-panel.js.map +1 -1
- package/build-module/hooks/color.js +1 -2
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/content-lock-ui.js +1 -1
- package/build-module/hooks/content-lock-ui.js.map +1 -1
- package/build-module/hooks/dimensions.js +25 -8
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +5 -5
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/font-size.js +5 -3
- package/build-module/hooks/font-size.js.map +1 -1
- package/build-module/hooks/layout.js +55 -0
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/min-height.js +3 -9
- package/build-module/hooks/min-height.js.map +1 -1
- package/build-module/hooks/use-typography-props.js +11 -8
- package/build-module/hooks/use-typography-props.js.map +1 -1
- package/build-module/store/reducer.js +409 -274
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +55 -48
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/pasting.js +6 -10
- package/build-module/utils/pasting.js.map +1 -1
- package/build-module/utils/sorting.js +56 -0
- package/build-module/utils/sorting.js.map +1 -0
- package/build-style/content-rtl.css +701 -0
- package/build-style/content.css +701 -0
- package/build-style/default-editor-styles-rtl.css +17 -3
- package/build-style/default-editor-styles.css +17 -3
- package/build-style/style-rtl.css +313 -665
- package/build-style/style.css +313 -665
- package/package.json +32 -30
- package/src/autocompleters/block.js +2 -6
- package/src/autocompleters/link.js +2 -0
- package/src/components/alignment-control/test/index.js +6 -1
- package/src/components/alignment-control/ui.js +1 -7
- package/src/components/block-alignment-control/test/index.js +6 -1
- package/src/components/block-alignment-control/use-available-alignments.js +4 -3
- package/src/components/block-card/index.js +46 -2
- package/src/components/block-card/style.scss +4 -0
- package/src/components/block-content-overlay/{style.scss → content.scss} +7 -1
- package/src/components/block-draggable/content.scss +20 -0
- package/src/components/block-draggable/index.native.js +54 -40
- package/src/components/block-draggable/style.scss +0 -21
- package/src/components/block-draggable/test/helpers.native.js +7 -9
- package/src/components/block-draggable/test/index.native.js +35 -45
- package/src/components/block-edit/edit.js +5 -2
- package/src/components/block-edit/edit.native.js +5 -6
- package/src/components/block-icon/index.js +4 -2
- package/src/components/block-icon/test/index.js +9 -5
- package/src/components/block-inspector/index.js +173 -85
- package/src/components/block-inspector/style.scss +16 -1
- package/src/components/block-list/block-list-context.native.js +5 -8
- package/src/components/block-list/block.js +74 -23
- package/src/components/block-list/block.native.js +78 -23
- package/src/components/block-list/{style.scss → content.scss} +1 -15
- package/src/components/block-list-appender/{style.scss → content.scss} +0 -0
- package/src/components/block-list-appender/index.js +65 -54
- package/src/components/block-list-appender/index.native.js +45 -34
- package/src/components/block-mobile-toolbar/block-actions-menu.native.js +42 -28
- package/src/components/block-mobile-toolbar/index.native.js +1 -1
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +125 -0
- package/src/components/block-mobile-toolbar/test/block-actions-menu.native.js +439 -0
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +42 -2
- package/src/components/block-mover/test/index.native.js +157 -1
- package/src/components/block-pattern-setup/index.js +17 -7
- package/src/components/block-pattern-setup/style.scss +29 -1
- package/src/components/block-patterns-list/index.js +47 -24
- package/src/components/block-preview/README.md +15 -10
- package/src/components/block-preview/auto.js +7 -1
- package/src/components/block-preview/content.scss +4 -0
- package/src/components/block-preview/index.js +7 -12
- package/src/components/block-preview/style.scss +0 -7
- package/src/components/block-preview/test/index.js +18 -35
- package/src/components/block-selection-clearer/test/index.js +12 -12
- package/src/components/block-settings-menu/block-settings-dropdown.js +32 -20
- package/src/components/block-styles/index.native.js +1 -2
- package/src/components/block-styles/utils.js +5 -7
- package/src/components/block-switcher/test/index.js +6 -1
- package/src/components/block-toolbar/index.js +12 -5
- package/src/components/block-toolbar/index.native.js +8 -11
- package/src/components/block-toolbar/style.scss +10 -0
- package/src/components/block-tools/insertion-point.js +3 -47
- package/src/components/block-tools/selected-block-popover.js +1 -3
- package/src/components/block-tools/style.scss +12 -5
- package/src/components/block-variation-picker/index.js +6 -5
- package/src/components/block-vertical-alignment-control/test/index.js +6 -1
- package/src/components/colors/test/with-colors.js +2 -0
- package/src/components/colors/utils.js +5 -3
- package/src/components/colors-gradients/control.js +0 -7
- package/src/components/colors-gradients/dropdown.js +0 -2
- package/src/components/colors-gradients/panel-color-gradient-settings.js +4 -22
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +4 -2
- package/src/components/copy-handler/index.js +53 -7
- package/src/components/default-block-appender/{style.scss → content.scss} +0 -0
- package/src/components/default-block-appender/test/index.js +2 -0
- package/src/components/font-sizes/fluid-utils.js +7 -1
- package/src/components/font-sizes/utils.js +5 -3
- package/src/components/font-sizes/with-font-sizes.js +4 -4
- package/src/components/gradients/use-gradient.js +2 -7
- package/src/components/height-control/index.js +123 -0
- package/src/components/height-control/stories/index.js +21 -0
- package/src/components/height-control/style.scss +5 -0
- package/src/components/iframe/index.js +33 -121
- package/src/components/iframe/use-compatibility-styles.js +95 -0
- package/src/components/image-editor/use-save-image.js +2 -0
- package/src/components/image-editor/zoom-dropdown.js +1 -0
- package/src/components/image-size-control/test/index.js +147 -79
- package/src/components/index.js +1 -0
- package/src/components/inner-blocks/{style.scss → content.scss} +0 -0
- package/src/components/inner-blocks/index.js +26 -7
- package/src/components/inner-blocks/use-inner-block-template-sync.js +28 -10
- package/src/components/inserter/block-patterns-explorer/sidebar.js +1 -0
- package/src/components/inserter/block-patterns-tab.js +28 -71
- package/src/components/inserter/block-types-tab.js +3 -2
- package/src/components/inserter/hooks/use-debounced-input.js +17 -0
- package/src/components/inserter/hooks/use-insertion-point.js +3 -2
- package/src/components/inserter/index.js +24 -3
- package/src/components/inserter/index.native.js +1 -1
- package/src/components/inserter/media-tab/hooks.js +89 -0
- package/src/components/inserter/media-tab/index.js +3 -0
- package/src/components/inserter/media-tab/media-list.js +93 -0
- package/src/components/inserter/media-tab/media-panel.js +83 -0
- package/src/components/inserter/media-tab/media-tab.js +135 -0
- package/src/components/inserter/media-tab/utils.js +37 -0
- package/src/components/inserter/menu.js +55 -13
- package/src/components/inserter/mobile-tab-navigation.js +85 -0
- package/src/components/inserter/quick-inserter.js +4 -0
- package/src/components/inserter/search-items.js +1 -2
- package/src/components/inserter/search-results.js +5 -2
- package/src/components/inserter/stories/index.js +1 -1
- package/src/components/inserter/stories/{fixtures.js → utils/fixtures.js} +0 -0
- package/src/components/inserter/style.scss +176 -11
- package/src/components/inserter/tabs.js +12 -1
- package/src/components/inserter-list-item/index.js +11 -1
- package/src/components/inserter-list-item/style.scss +26 -0
- package/src/components/inspector-controls/groups.js +2 -0
- package/src/components/inspector-controls-tabs/advanced-controls-panel.js +37 -0
- package/src/components/inspector-controls-tabs/index.js +62 -0
- package/src/components/inspector-controls-tabs/settings-tab.js +18 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +51 -0
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +89 -0
- package/src/components/inspector-controls-tabs/use-is-list-view-tab-disabled.js +9 -0
- package/src/components/inspector-controls-tabs/utils.js +28 -0
- package/src/components/line-height-control/test/index.js +5 -5
- package/src/components/link-control/README.md +1 -1
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/search-input.js +0 -1
- package/src/components/link-control/test/index.js +204 -403
- package/src/components/link-control/use-internal-input-value.js +3 -3
- package/src/components/list-view/block-select-button.js +1 -1
- package/src/components/list-view/block.js +3 -0
- package/src/components/list-view/branch.js +10 -8
- package/src/components/list-view/style.scss +21 -16
- package/src/components/media-placeholder/{style.scss → content.scss} +0 -0
- package/src/components/media-replace-flow/test/index.js +39 -9
- package/src/components/media-upload/test/index.native.js +2 -0
- package/src/components/off-canvas-editor/appender.js +98 -0
- package/src/components/off-canvas-editor/block-edit-button.js +27 -0
- package/src/components/off-canvas-editor/block-select-button.js +6 -2
- package/src/components/off-canvas-editor/block.js +160 -77
- package/src/components/off-canvas-editor/branch.js +3 -5
- package/src/components/off-canvas-editor/index.js +68 -33
- package/src/components/off-canvas-editor/leaf.js +5 -1
- package/src/components/off-canvas-editor/link-ui.js +166 -0
- package/src/components/off-canvas-editor/style.scss +19 -386
- package/src/components/off-canvas-editor/test/use-inserted-block.js +108 -0
- package/src/components/off-canvas-editor/update-attributes.js +99 -0
- package/src/components/off-canvas-editor/use-inserted-block.js +47 -0
- package/src/components/plain-text/{style.scss → content.scss} +0 -0
- package/src/components/recursion-provider/test/index.js +27 -29
- package/src/components/responsive-block-control/label.js +2 -3
- package/src/components/responsive-block-control/test/index.js +4 -2
- package/src/components/rich-text/content.scss +42 -0
- package/src/components/rich-text/format-edit.js +6 -10
- package/src/components/rich-text/format-toolbar/index.js +6 -4
- package/src/components/rich-text/index.js +3 -2
- package/src/components/rich-text/index.native.js +0 -2
- package/src/components/rich-text/style.scss +0 -43
- package/src/components/rich-text/use-insert-replacement-text.js +31 -0
- package/src/components/rich-text/use-paste-handler.js +33 -14
- package/src/components/rich-text/use-undo-automatic-change.js +7 -1
- package/src/components/rich-text/utils.js +2 -21
- package/src/components/spacing-sizes-control/index.js +0 -1
- package/src/components/spacing-sizes-control/spacing-input-control.js +9 -0
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/typewriter/index.js +3 -1
- package/src/components/ungroup-button/index.native.js +6 -2
- package/src/components/url-input/index.js +57 -73
- package/src/components/url-input/test/button.js +2 -0
- package/src/components/url-popover/image-url-input-ui.js +5 -4
- package/src/components/url-popover/test/__snapshots__/index.js.snap +8 -6
- package/src/components/url-popover/test/index.js +37 -9
- package/src/components/use-block-display-information/index.js +14 -5
- package/src/components/use-setting/index.js +13 -1
- package/src/components/use-setting/test/index.js +99 -0
- package/src/components/warning/test/index.js +2 -0
- package/src/components/writing-flow/index.js +1 -1
- package/src/content.scss +10 -0
- package/src/hooks/border.js +0 -1
- package/src/hooks/child-layout.js +190 -0
- package/src/hooks/color-panel.js +0 -1
- package/src/hooks/color.js +0 -2
- package/src/hooks/content-lock-ui.js +1 -1
- package/src/hooks/dimensions.js +45 -7
- package/src/hooks/font-family.js +3 -5
- package/src/hooks/font-size.js +13 -4
- package/src/hooks/layout.js +60 -0
- package/src/hooks/min-height.js +2 -19
- package/src/hooks/test/use-typography-props.js +26 -0
- package/src/hooks/use-typography-props.js +15 -7
- package/src/store/reducer.js +471 -428
- package/src/store/selectors.js +57 -59
- package/src/store/test/performance.js +71 -0
- package/src/store/test/reducer.js +623 -491
- package/src/store/test/selectors.js +1820 -1306
- package/src/style.scss +4 -7
- package/src/utils/pasting.js +3 -9
- package/src/utils/sorting.js +54 -0
- package/src/utils/test/sorting.js +49 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/block-preview/live.js +0 -30
- package/build/components/block-preview/live.js.map +0 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +0 -21
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build/components/rich-text/file-paste-handler.js +0 -21
- package/build/components/rich-text/file-paste-handler.js.map +0 -1
- package/build-module/components/block-preview/live.js +0 -20
- package/build-module/components/block-preview/live.js.map +0 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +0 -1
- package/build-module/components/rich-text/file-paste-handler.js +0 -13
- package/build-module/components/rich-text/file-paste-handler.js.map +0 -1
- package/src/components/block-preview/live.js +0 -19
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +0 -11
- package/src/components/rich-text/file-paste-handler.js +0 -13
|
@@ -210,38 +210,48 @@ describe( 'state', () => {
|
|
|
210
210
|
} );
|
|
211
211
|
it( 'can replace a child block', () => {
|
|
212
212
|
const existingState = deepFreeze( {
|
|
213
|
-
byClientId:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
213
|
+
byClientId: new Map(
|
|
214
|
+
Object.entries( {
|
|
215
|
+
chicken: {
|
|
216
|
+
clientId: 'chicken',
|
|
217
|
+
name: 'core/test-parent-block',
|
|
218
|
+
isValid: true,
|
|
219
|
+
},
|
|
220
|
+
'chicken-child': {
|
|
221
|
+
clientId: 'chicken-child',
|
|
222
|
+
name: 'core/test-child-block',
|
|
223
|
+
isValid: true,
|
|
224
|
+
},
|
|
225
|
+
} )
|
|
226
|
+
),
|
|
227
|
+
attributes: new Map(
|
|
228
|
+
Object.entries( {
|
|
229
|
+
chicken: {},
|
|
230
|
+
'chicken-child': {
|
|
231
|
+
attr: true,
|
|
232
|
+
},
|
|
233
|
+
} )
|
|
234
|
+
),
|
|
235
|
+
order: new Map(
|
|
236
|
+
Object.entries( {
|
|
237
|
+
'': [ 'chicken' ],
|
|
238
|
+
chicken: [ 'chicken-child' ],
|
|
239
|
+
'chicken-child': [],
|
|
240
|
+
} )
|
|
241
|
+
),
|
|
242
|
+
parents: new Map(
|
|
243
|
+
Object.entries( {
|
|
244
|
+
chicken: '',
|
|
245
|
+
'chicken-child': 'chicken',
|
|
246
|
+
} )
|
|
247
|
+
),
|
|
248
|
+
tree: new Map(
|
|
249
|
+
Object.entries( {
|
|
250
|
+
'': {},
|
|
251
|
+
chicken: {},
|
|
252
|
+
'chicken-child': {},
|
|
253
|
+
} )
|
|
254
|
+
),
|
|
245
255
|
controlledInnerBlocks: {},
|
|
246
256
|
} );
|
|
247
257
|
|
|
@@ -264,66 +274,84 @@ describe( 'state', () => {
|
|
|
264
274
|
expect( restState ).toEqual( {
|
|
265
275
|
isPersistentChange: true,
|
|
266
276
|
isIgnoredChange: false,
|
|
267
|
-
byClientId:
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
277
|
+
byClientId: new Map(
|
|
278
|
+
Object.entries( {
|
|
279
|
+
chicken: {
|
|
280
|
+
clientId: 'chicken',
|
|
281
|
+
name: 'core/test-parent-block',
|
|
282
|
+
isValid: true,
|
|
283
|
+
},
|
|
284
|
+
[ newChildBlockId ]: {
|
|
285
|
+
clientId: newChildBlockId,
|
|
286
|
+
name: 'core/test-child-block',
|
|
287
|
+
isValid: true,
|
|
288
|
+
},
|
|
289
|
+
} )
|
|
290
|
+
),
|
|
291
|
+
attributes: new Map(
|
|
292
|
+
Object.entries( {
|
|
293
|
+
chicken: {},
|
|
294
|
+
[ newChildBlockId ]: {
|
|
295
|
+
attr: false,
|
|
296
|
+
attr2: 'perfect',
|
|
297
|
+
},
|
|
298
|
+
} )
|
|
299
|
+
),
|
|
300
|
+
order: new Map(
|
|
301
|
+
Object.entries( {
|
|
302
|
+
'': [ 'chicken' ],
|
|
303
|
+
chicken: [ newChildBlockId ],
|
|
304
|
+
[ newChildBlockId ]: [],
|
|
305
|
+
} )
|
|
306
|
+
),
|
|
307
|
+
parents: new Map(
|
|
308
|
+
Object.entries( {
|
|
309
|
+
[ newChildBlockId ]: 'chicken',
|
|
310
|
+
chicken: '',
|
|
311
|
+
} )
|
|
312
|
+
),
|
|
295
313
|
controlledInnerBlocks: {},
|
|
296
314
|
} );
|
|
297
|
-
expect( state.tree.chicken ).not.toBe(
|
|
298
|
-
existingState.tree.chicken
|
|
315
|
+
expect( state.tree.get( 'chicken' ) ).not.toBe(
|
|
316
|
+
existingState.tree.get( 'chicken' )
|
|
299
317
|
);
|
|
300
318
|
} );
|
|
301
319
|
|
|
302
320
|
it( 'can insert a child block', () => {
|
|
303
321
|
const existingState = deepFreeze( {
|
|
304
|
-
byClientId:
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
322
|
+
byClientId: new Map(
|
|
323
|
+
Object.entries( {
|
|
324
|
+
chicken: {
|
|
325
|
+
clientId: 'chicken',
|
|
326
|
+
name: 'core/test-parent-block',
|
|
327
|
+
isValid: true,
|
|
328
|
+
},
|
|
329
|
+
} )
|
|
330
|
+
),
|
|
331
|
+
attributes: new Map(
|
|
332
|
+
Object.entries( {
|
|
333
|
+
chicken: {},
|
|
334
|
+
} )
|
|
335
|
+
),
|
|
336
|
+
order: new Map(
|
|
337
|
+
Object.entries( {
|
|
338
|
+
'': [ 'chicken' ],
|
|
339
|
+
chicken: [],
|
|
340
|
+
} )
|
|
341
|
+
),
|
|
342
|
+
parents: new Map(
|
|
343
|
+
Object.entries( {
|
|
344
|
+
chicken: '',
|
|
345
|
+
} )
|
|
346
|
+
),
|
|
347
|
+
tree: new Map(
|
|
348
|
+
Object.entries( {
|
|
349
|
+
'': {
|
|
350
|
+
innerBlocks: [],
|
|
351
|
+
},
|
|
352
|
+
chicken: {},
|
|
353
|
+
} )
|
|
354
|
+
),
|
|
327
355
|
controlledInnerBlocks: {},
|
|
328
356
|
} );
|
|
329
357
|
|
|
@@ -346,46 +374,54 @@ describe( 'state', () => {
|
|
|
346
374
|
expect( restState ).toEqual( {
|
|
347
375
|
isPersistentChange: true,
|
|
348
376
|
isIgnoredChange: false,
|
|
349
|
-
byClientId:
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
+
byClientId: new Map(
|
|
378
|
+
Object.entries( {
|
|
379
|
+
chicken: {
|
|
380
|
+
clientId: 'chicken',
|
|
381
|
+
name: 'core/test-parent-block',
|
|
382
|
+
isValid: true,
|
|
383
|
+
},
|
|
384
|
+
[ newChildBlockId ]: {
|
|
385
|
+
clientId: newChildBlockId,
|
|
386
|
+
name: 'core/test-child-block',
|
|
387
|
+
isValid: true,
|
|
388
|
+
},
|
|
389
|
+
} )
|
|
390
|
+
),
|
|
391
|
+
attributes: new Map(
|
|
392
|
+
Object.entries( {
|
|
393
|
+
chicken: {},
|
|
394
|
+
[ newChildBlockId ]: {
|
|
395
|
+
attr: false,
|
|
396
|
+
attr2: 'perfect',
|
|
397
|
+
},
|
|
398
|
+
} )
|
|
399
|
+
),
|
|
400
|
+
order: new Map(
|
|
401
|
+
Object.entries( {
|
|
402
|
+
'': [ 'chicken' ],
|
|
403
|
+
chicken: [ newChildBlockId ],
|
|
404
|
+
[ newChildBlockId ]: [],
|
|
405
|
+
} )
|
|
406
|
+
),
|
|
407
|
+
parents: new Map(
|
|
408
|
+
Object.entries( {
|
|
409
|
+
[ newChildBlockId ]: 'chicken',
|
|
410
|
+
chicken: '',
|
|
411
|
+
} )
|
|
412
|
+
),
|
|
377
413
|
controlledInnerBlocks: {},
|
|
378
414
|
} );
|
|
379
|
-
expect( state.tree.chicken ).not.toBe(
|
|
380
|
-
existingState.tree.chicken
|
|
415
|
+
expect( state.tree.get( 'chicken' ) ).not.toBe(
|
|
416
|
+
existingState.tree.get( 'chicken' )
|
|
381
417
|
);
|
|
382
|
-
expect( state.tree
|
|
383
|
-
state.tree.chicken
|
|
418
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
419
|
+
state.tree.get( 'chicken' )
|
|
384
420
|
);
|
|
385
|
-
expect( state.tree.chicken.innerBlocks[ 0 ] ).toBe(
|
|
386
|
-
state.tree
|
|
421
|
+
expect( state.tree.get( 'chicken' ).innerBlocks[ 0 ] ).toBe(
|
|
422
|
+
state.tree.get( newChildBlockId )
|
|
387
423
|
);
|
|
388
|
-
expect( state.tree
|
|
424
|
+
expect( state.tree.get( newChildBlockId ) ).toEqual( {
|
|
389
425
|
clientId: newChildBlockId,
|
|
390
426
|
innerBlocks: [],
|
|
391
427
|
isValid: true,
|
|
@@ -399,44 +435,52 @@ describe( 'state', () => {
|
|
|
399
435
|
|
|
400
436
|
it( 'can replace multiple child blocks', () => {
|
|
401
437
|
const existingState = deepFreeze( {
|
|
402
|
-
byClientId:
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
438
|
+
byClientId: new Map(
|
|
439
|
+
Object.entries( {
|
|
440
|
+
chicken: {
|
|
441
|
+
clientId: 'chicken',
|
|
442
|
+
name: 'core/test-parent-block',
|
|
443
|
+
isValid: true,
|
|
444
|
+
},
|
|
445
|
+
'chicken-child': {
|
|
446
|
+
clientId: 'chicken-child',
|
|
447
|
+
name: 'core/test-child-block',
|
|
448
|
+
isValid: true,
|
|
449
|
+
},
|
|
450
|
+
'chicken-child-2': {
|
|
451
|
+
clientId: 'chicken-child',
|
|
452
|
+
name: 'core/test-child-block',
|
|
453
|
+
isValid: true,
|
|
454
|
+
},
|
|
455
|
+
} )
|
|
456
|
+
),
|
|
457
|
+
attributes: new Map(
|
|
458
|
+
Object.entries( {
|
|
459
|
+
chicken: {},
|
|
460
|
+
'chicken-child': {
|
|
461
|
+
attr: true,
|
|
462
|
+
},
|
|
463
|
+
'chicken-child-2': {
|
|
464
|
+
attr2: 'ok',
|
|
465
|
+
},
|
|
466
|
+
} )
|
|
467
|
+
),
|
|
468
|
+
order: new Map(
|
|
469
|
+
Object.entries( {
|
|
470
|
+
'': [ 'chicken' ],
|
|
471
|
+
chicken: [ 'chicken-child', 'chicken-child-2' ],
|
|
472
|
+
'chicken-child': [],
|
|
473
|
+
'chicken-child-2': [],
|
|
474
|
+
} )
|
|
475
|
+
),
|
|
476
|
+
parents: new Map(
|
|
477
|
+
Object.entries( {
|
|
478
|
+
chicken: '',
|
|
479
|
+
'chicken-child': 'chicken',
|
|
480
|
+
'chicken-child-2': 'chicken',
|
|
481
|
+
} )
|
|
482
|
+
),
|
|
483
|
+
tree: new Map(),
|
|
440
484
|
controlledInnerBlocks: {},
|
|
441
485
|
} );
|
|
442
486
|
|
|
@@ -470,75 +514,83 @@ describe( 'state', () => {
|
|
|
470
514
|
expect( restState ).toEqual( {
|
|
471
515
|
isPersistentChange: true,
|
|
472
516
|
isIgnoredChange: false,
|
|
473
|
-
byClientId:
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
517
|
+
byClientId: new Map(
|
|
518
|
+
Object.entries( {
|
|
519
|
+
chicken: {
|
|
520
|
+
clientId: 'chicken',
|
|
521
|
+
name: 'core/test-parent-block',
|
|
522
|
+
isValid: true,
|
|
523
|
+
},
|
|
524
|
+
[ newChildBlockId1 ]: {
|
|
525
|
+
clientId: newChildBlockId1,
|
|
526
|
+
name: 'core/test-child-block',
|
|
527
|
+
isValid: true,
|
|
528
|
+
},
|
|
529
|
+
[ newChildBlockId2 ]: {
|
|
530
|
+
clientId: newChildBlockId2,
|
|
531
|
+
name: 'core/test-child-block',
|
|
532
|
+
isValid: true,
|
|
533
|
+
},
|
|
534
|
+
[ newChildBlockId3 ]: {
|
|
535
|
+
clientId: newChildBlockId3,
|
|
536
|
+
name: 'core/test-child-block',
|
|
537
|
+
isValid: true,
|
|
538
|
+
},
|
|
539
|
+
} )
|
|
540
|
+
),
|
|
541
|
+
attributes: new Map(
|
|
542
|
+
Object.entries( {
|
|
543
|
+
chicken: {},
|
|
544
|
+
[ newChildBlockId1 ]: {
|
|
545
|
+
attr: false,
|
|
546
|
+
attr2: 'perfect',
|
|
547
|
+
},
|
|
548
|
+
[ newChildBlockId2 ]: {
|
|
549
|
+
attr: true,
|
|
550
|
+
attr2: 'not-perfect',
|
|
551
|
+
},
|
|
552
|
+
[ newChildBlockId3 ]: {
|
|
553
|
+
attr2: 'hello',
|
|
554
|
+
},
|
|
555
|
+
} )
|
|
556
|
+
),
|
|
557
|
+
order: new Map(
|
|
558
|
+
Object.entries( {
|
|
559
|
+
'': [ 'chicken' ],
|
|
560
|
+
chicken: [
|
|
561
|
+
newChildBlockId1,
|
|
562
|
+
newChildBlockId2,
|
|
563
|
+
newChildBlockId3,
|
|
564
|
+
],
|
|
565
|
+
[ newChildBlockId1 ]: [],
|
|
566
|
+
[ newChildBlockId2 ]: [],
|
|
567
|
+
[ newChildBlockId3 ]: [],
|
|
568
|
+
} )
|
|
569
|
+
),
|
|
570
|
+
parents: new Map(
|
|
571
|
+
Object.entries( {
|
|
572
|
+
chicken: '',
|
|
573
|
+
[ newChildBlockId1 ]: 'chicken',
|
|
574
|
+
[ newChildBlockId2 ]: 'chicken',
|
|
575
|
+
[ newChildBlockId3 ]: 'chicken',
|
|
576
|
+
} )
|
|
577
|
+
),
|
|
526
578
|
controlledInnerBlocks: {},
|
|
527
579
|
} );
|
|
528
580
|
|
|
529
|
-
expect( state.tree
|
|
530
|
-
state.tree.chicken
|
|
581
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
582
|
+
state.tree.get( 'chicken' )
|
|
531
583
|
);
|
|
532
|
-
expect( state.tree.chicken.innerBlocks[ 0 ] ).toBe(
|
|
533
|
-
state.tree
|
|
584
|
+
expect( state.tree.get( 'chicken' ).innerBlocks[ 0 ] ).toBe(
|
|
585
|
+
state.tree.get( newChildBlockId1 )
|
|
534
586
|
);
|
|
535
|
-
expect( state.tree.chicken.innerBlocks[ 1 ] ).toBe(
|
|
536
|
-
state.tree
|
|
587
|
+
expect( state.tree.get( 'chicken' ).innerBlocks[ 1 ] ).toBe(
|
|
588
|
+
state.tree.get( newChildBlockId2 )
|
|
537
589
|
);
|
|
538
|
-
expect( state.tree.chicken.innerBlocks[ 2 ] ).toBe(
|
|
539
|
-
state.tree
|
|
590
|
+
expect( state.tree.get( 'chicken' ).innerBlocks[ 2 ] ).toBe(
|
|
591
|
+
state.tree.get( newChildBlockId3 )
|
|
540
592
|
);
|
|
541
|
-
expect( state.tree
|
|
593
|
+
expect( state.tree.get( newChildBlockId1 ) ).toEqual( {
|
|
542
594
|
innerBlocks: [],
|
|
543
595
|
clientId: newChildBlockId1,
|
|
544
596
|
name: 'core/test-child-block',
|
|
@@ -552,42 +604,52 @@ describe( 'state', () => {
|
|
|
552
604
|
|
|
553
605
|
it( 'can replace a child block that has other children', () => {
|
|
554
606
|
const existingState = deepFreeze( {
|
|
555
|
-
byClientId:
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
607
|
+
byClientId: new Map(
|
|
608
|
+
Object.entries( {
|
|
609
|
+
chicken: {
|
|
610
|
+
clientId: 'chicken',
|
|
611
|
+
name: 'core/test-parent-block',
|
|
612
|
+
isValid: true,
|
|
613
|
+
},
|
|
614
|
+
'chicken-child': {
|
|
615
|
+
clientId: 'chicken-child',
|
|
616
|
+
name: 'core/test-child-block',
|
|
617
|
+
isValid: true,
|
|
618
|
+
},
|
|
619
|
+
'chicken-grand-child': {
|
|
620
|
+
clientId: 'chicken-child',
|
|
621
|
+
name: 'core/test-block',
|
|
622
|
+
isValid: true,
|
|
623
|
+
},
|
|
624
|
+
} )
|
|
625
|
+
),
|
|
626
|
+
attributes: new Map(
|
|
627
|
+
Object.entries( {
|
|
628
|
+
chicken: {},
|
|
629
|
+
'chicken-child': {},
|
|
630
|
+
'chicken-grand-child': {},
|
|
631
|
+
} )
|
|
632
|
+
),
|
|
633
|
+
order: new Map(
|
|
634
|
+
Object.entries( {
|
|
635
|
+
'': [ 'chicken' ],
|
|
636
|
+
chicken: [ 'chicken-child' ],
|
|
637
|
+
'chicken-child': [ 'chicken-grand-child' ],
|
|
638
|
+
'chicken-grand-child': [],
|
|
639
|
+
} )
|
|
640
|
+
),
|
|
641
|
+
parents: new Map(
|
|
642
|
+
Object.entries( {
|
|
643
|
+
chicken: '',
|
|
644
|
+
'chicken-child': 'chicken',
|
|
645
|
+
'chicken-grand-child': 'chicken-child',
|
|
646
|
+
} )
|
|
647
|
+
),
|
|
648
|
+
tree: new Map(
|
|
649
|
+
Object.entries( {
|
|
650
|
+
chicken: {},
|
|
651
|
+
} )
|
|
652
|
+
),
|
|
591
653
|
controlledInnerBlocks: {},
|
|
592
654
|
} );
|
|
593
655
|
|
|
@@ -607,37 +669,45 @@ describe( 'state', () => {
|
|
|
607
669
|
expect( restState ).toEqual( {
|
|
608
670
|
isPersistentChange: true,
|
|
609
671
|
isIgnoredChange: false,
|
|
610
|
-
byClientId:
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
672
|
+
byClientId: new Map(
|
|
673
|
+
Object.entries( {
|
|
674
|
+
chicken: {
|
|
675
|
+
clientId: 'chicken',
|
|
676
|
+
name: 'core/test-parent-block',
|
|
677
|
+
isValid: true,
|
|
678
|
+
},
|
|
679
|
+
[ newChildBlockId ]: {
|
|
680
|
+
clientId: newChildBlockId,
|
|
681
|
+
name: 'core/test-block',
|
|
682
|
+
isValid: true,
|
|
683
|
+
},
|
|
684
|
+
} )
|
|
685
|
+
),
|
|
686
|
+
attributes: new Map(
|
|
687
|
+
Object.entries( {
|
|
688
|
+
chicken: {},
|
|
689
|
+
[ newChildBlockId ]: {},
|
|
690
|
+
} )
|
|
691
|
+
),
|
|
692
|
+
order: new Map(
|
|
693
|
+
Object.entries( {
|
|
694
|
+
'': [ 'chicken' ],
|
|
695
|
+
chicken: [ newChildBlockId ],
|
|
696
|
+
[ newChildBlockId ]: [],
|
|
697
|
+
} )
|
|
698
|
+
),
|
|
699
|
+
parents: new Map(
|
|
700
|
+
Object.entries( {
|
|
701
|
+
chicken: '',
|
|
702
|
+
[ newChildBlockId ]: 'chicken',
|
|
703
|
+
} )
|
|
704
|
+
),
|
|
635
705
|
controlledInnerBlocks: {},
|
|
636
706
|
} );
|
|
637
707
|
|
|
638
708
|
// The block object of the parent should be updated.
|
|
639
|
-
expect( state.tree.chicken ).not.toBe(
|
|
640
|
-
existingState.tree.chicken
|
|
709
|
+
expect( state.tree.get( 'chicken' ) ).not.toBe(
|
|
710
|
+
existingState.tree.get( 'chicken' )
|
|
641
711
|
);
|
|
642
712
|
} );
|
|
643
713
|
} );
|
|
@@ -646,13 +716,13 @@ describe( 'state', () => {
|
|
|
646
716
|
const state = blocks( undefined, {} );
|
|
647
717
|
|
|
648
718
|
expect( state ).toEqual( {
|
|
649
|
-
byClientId:
|
|
650
|
-
attributes:
|
|
651
|
-
order:
|
|
652
|
-
parents:
|
|
719
|
+
byClientId: new Map(),
|
|
720
|
+
attributes: new Map(),
|
|
721
|
+
order: new Map(),
|
|
722
|
+
parents: new Map(),
|
|
653
723
|
isPersistentChange: true,
|
|
654
724
|
isIgnoredChange: false,
|
|
655
|
-
tree:
|
|
725
|
+
tree: new Map(),
|
|
656
726
|
controlledInnerBlocks: {},
|
|
657
727
|
} );
|
|
658
728
|
} );
|
|
@@ -664,20 +734,20 @@ describe( 'state', () => {
|
|
|
664
734
|
blocks: [ { clientId: 'bananas', innerBlocks: [] } ],
|
|
665
735
|
} );
|
|
666
736
|
|
|
667
|
-
expect(
|
|
668
|
-
expect(
|
|
737
|
+
expect( state.byClientId.size ).toBe( 1 );
|
|
738
|
+
expect( state.byClientId.get( 'bananas' ).clientId ).toBe(
|
|
669
739
|
'bananas'
|
|
670
740
|
);
|
|
671
|
-
expect( state.order ).toEqual( {
|
|
741
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
672
742
|
'': [ 'bananas' ],
|
|
673
743
|
bananas: [],
|
|
674
744
|
} );
|
|
675
|
-
expect( state.tree.bananas ).toEqual( {
|
|
745
|
+
expect( state.tree.get( 'bananas' ) ).toEqual( {
|
|
676
746
|
clientId: 'bananas',
|
|
677
747
|
innerBlocks: [],
|
|
678
748
|
} );
|
|
679
|
-
expect( state.tree
|
|
680
|
-
state.tree.bananas
|
|
749
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
750
|
+
state.tree.get( 'bananas' )
|
|
681
751
|
);
|
|
682
752
|
} );
|
|
683
753
|
} );
|
|
@@ -696,8 +766,8 @@ describe( 'state', () => {
|
|
|
696
766
|
],
|
|
697
767
|
} );
|
|
698
768
|
|
|
699
|
-
expect(
|
|
700
|
-
expect( state.order ).toEqual( {
|
|
769
|
+
expect( state.byClientId.size ).toBe( 2 );
|
|
770
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
701
771
|
'': [ 'bananas' ],
|
|
702
772
|
apples: [],
|
|
703
773
|
bananas: [ 'apples' ],
|
|
@@ -727,21 +797,21 @@ describe( 'state', () => {
|
|
|
727
797
|
],
|
|
728
798
|
} );
|
|
729
799
|
|
|
730
|
-
expect(
|
|
731
|
-
expect(
|
|
732
|
-
|
|
733
|
-
);
|
|
734
|
-
expect( state.order ).toEqual( {
|
|
800
|
+
expect( state.byClientId.size ).toBe( 2 );
|
|
801
|
+
expect( state.byClientId.get( 'ribs' ).clientId ).toBe( 'ribs' );
|
|
802
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
735
803
|
'': [ 'chicken', 'ribs' ],
|
|
736
804
|
chicken: [],
|
|
737
805
|
ribs: [],
|
|
738
806
|
} );
|
|
739
807
|
|
|
740
|
-
expect( state.tree
|
|
741
|
-
state.tree.chicken
|
|
808
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
809
|
+
state.tree.get( 'chicken' )
|
|
742
810
|
);
|
|
743
|
-
expect( state.tree
|
|
744
|
-
|
|
811
|
+
expect( state.tree.get( '' ).innerBlocks[ 1 ] ).toBe(
|
|
812
|
+
state.tree.get( 'ribs' )
|
|
813
|
+
);
|
|
814
|
+
expect( state.tree.get( 'chicken' ) ).toEqual( {
|
|
745
815
|
clientId: 'chicken',
|
|
746
816
|
name: 'core/test-block',
|
|
747
817
|
attributes: {},
|
|
@@ -773,24 +843,22 @@ describe( 'state', () => {
|
|
|
773
843
|
],
|
|
774
844
|
} );
|
|
775
845
|
|
|
776
|
-
expect(
|
|
777
|
-
expect(
|
|
846
|
+
expect( state.byClientId.size ).toBe( 1 );
|
|
847
|
+
expect( state.byClientId.get( 'wings' ).name ).toBe(
|
|
778
848
|
'core/freeform'
|
|
779
849
|
);
|
|
780
|
-
expect(
|
|
781
|
-
|
|
782
|
-
);
|
|
783
|
-
expect( state.order ).toEqual( {
|
|
850
|
+
expect( state.byClientId.get( 'wings' ).clientId ).toBe( 'wings' );
|
|
851
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
784
852
|
'': [ 'wings' ],
|
|
785
853
|
wings: [],
|
|
786
854
|
} );
|
|
787
|
-
expect( state.parents ).toEqual( {
|
|
855
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {
|
|
788
856
|
wings: '',
|
|
789
857
|
} );
|
|
790
|
-
expect( state.tree
|
|
791
|
-
state.tree.wings
|
|
858
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
859
|
+
state.tree.get( 'wings' )
|
|
792
860
|
);
|
|
793
|
-
expect( state.tree.wings ).toEqual( {
|
|
861
|
+
expect( state.tree.get( 'wings' ) ).toEqual( {
|
|
794
862
|
clientId: 'wings',
|
|
795
863
|
name: 'core/freeform',
|
|
796
864
|
innerBlocks: [],
|
|
@@ -815,8 +883,8 @@ describe( 'state', () => {
|
|
|
815
883
|
blocks: [],
|
|
816
884
|
} );
|
|
817
885
|
|
|
818
|
-
expect(
|
|
819
|
-
expect( state.tree
|
|
886
|
+
expect( state.byClientId.size ).toBe( 0 );
|
|
887
|
+
expect( state.tree.get( '' ).innerBlocks ).toHaveLength( 0 );
|
|
820
888
|
} );
|
|
821
889
|
|
|
822
890
|
it( 'should replace the block and remove references to its inner blocks', () => {
|
|
@@ -850,18 +918,18 @@ describe( 'state', () => {
|
|
|
850
918
|
],
|
|
851
919
|
} );
|
|
852
920
|
|
|
853
|
-
expect(
|
|
854
|
-
expect( state.order ).toEqual( {
|
|
921
|
+
expect( state.byClientId.size ).toBe( 1 );
|
|
922
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
855
923
|
'': [ 'wings' ],
|
|
856
924
|
wings: [],
|
|
857
925
|
} );
|
|
858
|
-
expect( state.parents ).toEqual( {
|
|
926
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {
|
|
859
927
|
wings: '',
|
|
860
928
|
} );
|
|
861
|
-
expect( state.tree
|
|
862
|
-
state.tree.wings
|
|
929
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
930
|
+
state.tree.get( 'wings' )
|
|
863
931
|
);
|
|
864
|
-
expect( state.tree.wings ).toEqual( {
|
|
932
|
+
expect( state.tree.get( 'wings' ) ).toEqual( {
|
|
865
933
|
clientId: 'wings',
|
|
866
934
|
name: 'core/freeform',
|
|
867
935
|
innerBlocks: [],
|
|
@@ -885,21 +953,21 @@ describe( 'state', () => {
|
|
|
885
953
|
blocks: [ replacementBlock ],
|
|
886
954
|
} );
|
|
887
955
|
|
|
888
|
-
expect( state.order ).toEqual( {
|
|
956
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
889
957
|
'': [ wrapperBlock.clientId ],
|
|
890
958
|
[ wrapperBlock.clientId ]: [ replacementBlock.clientId ],
|
|
891
959
|
[ replacementBlock.clientId ]: [],
|
|
892
960
|
} );
|
|
893
961
|
|
|
894
|
-
expect( state.parents ).toEqual( {
|
|
962
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {
|
|
895
963
|
[ wrapperBlock.clientId ]: '',
|
|
896
964
|
[ replacementBlock.clientId ]: wrapperBlock.clientId,
|
|
897
965
|
} );
|
|
898
966
|
|
|
899
|
-
expect(
|
|
900
|
-
state.tree
|
|
901
|
-
);
|
|
902
|
-
expect( state.tree
|
|
967
|
+
expect(
|
|
968
|
+
state.tree.get( wrapperBlock.clientId ).innerBlocks[ 0 ]
|
|
969
|
+
).toBe( state.tree.get( replacementBlock.clientId ) );
|
|
970
|
+
expect( state.tree.get( replacementBlock.clientId ) ).toEqual( {
|
|
903
971
|
clientId: replacementBlock.clientId,
|
|
904
972
|
name: 'core/test-block',
|
|
905
973
|
innerBlocks: [],
|
|
@@ -932,22 +1000,22 @@ describe( 'state', () => {
|
|
|
932
1000
|
],
|
|
933
1001
|
} );
|
|
934
1002
|
|
|
935
|
-
expect(
|
|
936
|
-
expect(
|
|
1003
|
+
expect( replacedState.byClientId.size ).toBe( 1 );
|
|
1004
|
+
expect( originalState.byClientId.get( 'chicken' ).name ).toBe(
|
|
937
1005
|
'core/test-block'
|
|
938
1006
|
);
|
|
939
|
-
expect(
|
|
1007
|
+
expect( replacedState.byClientId.get( 'chicken' ).name ).toBe(
|
|
940
1008
|
'core/freeform'
|
|
941
1009
|
);
|
|
942
|
-
expect(
|
|
943
|
-
|
|
944
|
-
)
|
|
945
|
-
expect( replacedState.order ).toEqual( {
|
|
1010
|
+
expect( replacedState.byClientId.get( 'chicken' ).clientId ).toBe(
|
|
1011
|
+
'chicken'
|
|
1012
|
+
);
|
|
1013
|
+
expect( Object.fromEntries( replacedState.order ) ).toEqual( {
|
|
946
1014
|
'': [ 'chicken' ],
|
|
947
1015
|
chicken: [],
|
|
948
1016
|
} );
|
|
949
|
-
expect( originalState.tree.chicken ).not.toBe(
|
|
950
|
-
replacedState.tree.chicken
|
|
1017
|
+
expect( originalState.tree.get( 'chicken' ) ).not.toBe(
|
|
1018
|
+
replacedState.tree.get( 'chicken' )
|
|
951
1019
|
);
|
|
952
1020
|
|
|
953
1021
|
const nestedBlock = {
|
|
@@ -977,16 +1045,16 @@ describe( 'state', () => {
|
|
|
977
1045
|
blocks: [ replacementNestedBlock ],
|
|
978
1046
|
} );
|
|
979
1047
|
|
|
980
|
-
expect( replacedNestedState.order ).toEqual( {
|
|
1048
|
+
expect( Object.fromEntries( replacedNestedState.order ) ).toEqual( {
|
|
981
1049
|
'': [ wrapperBlock.clientId ],
|
|
982
1050
|
[ wrapperBlock.clientId ]: [ replacementNestedBlock.clientId ],
|
|
983
1051
|
[ replacementNestedBlock.clientId ]: [],
|
|
984
1052
|
} );
|
|
985
1053
|
|
|
986
|
-
expect( originalNestedState.byClientId.chicken.name ).toBe(
|
|
1054
|
+
expect( originalNestedState.byClientId.get( 'chicken' ).name ).toBe(
|
|
987
1055
|
'core/test-block'
|
|
988
1056
|
);
|
|
989
|
-
expect( replacedNestedState.byClientId.chicken.name ).toBe(
|
|
1057
|
+
expect( replacedNestedState.byClientId.get( 'chicken' ).name ).toBe(
|
|
990
1058
|
'core/freeform'
|
|
991
1059
|
);
|
|
992
1060
|
} );
|
|
@@ -1013,19 +1081,19 @@ describe( 'state', () => {
|
|
|
1013
1081
|
},
|
|
1014
1082
|
} );
|
|
1015
1083
|
|
|
1016
|
-
expect( state.byClientId.chicken ).toEqual( {
|
|
1084
|
+
expect( state.byClientId.get( 'chicken' ) ).toEqual( {
|
|
1017
1085
|
clientId: 'chicken',
|
|
1018
1086
|
name: 'core/test-block',
|
|
1019
1087
|
isValid: true,
|
|
1020
1088
|
} );
|
|
1021
1089
|
|
|
1022
|
-
expect( state.attributes.chicken ).toEqual( {
|
|
1090
|
+
expect( state.attributes.get( 'chicken' ) ).toEqual( {
|
|
1023
1091
|
content: 'ribs',
|
|
1024
1092
|
} );
|
|
1025
|
-
expect( state.tree
|
|
1026
|
-
state.tree.chicken
|
|
1093
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
1094
|
+
state.tree.get( 'chicken' )
|
|
1027
1095
|
);
|
|
1028
|
-
expect( state.tree.chicken ).toEqual( {
|
|
1096
|
+
expect( state.tree.get( 'chicken' ) ).toEqual( {
|
|
1029
1097
|
clientId: 'chicken',
|
|
1030
1098
|
name: 'core/test-block',
|
|
1031
1099
|
innerBlocks: [],
|
|
@@ -1058,20 +1126,20 @@ describe( 'state', () => {
|
|
|
1058
1126
|
updatedId: 3,
|
|
1059
1127
|
} );
|
|
1060
1128
|
|
|
1061
|
-
expect( state.byClientId.chicken ).toEqual( {
|
|
1129
|
+
expect( state.byClientId.get( 'chicken' ) ).toEqual( {
|
|
1062
1130
|
clientId: 'chicken',
|
|
1063
1131
|
name: 'core/block',
|
|
1064
1132
|
isValid: false,
|
|
1065
1133
|
} );
|
|
1066
1134
|
|
|
1067
|
-
expect( state.attributes.chicken ).toEqual( {
|
|
1135
|
+
expect( state.attributes.get( 'chicken' ) ).toEqual( {
|
|
1068
1136
|
ref: 3,
|
|
1069
1137
|
} );
|
|
1070
1138
|
|
|
1071
|
-
expect( state.tree
|
|
1072
|
-
state.tree.chicken
|
|
1139
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
1140
|
+
state.tree.get( 'chicken' )
|
|
1073
1141
|
);
|
|
1074
|
-
expect( state.tree.chicken ).toEqual( {
|
|
1142
|
+
expect( state.tree.get( 'chicken' ) ).toEqual( {
|
|
1075
1143
|
clientId: 'chicken',
|
|
1076
1144
|
name: 'core/block',
|
|
1077
1145
|
isValid: false,
|
|
@@ -1105,12 +1173,16 @@ describe( 'state', () => {
|
|
|
1105
1173
|
clientIds: [ 'ribs' ],
|
|
1106
1174
|
} );
|
|
1107
1175
|
|
|
1108
|
-
expect( state.order
|
|
1109
|
-
expect( state.tree
|
|
1110
|
-
|
|
1111
|
-
|
|
1176
|
+
expect( state.order.get( '' ) ).toEqual( [ 'ribs', 'chicken' ] );
|
|
1177
|
+
expect( state.tree.get( '' ).innerBlocks[ 0 ] ).toBe(
|
|
1178
|
+
state.tree.get( 'ribs' )
|
|
1179
|
+
);
|
|
1180
|
+
expect( state.tree.get( '' ).innerBlocks[ 1 ] ).toBe(
|
|
1181
|
+
state.tree.get( 'chicken' )
|
|
1182
|
+
);
|
|
1183
|
+
expect( state.tree.get( 'chicken' ) ).toBe(
|
|
1184
|
+
original.tree.get( 'chicken' )
|
|
1112
1185
|
);
|
|
1113
|
-
expect( state.tree.chicken ).toBe( original.tree.chicken );
|
|
1114
1186
|
} );
|
|
1115
1187
|
|
|
1116
1188
|
it( 'should move the nested block up', () => {
|
|
@@ -1130,7 +1202,7 @@ describe( 'state', () => {
|
|
|
1130
1202
|
rootClientId: wrapperBlock.clientId,
|
|
1131
1203
|
} );
|
|
1132
1204
|
|
|
1133
|
-
expect( state.order ).toEqual( {
|
|
1205
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
1134
1206
|
'': [ wrapperBlock.clientId ],
|
|
1135
1207
|
[ wrapperBlock.clientId ]: [
|
|
1136
1208
|
movedBlock.clientId,
|
|
@@ -1140,14 +1212,14 @@ describe( 'state', () => {
|
|
|
1140
1212
|
[ siblingBlock.clientId ]: [],
|
|
1141
1213
|
} );
|
|
1142
1214
|
|
|
1143
|
-
expect(
|
|
1144
|
-
state.tree
|
|
1145
|
-
);
|
|
1146
|
-
expect(
|
|
1147
|
-
state.tree
|
|
1148
|
-
);
|
|
1149
|
-
expect( state.tree
|
|
1150
|
-
original.tree
|
|
1215
|
+
expect(
|
|
1216
|
+
state.tree.get( wrapperBlock.clientId ).innerBlocks[ 0 ]
|
|
1217
|
+
).toBe( state.tree.get( movedBlock.clientId ) );
|
|
1218
|
+
expect(
|
|
1219
|
+
state.tree.get( wrapperBlock.clientId ).innerBlocks[ 1 ]
|
|
1220
|
+
).toBe( state.tree.get( siblingBlock.clientId ) );
|
|
1221
|
+
expect( state.tree.get( movedBlock.clientId ) ).toBe(
|
|
1222
|
+
original.tree.get( movedBlock.clientId )
|
|
1151
1223
|
);
|
|
1152
1224
|
} );
|
|
1153
1225
|
|
|
@@ -1180,7 +1252,7 @@ describe( 'state', () => {
|
|
|
1180
1252
|
clientIds: [ 'ribs', 'veggies' ],
|
|
1181
1253
|
} );
|
|
1182
1254
|
|
|
1183
|
-
expect( state.order
|
|
1255
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1184
1256
|
'ribs',
|
|
1185
1257
|
'veggies',
|
|
1186
1258
|
'chicken',
|
|
@@ -1206,7 +1278,7 @@ describe( 'state', () => {
|
|
|
1206
1278
|
rootClientId: wrapperBlock.clientId,
|
|
1207
1279
|
} );
|
|
1208
1280
|
|
|
1209
|
-
expect( state.order ).toEqual( {
|
|
1281
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
1210
1282
|
'': [ wrapperBlock.clientId ],
|
|
1211
1283
|
[ wrapperBlock.clientId ]: [
|
|
1212
1284
|
movedBlockA.clientId,
|
|
@@ -1268,7 +1340,7 @@ describe( 'state', () => {
|
|
|
1268
1340
|
clientIds: [ 'chicken' ],
|
|
1269
1341
|
} );
|
|
1270
1342
|
|
|
1271
|
-
expect( state.order
|
|
1343
|
+
expect( state.order.get( '' ) ).toEqual( [ 'ribs', 'chicken' ] );
|
|
1272
1344
|
} );
|
|
1273
1345
|
|
|
1274
1346
|
it( 'should move the nested block down', () => {
|
|
@@ -1288,7 +1360,7 @@ describe( 'state', () => {
|
|
|
1288
1360
|
rootClientId: wrapperBlock.clientId,
|
|
1289
1361
|
} );
|
|
1290
1362
|
|
|
1291
|
-
expect( state.order ).toEqual( {
|
|
1363
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
1292
1364
|
'': [ wrapperBlock.clientId ],
|
|
1293
1365
|
[ wrapperBlock.clientId ]: [
|
|
1294
1366
|
siblingBlock.clientId,
|
|
@@ -1328,7 +1400,7 @@ describe( 'state', () => {
|
|
|
1328
1400
|
clientIds: [ 'chicken', 'ribs' ],
|
|
1329
1401
|
} );
|
|
1330
1402
|
|
|
1331
|
-
expect( state.order
|
|
1403
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1332
1404
|
'veggies',
|
|
1333
1405
|
'chicken',
|
|
1334
1406
|
'ribs',
|
|
@@ -1354,7 +1426,7 @@ describe( 'state', () => {
|
|
|
1354
1426
|
rootClientId: wrapperBlock.clientId,
|
|
1355
1427
|
} );
|
|
1356
1428
|
|
|
1357
|
-
expect( state.order ).toEqual( {
|
|
1429
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
1358
1430
|
'': [ wrapperBlock.clientId ],
|
|
1359
1431
|
[ wrapperBlock.clientId ]: [
|
|
1360
1432
|
siblingBlock.clientId,
|
|
@@ -1416,21 +1488,23 @@ describe( 'state', () => {
|
|
|
1416
1488
|
clientIds: [ 'chicken' ],
|
|
1417
1489
|
} );
|
|
1418
1490
|
|
|
1419
|
-
expect( state.order
|
|
1420
|
-
expect( state.order ).not.toHaveProperty(
|
|
1421
|
-
|
|
1491
|
+
expect( state.order.get( '' ) ).toEqual( [ 'ribs' ] );
|
|
1492
|
+
expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
|
|
1493
|
+
'chicken'
|
|
1494
|
+
);
|
|
1495
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {
|
|
1422
1496
|
ribs: '',
|
|
1423
1497
|
} );
|
|
1424
|
-
expect( state.byClientId ).toEqual( {
|
|
1498
|
+
expect( Object.fromEntries( state.byClientId ) ).toEqual( {
|
|
1425
1499
|
ribs: {
|
|
1426
1500
|
clientId: 'ribs',
|
|
1427
1501
|
name: 'core/test-block',
|
|
1428
1502
|
},
|
|
1429
1503
|
} );
|
|
1430
|
-
expect( state.attributes ).toEqual( {
|
|
1504
|
+
expect( Object.fromEntries( state.attributes ) ).toEqual( {
|
|
1431
1505
|
ribs: {},
|
|
1432
1506
|
} );
|
|
1433
|
-
expect( state.tree
|
|
1507
|
+
expect( state.tree.get( '' ).innerBlocks ).toHaveLength( 1 );
|
|
1434
1508
|
} );
|
|
1435
1509
|
|
|
1436
1510
|
it( 'should remove multiple blocks', () => {
|
|
@@ -1462,19 +1536,23 @@ describe( 'state', () => {
|
|
|
1462
1536
|
clientIds: [ 'chicken', 'veggies' ],
|
|
1463
1537
|
} );
|
|
1464
1538
|
|
|
1465
|
-
expect( state.order
|
|
1466
|
-
expect( state.order ).not.toHaveProperty(
|
|
1467
|
-
|
|
1468
|
-
|
|
1539
|
+
expect( state.order.get( '' ) ).toEqual( [ 'ribs' ] );
|
|
1540
|
+
expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
|
|
1541
|
+
'chicken'
|
|
1542
|
+
);
|
|
1543
|
+
expect( Object.fromEntries( state.order ) ).not.toHaveProperty(
|
|
1544
|
+
'veggies'
|
|
1545
|
+
);
|
|
1546
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {
|
|
1469
1547
|
ribs: '',
|
|
1470
1548
|
} );
|
|
1471
|
-
expect( state.byClientId ).toEqual( {
|
|
1549
|
+
expect( Object.fromEntries( state.byClientId ) ).toEqual( {
|
|
1472
1550
|
ribs: {
|
|
1473
1551
|
clientId: 'ribs',
|
|
1474
1552
|
name: 'core/test-block',
|
|
1475
1553
|
},
|
|
1476
1554
|
} );
|
|
1477
|
-
expect( state.attributes ).toEqual( {
|
|
1555
|
+
expect( Object.fromEntries( state.attributes ) ).toEqual( {
|
|
1478
1556
|
ribs: {},
|
|
1479
1557
|
} );
|
|
1480
1558
|
} );
|
|
@@ -1496,11 +1574,11 @@ describe( 'state', () => {
|
|
|
1496
1574
|
clientIds: [ block.clientId ],
|
|
1497
1575
|
} );
|
|
1498
1576
|
|
|
1499
|
-
expect( state.byClientId ).toEqual(
|
|
1500
|
-
expect( state.order ).toEqual( {
|
|
1577
|
+
expect( state.byClientId ).toEqual( new Map() );
|
|
1578
|
+
expect( Object.fromEntries( state.order ) ).toEqual( {
|
|
1501
1579
|
'': [],
|
|
1502
1580
|
} );
|
|
1503
|
-
expect( state.parents ).toEqual( {} );
|
|
1581
|
+
expect( Object.fromEntries( state.parents ) ).toEqual( {} );
|
|
1504
1582
|
} );
|
|
1505
1583
|
|
|
1506
1584
|
it( 'should insert at the specified index', () => {
|
|
@@ -1534,8 +1612,8 @@ describe( 'state', () => {
|
|
|
1534
1612
|
],
|
|
1535
1613
|
} );
|
|
1536
1614
|
|
|
1537
|
-
expect(
|
|
1538
|
-
expect( state.order
|
|
1615
|
+
expect( state.byClientId.size ).toBe( 3 );
|
|
1616
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1539
1617
|
'kumquat',
|
|
1540
1618
|
'persimmon',
|
|
1541
1619
|
'loquat',
|
|
@@ -1572,7 +1650,7 @@ describe( 'state', () => {
|
|
|
1572
1650
|
index: 0,
|
|
1573
1651
|
} );
|
|
1574
1652
|
|
|
1575
|
-
expect( state.order
|
|
1653
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1576
1654
|
'ribs',
|
|
1577
1655
|
'chicken',
|
|
1578
1656
|
'veggies',
|
|
@@ -1609,7 +1687,7 @@ describe( 'state', () => {
|
|
|
1609
1687
|
index: 2,
|
|
1610
1688
|
} );
|
|
1611
1689
|
|
|
1612
|
-
expect( state.order
|
|
1690
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1613
1691
|
'chicken',
|
|
1614
1692
|
'veggies',
|
|
1615
1693
|
'ribs',
|
|
@@ -1646,7 +1724,7 @@ describe( 'state', () => {
|
|
|
1646
1724
|
index: 1,
|
|
1647
1725
|
} );
|
|
1648
1726
|
|
|
1649
|
-
expect( state.order
|
|
1727
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1650
1728
|
'chicken',
|
|
1651
1729
|
'ribs',
|
|
1652
1730
|
'veggies',
|
|
@@ -1683,7 +1761,7 @@ describe( 'state', () => {
|
|
|
1683
1761
|
index: 0,
|
|
1684
1762
|
} );
|
|
1685
1763
|
|
|
1686
|
-
expect( state.order
|
|
1764
|
+
expect( state.order.get( '' ) ).toEqual( [
|
|
1687
1765
|
'ribs',
|
|
1688
1766
|
'veggies',
|
|
1689
1767
|
'chicken',
|
|
@@ -1722,8 +1800,11 @@ describe( 'state', () => {
|
|
|
1722
1800
|
index: 0,
|
|
1723
1801
|
} );
|
|
1724
1802
|
|
|
1725
|
-
expect( state.order
|
|
1726
|
-
expect( state.order.chicken ).toEqual( [
|
|
1803
|
+
expect( state.order.get( '' ) ).toEqual( [ 'chicken' ] );
|
|
1804
|
+
expect( state.order.get( 'chicken' ) ).toEqual( [
|
|
1805
|
+
'ribs',
|
|
1806
|
+
'veggies',
|
|
1807
|
+
] );
|
|
1727
1808
|
} );
|
|
1728
1809
|
|
|
1729
1810
|
describe( 'blocks', () => {
|
|
@@ -1795,7 +1876,42 @@ describe( 'state', () => {
|
|
|
1795
1876
|
},
|
|
1796
1877
|
} );
|
|
1797
1878
|
|
|
1798
|
-
expect( state.attributes.kumquat.updated ).toBe(
|
|
1879
|
+
expect( state.attributes.get( 'kumquat' ).updated ).toBe(
|
|
1880
|
+
true
|
|
1881
|
+
);
|
|
1882
|
+
} );
|
|
1883
|
+
|
|
1884
|
+
it( 'should not updated equal attributes', () => {
|
|
1885
|
+
const original = deepFreeze(
|
|
1886
|
+
blocks( undefined, {
|
|
1887
|
+
type: 'RESET_BLOCKS',
|
|
1888
|
+
blocks: [
|
|
1889
|
+
{
|
|
1890
|
+
clientId: 'kumquat',
|
|
1891
|
+
attributes: {},
|
|
1892
|
+
innerBlocks: [],
|
|
1893
|
+
},
|
|
1894
|
+
],
|
|
1895
|
+
} )
|
|
1896
|
+
);
|
|
1897
|
+
const state = blocks( original, {
|
|
1898
|
+
type: 'UPDATE_BLOCK_ATTRIBUTES',
|
|
1899
|
+
clientIds: [ 'kumquat' ],
|
|
1900
|
+
attributes: {
|
|
1901
|
+
updated: true,
|
|
1902
|
+
},
|
|
1903
|
+
} );
|
|
1904
|
+
const updatedState = blocks( state, {
|
|
1905
|
+
type: 'UPDATE_BLOCK_ATTRIBUTES',
|
|
1906
|
+
clientIds: [ 'kumquat' ],
|
|
1907
|
+
attributes: {
|
|
1908
|
+
updated: true,
|
|
1909
|
+
},
|
|
1910
|
+
} );
|
|
1911
|
+
|
|
1912
|
+
expect( state.attributes.get( 'kumquat' ) ).toBe(
|
|
1913
|
+
updatedState.attributes.get( 'kumquat' )
|
|
1914
|
+
);
|
|
1799
1915
|
} );
|
|
1800
1916
|
|
|
1801
1917
|
it( 'should return with attribute block updates when attributes are unique by block', () => {
|
|
@@ -1820,7 +1936,9 @@ describe( 'state', () => {
|
|
|
1820
1936
|
uniqueByBlock: true,
|
|
1821
1937
|
} );
|
|
1822
1938
|
|
|
1823
|
-
expect( state.attributes.kumquat.updated ).toBe(
|
|
1939
|
+
expect( state.attributes.get( 'kumquat' ).updated ).toBe(
|
|
1940
|
+
true
|
|
1941
|
+
);
|
|
1824
1942
|
} );
|
|
1825
1943
|
|
|
1826
1944
|
it( 'should accumulate attribute block updates', () => {
|
|
@@ -1846,7 +1964,7 @@ describe( 'state', () => {
|
|
|
1846
1964
|
},
|
|
1847
1965
|
} );
|
|
1848
1966
|
|
|
1849
|
-
expect( state.attributes.kumquat ).toEqual( {
|
|
1967
|
+
expect( state.attributes.get( 'kumquat' ) ).toEqual( {
|
|
1850
1968
|
updated: true,
|
|
1851
1969
|
moreUpdated: true,
|
|
1852
1970
|
} );
|
|
@@ -1914,7 +2032,7 @@ describe( 'state', () => {
|
|
|
1914
2032
|
clientIds: [ 'kumquat' ],
|
|
1915
2033
|
} );
|
|
1916
2034
|
|
|
1917
|
-
expect( state.attributes.kumquat ).toEqual( {} );
|
|
2035
|
+
expect( state.attributes.get( 'kumquat' ) ).toEqual( {} );
|
|
1918
2036
|
} );
|
|
1919
2037
|
} );
|
|
1920
2038
|
|
|
@@ -2111,105 +2229,115 @@ describe( 'state', () => {
|
|
|
2111
2229
|
expect( state.controlledInnerBlocks.chicken ).toBe( true );
|
|
2112
2230
|
// The previous content of the block should be removed
|
|
2113
2231
|
expect( state.byClientId.child ).toBeUndefined();
|
|
2114
|
-
expect( state.tree.child ).toBeUndefined();
|
|
2115
|
-
expect( state.tree.chicken.innerBlocks ).toEqual(
|
|
2232
|
+
expect( state.tree.get( 'child' ) ).toBeUndefined();
|
|
2233
|
+
expect( state.tree.get( 'chicken' ).innerBlocks ).toEqual(
|
|
2234
|
+
[]
|
|
2235
|
+
);
|
|
2116
2236
|
} );
|
|
2117
2237
|
it( 'should preserve the controlled blocks in state and re-attach them in other pieces of state(order, tree, etc..), when we replace inner blocks', () => {
|
|
2118
2238
|
const initialState = {
|
|
2119
|
-
byClientId:
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2239
|
+
byClientId: new Map(
|
|
2240
|
+
Object.entries( {
|
|
2241
|
+
'group-id': {
|
|
2242
|
+
clientId: 'group-id',
|
|
2243
|
+
name: 'core/group',
|
|
2244
|
+
isValid: true,
|
|
2245
|
+
},
|
|
2246
|
+
'reusable-id': {
|
|
2247
|
+
clientId: 'reusable-id',
|
|
2248
|
+
name: 'core/block',
|
|
2249
|
+
isValid: true,
|
|
2250
|
+
},
|
|
2251
|
+
'paragraph-id': {
|
|
2252
|
+
clientId: 'paragraph-id',
|
|
2253
|
+
name: 'core/paragraph',
|
|
2254
|
+
isValid: true,
|
|
2255
|
+
},
|
|
2256
|
+
} )
|
|
2257
|
+
),
|
|
2258
|
+
order: new Map(
|
|
2259
|
+
Object.entries( {
|
|
2260
|
+
'': [ 'group-id' ],
|
|
2261
|
+
'group-id': [ 'reusable-id' ],
|
|
2262
|
+
'reusable-id': [ 'paragraph-id' ],
|
|
2263
|
+
'paragraph-id': [],
|
|
2264
|
+
} )
|
|
2265
|
+
),
|
|
2142
2266
|
controlledInnerBlocks: {
|
|
2143
2267
|
'reusable-id': true,
|
|
2144
2268
|
},
|
|
2145
|
-
parents:
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2269
|
+
parents: new Map(
|
|
2270
|
+
Object.entries( {
|
|
2271
|
+
'group-id': '',
|
|
2272
|
+
'reusable-id': 'group-id',
|
|
2273
|
+
'paragraph-id': 'reusable-id',
|
|
2274
|
+
} )
|
|
2275
|
+
),
|
|
2276
|
+
tree: new Map(
|
|
2277
|
+
Object.entries( {
|
|
2278
|
+
'group-id': {
|
|
2279
|
+
clientId: 'group-id',
|
|
2280
|
+
name: 'core/group',
|
|
2281
|
+
isValid: true,
|
|
2282
|
+
innerBlocks: [
|
|
2283
|
+
{
|
|
2284
|
+
clientId: 'reusable-id',
|
|
2285
|
+
name: 'core/block',
|
|
2286
|
+
isValid: true,
|
|
2287
|
+
attributes: {
|
|
2288
|
+
ref: 687,
|
|
2289
|
+
},
|
|
2290
|
+
innerBlocks: [],
|
|
2162
2291
|
},
|
|
2163
|
-
|
|
2292
|
+
],
|
|
2293
|
+
},
|
|
2294
|
+
'reusable-id': {
|
|
2295
|
+
clientId: 'reusable-id',
|
|
2296
|
+
name: 'core/block',
|
|
2297
|
+
isValid: true,
|
|
2298
|
+
attributes: {
|
|
2299
|
+
ref: 687,
|
|
2164
2300
|
},
|
|
2165
|
-
|
|
2166
|
-
},
|
|
2167
|
-
'reusable-id': {
|
|
2168
|
-
clientId: 'reusable-id',
|
|
2169
|
-
name: 'core/block',
|
|
2170
|
-
isValid: true,
|
|
2171
|
-
attributes: {
|
|
2172
|
-
ref: 687,
|
|
2301
|
+
innerBlocks: [],
|
|
2173
2302
|
},
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2303
|
+
'': {
|
|
2304
|
+
innerBlocks: [
|
|
2305
|
+
{
|
|
2306
|
+
clientId: 'group-id',
|
|
2307
|
+
name: 'core/group',
|
|
2308
|
+
isValid: true,
|
|
2309
|
+
innerBlocks: [
|
|
2310
|
+
{
|
|
2311
|
+
clientId: 'reusable-id',
|
|
2312
|
+
name: 'core/block',
|
|
2313
|
+
isValid: true,
|
|
2314
|
+
attributes: {
|
|
2315
|
+
ref: 687,
|
|
2316
|
+
},
|
|
2317
|
+
innerBlocks: [],
|
|
2189
2318
|
},
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
},
|
|
2319
|
+
],
|
|
2320
|
+
},
|
|
2321
|
+
],
|
|
2322
|
+
},
|
|
2323
|
+
'paragraph-id': {
|
|
2324
|
+
clientId: 'paragraph-id',
|
|
2325
|
+
name: 'core/paragraph',
|
|
2326
|
+
isValid: true,
|
|
2327
|
+
innerBlocks: [],
|
|
2328
|
+
},
|
|
2329
|
+
'controlled||reusable-id': {
|
|
2330
|
+
innerBlocks: [
|
|
2331
|
+
{
|
|
2332
|
+
clientId: 'paragraph-id',
|
|
2333
|
+
name: 'core/paragraph',
|
|
2334
|
+
isValid: true,
|
|
2335
|
+
innerBlocks: [],
|
|
2336
|
+
},
|
|
2337
|
+
],
|
|
2338
|
+
},
|
|
2339
|
+
} )
|
|
2340
|
+
),
|
|
2213
2341
|
};
|
|
2214
2342
|
// We will dispatch an action that replaces the inner
|
|
2215
2343
|
// blocks with the same inner blocks, which contain
|
|
@@ -2231,11 +2359,15 @@ describe( 'state', () => {
|
|
|
2231
2359
|
updateSelection: false,
|
|
2232
2360
|
};
|
|
2233
2361
|
const state = blocks( initialState, action );
|
|
2234
|
-
expect( state.order ).toEqual(
|
|
2235
|
-
expect.objectContaining(
|
|
2362
|
+
expect( Object.fromEntries( state.order ) ).toEqual(
|
|
2363
|
+
expect.objectContaining(
|
|
2364
|
+
Object.fromEntries( initialState.order )
|
|
2365
|
+
)
|
|
2236
2366
|
);
|
|
2237
|
-
expect( state.tree ).toEqual(
|
|
2238
|
-
expect.objectContaining(
|
|
2367
|
+
expect( Object.fromEntries( state.tree ) ).toEqual(
|
|
2368
|
+
expect.objectContaining(
|
|
2369
|
+
Object.fromEntries( initialState.tree )
|
|
2370
|
+
)
|
|
2239
2371
|
);
|
|
2240
2372
|
} );
|
|
2241
2373
|
} );
|