@wordpress/block-editor 15.11.0 → 15.11.1-next.v.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/build/components/block-controls/index.cjs +1 -1
- package/build/components/block-controls/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +6 -19
- package/build/components/block-inspector/index.cjs.map +3 -3
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +37 -13
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-settings-menu-controls/index.cjs +1 -1
- package/build/components/block-settings-menu-controls/index.cjs.map +2 -2
- package/build/components/block-toolbar/index.cjs +1 -1
- package/build/components/block-toolbar/index.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +2 -26
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +7 -9
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +13 -11
- package/build/components/block-visibility/modal.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +1 -1
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +5 -1
- package/build/components/block-visibility/utils.cjs.map +2 -2
- package/build/components/block-visibility/viewport-menu-item.cjs +11 -4
- package/build/components/block-visibility/viewport-menu-item.cjs.map +2 -2
- package/build/components/block-visibility/viewport-toolbar.cjs +4 -6
- package/build/components/block-visibility/viewport-toolbar.cjs.map +2 -2
- package/build/components/block-visibility/viewport-visibility-info.cjs +121 -0
- package/build/components/block-visibility/viewport-visibility-info.cjs.map +7 -0
- package/build/components/color-palette/with-color-context.cjs +1 -1
- package/build/components/color-palette/with-color-context.cjs.map +2 -2
- package/build/components/color-style-selector/index.cjs +1 -1
- package/build/components/color-style-selector/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +5 -3
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/colors-gradients/dropdown.cjs +1 -1
- package/build/components/colors-gradients/dropdown.cjs.map +2 -2
- package/build/components/editable-text/index.cjs +5 -1
- package/build/components/editable-text/index.cjs.map +2 -2
- package/build/components/font-sizes/with-font-sizes.cjs +5 -3
- package/build/components/font-sizes/with-font-sizes.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs +26 -13
- package/build/components/global-styles/advanced-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +1 -1
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +1 -1
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/gradients/with-gradient.cjs +1 -1
- package/build/components/gradients/with-gradient.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +12 -2
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls/index.cjs +1 -1
- package/build/components/inspector-controls/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/index.cjs +1 -1
- package/build/components/inspector-controls-tabs/index.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +8 -16
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +29 -34
- package/build/components/list-view/block.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +3 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/provider/index.cjs +7 -8
- package/build/components/provider/index.cjs.map +2 -2
- package/build/components/provider/with-registry-provider.cjs +1 -1
- package/build/components/provider/with-registry-provider.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +2 -34
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +1 -1
- package/build/hooks/cross-origin-isolation.cjs.map +2 -2
- package/build/hooks/custom-css.cjs +141 -0
- package/build/hooks/custom-css.cjs.map +7 -0
- package/build/hooks/fit-text.cjs +14 -7
- package/build/hooks/fit-text.cjs.map +2 -2
- package/build/hooks/grid-visualizer.cjs +1 -1
- package/build/hooks/grid-visualizer.cjs.map +2 -2
- package/build/hooks/index.cjs +4 -0
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/layout.cjs +10 -4
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/list-view.cjs +9 -5
- package/build/hooks/list-view.cjs.map +3 -3
- package/build/hooks/utils.cjs +2 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/grid.cjs +12 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/store/defaults.cjs +3 -0
- package/build/store/defaults.cjs.map +2 -2
- package/build/store/private-selectors.cjs +45 -37
- package/build/store/private-selectors.cjs.map +2 -2
- package/build/utils/fit-text-utils.cjs +5 -1
- package/build/utils/fit-text-utils.cjs.map +2 -2
- package/build-module/components/block-controls/index.mjs +1 -1
- package/build-module/components/block-controls/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +6 -19
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +37 -13
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs +2 -2
- package/build-module/components/block-settings-menu-controls/index.mjs.map +2 -2
- package/build-module/components/block-toolbar/index.mjs +2 -2
- package/build-module/components/block-toolbar/index.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +2 -26
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +6 -9
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +13 -11
- package/build-module/components/block-visibility/modal.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +1 -1
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +5 -1
- package/build-module/components/block-visibility/utils.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-menu-item.mjs +11 -4
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-toolbar.mjs +4 -6
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/viewport-visibility-info.mjs +95 -0
- package/build-module/components/block-visibility/viewport-visibility-info.mjs.map +7 -0
- package/build-module/components/color-palette/with-color-context.mjs +1 -1
- package/build-module/components/color-palette/with-color-context.mjs.map +2 -2
- package/build-module/components/color-style-selector/index.mjs +1 -1
- package/build-module/components/color-style-selector/index.mjs.map +2 -2
- package/build-module/components/colors/with-colors.mjs +5 -3
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/colors-gradients/dropdown.mjs +1 -1
- package/build-module/components/colors-gradients/dropdown.mjs.map +2 -2
- package/build-module/components/editable-text/index.mjs +5 -1
- package/build-module/components/editable-text/index.mjs.map +2 -2
- package/build-module/components/font-sizes/with-font-sizes.mjs +5 -3
- package/build-module/components/font-sizes/with-font-sizes.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +22 -13
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +1 -1
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +1 -1
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/gradients/with-gradient.mjs +1 -1
- package/build-module/components/gradients/with-gradient.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +12 -2
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls/index.mjs +1 -1
- package/build-module/components/inspector-controls/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/index.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/index.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +8 -16
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +31 -36
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/list-view/utils.mjs +3 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +7 -8
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/provider/with-registry-provider.mjs +1 -1
- package/build-module/components/provider/with-registry-provider.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +3 -37
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +1 -1
- package/build-module/hooks/cross-origin-isolation.mjs.map +2 -2
- package/build-module/hooks/custom-css.mjs +112 -0
- package/build-module/hooks/custom-css.mjs.map +7 -0
- package/build-module/hooks/fit-text.mjs +14 -7
- package/build-module/hooks/fit-text.mjs.map +2 -2
- package/build-module/hooks/grid-visualizer.mjs +1 -1
- package/build-module/hooks/grid-visualizer.mjs.map +2 -2
- package/build-module/hooks/index.mjs +4 -0
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +10 -4
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +10 -6
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +2 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +12 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/store/defaults.mjs +3 -0
- package/build-module/store/defaults.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +42 -40
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/utils/fit-text-utils.mjs +5 -1
- package/build-module/utils/fit-text-utils.mjs.map +2 -2
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +39 -39
- package/src/components/block-controls/index.js +1 -1
- package/src/components/block-controls/test/index.js +1 -0
- package/src/components/block-edit/test/edit.js +10 -0
- package/src/components/block-inspector/index.js +14 -32
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +49 -29
- package/src/components/block-preview/test/index.js +11 -7
- package/src/components/block-settings-menu-controls/index.js +2 -2
- package/src/components/block-switcher/test/index.js +2 -0
- package/src/components/block-switcher/test/use-transformed.patterns.js +2 -0
- package/src/components/block-switcher/test/utils.js +2 -0
- package/src/components/block-toolbar/index.js +2 -2
- package/src/components/block-tools/index.js +2 -29
- package/src/components/block-visibility/index.js +3 -19
- package/src/components/block-visibility/modal.js +16 -14
- package/src/components/block-visibility/test/use-block-visibility.js +27 -25
- package/src/components/block-visibility/test/utils.js +24 -8
- package/src/components/block-visibility/use-block-visibility.js +1 -4
- package/src/components/block-visibility/utils.js +9 -1
- package/src/components/block-visibility/viewport-menu-item.js +11 -5
- package/src/components/block-visibility/viewport-toolbar.js +5 -6
- package/src/components/block-visibility/viewport-visibility-info.js +131 -0
- package/src/components/color-palette/with-color-context.js +1 -1
- package/src/components/color-style-selector/index.js +2 -3
- package/src/components/colors/with-colors.js +23 -20
- package/src/components/colors-gradients/dropdown.js +2 -3
- package/src/components/editable-text/index.js +5 -1
- package/src/components/font-sizes/with-font-sizes.js +13 -10
- package/src/components/global-styles/advanced-panel.js +35 -16
- package/src/components/global-styles/filters-panel.js +2 -3
- package/src/components/global-styles/shadow-panel-components.js +1 -1
- package/src/components/global-styles/style.scss +9 -5
- package/src/components/gradients/with-gradient.js +7 -4
- package/src/components/inner-blocks/test/index.js +2 -0
- package/src/components/inspector-controls/fill.js +25 -5
- package/src/components/inspector-controls/index.js +1 -1
- package/src/components/inspector-controls-tabs/index.js +5 -1
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +3 -4
- package/src/components/link-control/test/index.js +6 -1
- package/src/components/list-view/block-select-button.js +16 -25
- package/src/components/list-view/block.js +38 -43
- package/src/components/list-view/utils.js +4 -2
- package/src/components/media-replace-flow/test/index.js +13 -11
- package/src/components/provider/index.js +11 -10
- package/src/components/provider/test/use-block-sync.js +1 -0
- package/src/components/provider/with-registry-provider.js +1 -1
- package/src/components/use-block-commands/index.js +0 -41
- package/src/hooks/cross-origin-isolation.js +19 -18
- package/src/hooks/custom-css.js +176 -0
- package/src/hooks/fit-text.js +20 -5
- package/src/hooks/grid-visualizer.js +15 -14
- package/src/hooks/index.js +4 -0
- package/src/hooks/layout.js +55 -43
- package/src/hooks/list-view.js +10 -6
- package/src/hooks/test/align.js +1 -0
- package/src/hooks/test/allowed-blocks.js +8 -0
- package/src/hooks/test/auto-inspector-controls.js +4 -0
- package/src/hooks/test/font-size.js +1 -0
- package/src/hooks/test/metadata.js +4 -0
- package/src/hooks/test/text-align.js +1 -0
- package/src/hooks/utils.js +123 -119
- package/src/layouts/grid.js +19 -3
- package/src/layouts/test/grid.js +1 -1
- package/src/store/defaults.js +4 -0
- package/src/store/private-selectors.js +94 -63
- package/src/store/test/actions.js +7 -0
- package/src/store/test/private-selectors.js +116 -119
- package/src/store/test/reducer.js +4 -0
- package/src/store/test/registry-selectors.js +2 -0
- package/src/store/test/selectors.js +19 -0
- package/src/utils/fit-text-utils.js +12 -2
- package/build/components/block-visibility/block-visibility-info.cjs +0 -63
- package/build/components/block-visibility/block-visibility-info.cjs.map +0 -7
- package/build/components/block-visibility/menu-item.cjs +0 -109
- package/build/components/block-visibility/menu-item.cjs.map +0 -7
- package/build/components/block-visibility/toolbar.cjs +0 -92
- package/build/components/block-visibility/toolbar.cjs.map +0 -7
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -47
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +0 -7
- package/build-module/components/block-visibility/menu-item.mjs +0 -88
- package/build-module/components/block-visibility/menu-item.mjs.map +0 -7
- package/build-module/components/block-visibility/toolbar.mjs +0 -71
- package/build-module/components/block-visibility/toolbar.mjs.map +0 -7
- package/src/components/block-visibility/block-visibility-info.js +0 -62
- package/src/components/block-visibility/menu-item.js +0 -96
- package/src/components/block-visibility/toolbar.js +0 -88
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "15.11.0",
|
|
3
|
+
"version": "15.11.1-next.v.0+b8934fcf9",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -61,43 +61,43 @@
|
|
|
61
61
|
],
|
|
62
62
|
"dependencies": {
|
|
63
63
|
"@react-spring/web": "^9.4.5",
|
|
64
|
-
"@wordpress/a11y": "^4.38.0",
|
|
65
|
-
"@wordpress/api-fetch": "^7.38.0",
|
|
66
|
-
"@wordpress/base-styles": "^6.14.0",
|
|
67
|
-
"@wordpress/blob": "^4.38.0",
|
|
68
|
-
"@wordpress/block-serialization-default-parser": "^5.38.0",
|
|
69
|
-
"@wordpress/blocks": "^15.11.0",
|
|
70
|
-
"@wordpress/commands": "^1.38.0",
|
|
71
|
-
"@wordpress/components": "^32.0.0",
|
|
72
|
-
"@wordpress/compose": "^7.38.0",
|
|
73
|
-
"@wordpress/data": "^10.38.0",
|
|
74
|
-
"@wordpress/dataviews": "^11.
|
|
75
|
-
"@wordpress/date": "^5.38.0",
|
|
76
|
-
"@wordpress/deprecated": "^4.38.0",
|
|
77
|
-
"@wordpress/dom": "^4.38.0",
|
|
78
|
-
"@wordpress/element": "^6.38.0",
|
|
79
|
-
"@wordpress/escape-html": "^3.38.0",
|
|
80
|
-
"@wordpress/global-styles-engine": "^1.5.0",
|
|
81
|
-
"@wordpress/hooks": "^4.38.0",
|
|
82
|
-
"@wordpress/html-entities": "^4.38.0",
|
|
83
|
-
"@wordpress/i18n": "^6.11.0",
|
|
84
|
-
"@wordpress/icons": "^11.5.0",
|
|
85
|
-
"@wordpress/image-cropper": "^1.2.0",
|
|
86
|
-
"@wordpress/interactivity": "^6.38.0",
|
|
87
|
-
"@wordpress/is-shallow-equal": "^5.38.0",
|
|
88
|
-
"@wordpress/keyboard-shortcuts": "^5.38.0",
|
|
89
|
-
"@wordpress/keycodes": "^4.38.0",
|
|
90
|
-
"@wordpress/notices": "^5.38.0",
|
|
91
|
-
"@wordpress/preferences": "^4.38.0",
|
|
92
|
-
"@wordpress/priority-queue": "^3.38.0",
|
|
93
|
-
"@wordpress/private-apis": "^1.38.0",
|
|
94
|
-
"@wordpress/rich-text": "^7.38.0",
|
|
95
|
-
"@wordpress/style-engine": "^2.38.0",
|
|
96
|
-
"@wordpress/token-list": "^3.38.0",
|
|
97
|
-
"@wordpress/upload-media": "^0.23.0",
|
|
98
|
-
"@wordpress/url": "^4.38.0",
|
|
99
|
-
"@wordpress/warning": "^3.38.0",
|
|
100
|
-
"@wordpress/wordcount": "^4.38.0",
|
|
64
|
+
"@wordpress/a11y": "^4.38.1-next.v.0+b8934fcf9",
|
|
65
|
+
"@wordpress/api-fetch": "^7.38.1-next.v.0+b8934fcf9",
|
|
66
|
+
"@wordpress/base-styles": "^6.14.1-next.v.0+b8934fcf9",
|
|
67
|
+
"@wordpress/blob": "^4.38.1-next.v.0+b8934fcf9",
|
|
68
|
+
"@wordpress/block-serialization-default-parser": "^5.38.1-next.v.0+b8934fcf9",
|
|
69
|
+
"@wordpress/blocks": "^15.11.1-next.v.0+b8934fcf9",
|
|
70
|
+
"@wordpress/commands": "^1.38.1-next.v.0+b8934fcf9",
|
|
71
|
+
"@wordpress/components": "^32.0.2-next.v.0+b8934fcf9",
|
|
72
|
+
"@wordpress/compose": "^7.38.1-next.v.0+b8934fcf9",
|
|
73
|
+
"@wordpress/data": "^10.38.1-next.v.0+b8934fcf9",
|
|
74
|
+
"@wordpress/dataviews": "^11.3.1-next.v.0+b8934fcf9",
|
|
75
|
+
"@wordpress/date": "^5.38.1-next.v.0+b8934fcf9",
|
|
76
|
+
"@wordpress/deprecated": "^4.38.1-next.v.0+b8934fcf9",
|
|
77
|
+
"@wordpress/dom": "^4.38.1-next.v.0+b8934fcf9",
|
|
78
|
+
"@wordpress/element": "^6.38.1-next.v.0+b8934fcf9",
|
|
79
|
+
"@wordpress/escape-html": "^3.38.1-next.v.0+b8934fcf9",
|
|
80
|
+
"@wordpress/global-styles-engine": "^1.5.1-next.v.0+b8934fcf9",
|
|
81
|
+
"@wordpress/hooks": "^4.38.1-next.v.0+b8934fcf9",
|
|
82
|
+
"@wordpress/html-entities": "^4.38.1-next.v.0+b8934fcf9",
|
|
83
|
+
"@wordpress/i18n": "^6.11.1-next.v.0+b8934fcf9",
|
|
84
|
+
"@wordpress/icons": "^11.5.1-next.v.0+b8934fcf9",
|
|
85
|
+
"@wordpress/image-cropper": "^1.2.1-next.v.0+b8934fcf9",
|
|
86
|
+
"@wordpress/interactivity": "^6.38.1-next.v.0+b8934fcf9",
|
|
87
|
+
"@wordpress/is-shallow-equal": "^5.38.1-next.v.0+b8934fcf9",
|
|
88
|
+
"@wordpress/keyboard-shortcuts": "^5.38.1-next.v.0+b8934fcf9",
|
|
89
|
+
"@wordpress/keycodes": "^4.38.1-next.v.0+b8934fcf9",
|
|
90
|
+
"@wordpress/notices": "^5.38.1-next.v.0+b8934fcf9",
|
|
91
|
+
"@wordpress/preferences": "^4.38.1-next.v.0+b8934fcf9",
|
|
92
|
+
"@wordpress/priority-queue": "^3.38.1-next.v.0+b8934fcf9",
|
|
93
|
+
"@wordpress/private-apis": "^1.38.1-next.v.0+b8934fcf9",
|
|
94
|
+
"@wordpress/rich-text": "^7.38.1-next.v.0+b8934fcf9",
|
|
95
|
+
"@wordpress/style-engine": "^2.38.1-next.v.0+b8934fcf9",
|
|
96
|
+
"@wordpress/token-list": "^3.38.1-next.v.0+b8934fcf9",
|
|
97
|
+
"@wordpress/upload-media": "^0.23.1-next.v.0+b8934fcf9",
|
|
98
|
+
"@wordpress/url": "^4.38.1-next.v.0+b8934fcf9",
|
|
99
|
+
"@wordpress/warning": "^3.38.1-next.v.0+b8934fcf9",
|
|
100
|
+
"@wordpress/wordcount": "^4.38.1-next.v.0+b8934fcf9",
|
|
101
101
|
"change-case": "^4.1.2",
|
|
102
102
|
"clsx": "^2.1.1",
|
|
103
103
|
"colord": "^2.7.0",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"publishConfig": {
|
|
125
125
|
"access": "public"
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "17529010285784fd2e735348a28391c79de87c88"
|
|
128
128
|
}
|
|
@@ -12,7 +12,7 @@ BlockControls.Slot = BlockControlsSlot;
|
|
|
12
12
|
export const BlockFormatControls = ( props ) => {
|
|
13
13
|
return <BlockControlsFill group="inline" { ...props } />;
|
|
14
14
|
};
|
|
15
|
-
BlockFormatControls.Slot = ( props )
|
|
15
|
+
BlockFormatControls.Slot = function Slot( props ) {
|
|
16
16
|
return <BlockControlsSlot group="inline" { ...props } />;
|
|
17
17
|
};
|
|
18
18
|
|
|
@@ -37,6 +37,7 @@ describe( 'Edit', () => {
|
|
|
37
37
|
const edit = () => <div data-testid="foo-bar" />;
|
|
38
38
|
|
|
39
39
|
registerBlockType( 'core/test-block', {
|
|
40
|
+
apiVersion: 3,
|
|
40
41
|
save: noop,
|
|
41
42
|
category: 'text',
|
|
42
43
|
title: 'block title',
|
|
@@ -52,6 +53,7 @@ describe( 'Edit', () => {
|
|
|
52
53
|
const save = () => <div data-testid="foo-bar" />;
|
|
53
54
|
|
|
54
55
|
registerBlockType( 'core/test-block', {
|
|
56
|
+
apiVersion: 3,
|
|
55
57
|
save,
|
|
56
58
|
category: 'text',
|
|
57
59
|
title: 'block title',
|
|
@@ -79,6 +81,13 @@ describe( 'Edit', () => {
|
|
|
79
81
|
|
|
80
82
|
render( <Edit name="core/test-block" attributes={ attributes } /> );
|
|
81
83
|
|
|
84
|
+
// This test is for API version 1 blocks, so the console warning is intentional.
|
|
85
|
+
// API version 1 blocks automatically receive the default block class name,
|
|
86
|
+
// while API version 2+ blocks require useBlockProps() to be used explicitly.
|
|
87
|
+
expect( console ).toHaveWarnedWith(
|
|
88
|
+
'Block with API version 2 or lower is deprecated since version 6.9. See: https://developer.wordpress.org/block-editor/reference-guides/block-api/block-api-versions/block-migration-for-iframe-editor-compatibility/ Note: The block "core/test-block" is registered with API version 1. This means that the post editor may work as a non-iframe editor. Since all editors are planned to work as iframes in the future, set the `apiVersion` field to 3 and test the block inside the iframe editor.'
|
|
89
|
+
);
|
|
90
|
+
|
|
82
91
|
const editElement = screen.getByTestId( 'foo-bar' );
|
|
83
92
|
expect( editElement ).toHaveClass( 'wp-block-test-block' );
|
|
84
93
|
expect( editElement ).toHaveClass( 'my-class' );
|
|
@@ -87,6 +96,7 @@ describe( 'Edit', () => {
|
|
|
87
96
|
it( 'should assign context', () => {
|
|
88
97
|
const edit = ( { context } ) => context.value;
|
|
89
98
|
registerBlockType( 'core/test-block', {
|
|
99
|
+
apiVersion: 3,
|
|
90
100
|
category: 'text',
|
|
91
101
|
title: 'block title',
|
|
92
102
|
usesContext: [ 'value' ],
|
|
@@ -29,7 +29,7 @@ import PositionControls from '../inspector-controls-tabs/position-controls-panel
|
|
|
29
29
|
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
30
30
|
import { useBorderPanelLabel } from '../../hooks/border';
|
|
31
31
|
import ContentTab from '../inspector-controls-tabs/content-tab';
|
|
32
|
-
import
|
|
32
|
+
import ViewportVisibilityInfo from '../block-visibility/viewport-visibility-info';
|
|
33
33
|
import { unlock } from '../../lock-unlock';
|
|
34
34
|
|
|
35
35
|
function StyleInspectorSlots( {
|
|
@@ -77,7 +77,6 @@ function StyleInspectorSlots( {
|
|
|
77
77
|
function BlockInspector() {
|
|
78
78
|
const {
|
|
79
79
|
selectedBlockCount,
|
|
80
|
-
selectedBlockClientId,
|
|
81
80
|
renderedBlockName,
|
|
82
81
|
renderedBlockClientId,
|
|
83
82
|
blockType,
|
|
@@ -119,7 +118,6 @@ function BlockInspector() {
|
|
|
119
118
|
|
|
120
119
|
return {
|
|
121
120
|
selectedBlockCount: getSelectedBlockCount(),
|
|
122
|
-
selectedBlockClientId: _selectedBlockClientId,
|
|
123
121
|
renderedBlockClientId: _renderedBlockClientId,
|
|
124
122
|
renderedBlockName: _renderedBlockName,
|
|
125
123
|
blockType: _blockType,
|
|
@@ -257,7 +255,6 @@ function BlockInspector() {
|
|
|
257
255
|
>
|
|
258
256
|
<BlockInspectorSingleBlock
|
|
259
257
|
renderedBlockClientId={ renderedBlockClientId }
|
|
260
|
-
selectedBlockClientId={ selectedBlockClientId }
|
|
261
258
|
blockName={ blockType.name }
|
|
262
259
|
isSectionBlock={ isSectionBlock }
|
|
263
260
|
availableTabs={ availableTabs }
|
|
@@ -309,10 +306,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
309
306
|
// The block that is displayed in the inspector. This is the block whose
|
|
310
307
|
// controls and information are shown to the user.
|
|
311
308
|
renderedBlockClientId,
|
|
312
|
-
// The actual block that is selected in the editor. This may or may not
|
|
313
|
-
// be the same as the rendered block (e.g., when a child block is selected
|
|
314
|
-
// but its parent section block is the main one rendered in the inspector).
|
|
315
|
-
selectedBlockClientId,
|
|
316
309
|
blockName,
|
|
317
310
|
isSectionBlock,
|
|
318
311
|
availableTabs,
|
|
@@ -332,10 +325,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
332
325
|
renderedBlockClientId
|
|
333
326
|
);
|
|
334
327
|
const isBlockSynced = blockInformation.isSynced;
|
|
335
|
-
const shouldShowTabs = ! isBlockSynced && hasMultipleTabs;
|
|
336
|
-
const isSectionBlockSelected =
|
|
337
|
-
window?.__experimentalContentOnlyPatternInsertion &&
|
|
338
|
-
selectedBlockClientId === renderedBlockClientId;
|
|
339
328
|
|
|
340
329
|
return (
|
|
341
330
|
<div className="block-editor-block-inspector">
|
|
@@ -353,22 +342,24 @@ const BlockInspectorSingleBlock = ( {
|
|
|
353
342
|
isChild={ hasParentChildBlockCards }
|
|
354
343
|
clientId={ renderedBlockClientId }
|
|
355
344
|
/>
|
|
356
|
-
<
|
|
345
|
+
<ViewportVisibilityInfo clientId={ renderedBlockClientId } />
|
|
357
346
|
{ window?.__experimentalContentOnlyPatternInsertion && (
|
|
358
347
|
<EditContents clientId={ renderedBlockClientId } />
|
|
359
348
|
) }
|
|
360
349
|
<BlockVariationTransforms blockClientId={ renderedBlockClientId } />
|
|
361
|
-
{
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
350
|
+
{ hasMultipleTabs && (
|
|
351
|
+
<>
|
|
352
|
+
<InspectorControlsTabs
|
|
353
|
+
hasBlockStyles={ hasBlockStyles }
|
|
354
|
+
clientId={ renderedBlockClientId }
|
|
355
|
+
blockName={ blockName }
|
|
356
|
+
tabs={ availableTabs }
|
|
357
|
+
isSectionBlock={ isSectionBlock }
|
|
358
|
+
contentClientIds={ contentClientIds }
|
|
359
|
+
/>
|
|
360
|
+
</>
|
|
370
361
|
) }
|
|
371
|
-
{ !
|
|
362
|
+
{ ! hasMultipleTabs && (
|
|
372
363
|
<>
|
|
373
364
|
{ hasBlockStyles && (
|
|
374
365
|
<BlockStyles clientId={ renderedBlockClientId } />
|
|
@@ -379,15 +370,6 @@ const BlockInspectorSingleBlock = ( {
|
|
|
379
370
|
{ ! isSectionBlock && (
|
|
380
371
|
<StyleInspectorSlots blockName={ blockName } />
|
|
381
372
|
) }
|
|
382
|
-
{ isSectionBlock &&
|
|
383
|
-
isBlockSynced &&
|
|
384
|
-
isSectionBlockSelected && (
|
|
385
|
-
<>
|
|
386
|
-
<InspectorControls.Slot />
|
|
387
|
-
{ /* Allow AdvancedControls so users can adjust local attributes (e.g. additional CSS classes, HTML element). */ }
|
|
388
|
-
<AdvancedControls />
|
|
389
|
-
</>
|
|
390
|
-
) }
|
|
391
373
|
</>
|
|
392
374
|
) }
|
|
393
375
|
<SkipToSelectedBlock key="back" />
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { isReusableBlock, isTemplatePart } from '@wordpress/blocks';
|
|
4
5
|
import { isTextField } from '@wordpress/dom';
|
|
5
6
|
import { ENTER, BACKSPACE, DELETE } from '@wordpress/keycodes';
|
|
6
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
@@ -31,6 +32,7 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
31
32
|
hasMultiSelection,
|
|
32
33
|
isSectionBlock,
|
|
33
34
|
editedContentOnlySection,
|
|
35
|
+
getBlock,
|
|
34
36
|
} = unlock( useSelect( blockEditorStore ) );
|
|
35
37
|
const {
|
|
36
38
|
insertAfterBlock,
|
|
@@ -128,15 +130,13 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
128
130
|
|
|
129
131
|
const rect = node.getBoundingClientRect();
|
|
130
132
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// Maybe remove the clone now that it's relative?
|
|
134
|
-
clone.style.display = 'none';
|
|
135
|
-
|
|
136
|
-
// Remove the id and leave it on the clone so that drop target
|
|
137
|
-
// calculations are correct.
|
|
133
|
+
// Remove the id and leave it on a shallow clone so that drop
|
|
134
|
+
// target calculations are correct.
|
|
138
135
|
const id = node.id;
|
|
136
|
+
const clone = node.cloneNode();
|
|
137
|
+
clone.style.display = 'none';
|
|
139
138
|
node.id = null;
|
|
139
|
+
node.after( clone );
|
|
140
140
|
|
|
141
141
|
let _scale = 1;
|
|
142
142
|
|
|
@@ -154,8 +154,6 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
154
154
|
|
|
155
155
|
const inverted = 1 / _scale;
|
|
156
156
|
|
|
157
|
-
node.after( clone );
|
|
158
|
-
|
|
159
157
|
const originalNodeProperties = {};
|
|
160
158
|
for ( const property of [
|
|
161
159
|
'transform',
|
|
@@ -225,32 +223,41 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
225
223
|
}
|
|
226
224
|
|
|
227
225
|
let hasStarted = false;
|
|
226
|
+
let lastClientX = originClientX;
|
|
227
|
+
let lastClientY = originClientY;
|
|
228
|
+
|
|
229
|
+
function dragOver( e ) {
|
|
230
|
+
// Only trigger `over` if the mouse has moved.
|
|
231
|
+
if (
|
|
232
|
+
e.clientX === lastClientX &&
|
|
233
|
+
e.clientY === lastClientY
|
|
234
|
+
) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
lastClientX = e.clientX;
|
|
238
|
+
lastClientY = e.clientY;
|
|
239
|
+
over();
|
|
240
|
+
}
|
|
228
241
|
|
|
229
|
-
function over(
|
|
242
|
+
function over() {
|
|
230
243
|
if ( ! hasStarted ) {
|
|
231
244
|
hasStarted = true;
|
|
232
245
|
node.style.pointerEvents = 'none';
|
|
233
246
|
}
|
|
247
|
+
const pointerYDelta = lastClientY - originClientY;
|
|
248
|
+
const pointerXDelta = lastClientX - originClientX;
|
|
234
249
|
const scrollTop = defaultView.scrollY;
|
|
235
250
|
const scrollLeft = defaultView.scrollX;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}px`;
|
|
243
|
-
node.style.left = `${
|
|
244
|
-
( e.clientX -
|
|
245
|
-
originClientX +
|
|
246
|
-
scrollLeft -
|
|
247
|
-
originScrollLeft ) *
|
|
248
|
-
inverted
|
|
249
|
-
}px`;
|
|
251
|
+
const scrollTopDelta = scrollTop - originScrollTop;
|
|
252
|
+
const scrollLeftDelta = scrollLeft - originScrollLeft;
|
|
253
|
+
const topDelta = pointerYDelta + scrollTopDelta;
|
|
254
|
+
const leftDelta = pointerXDelta + scrollLeftDelta;
|
|
255
|
+
node.style.top = `${ topDelta * inverted }px`;
|
|
256
|
+
node.style.left = `${ leftDelta * inverted }px`;
|
|
250
257
|
}
|
|
251
258
|
|
|
252
259
|
function end() {
|
|
253
|
-
ownerDocument.removeEventListener( 'dragover',
|
|
260
|
+
ownerDocument.removeEventListener( 'dragover', dragOver );
|
|
254
261
|
ownerDocument.removeEventListener( 'dragend', end );
|
|
255
262
|
ownerDocument.removeEventListener( 'drop', end );
|
|
256
263
|
ownerDocument.removeEventListener( 'scroll', over );
|
|
@@ -271,7 +278,7 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
271
278
|
);
|
|
272
279
|
}
|
|
273
280
|
|
|
274
|
-
ownerDocument.addEventListener( 'dragover',
|
|
281
|
+
ownerDocument.addEventListener( 'dragover', dragOver );
|
|
275
282
|
ownerDocument.addEventListener( 'dragend', end );
|
|
276
283
|
ownerDocument.addEventListener( 'drop', end );
|
|
277
284
|
ownerDocument.addEventListener( 'scroll', over );
|
|
@@ -294,12 +301,22 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
294
301
|
*/
|
|
295
302
|
function onDoubleClick( event ) {
|
|
296
303
|
const isSection = isSectionBlock( clientId );
|
|
304
|
+
const block = getBlock( clientId );
|
|
305
|
+
const isSyncedPattern = isReusableBlock( block );
|
|
306
|
+
const isTemplatePartBlock = isTemplatePart( block );
|
|
297
307
|
const isAlreadyEditing = editedContentOnlySection === clientId;
|
|
298
308
|
|
|
299
|
-
if (
|
|
300
|
-
|
|
301
|
-
|
|
309
|
+
if (
|
|
310
|
+
! isSection ||
|
|
311
|
+
isAlreadyEditing ||
|
|
312
|
+
isSyncedPattern ||
|
|
313
|
+
isTemplatePartBlock
|
|
314
|
+
) {
|
|
315
|
+
return;
|
|
302
316
|
}
|
|
317
|
+
|
|
318
|
+
event.preventDefault();
|
|
319
|
+
editContentOnlySection( clientId );
|
|
303
320
|
}
|
|
304
321
|
|
|
305
322
|
// Only add double-click listener if experimental flag is enabled
|
|
@@ -319,6 +336,9 @@ export function useEventHandlers( { clientId, isSelected } ) {
|
|
|
319
336
|
clientId,
|
|
320
337
|
isSelected,
|
|
321
338
|
getBlockRootClientId,
|
|
339
|
+
getBlock,
|
|
340
|
+
isReusableBlock,
|
|
341
|
+
isTemplatePart,
|
|
322
342
|
insertAfterBlock,
|
|
323
343
|
removeBlock,
|
|
324
344
|
isZoomOut,
|
|
@@ -16,22 +16,26 @@ import {
|
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
18
|
import { useBlockPreview } from '../';
|
|
19
|
+
import { useBlockProps } from '../../block-list/use-block-props';
|
|
19
20
|
|
|
20
21
|
describe( 'useBlockPreview', () => {
|
|
21
22
|
beforeAll( () => {
|
|
22
23
|
registerBlockType( 'core/test-block', {
|
|
24
|
+
apiVersion: 3,
|
|
23
25
|
save: () => (
|
|
24
|
-
<div>
|
|
26
|
+
<div { ...useBlockProps.save() }>
|
|
25
27
|
Test block save view
|
|
26
28
|
<button>Button</button>
|
|
27
29
|
</div>
|
|
28
30
|
),
|
|
29
|
-
edit: ()
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
edit: function Edit() {
|
|
32
|
+
return (
|
|
33
|
+
<div { ...useBlockProps() }>
|
|
34
|
+
Test block edit view
|
|
35
|
+
<button>Button</button>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
35
39
|
category: 'text',
|
|
36
40
|
title: 'test block',
|
|
37
41
|
} );
|
|
@@ -21,7 +21,7 @@ import { store as blockEditorStore } from '../../store';
|
|
|
21
21
|
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
22
22
|
import { ModifyContentOnlySectionMenuItem } from '../content-lock';
|
|
23
23
|
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
24
|
-
import {
|
|
24
|
+
import { BlockVisibilityViewportMenuItem } from '../block-visibility';
|
|
25
25
|
import { EditSectionMenuItem } from './edit-section-menu-item';
|
|
26
26
|
|
|
27
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
@@ -116,7 +116,7 @@ const BlockSettingsMenuControlsSlot = ( { fillProps, clientIds = null } ) => {
|
|
|
116
116
|
/>
|
|
117
117
|
) }
|
|
118
118
|
{ showVisibilityButton && (
|
|
119
|
-
<
|
|
119
|
+
<BlockVisibilityViewportMenuItem
|
|
120
120
|
clientIds={ selectedClientIds }
|
|
121
121
|
/>
|
|
122
122
|
) }
|
|
@@ -33,6 +33,7 @@ describe( 'BlockSwitcher', () => {
|
|
|
33
33
|
clientId: 'a1303fd6-3e60-4fff-a770-0e0ea656c5b9',
|
|
34
34
|
};
|
|
35
35
|
const headingBlockType = {
|
|
36
|
+
apiVersion: 3,
|
|
36
37
|
category: 'text',
|
|
37
38
|
title: 'Heading',
|
|
38
39
|
edit: () => {},
|
|
@@ -54,6 +55,7 @@ describe( 'BlockSwitcher', () => {
|
|
|
54
55
|
},
|
|
55
56
|
};
|
|
56
57
|
const paragraphBlockType = {
|
|
58
|
+
apiVersion: 3,
|
|
57
59
|
category: 'text',
|
|
58
60
|
title: 'Paragraph',
|
|
59
61
|
edit: () => {},
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
describe( 'use-transformed-patterns', () => {
|
|
15
15
|
beforeAll( () => {
|
|
16
16
|
registerBlockType( 'core/test-block-1', {
|
|
17
|
+
apiVersion: 3,
|
|
17
18
|
attributes: {
|
|
18
19
|
align: {
|
|
19
20
|
type: 'string',
|
|
@@ -36,6 +37,7 @@ describe( 'use-transformed-patterns', () => {
|
|
|
36
37
|
title: 'test block 1',
|
|
37
38
|
} );
|
|
38
39
|
registerBlockType( 'core/test-block-2', {
|
|
40
|
+
apiVersion: 3,
|
|
39
41
|
attributes: {
|
|
40
42
|
align: { type: 'string' },
|
|
41
43
|
content: { type: 'boolean' },
|
|
@@ -12,6 +12,7 @@ describe( 'BlockSwitcher - utils', () => {
|
|
|
12
12
|
describe( 'getRetainedBlockAttributes', () => {
|
|
13
13
|
beforeAll( () => {
|
|
14
14
|
registerBlockType( 'core/test-block-1', {
|
|
15
|
+
apiVersion: 3,
|
|
15
16
|
attributes: {
|
|
16
17
|
align: {
|
|
17
18
|
type: 'string',
|
|
@@ -34,6 +35,7 @@ describe( 'BlockSwitcher - utils', () => {
|
|
|
34
35
|
title: 'test block 1',
|
|
35
36
|
} );
|
|
36
37
|
registerBlockType( 'core/test-block-2', {
|
|
38
|
+
apiVersion: 3,
|
|
37
39
|
attributes: {
|
|
38
40
|
align: { type: 'string' },
|
|
39
41
|
content: { type: 'boolean' },
|
|
@@ -27,7 +27,7 @@ import BlockControls from '../block-controls';
|
|
|
27
27
|
import __unstableBlockToolbarLastItem from './block-toolbar-last-item';
|
|
28
28
|
import BlockSettingsMenu from '../block-settings-menu';
|
|
29
29
|
import { BlockLockToolbar } from '../block-lock';
|
|
30
|
-
import {
|
|
30
|
+
import { ViewportVisibilityToolbar } from '../block-visibility';
|
|
31
31
|
import { BlockGroupToolbar } from '../convert-to-group-buttons';
|
|
32
32
|
import BlockEditVisuallyButton from '../block-edit-visually-button';
|
|
33
33
|
import { useShowHoveredOrFocusedGestures } from './utils';
|
|
@@ -213,7 +213,7 @@ export function PrivateBlockToolbar( {
|
|
|
213
213
|
/>
|
|
214
214
|
{ isDefaultEditingMode &&
|
|
215
215
|
showBlockVisibilityButton && (
|
|
216
|
-
<
|
|
216
|
+
<ViewportVisibilityToolbar
|
|
217
217
|
clientIds={ blockClientIds }
|
|
218
218
|
/>
|
|
219
219
|
) }
|
|
@@ -35,7 +35,6 @@ import { useShowBlockTools } from './use-show-block-tools';
|
|
|
35
35
|
import { unlock } from '../../lock-unlock';
|
|
36
36
|
import usePasteStyles from '../use-paste-styles';
|
|
37
37
|
import { BlockVisibilityModal } from '../block-visibility';
|
|
38
|
-
import { cleanEmptyObject } from '../../hooks/utils';
|
|
39
38
|
|
|
40
39
|
function selector( select ) {
|
|
41
40
|
const {
|
|
@@ -101,7 +100,6 @@ export default function BlockTools( {
|
|
|
101
100
|
moveBlocksDown,
|
|
102
101
|
expandBlock,
|
|
103
102
|
stopEditingContentOnlySection,
|
|
104
|
-
updateBlockAttributes,
|
|
105
103
|
} = unlock( useDispatch( blockEditorStore ) );
|
|
106
104
|
|
|
107
105
|
function onKeyDown( event ) {
|
|
@@ -230,33 +228,8 @@ export default function BlockTools( {
|
|
|
230
228
|
return;
|
|
231
229
|
}
|
|
232
230
|
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
setVisibilityModalClientIds( clientIds );
|
|
236
|
-
} else {
|
|
237
|
-
const hasHiddenBlock = blocks.some(
|
|
238
|
-
( block ) =>
|
|
239
|
-
block.attributes.metadata?.blockVisibility === false
|
|
240
|
-
);
|
|
241
|
-
const attributesByClientId = Object.fromEntries(
|
|
242
|
-
blocks.map(
|
|
243
|
-
( { clientId: mapClientId, attributes } ) => [
|
|
244
|
-
mapClientId,
|
|
245
|
-
{
|
|
246
|
-
metadata: cleanEmptyObject( {
|
|
247
|
-
...attributes?.metadata,
|
|
248
|
-
blockVisibility: hasHiddenBlock
|
|
249
|
-
? undefined
|
|
250
|
-
: false,
|
|
251
|
-
} ),
|
|
252
|
-
},
|
|
253
|
-
]
|
|
254
|
-
)
|
|
255
|
-
);
|
|
256
|
-
updateBlockAttributes( clientIds, attributesByClientId, {
|
|
257
|
-
uniqueByBlock: true,
|
|
258
|
-
} );
|
|
259
|
-
}
|
|
231
|
+
// Open the visibility breakpoints modal.
|
|
232
|
+
setVisibilityModalClientIds( clientIds );
|
|
260
233
|
}
|
|
261
234
|
}
|
|
262
235
|
|
|
@@ -1,21 +1,5 @@
|
|
|
1
1
|
export { default as BlockVisibilityModal } from './modal';
|
|
2
2
|
export { default as useBlockVisibility } from './use-block-visibility';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import BlockVisibilityMenuItemDefault from './menu-item';
|
|
8
|
-
import BlockVisibilityViewportMenuItem from './viewport-menu-item';
|
|
9
|
-
|
|
10
|
-
const hasViewportVisibilityExperiment =
|
|
11
|
-
typeof window !== 'undefined' &&
|
|
12
|
-
window.__experimentalHideBlocksBasedOnScreenSize;
|
|
13
|
-
|
|
14
|
-
// Conditionally export the viewport versions when the experimental flag is enabled.
|
|
15
|
-
export const BlockVisibilityMenuItem = hasViewportVisibilityExperiment
|
|
16
|
-
? BlockVisibilityViewportMenuItem
|
|
17
|
-
: BlockVisibilityMenuItemDefault;
|
|
18
|
-
|
|
19
|
-
export const BlockVisibilityToolbar = hasViewportVisibilityExperiment
|
|
20
|
-
? BlockVisibilityViewportToolbar
|
|
21
|
-
: BlockVisibilityToolbarDefault;
|
|
3
|
+
export { default as ViewportVisibilityToolbar } from './viewport-toolbar';
|
|
4
|
+
export { default as BlockVisibilityViewportMenuItem } from './viewport-menu-item';
|
|
5
|
+
export { default as ViewportVisibilityInfo } from './viewport-visibility-info';
|
|
@@ -118,7 +118,7 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
118
118
|
return sprintf(
|
|
119
119
|
// translators: %s: The shortcut key to access the List View.
|
|
120
120
|
__(
|
|
121
|
-
'Block visibility settings
|
|
121
|
+
'Block visibility settings updated. You can access them via the List View (%s).'
|
|
122
122
|
),
|
|
123
123
|
listViewShortcut
|
|
124
124
|
);
|
|
@@ -160,18 +160,20 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
160
160
|
event.preventDefault();
|
|
161
161
|
const newVisibility = hideEverywhere
|
|
162
162
|
? false
|
|
163
|
-
:
|
|
164
|
-
(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
163
|
+
: {
|
|
164
|
+
viewport: BLOCK_VISIBILITY_VIEWPORT_ENTRIES.reduce(
|
|
165
|
+
( acc, [ , { key } ] ) => {
|
|
166
|
+
if ( viewportChecked[ key ] ) {
|
|
167
|
+
// Values are inverted to hide the block on the selected viewport.
|
|
168
|
+
// In the UI, the checkbox is checked (true) when the block is hidden on the selected viewport,
|
|
169
|
+
// so 'false' means hide the block on the selected viewport.
|
|
170
|
+
acc[ key ] = false;
|
|
171
|
+
}
|
|
172
|
+
return acc;
|
|
173
|
+
},
|
|
174
|
+
{}
|
|
175
|
+
),
|
|
176
|
+
};
|
|
175
177
|
const attributesByClientId = Object.fromEntries(
|
|
176
178
|
blocks.map( ( { clientId, attributes } ) => [
|
|
177
179
|
clientId,
|
|
@@ -190,7 +192,7 @@ export default function BlockVisibilityModal( { clientIds, onClose } ) {
|
|
|
190
192
|
createSuccessNotice( noticeMessage, {
|
|
191
193
|
id: hideEverywhere
|
|
192
194
|
? 'block-visibility-hidden'
|
|
193
|
-
: 'block-visibility-viewports-
|
|
195
|
+
: 'block-visibility-viewports-updated',
|
|
194
196
|
type: 'snackbar',
|
|
195
197
|
} );
|
|
196
198
|
onClose();
|