@wordpress/block-editor 14.9.0 → 14.10.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/LICENSE.md +1 -1
- package/README.md +40 -0
- package/build/components/audio-player/index.native.js +1 -1
- package/build/components/audio-player/index.native.js.map +1 -1
- package/build/components/background-image-control/index.js +4 -0
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-alignment-matrix-control/index.js +32 -0
- package/build/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build/components/block-card/index.js +45 -8
- package/build/components/block-card/index.js.map +1 -1
- package/build/components/block-edit/edit.js +147 -10
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/index.js +1 -2
- package/build/components/block-list/index.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/zoom-out-separator.js +20 -3
- package/build/components/block-list/zoom-out-separator.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/utils.js +3 -3
- package/build/components/block-styles/utils.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/button-block-appender/index.js +1 -5
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +6 -0
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/colors-gradients/dropdown.js +51 -11
- package/build/components/colors-gradients/dropdown.js.map +1 -1
- package/build/components/contrast-checker/index.native.js +1 -1
- package/build/components/contrast-checker/index.native.js.map +1 -1
- package/build/components/date-format-picker/index.js +7 -16
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +9 -0
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/font-family/index.js +10 -1
- package/build/components/font-family/index.js.map +1 -1
- package/build/components/global-styles/color-panel.js +3 -0
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +1 -1
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/grid/grid-visualizer.js +9 -0
- package/build/components/grid/grid-visualizer.js.map +1 -1
- package/build/components/grid/utils.js +12 -1
- package/build/components/grid/utils.js.map +1 -1
- package/build/components/iframe/index.js +1 -1
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.js +11 -11
- package/build/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -1
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build/components/inserter/category-tabs/index.js +1 -2
- package/build/components/inserter/category-tabs/index.js.map +1 -1
- package/build/components/inserter/index.js +6 -15
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +2 -13
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +2 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/line-height-control/index.js +9 -0
- package/build/components/line-height-control/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +2 -2
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +26 -26
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/plain-text/index.js +34 -0
- package/build/components/plain-text/index.js.map +1 -1
- package/build/components/provider/index.js +61 -5
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-media-upload-settings.js +28 -0
- package/build/components/provider/use-media-upload-settings.js.map +1 -0
- package/build/components/resolution-tool/index.js +3 -1
- package/build/components/resolution-tool/index.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -1
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/event-listeners/delete.js +7 -1
- package/build/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build/components/rich-text/index.js +2 -2
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +2 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/background.js +2 -0
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/block-bindings.js +15 -14
- package/build/hooks/block-bindings.js.map +1 -1
- package/build/hooks/border.js +3 -3
- package/build/hooks/border.js.map +1 -1
- package/build/hooks/color.js +1 -1
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/dimensions.js +2 -2
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/font-family.js +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/gap.js +2 -2
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js +7 -0
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/style.js +7 -7
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/supports.js +7 -7
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +6 -6
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-zoom-out.js +12 -1
- package/build/hooks/use-zoom-out.js.map +1 -1
- package/build/hooks/utils.js +1 -1
- package/build/hooks/utils.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +11 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +93 -12
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +6 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/block-bindings.js +95 -0
- package/build/utils/block-bindings.js.map +1 -1
- package/build-module/components/audio-player/index.native.js +2 -2
- package/build-module/components/audio-player/index.native.js.map +1 -1
- package/build-module/components/background-image-control/index.js +5 -1
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-alignment-matrix-control/index.js +32 -0
- package/build-module/components/block-alignment-matrix-control/index.js.map +1 -1
- package/build-module/components/block-card/index.js +45 -8
- package/build-module/components/block-card/index.js.map +1 -1
- package/build-module/components/block-edit/edit.js +148 -11
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/index.js +2 -3
- package/build-module/components/block-list/index.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/zoom-out-separator.js +20 -3
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +5 -8
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/utils.js +3 -3
- package/build-module/components/block-styles/utils.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +19 -6
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +2 -6
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +7 -1
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/colors-gradients/dropdown.js +51 -11
- package/build-module/components/colors-gradients/dropdown.js.map +1 -1
- package/build-module/components/contrast-checker/index.native.js +2 -2
- package/build-module/components/contrast-checker/index.native.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +7 -16
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +8 -0
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/font-family/index.js +10 -1
- package/build-module/components/font-family/index.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +3 -0
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +1 -1
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/grid/grid-visualizer.js +9 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -1
- package/build-module/components/grid/utils.js +12 -1
- package/build-module/components/grid/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +1 -1
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js +12 -12
- package/build-module/components/inner-blocks/use-inner-block-template-sync.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js +1 -1
- package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/patterns-filter.js.map +1 -1
- package/build-module/components/inserter/category-tabs/index.js +1 -2
- package/build-module/components/inserter/category-tabs/index.js.map +1 -1
- package/build-module/components/inserter/index.js +6 -15
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +2 -13
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +2 -2
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/line-height-control/index.js +8 -0
- package/build-module/components/line-height-control/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +3 -3
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +28 -28
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/plain-text/index.js +34 -0
- package/build-module/components/plain-text/index.js.map +1 -1
- package/build-module/components/provider/index.js +62 -5
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-media-upload-settings.js +22 -0
- package/build-module/components/provider/use-media-upload-settings.js.map +1 -0
- package/build-module/components/resolution-tool/index.js +3 -1
- package/build-module/components/resolution-tool/index.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -1
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/delete.js +7 -1
- package/build-module/components/rich-text/event-listeners/delete.js.map +1 -1
- package/build-module/components/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +2 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/background.js +2 -0
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/block-bindings.js +13 -12
- package/build-module/hooks/block-bindings.js.map +1 -1
- package/build-module/hooks/border.js +3 -3
- package/build-module/hooks/border.js.map +1 -1
- package/build-module/hooks/color.js +1 -1
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/dimensions.js +2 -2
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/gap.js +2 -2
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js +1 -0
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/style.js +7 -7
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/supports.js +7 -7
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +6 -6
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-zoom-out.js +12 -2
- package/build-module/hooks/use-zoom-out.js.map +1 -1
- package/build-module/hooks/utils.js +1 -1
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +11 -1
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +93 -12
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +6 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/block-bindings.js +90 -0
- package/build-module/utils/block-bindings.js.map +1 -1
- package/build-style/style-rtl.css +27 -9
- package/build-style/style.css +27 -9
- package/package.json +33 -33
- package/src/components/audio-player/index.native.js +2 -2
- package/src/components/background-image-control/index.js +4 -0
- package/src/components/background-image-control/style.scss +4 -2
- package/src/components/block-alignment-matrix-control/README.md +29 -6
- package/src/components/block-alignment-matrix-control/index.js +31 -0
- package/src/components/block-alignment-matrix-control/stories/index.story.js +78 -0
- package/src/components/block-card/README.md +7 -0
- package/src/components/block-card/index.js +41 -12
- package/src/components/block-card/stories/index.story.js +79 -0
- package/src/components/block-card/style.scss +9 -1
- package/src/components/block-edit/edit.js +218 -11
- package/src/components/block-list/index.js +2 -7
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/zoom-out-separator.js +30 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +17 -20
- package/src/components/block-styles/utils.js +3 -3
- package/src/components/block-title/stories/index.story.js +76 -0
- package/src/components/block-tools/style.scss +1 -0
- package/src/components/block-tools/zoom-out-mode-inserters.js +21 -3
- package/src/components/border-radius-control/README.md +59 -0
- package/src/components/border-radius-control/stories/index.story.js +58 -0
- package/src/components/button-block-appender/index.js +2 -7
- package/src/components/child-layout-control/index.js +14 -0
- package/src/components/colors-gradients/dropdown.js +57 -8
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/contrast-checker/index.native.js +2 -2
- package/src/components/contrast-checker/stories/index.story.js +117 -0
- package/src/components/date-format-picker/README.md +6 -13
- package/src/components/date-format-picker/index.js +10 -17
- package/src/components/date-format-picker/stories/index.story.js +69 -0
- package/src/components/date-format-picker/style.scss +3 -1
- package/src/components/default-block-appender/content.scss +1 -0
- package/src/components/dimensions-tool/stories/aspect-ratio-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/index.story.js +2 -1
- package/src/components/dimensions-tool/stories/scale-tool.story.js +2 -1
- package/src/components/dimensions-tool/stories/width-height-tool.story.js +2 -1
- package/src/components/font-appearance-control/index.js +15 -0
- package/src/components/font-family/README.md +1 -0
- package/src/components/font-family/index.js +17 -1
- package/src/components/font-family/stories/index.story.js +1 -0
- package/src/components/global-styles/color-panel.js +3 -0
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/typography-utils.js +1 -1
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/grid/grid-visualizer.js +11 -0
- package/src/components/grid/utils.js +19 -1
- package/src/components/iframe/index.js +1 -1
- package/src/components/inner-blocks/use-inner-block-template-sync.js +17 -10
- package/src/components/inserter/block-patterns-explorer/index.js +2 -3
- package/src/components/inserter/block-patterns-tab/index.js +3 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/src/components/inserter/block-patterns-tab/patterns-filter.js +2 -2
- package/src/components/inserter/category-tabs/index.js +3 -2
- package/src/components/inserter/index.js +1 -13
- package/src/components/inserter/quick-inserter.js +2 -25
- package/src/components/keyboard-shortcuts/index.js +2 -2
- package/src/components/line-height-control/README.md +1 -0
- package/src/components/line-height-control/index.js +12 -0
- package/src/components/line-height-control/stories/index.story.js +1 -0
- package/src/components/line-height-control/test/index.js +7 -1
- package/src/components/list-view/style.scss +10 -5
- package/src/components/media-placeholder/index.js +3 -3
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +28 -36
- package/src/components/media-replace-flow/style.scss +6 -6
- package/src/components/plain-text/README.md +2 -2
- package/src/components/plain-text/index.js +34 -0
- package/src/components/plain-text/stories/index.story.js +75 -0
- package/src/components/provider/index.js +81 -4
- package/src/components/provider/use-media-upload-settings.js +25 -0
- package/src/components/resolution-tool/index.js +2 -0
- package/src/components/resolution-tool/stories/index.story.js +36 -8
- package/src/components/responsive-block-control/index.js +1 -1
- package/src/components/rich-text/event-listeners/delete.js +6 -1
- package/src/components/rich-text/index.js +1 -1
- package/src/components/text-alignment-control/README.md +49 -0
- package/src/components/text-alignment-control/stories/index.story.js +56 -18
- package/src/components/text-decoration-control/README.md +0 -1
- package/src/components/text-decoration-control/stories/index.story.js +51 -16
- package/src/components/text-transform-control/README.md +3 -4
- package/src/components/text-transform-control/stories/index.story.js +53 -16
- package/src/components/use-block-drop-zone/index.js +8 -1
- package/src/components/warning/stories/index.story.js +86 -0
- package/src/hooks/background.js +6 -0
- package/src/hooks/block-bindings.js +17 -18
- package/src/hooks/border.js +9 -3
- package/src/hooks/color.js +1 -1
- package/src/hooks/dimensions.js +2 -2
- package/src/hooks/font-family.js +1 -1
- package/src/hooks/gap.js +2 -2
- package/src/hooks/index.js +0 -1
- package/src/hooks/index.native.js +1 -0
- package/src/hooks/style.js +13 -7
- package/src/hooks/supports.js +7 -7
- package/src/hooks/test/style.js +2 -1
- package/src/hooks/typography.js +6 -6
- package/src/hooks/use-zoom-out.js +10 -2
- package/src/hooks/utils.js +1 -1
- package/src/store/private-actions.js +1 -0
- package/src/store/private-selectors.js +15 -5
- package/src/store/reducer.js +112 -19
- package/src/store/selectors.js +6 -8
- package/src/store/test/private-selectors.js +53 -9
- package/src/store/test/reducer.js +172 -166
- package/src/store/test/selectors.js +23 -0
- package/src/utils/block-bindings.js +95 -0
- package/tsconfig.json +2 -5
- package/build/hooks/use-bindings-attributes.js +0 -262
- package/build/hooks/use-bindings-attributes.js.map +0 -1
- package/build-module/hooks/use-bindings-attributes.js +0 -253
- package/build-module/hooks/use-bindings-attributes.js.map +0 -1
- package/src/hooks/use-bindings-attributes.js +0 -322
package/src/hooks/supports.js
CHANGED
|
@@ -6,20 +6,20 @@ import { Platform } from '@wordpress/element';
|
|
|
6
6
|
|
|
7
7
|
const ALIGN_SUPPORT_KEY = 'align';
|
|
8
8
|
const ALIGN_WIDE_SUPPORT_KEY = 'alignWide';
|
|
9
|
-
const BORDER_SUPPORT_KEY = '
|
|
9
|
+
const BORDER_SUPPORT_KEY = '__experimentalBorder';
|
|
10
10
|
const COLOR_SUPPORT_KEY = 'color';
|
|
11
11
|
const CUSTOM_CLASS_NAME_SUPPORT_KEY = 'customClassName';
|
|
12
|
-
const FONT_FAMILY_SUPPORT_KEY = 'typography.
|
|
12
|
+
const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';
|
|
13
13
|
const FONT_SIZE_SUPPORT_KEY = 'typography.fontSize';
|
|
14
14
|
const LINE_HEIGHT_SUPPORT_KEY = 'typography.lineHeight';
|
|
15
15
|
/**
|
|
16
16
|
* Key within block settings' support array indicating support for font style.
|
|
17
17
|
*/
|
|
18
|
-
const FONT_STYLE_SUPPORT_KEY = 'typography.
|
|
18
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
19
19
|
/**
|
|
20
20
|
* Key within block settings' support array indicating support for font weight.
|
|
21
21
|
*/
|
|
22
|
-
const FONT_WEIGHT_SUPPORT_KEY = 'typography.
|
|
22
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
23
23
|
/**
|
|
24
24
|
* Key within block settings' supports array indicating support for text
|
|
25
25
|
* align e.g. settings found in `block.json`.
|
|
@@ -34,7 +34,7 @@ const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
|
|
|
34
34
|
* Key within block settings' supports array indicating support for text
|
|
35
35
|
* decorations e.g. settings found in `block.json`.
|
|
36
36
|
*/
|
|
37
|
-
const TEXT_DECORATION_SUPPORT_KEY = 'typography.
|
|
37
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
38
38
|
/**
|
|
39
39
|
* Key within block settings' supports array indicating support for writing mode
|
|
40
40
|
* e.g. settings found in `block.json`.
|
|
@@ -44,13 +44,13 @@ const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
|
|
|
44
44
|
* Key within block settings' supports array indicating support for text
|
|
45
45
|
* transforms e.g. settings found in `block.json`.
|
|
46
46
|
*/
|
|
47
|
-
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.
|
|
47
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Key within block settings' supports array indicating support for letter-spacing
|
|
51
51
|
* e.g. settings found in `block.json`.
|
|
52
52
|
*/
|
|
53
|
-
const LETTER_SPACING_SUPPORT_KEY = 'typography.
|
|
53
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
54
54
|
const LAYOUT_SUPPORT_KEY = 'layout';
|
|
55
55
|
const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
56
56
|
LINE_HEIGHT_SUPPORT_KEY,
|
package/src/hooks/test/style.js
CHANGED
|
@@ -133,7 +133,8 @@ describe( 'addSaveProps', () => {
|
|
|
133
133
|
const applySkipSerialization = ( features ) => {
|
|
134
134
|
const updatedSettings = { ...blockSettings };
|
|
135
135
|
Object.keys( features ).forEach( ( key ) => {
|
|
136
|
-
updatedSettings.supports[ key ].
|
|
136
|
+
updatedSettings.supports[ key ].__experimentalSkipSerialization =
|
|
137
|
+
features[ key ];
|
|
137
138
|
} );
|
|
138
139
|
return updatedSettings;
|
|
139
140
|
};
|
package/src/hooks/typography.js
CHANGED
|
@@ -27,12 +27,12 @@ function omit( object, keys ) {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
const LETTER_SPACING_SUPPORT_KEY = 'typography.
|
|
31
|
-
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.
|
|
32
|
-
const TEXT_DECORATION_SUPPORT_KEY = 'typography.
|
|
30
|
+
const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing';
|
|
31
|
+
const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform';
|
|
32
|
+
const TEXT_DECORATION_SUPPORT_KEY = 'typography.__experimentalTextDecoration';
|
|
33
33
|
const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';
|
|
34
|
-
const FONT_STYLE_SUPPORT_KEY = 'typography.
|
|
35
|
-
const FONT_WEIGHT_SUPPORT_KEY = 'typography.
|
|
34
|
+
const FONT_STYLE_SUPPORT_KEY = 'typography.__experimentalFontStyle';
|
|
35
|
+
const FONT_WEIGHT_SUPPORT_KEY = 'typography.__experimentalFontWeight';
|
|
36
36
|
const WRITING_MODE_SUPPORT_KEY = 'typography.__experimentalWritingMode';
|
|
37
37
|
export const TYPOGRAPHY_SUPPORT_KEY = 'typography';
|
|
38
38
|
export const TYPOGRAPHY_SUPPORT_KEYS = [
|
|
@@ -133,7 +133,7 @@ export function TypographyPanel( { clientId, name, setAttributes, settings } ) {
|
|
|
133
133
|
|
|
134
134
|
const defaultControls = getBlockSupport( name, [
|
|
135
135
|
TYPOGRAPHY_SUPPORT_KEY,
|
|
136
|
-
'
|
|
136
|
+
'__experimentalDefaultControls',
|
|
137
137
|
] );
|
|
138
138
|
|
|
139
139
|
return (
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
5
|
+
import { useEffect, useRef, useContext } from '@wordpress/element';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { store as blockEditorStore } from '../store';
|
|
11
11
|
import { unlock } from '../lock-unlock';
|
|
12
|
+
import BlockContext from '../components/block-context';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* A hook used to set the editor mode to zoomed out mode, invoking the hook sets the mode.
|
|
@@ -19,6 +20,7 @@ import { unlock } from '../lock-unlock';
|
|
|
19
20
|
* @param {boolean} enabled If we should enter into zoomOut mode or not
|
|
20
21
|
*/
|
|
21
22
|
export function useZoomOut( enabled = true ) {
|
|
23
|
+
const { postId } = useContext( BlockContext );
|
|
22
24
|
const { setZoomLevel, resetZoomLevel } = unlock(
|
|
23
25
|
useDispatch( blockEditorStore )
|
|
24
26
|
);
|
|
@@ -37,6 +39,7 @@ export function useZoomOut( enabled = true ) {
|
|
|
37
39
|
|
|
38
40
|
const controlZoomLevelRef = useRef( false );
|
|
39
41
|
const isEnabledRef = useRef( enabled );
|
|
42
|
+
const postIdRef = useRef( postId );
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
* This hook tracks if the zoom state was changed manually by the user via clicking
|
|
@@ -55,6 +58,11 @@ export function useZoomOut( enabled = true ) {
|
|
|
55
58
|
useEffect( () => {
|
|
56
59
|
isEnabledRef.current = enabled;
|
|
57
60
|
|
|
61
|
+
// If the user created a new post/page, we should take control of the zoom level.
|
|
62
|
+
if ( postIdRef.current !== postId ) {
|
|
63
|
+
controlZoomLevelRef.current = true;
|
|
64
|
+
}
|
|
65
|
+
|
|
58
66
|
if ( enabled !== isZoomOut() ) {
|
|
59
67
|
controlZoomLevelRef.current = true;
|
|
60
68
|
|
|
@@ -71,5 +79,5 @@ export function useZoomOut( enabled = true ) {
|
|
|
71
79
|
resetZoomLevel();
|
|
72
80
|
}
|
|
73
81
|
};
|
|
74
|
-
}, [ enabled, isZoomOut, resetZoomLevel, setZoomLevel ] );
|
|
82
|
+
}, [ enabled, isZoomOut, postId, resetZoomLevel, setZoomLevel ] );
|
|
75
83
|
}
|
package/src/hooks/utils.js
CHANGED
|
@@ -124,7 +124,7 @@ export function shouldSkipSerialization(
|
|
|
124
124
|
feature
|
|
125
125
|
) {
|
|
126
126
|
const support = getBlockSupport( blockNameOrType, featureSet );
|
|
127
|
-
const skipSerialization = support?.
|
|
127
|
+
const skipSerialization = support?.__experimentalSkipSerialization;
|
|
128
128
|
|
|
129
129
|
if ( Array.isArray( skipSerialization ) ) {
|
|
130
130
|
return skipSerialization.includes( feature );
|
|
@@ -502,13 +502,23 @@ export const getParentSectionBlock = ( state, clientId ) => {
|
|
|
502
502
|
* @return {boolean} Whether the block is a content locking parent.
|
|
503
503
|
*/
|
|
504
504
|
export function isSectionBlock( state, clientId ) {
|
|
505
|
+
const blockName = getBlockName( state, clientId );
|
|
506
|
+
if (
|
|
507
|
+
blockName === 'core/block' ||
|
|
508
|
+
getTemplateLock( state, clientId ) === 'contentOnly'
|
|
509
|
+
) {
|
|
510
|
+
return true;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// Template parts become sections in navigation mode.
|
|
514
|
+
const _isNavigationMode = isNavigationMode( state );
|
|
515
|
+
if ( _isNavigationMode && blockName === 'core/template-part' ) {
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
|
|
505
519
|
const sectionRootClientId = getSectionRootClientId( state );
|
|
506
520
|
const sectionClientIds = getBlockOrder( state, sectionRootClientId );
|
|
507
|
-
return (
|
|
508
|
-
getBlockName( state, clientId ) === 'core/block' ||
|
|
509
|
-
getTemplateLock( state, clientId ) === 'contentOnly' ||
|
|
510
|
-
( isNavigationMode( state ) && sectionClientIds.includes( clientId ) )
|
|
511
|
-
);
|
|
521
|
+
return _isNavigationMode && sectionClientIds.includes( clientId );
|
|
512
522
|
}
|
|
513
523
|
|
|
514
524
|
/**
|
package/src/store/reducer.js
CHANGED
|
@@ -1964,8 +1964,14 @@ export function temporarilyEditingFocusModeRevert( state = '', action ) {
|
|
|
1964
1964
|
export function blockEditingModes( state = new Map(), action ) {
|
|
1965
1965
|
switch ( action.type ) {
|
|
1966
1966
|
case 'SET_BLOCK_EDITING_MODE':
|
|
1967
|
+
if ( state.get( action.clientId ) === action.mode ) {
|
|
1968
|
+
return state;
|
|
1969
|
+
}
|
|
1967
1970
|
return new Map( state ).set( action.clientId, action.mode );
|
|
1968
1971
|
case 'UNSET_BLOCK_EDITING_MODE': {
|
|
1972
|
+
if ( ! state.has( action.clientId ) ) {
|
|
1973
|
+
return state;
|
|
1974
|
+
}
|
|
1969
1975
|
const newState = new Map( state );
|
|
1970
1976
|
newState.delete( action.clientId );
|
|
1971
1977
|
return newState;
|
|
@@ -2186,19 +2192,19 @@ function getBlockTreeBlock( state, clientId ) {
|
|
|
2186
2192
|
* The callback receives the current block as its argument.
|
|
2187
2193
|
*/
|
|
2188
2194
|
function traverseBlockTree( state, clientId, callback ) {
|
|
2189
|
-
const
|
|
2190
|
-
if ( !
|
|
2195
|
+
const tree = getBlockTreeBlock( state, clientId );
|
|
2196
|
+
if ( ! tree ) {
|
|
2191
2197
|
return;
|
|
2192
2198
|
}
|
|
2193
2199
|
|
|
2194
|
-
callback(
|
|
2200
|
+
callback( tree );
|
|
2195
2201
|
|
|
2196
|
-
if ( !
|
|
2202
|
+
if ( ! tree?.innerBlocks?.length ) {
|
|
2197
2203
|
return;
|
|
2198
2204
|
}
|
|
2199
2205
|
|
|
2200
|
-
for ( const
|
|
2201
|
-
traverseBlockTree( state,
|
|
2206
|
+
for ( const innerBlock of tree?.innerBlocks ) {
|
|
2207
|
+
traverseBlockTree( state, innerBlock.clientId, callback );
|
|
2202
2208
|
}
|
|
2203
2209
|
}
|
|
2204
2210
|
|
|
@@ -2212,8 +2218,12 @@ function traverseBlockTree( state, clientId, callback ) {
|
|
|
2212
2218
|
* @return {string|undefined} The client ID of the parent block if found, undefined otherwise.
|
|
2213
2219
|
*/
|
|
2214
2220
|
function findParentInClientIdsList( state, clientId, clientIds ) {
|
|
2221
|
+
if ( ! clientIds.length ) {
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2215
2225
|
let parent = state.blocks.parents.get( clientId );
|
|
2216
|
-
while ( parent ) {
|
|
2226
|
+
while ( parent !== undefined ) {
|
|
2217
2227
|
if ( clientIds.includes( parent ) ) {
|
|
2218
2228
|
return parent;
|
|
2219
2229
|
}
|
|
@@ -2258,15 +2268,65 @@ function getDerivedBlockEditingModesForTree(
|
|
|
2258
2268
|
// so the default block editing mode is set to disabled.
|
|
2259
2269
|
const sectionRootClientId = state.settings?.[ sectionRootClientIdKey ];
|
|
2260
2270
|
const sectionClientIds = state.blocks.order.get( sectionRootClientId );
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2263
|
-
).filter(
|
|
2264
|
-
( clientId ) =>
|
|
2265
|
-
state.blocks.byClientId?.get( clientId )?.name === 'core/block'
|
|
2271
|
+
const hasDisabledBlocks = Array.from( state.blockEditingModes ).some(
|
|
2272
|
+
( [ , mode ] ) => mode === 'disabled'
|
|
2266
2273
|
);
|
|
2274
|
+
const templatePartClientIds = [];
|
|
2275
|
+
const syncedPatternClientIds = [];
|
|
2276
|
+
|
|
2277
|
+
Object.keys( state.blocks.controlledInnerBlocks ).forEach( ( clientId ) => {
|
|
2278
|
+
const block = state.blocks.byClientId?.get( clientId );
|
|
2279
|
+
|
|
2280
|
+
if ( block?.name === 'core/template-part' ) {
|
|
2281
|
+
templatePartClientIds.push( clientId );
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
if ( block?.name === 'core/block' ) {
|
|
2285
|
+
syncedPatternClientIds.push( clientId );
|
|
2286
|
+
}
|
|
2287
|
+
} );
|
|
2267
2288
|
|
|
2268
2289
|
traverseBlockTree( state, treeClientId, ( block ) => {
|
|
2269
2290
|
const { clientId, name: blockName } = block;
|
|
2291
|
+
|
|
2292
|
+
// If the block already has an explicit block editing mode set,
|
|
2293
|
+
// don't override it.
|
|
2294
|
+
if ( state.blockEditingModes.has( clientId ) ) {
|
|
2295
|
+
return;
|
|
2296
|
+
}
|
|
2297
|
+
|
|
2298
|
+
// Disabled explicit block editing modes are inherited by children.
|
|
2299
|
+
// It's an expensive calculation, so only do it if there are disabled blocks.
|
|
2300
|
+
if ( hasDisabledBlocks ) {
|
|
2301
|
+
// Look through parents to find one with an explicit block editing mode.
|
|
2302
|
+
let ancestorBlockEditingMode;
|
|
2303
|
+
let parent = state.blocks.parents.get( clientId );
|
|
2304
|
+
while ( parent !== undefined ) {
|
|
2305
|
+
// There's a chance we only just calculated this for the parent,
|
|
2306
|
+
// if so we can return that value for a faster lookup.
|
|
2307
|
+
if ( derivedBlockEditingModes.has( parent ) ) {
|
|
2308
|
+
ancestorBlockEditingMode =
|
|
2309
|
+
derivedBlockEditingModes.get( parent );
|
|
2310
|
+
} else if ( state.blockEditingModes.has( parent ) ) {
|
|
2311
|
+
// Checking the explicit block editing mode will be slower,
|
|
2312
|
+
// as the block editing mode is more likely to be set on a
|
|
2313
|
+
// distant ancestor.
|
|
2314
|
+
ancestorBlockEditingMode =
|
|
2315
|
+
state.blockEditingModes.get( parent );
|
|
2316
|
+
}
|
|
2317
|
+
if ( ancestorBlockEditingMode ) {
|
|
2318
|
+
break;
|
|
2319
|
+
}
|
|
2320
|
+
parent = state.blocks.parents.get( parent );
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
// If the ancestor block editing mode is disabled, it's inherited by the child.
|
|
2324
|
+
if ( ancestorBlockEditingMode === 'disabled' ) {
|
|
2325
|
+
derivedBlockEditingModes.set( clientId, 'disabled' );
|
|
2326
|
+
return;
|
|
2327
|
+
}
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2270
2330
|
if ( isZoomedOut || isNavMode ) {
|
|
2271
2331
|
// If the root block is the section root set its editing mode to contentOnly.
|
|
2272
2332
|
if ( clientId === sectionRootClientId ) {
|
|
@@ -2287,15 +2347,41 @@ function getDerivedBlockEditingModesForTree(
|
|
|
2287
2347
|
|
|
2288
2348
|
// If zoomed out, all blocks that aren't sections or the section root are
|
|
2289
2349
|
// disabled.
|
|
2290
|
-
|
|
2291
|
-
if (
|
|
2292
|
-
isZoomedOut ||
|
|
2293
|
-
! findParentInClientIdsList( state, clientId, sectionClientIds )
|
|
2294
|
-
) {
|
|
2350
|
+
if ( isZoomedOut ) {
|
|
2295
2351
|
derivedBlockEditingModes.set( clientId, 'disabled' );
|
|
2296
2352
|
return;
|
|
2297
2353
|
}
|
|
2298
2354
|
|
|
2355
|
+
const isInSection = !! findParentInClientIdsList(
|
|
2356
|
+
state,
|
|
2357
|
+
clientId,
|
|
2358
|
+
sectionClientIds
|
|
2359
|
+
);
|
|
2360
|
+
if ( ! isInSection ) {
|
|
2361
|
+
if ( clientId === '' ) {
|
|
2362
|
+
derivedBlockEditingModes.set( clientId, 'disabled' );
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
|
|
2366
|
+
// Allow selection of template parts outside of sections.
|
|
2367
|
+
if ( blockName === 'core/template-part' ) {
|
|
2368
|
+
derivedBlockEditingModes.set( clientId, 'contentOnly' );
|
|
2369
|
+
return;
|
|
2370
|
+
}
|
|
2371
|
+
|
|
2372
|
+
const isInTemplatePart = !! findParentInClientIdsList(
|
|
2373
|
+
state,
|
|
2374
|
+
clientId,
|
|
2375
|
+
templatePartClientIds
|
|
2376
|
+
);
|
|
2377
|
+
// Allow contentOnly blocks in template parts outside of sections
|
|
2378
|
+
// to be editable. Only disable blocks that don't fit this criteria.
|
|
2379
|
+
if ( ! isInTemplatePart && ! isContentBlock( blockName ) ) {
|
|
2380
|
+
derivedBlockEditingModes.set( clientId, 'disabled' );
|
|
2381
|
+
return;
|
|
2382
|
+
}
|
|
2383
|
+
}
|
|
2384
|
+
|
|
2299
2385
|
// Handle synced pattern content so the inner blocks of a synced pattern are
|
|
2300
2386
|
// properly disabled.
|
|
2301
2387
|
if ( syncedPatternClientIds.length ) {
|
|
@@ -2560,11 +2646,16 @@ export function withDerivedBlockEditingModes( reducer ) {
|
|
|
2560
2646
|
}
|
|
2561
2647
|
break;
|
|
2562
2648
|
}
|
|
2649
|
+
case 'SET_BLOCK_EDITING_MODE':
|
|
2650
|
+
case 'UNSET_BLOCK_EDITING_MODE':
|
|
2563
2651
|
case 'SET_HAS_CONTROLLED_INNER_BLOCKS': {
|
|
2564
|
-
const updatedBlock =
|
|
2652
|
+
const updatedBlock = getBlockTreeBlock(
|
|
2653
|
+
nextState,
|
|
2565
2654
|
action.clientId
|
|
2566
2655
|
);
|
|
2567
|
-
|
|
2656
|
+
|
|
2657
|
+
// The block might have been removed in which case it'll be
|
|
2658
|
+
// handled by the `REMOVE_BLOCKS` action.
|
|
2568
2659
|
if ( ! updatedBlock ) {
|
|
2569
2660
|
break;
|
|
2570
2661
|
}
|
|
@@ -2573,6 +2664,7 @@ export function withDerivedBlockEditingModes( reducer ) {
|
|
|
2573
2664
|
getDerivedBlockEditingModesUpdates( {
|
|
2574
2665
|
prevState: state,
|
|
2575
2666
|
nextState,
|
|
2667
|
+
removedClientIds: [ action.clientId ],
|
|
2576
2668
|
addedBlocks: [ updatedBlock ],
|
|
2577
2669
|
isNavMode: false,
|
|
2578
2670
|
} );
|
|
@@ -2580,6 +2672,7 @@ export function withDerivedBlockEditingModes( reducer ) {
|
|
|
2580
2672
|
getDerivedBlockEditingModesUpdates( {
|
|
2581
2673
|
prevState: state,
|
|
2582
2674
|
nextState,
|
|
2675
|
+
removedClientIds: [ action.clientId ],
|
|
2583
2676
|
addedBlocks: [ updatedBlock ],
|
|
2584
2677
|
isNavMode: true,
|
|
2585
2678
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -128,7 +128,7 @@ export function isBlockValid( state, clientId ) {
|
|
|
128
128
|
* @param {Object} state Editor state.
|
|
129
129
|
* @param {string} clientId Block client ID.
|
|
130
130
|
*
|
|
131
|
-
* @return {Object
|
|
131
|
+
* @return {?Object} Block attributes.
|
|
132
132
|
*/
|
|
133
133
|
export function getBlockAttributes( state, clientId ) {
|
|
134
134
|
const block = state.blocks.byClientId.get( clientId );
|
|
@@ -1992,7 +1992,7 @@ const getItemFromVariation = ( state, item ) => ( variation ) => {
|
|
|
1992
1992
|
* Returns the calculated frecency.
|
|
1993
1993
|
*
|
|
1994
1994
|
* 'frecency' is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
|
1995
|
-
* that combines block usage
|
|
1995
|
+
* that combines block usage frequency and recency.
|
|
1996
1996
|
*
|
|
1997
1997
|
* @param {number} time When the last insert occurred as a UNIX epoch
|
|
1998
1998
|
* @param {number} count The number of inserts that have occurred.
|
|
@@ -2080,7 +2080,7 @@ const buildBlockTypeItem =
|
|
|
2080
2080
|
* inserter and handle its selection.
|
|
2081
2081
|
*
|
|
2082
2082
|
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
|
2083
|
-
* that combines block usage
|
|
2083
|
+
* that combines block usage frequency and recency.
|
|
2084
2084
|
*
|
|
2085
2085
|
* Items are returned ordered descendingly by their 'utility' and 'frecency'.
|
|
2086
2086
|
*
|
|
@@ -2236,7 +2236,7 @@ export const getInserterItems = createRegistrySelector( ( select ) =>
|
|
|
2236
2236
|
* transform list and handle its selection.
|
|
2237
2237
|
*
|
|
2238
2238
|
* The 'frecency' property is a heuristic (https://en.wikipedia.org/wiki/Frecency)
|
|
2239
|
-
* that combines block usage
|
|
2239
|
+
* that combines block usage frequency and recency.
|
|
2240
2240
|
*
|
|
2241
2241
|
* Items are returned ordered descendingly by their 'frecency'.
|
|
2242
2242
|
*
|
|
@@ -2400,7 +2400,7 @@ export const __experimentalGetAllowedBlocks = createSelector(
|
|
|
2400
2400
|
* @typedef {Object} WPDirectInsertBlock
|
|
2401
2401
|
* @property {string} name The type of block.
|
|
2402
2402
|
* @property {?Object} attributes Attributes to pass to the newly created block.
|
|
2403
|
-
* @property {?Array<string>} attributesToCopy Attributes to be copied from
|
|
2403
|
+
* @property {?Array<string>} attributesToCopy Attributes to be copied from adjacent blocks when inserted.
|
|
2404
2404
|
*/
|
|
2405
2405
|
export function getDirectInsertBlock( state, rootClientId = null ) {
|
|
2406
2406
|
if ( ! rootClientId ) {
|
|
@@ -3087,9 +3087,7 @@ export const getBlockEditingMode = createRegistrySelector(
|
|
|
3087
3087
|
const isContent = hasContentRoleAttribute( name );
|
|
3088
3088
|
return isContent ? 'contentOnly' : 'disabled';
|
|
3089
3089
|
}
|
|
3090
|
-
|
|
3091
|
-
const parentMode = getBlockEditingMode( state, rootClientId );
|
|
3092
|
-
return parentMode === 'contentOnly' ? 'default' : parentMode;
|
|
3090
|
+
return 'default';
|
|
3093
3091
|
}
|
|
3094
3092
|
);
|
|
3095
3093
|
|
|
@@ -122,6 +122,7 @@ describe( 'private selectors', () => {
|
|
|
122
122
|
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f': {},
|
|
123
123
|
},
|
|
124
124
|
blockEditingModes: new Map( [] ),
|
|
125
|
+
derivedBlockEditingModes: new Map( [] ),
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
const hasContentRoleAttribute = jest.fn( () => false );
|
|
@@ -142,6 +143,7 @@ describe( 'private selectors', () => {
|
|
|
142
143
|
const state = {
|
|
143
144
|
...baseState,
|
|
144
145
|
blockEditingModes: new Map( [] ),
|
|
146
|
+
derivedBlockEditingModes: new Map( [] ),
|
|
145
147
|
};
|
|
146
148
|
expect(
|
|
147
149
|
isBlockSubtreeDisabled(
|
|
@@ -157,6 +159,12 @@ describe( 'private selectors', () => {
|
|
|
157
159
|
blockEditingModes: new Map( [
|
|
158
160
|
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
159
161
|
] ),
|
|
162
|
+
derivedBlockEditingModes: new Map( [
|
|
163
|
+
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'disabled' ],
|
|
164
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
165
|
+
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', 'disabled' ],
|
|
166
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'disabled' ],
|
|
167
|
+
] ),
|
|
160
168
|
};
|
|
161
169
|
expect(
|
|
162
170
|
isBlockSubtreeDisabled(
|
|
@@ -166,10 +174,18 @@ describe( 'private selectors', () => {
|
|
|
166
174
|
).toBe( true );
|
|
167
175
|
} );
|
|
168
176
|
|
|
169
|
-
it( 'should return true when top level block is disabled via
|
|
177
|
+
it( 'should return true when top level block is disabled via inheritance and there are no editing modes within it', () => {
|
|
170
178
|
const state = {
|
|
171
179
|
...baseState,
|
|
172
180
|
blockEditingModes: new Map( [ [ '', 'disabled' ] ] ),
|
|
181
|
+
derivedBlockEditingModes: new Map( [
|
|
182
|
+
[ '6cf70164-9097-4460-bcbf-200560546988', 'disabled' ],
|
|
183
|
+
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
184
|
+
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'disabled' ],
|
|
185
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
186
|
+
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', 'disabled' ],
|
|
187
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'disabled' ],
|
|
188
|
+
] ),
|
|
173
189
|
};
|
|
174
190
|
expect(
|
|
175
191
|
isBlockSubtreeDisabled(
|
|
@@ -186,6 +202,11 @@ describe( 'private selectors', () => {
|
|
|
186
202
|
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
187
203
|
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', 'disabled' ],
|
|
188
204
|
] ),
|
|
205
|
+
derivedBlockEditingModes: new Map( [
|
|
206
|
+
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'disabled' ],
|
|
207
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
208
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'disabled' ],
|
|
209
|
+
] ),
|
|
189
210
|
};
|
|
190
211
|
expect(
|
|
191
212
|
isBlockSubtreeDisabled(
|
|
@@ -202,6 +223,11 @@ describe( 'private selectors', () => {
|
|
|
202
223
|
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
203
224
|
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', 'default' ],
|
|
204
225
|
] ),
|
|
226
|
+
derivedBlockEditingModes: new Map( [
|
|
227
|
+
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'disabled' ],
|
|
228
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
229
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'disabled' ],
|
|
230
|
+
] ),
|
|
205
231
|
};
|
|
206
232
|
expect(
|
|
207
233
|
isBlockSubtreeDisabled(
|
|
@@ -218,6 +244,13 @@ describe( 'private selectors', () => {
|
|
|
218
244
|
[ '', 'disabled' ],
|
|
219
245
|
[ 'b3247f75-fd94-4fef-97f9-5bfd162cc416', 'default' ],
|
|
220
246
|
] ),
|
|
247
|
+
derivedBlockEditingModes: new Map( [
|
|
248
|
+
[ '6cf70164-9097-4460-bcbf-200560546988', 'disabled' ],
|
|
249
|
+
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
250
|
+
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'disabled' ],
|
|
251
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
252
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'disabled' ],
|
|
253
|
+
] ),
|
|
221
254
|
};
|
|
222
255
|
expect(
|
|
223
256
|
isBlockSubtreeDisabled(
|
|
@@ -303,6 +336,7 @@ describe( 'private selectors', () => {
|
|
|
303
336
|
const state = {
|
|
304
337
|
...baseState,
|
|
305
338
|
blockEditingModes: new Map( [] ),
|
|
339
|
+
derivedBlockEditingModes: new Map( [] ),
|
|
306
340
|
};
|
|
307
341
|
expect( getEnabledClientIdsTree( state ) ).toEqual( [
|
|
308
342
|
{
|
|
@@ -340,6 +374,7 @@ describe( 'private selectors', () => {
|
|
|
340
374
|
const state = {
|
|
341
375
|
...baseState,
|
|
342
376
|
blockEditingModes: new Map( [] ),
|
|
377
|
+
derivedBlockEditingModes: new Map( [] ),
|
|
343
378
|
};
|
|
344
379
|
expect(
|
|
345
380
|
getEnabledClientIdsTree(
|
|
@@ -375,6 +410,10 @@ describe( 'private selectors', () => {
|
|
|
375
410
|
[ 'b26fc763-417d-4f01-b81c-2ec61e14a972', 'contentOnly' ],
|
|
376
411
|
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'contentOnly' ],
|
|
377
412
|
] ),
|
|
413
|
+
derivedBlockEditingModes: new Map( [
|
|
414
|
+
[ '6cf70164-9097-4460-bcbf-200560546988', 'disabled' ],
|
|
415
|
+
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
416
|
+
] ),
|
|
378
417
|
};
|
|
379
418
|
expect( getEnabledClientIdsTree( state ) ).toEqual( [
|
|
380
419
|
{
|
|
@@ -412,6 +451,7 @@ describe( 'private selectors', () => {
|
|
|
412
451
|
] ),
|
|
413
452
|
},
|
|
414
453
|
blockEditingModes: new Map(),
|
|
454
|
+
derivedBlockEditingModes: new Map(),
|
|
415
455
|
};
|
|
416
456
|
expect(
|
|
417
457
|
getEnabledBlockParents(
|
|
@@ -433,7 +473,7 @@ describe( 'private selectors', () => {
|
|
|
433
473
|
],
|
|
434
474
|
[
|
|
435
475
|
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
436
|
-
'
|
|
476
|
+
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337',
|
|
437
477
|
],
|
|
438
478
|
[
|
|
439
479
|
'4c2b7140-fffd-44b4-b2a7-820c670a6514',
|
|
@@ -442,6 +482,7 @@ describe( 'private selectors', () => {
|
|
|
442
482
|
] ),
|
|
443
483
|
|
|
444
484
|
order: new Map( [
|
|
485
|
+
[ '', [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337' ] ],
|
|
445
486
|
[
|
|
446
487
|
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337',
|
|
447
488
|
[
|
|
@@ -453,12 +494,15 @@ describe( 'private selectors', () => {
|
|
|
453
494
|
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
454
495
|
[ '4c2b7140-fffd-44b4-b2a7-820c670a6514' ],
|
|
455
496
|
],
|
|
456
|
-
[ '', [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337' ] ],
|
|
457
497
|
] ),
|
|
458
498
|
},
|
|
459
499
|
blockEditingModes: new Map( [
|
|
460
500
|
[ '', 'disabled' ],
|
|
461
|
-
[ '
|
|
501
|
+
[ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c', 'default' ],
|
|
502
|
+
] ),
|
|
503
|
+
derivedBlockEditingModes: new Map( [
|
|
504
|
+
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
505
|
+
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'disabled' ],
|
|
462
506
|
] ),
|
|
463
507
|
blockListSettings: {},
|
|
464
508
|
};
|
|
@@ -467,10 +511,7 @@ describe( 'private selectors', () => {
|
|
|
467
511
|
state,
|
|
468
512
|
'4c2b7140-fffd-44b4-b2a7-820c670a6514'
|
|
469
513
|
)
|
|
470
|
-
).toEqual( [
|
|
471
|
-
'9b9c5c3f-2e46-4f02-9e14-9fe9515b958f',
|
|
472
|
-
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
473
|
-
] );
|
|
514
|
+
).toEqual( [ 'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c' ] );
|
|
474
515
|
} );
|
|
475
516
|
|
|
476
517
|
it( 'should order from bottom to top if ascending is true', () => {
|
|
@@ -493,6 +534,7 @@ describe( 'private selectors', () => {
|
|
|
493
534
|
],
|
|
494
535
|
] ),
|
|
495
536
|
order: new Map( [
|
|
537
|
+
[ '', [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337' ] ],
|
|
496
538
|
[
|
|
497
539
|
'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337',
|
|
498
540
|
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f' ],
|
|
@@ -505,13 +547,15 @@ describe( 'private selectors', () => {
|
|
|
505
547
|
'e178812d-ce5e-48c7-a945-8ae4ffcbbb7c',
|
|
506
548
|
[ '4c2b7140-fffd-44b4-b2a7-820c670a6514' ],
|
|
507
549
|
],
|
|
508
|
-
[ '', [ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337' ] ],
|
|
509
550
|
] ),
|
|
510
551
|
},
|
|
511
552
|
blockEditingModes: new Map( [
|
|
512
553
|
[ '', 'disabled' ],
|
|
513
554
|
[ '9b9c5c3f-2e46-4f02-9e14-9fe9515b958f', 'default' ],
|
|
514
555
|
] ),
|
|
556
|
+
derivedBlockEditingModes: new Map( [
|
|
557
|
+
[ 'ef45d5fd-5234-4fd5-ac4f-c3736c7f9337', 'disabled' ],
|
|
558
|
+
] ),
|
|
515
559
|
blockListSettings: {},
|
|
516
560
|
};
|
|
517
561
|
expect(
|