@wordpress/block-editor 16.2.0 → 17.0.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 +39 -0
- package/build/components/block-inspector/index.cjs +9 -6
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-keyboard-shortcuts/index.cjs +201 -0
- package/build/components/block-keyboard-shortcuts/index.cjs.map +7 -0
- package/build/components/block-list/block.cjs +10 -3
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-list/index.cjs +6 -1
- package/build/components/block-list/index.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs +4 -0
- package/build/components/block-list/use-block-props/use-focus-first-element.cjs.map +2 -2
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs +6 -7
- package/build/components/block-list/use-block-props/use-selected-block-event-handlers.cjs.map +2 -2
- package/build/components/block-parent-selector/index.cjs +98 -29
- package/build/components/block-parent-selector/index.cjs.map +3 -3
- package/build/components/block-popover/inbetween.cjs +2 -2
- package/build/components/block-popover/inbetween.cjs.map +2 -2
- package/build/components/block-preview/index.cjs +0 -4
- package/build/components/block-preview/index.cjs.map +2 -2
- package/build/components/block-styles/index.cjs +77 -33
- package/build/components/block-styles/index.cjs.map +3 -3
- package/build/components/block-visibility/constants.cjs.map +2 -2
- package/build/components/child-layout-control/index.cjs.map +2 -2
- package/build/components/colors/with-colors.cjs +55 -71
- package/build/components/colors/with-colors.cjs.map +2 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs +4 -2
- package/build/components/dimensions-tool/aspect-ratio-tool.cjs.map +2 -2
- package/build/components/dimensions-tool/index.cjs +18 -16
- package/build/components/dimensions-tool/index.cjs.map +2 -2
- package/build/components/dimensions-tool/utils.cjs +61 -0
- package/build/components/dimensions-tool/utils.cjs.map +7 -0
- package/build/components/duotone-control/index.cjs +2 -0
- package/build/components/duotone-control/index.cjs.map +2 -2
- package/build/components/global-styles/advanced-panel.cjs.map +3 -3
- package/build/components/global-styles/border-panel.cjs +2 -5
- package/build/components/global-styles/border-panel.cjs.map +2 -2
- package/build/components/global-styles/color-panel.cjs +14 -2
- package/build/components/global-styles/color-panel.cjs.map +2 -2
- package/build/components/global-styles/dimensions-panel.cjs +9 -5
- package/build/components/global-styles/dimensions-panel.cjs.map +2 -2
- package/build/components/global-styles/filters-panel.cjs +12 -8
- package/build/components/global-styles/filters-panel.cjs.map +2 -2
- package/build/components/global-styles/shadow-panel-components.cjs +16 -11
- package/build/components/global-styles/shadow-panel-components.cjs.map +2 -2
- package/build/components/global-styles/utils.cjs +9 -0
- package/build/components/global-styles/utils.cjs.map +2 -2
- package/build/components/inner-blocks/index.cjs +5 -3
- package/build/components/inner-blocks/index.cjs.map +2 -2
- package/build/components/inserter/block-patterns-explorer/index.cjs +39 -22
- package/build/components/inserter/block-patterns-explorer/index.cjs.map +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.cjs +21 -55
- package/build/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.cjs.map +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.cjs +19 -44
- package/build/components/inserter/block-patterns-explorer/pattern-list.cjs.map +3 -3
- package/build/components/inserter/hooks/use-insertion-point.cjs +4 -4
- package/build/components/inserter/hooks/use-insertion-point.cjs.map +2 -2
- package/build/components/inserter/menu.cjs +18 -7
- package/build/components/inserter/menu.cjs.map +2 -2
- package/build/components/inserter/quick-inserter.cjs +30 -27
- package/build/components/inserter/quick-inserter.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/styles-tab.cjs +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.cjs.map +2 -2
- package/build/components/list-view/index.cjs +31 -5
- package/build/components/list-view/index.cjs.map +3 -3
- package/build/components/list-view/utils.cjs +13 -1
- package/build/components/list-view/utils.cjs.map +2 -2
- package/build/components/media-placeholder/index.cjs +1 -1
- package/build/components/media-placeholder/index.cjs.map +3 -3
- package/build/components/provider/index.cjs +5 -1
- package/build/components/provider/index.cjs.map +3 -3
- package/build/components/publish-date-time-picker/index.cjs +3 -2
- package/build/components/publish-date-time-picker/index.cjs.map +2 -2
- package/build/components/rich-text/event-listeners/enter.cjs +46 -39
- package/build/components/rich-text/event-listeners/enter.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +7 -5
- package/build/components/rich-text/index.cjs.map +2 -2
- package/build/components/rich-text/multiline.cjs +105 -70
- package/build/components/rich-text/multiline.cjs.map +3 -3
- package/build/components/url-input/index.cjs.map +2 -2
- package/build/components/writing-flow/use-input.cjs +65 -13
- package/build/components/writing-flow/use-input.cjs.map +3 -3
- package/build/hooks/border.cjs +25 -3
- package/build/hooks/border.cjs.map +2 -2
- package/build/hooks/dimensions.cjs +9 -2
- package/build/hooks/dimensions.cjs.map +2 -2
- package/build/hooks/duotone.cjs +4 -3
- package/build/hooks/duotone.cjs.map +2 -2
- package/build/hooks/gap.cjs +8 -2
- package/build/hooks/gap.cjs.map +2 -2
- package/build/hooks/layout-child.cjs +35 -13
- package/build/hooks/layout-child.cjs.map +2 -2
- package/build/hooks/layout.cjs +23 -1
- package/build/hooks/layout.cjs.map +2 -2
- package/build/hooks/states.cjs +7 -4
- package/build/hooks/states.cjs.map +2 -2
- package/build/layouts/constrained.cjs +8 -1
- package/build/layouts/constrained.cjs.map +2 -2
- package/build/layouts/flex.cjs +9 -0
- package/build/layouts/flex.cjs.map +2 -2
- package/build/layouts/flow.cjs +4 -1
- package/build/layouts/flow.cjs.map +2 -2
- package/build/layouts/grid.cjs +5 -1
- package/build/layouts/grid.cjs.map +2 -2
- package/build/private-apis.cjs +3 -1
- package/build/private-apis.cjs.map +2 -2
- package/build/store/actions.cjs +1 -1
- package/build/store/actions.cjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +9 -6
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-keyboard-shortcuts/index.mjs +173 -0
- package/build-module/components/block-keyboard-shortcuts/index.mjs.map +7 -0
- package/build-module/components/block-list/block.mjs +10 -3
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-list/index.mjs +6 -1
- package/build-module/components/block-list/index.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs +4 -0
- package/build-module/components/block-list/use-block-props/use-focus-first-element.mjs.map +2 -2
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs +6 -7
- package/build-module/components/block-list/use-block-props/use-selected-block-event-handlers.mjs.map +2 -2
- package/build-module/components/block-parent-selector/index.mjs +101 -32
- package/build-module/components/block-parent-selector/index.mjs.map +2 -2
- package/build-module/components/block-popover/inbetween.mjs +2 -2
- package/build-module/components/block-popover/inbetween.mjs.map +2 -2
- package/build-module/components/block-preview/index.mjs +0 -4
- package/build-module/components/block-preview/index.mjs.map +2 -2
- package/build-module/components/block-styles/index.mjs +79 -35
- package/build-module/components/block-styles/index.mjs.map +2 -2
- package/build-module/components/block-visibility/constants.mjs.map +2 -2
- package/build-module/components/child-layout-control/index.mjs +5 -5
- package/build-module/components/child-layout-control/index.mjs.map +1 -1
- package/build-module/components/colors/with-colors.mjs +56 -72
- package/build-module/components/colors/with-colors.mjs.map +2 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs +4 -2
- package/build-module/components/dimensions-tool/aspect-ratio-tool.mjs.map +2 -2
- package/build-module/components/dimensions-tool/index.mjs +19 -17
- package/build-module/components/dimensions-tool/index.mjs.map +2 -2
- package/build-module/components/dimensions-tool/utils.mjs +35 -0
- package/build-module/components/dimensions-tool/utils.mjs.map +7 -0
- package/build-module/components/duotone-control/index.mjs +2 -0
- package/build-module/components/duotone-control/index.mjs.map +2 -2
- package/build-module/components/global-styles/advanced-panel.mjs +5 -2
- package/build-module/components/global-styles/advanced-panel.mjs.map +2 -2
- package/build-module/components/global-styles/border-panel.mjs +2 -5
- package/build-module/components/global-styles/border-panel.mjs.map +2 -2
- package/build-module/components/global-styles/color-panel.mjs +14 -2
- package/build-module/components/global-styles/color-panel.mjs.map +2 -2
- package/build-module/components/global-styles/dimensions-panel.mjs +9 -5
- package/build-module/components/global-styles/dimensions-panel.mjs.map +2 -2
- package/build-module/components/global-styles/filters-panel.mjs +16 -9
- package/build-module/components/global-styles/filters-panel.mjs.map +2 -2
- package/build-module/components/global-styles/shadow-panel-components.mjs +16 -11
- package/build-module/components/global-styles/shadow-panel-components.mjs.map +2 -2
- package/build-module/components/global-styles/utils.mjs +8 -0
- package/build-module/components/global-styles/utils.mjs.map +2 -2
- package/build-module/components/inner-blocks/index.mjs +5 -3
- package/build-module/components/inner-blocks/index.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-explorer/index.mjs +39 -22
- package/build-module/components/inserter/block-patterns-explorer/index.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.mjs +22 -56
- package/build-module/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.mjs.map +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.mjs +20 -45
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.mjs.map +2 -2
- package/build-module/components/inserter/hooks/use-insertion-point.mjs +4 -4
- package/build-module/components/inserter/hooks/use-insertion-point.mjs.map +2 -2
- package/build-module/components/inserter/menu.mjs +19 -8
- package/build-module/components/inserter/menu.mjs.map +2 -2
- package/build-module/components/inserter/quick-inserter.mjs +30 -27
- package/build-module/components/inserter/quick-inserter.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.mjs.map +2 -2
- package/build-module/components/list-view/index.mjs +32 -5
- package/build-module/components/list-view/index.mjs.map +3 -3
- package/build-module/components/list-view/utils.mjs +13 -1
- package/build-module/components/list-view/utils.mjs.map +2 -2
- package/build-module/components/media-placeholder/index.mjs +3 -3
- package/build-module/components/media-placeholder/index.mjs.map +2 -2
- package/build-module/components/provider/index.mjs +6 -2
- package/build-module/components/provider/index.mjs.map +2 -2
- package/build-module/components/publish-date-time-picker/index.mjs +3 -2
- package/build-module/components/publish-date-time-picker/index.mjs.map +2 -2
- package/build-module/components/rich-text/event-listeners/enter.mjs +46 -39
- package/build-module/components/rich-text/event-listeners/enter.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +7 -5
- package/build-module/components/rich-text/index.mjs.map +2 -2
- package/build-module/components/rich-text/multiline.mjs +112 -72
- package/build-module/components/rich-text/multiline.mjs.map +2 -2
- package/build-module/components/url-input/index.mjs +2 -2
- package/build-module/components/url-input/index.mjs.map +1 -1
- package/build-module/components/writing-flow/use-input.mjs +66 -14
- package/build-module/components/writing-flow/use-input.mjs.map +3 -3
- package/build-module/hooks/border.mjs +26 -8
- package/build-module/hooks/border.mjs.map +2 -2
- package/build-module/hooks/dimensions.mjs +9 -2
- package/build-module/hooks/dimensions.mjs.map +2 -2
- package/build-module/hooks/duotone.mjs +8 -4
- package/build-module/hooks/duotone.mjs.map +2 -2
- package/build-module/hooks/gap.mjs +6 -1
- package/build-module/hooks/gap.mjs.map +2 -2
- package/build-module/hooks/layout-child.mjs +36 -13
- package/build-module/hooks/layout-child.mjs.map +2 -2
- package/build-module/hooks/layout.mjs +22 -1
- package/build-module/hooks/layout.mjs.map +2 -2
- package/build-module/hooks/states.mjs +8 -5
- package/build-module/hooks/states.mjs.map +2 -2
- package/build-module/layouts/constrained.mjs +8 -1
- package/build-module/layouts/constrained.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +9 -0
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/layouts/flow.mjs +4 -1
- package/build-module/layouts/flow.mjs.map +2 -2
- package/build-module/layouts/grid.mjs +5 -1
- package/build-module/layouts/grid.mjs.map +2 -2
- package/build-module/private-apis.mjs +3 -1
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/store/actions.mjs +1 -1
- package/build-module/store/actions.mjs.map +2 -2
- package/build-style/style-rtl.css +108 -71
- package/build-style/style.css +108 -71
- package/build-types/components/block-visibility/constants.d.ts +4 -3
- package/build-types/components/block-visibility/constants.d.ts.map +1 -1
- package/package.json +43 -43
- package/src/components/background-image-control/README.md +122 -0
- package/src/components/block-edit-visually-button/README.md +39 -0
- package/src/components/block-editing-mode/README.md +72 -0
- package/src/components/block-inspector/index.js +6 -6
- package/src/components/block-keyboard-shortcuts/index.js +256 -0
- package/src/components/block-list/block.js +7 -0
- package/src/components/block-list/index.js +7 -1
- package/src/components/block-list/use-block-props/use-focus-first-element.js +5 -0
- package/src/components/block-list/use-block-props/use-selected-block-event-handlers.js +6 -8
- package/src/components/block-parent-selector/index.js +111 -30
- package/src/components/block-popover/README.md +10 -3
- package/src/components/block-popover/inbetween.js +8 -2
- package/src/components/block-popover/stories/index.story.jsx +143 -0
- package/src/components/block-preview/index.js +0 -2
- package/src/components/block-styles/index.js +95 -43
- package/src/components/block-styles/style.scss +5 -34
- package/src/components/block-tools/style.scss +94 -0
- package/src/components/block-visibility/constants.ts +4 -3
- package/src/components/child-layout-control/index.js +5 -5
- package/src/components/color-palette/test/__snapshots__/control.js.snap +3 -29
- package/src/components/colors/test/with-colors.js +6 -7
- package/src/components/colors/with-colors.js +79 -105
- package/src/components/dimensions-tool/aspect-ratio-tool.js +16 -4
- package/src/components/dimensions-tool/index.js +34 -22
- package/src/components/dimensions-tool/test/index.js +166 -2
- package/src/components/dimensions-tool/test/utils.js +51 -0
- package/src/components/dimensions-tool/utils.js +67 -0
- package/src/components/duotone-control/index.js +2 -0
- package/src/components/duotone-control/test/index.js +100 -0
- package/src/components/global-styles/advanced-panel.js +5 -2
- package/src/components/global-styles/border-panel.js +11 -9
- package/src/components/global-styles/color-panel.js +13 -1
- package/src/components/global-styles/dimensions-panel.js +17 -5
- package/src/components/global-styles/filters-panel.js +24 -10
- package/src/components/global-styles/shadow-panel-components.js +38 -11
- package/src/components/global-styles/test/border-panel.js +230 -0
- package/src/components/global-styles/test/color-panel.js +24 -0
- package/src/components/global-styles/test/dimensions-panel.js +98 -7
- package/src/components/global-styles/test/filters-panel.js +84 -0
- package/src/components/global-styles/test/utils.js +30 -0
- package/src/components/global-styles/utils.js +23 -0
- package/src/components/inner-blocks/index.js +11 -2
- package/src/components/inner-blocks/stories/index.story.jsx +246 -0
- package/src/components/inserter/block-patterns-explorer/index.js +24 -11
- package/src/components/inserter/block-patterns-explorer/pattern-explorer-sidebar.js +18 -56
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +22 -47
- package/src/components/inserter/hooks/use-insertion-point.js +9 -4
- package/src/components/inserter/menu.js +23 -10
- package/src/components/inserter/quick-inserter.js +15 -13
- package/src/components/inserter/style.scss +44 -62
- package/src/components/inspector-controls-tabs/README.md +92 -0
- package/src/components/inspector-controls-tabs/styles-tab.js +1 -1
- package/src/components/link-control/test/index.js +5 -0
- package/src/components/list-view/index.js +50 -7
- package/src/components/list-view/utils.js +16 -1
- package/src/components/media-placeholder/index.js +9 -4
- package/src/components/plain-text/stories/index.story.jsx +3 -0
- package/src/components/provider/index.js +7 -1
- package/src/components/publish-date-time-picker/README.md +10 -0
- package/src/components/publish-date-time-picker/index.js +17 -14
- package/src/components/rich-text/event-listeners/enter.js +58 -45
- package/src/components/rich-text/index.js +9 -4
- package/src/components/rich-text/multiline.js +126 -86
- package/src/components/url-input/index.js +2 -2
- package/src/components/url-input/test/fixtures/validated-input-control-deprecation.js +27 -0
- package/src/components/url-input/test/index.js +5 -0
- package/src/components/url-popover/README.md +7 -0
- package/src/components/url-popover/stories/index.story.jsx +133 -47
- package/src/components/writing-flow/use-input.js +105 -15
- package/src/hooks/border.js +27 -8
- package/src/hooks/dimensions.js +8 -1
- package/src/hooks/duotone.js +23 -7
- package/src/hooks/gap.js +16 -0
- package/src/hooks/layout-child.js +41 -9
- package/src/hooks/layout.js +117 -71
- package/src/hooks/states.js +8 -5
- package/src/hooks/test/gap.js +31 -1
- package/src/hooks/test/layout-child.js +60 -1
- package/src/hooks/test/layout.js +27 -0
- package/src/layouts/constrained.js +9 -1
- package/src/layouts/flex.js +15 -0
- package/src/layouts/flow.js +4 -1
- package/src/layouts/grid.js +9 -1
- package/src/layouts/test/constrained.js +26 -0
- package/src/layouts/test/flow.js +26 -0
- package/src/layouts/test/grid.js +46 -0
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +14 -1
- package/build/components/floating-toolbar/nav-up-icon.cjs +0 -52
- package/build/components/floating-toolbar/nav-up-icon.cjs.map +0 -7
- package/build/components/gradients/with-gradient.cjs +0 -36
- package/build/components/gradients/with-gradient.cjs.map +0 -7
- package/build/components/inserter-button/sparkles.cjs +0 -36
- package/build/components/inserter-button/sparkles.cjs.map +0 -7
- package/build-module/components/floating-toolbar/nav-up-icon.mjs +0 -31
- package/build-module/components/floating-toolbar/nav-up-icon.mjs.map +0 -7
- package/build-module/components/gradients/with-gradient.mjs +0 -11
- package/build-module/components/gradients/with-gradient.mjs.map +0 -7
- package/build-module/components/inserter-button/sparkles.mjs +0 -15
- package/build-module/components/inserter-button/sparkles.mjs.map +0 -7
- package/build-style/default-editor-styles-rtl.css +0 -68
- package/build-style/default-editor-styles.css +0 -68
- package/src/components/floating-toolbar/nav-up-icon.js +0 -22
- package/src/components/gradients/with-gradient.js +0 -9
- package/src/components/inserter-button/README.md +0 -62
- package/src/components/inserter-button/sparkles.js +0 -12
- package/src/default-editor-styles.scss +0 -25
|
@@ -119,6 +119,14 @@
|
|
|
119
119
|
margin-left: 0;
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
// Make room for the inserter next to the parent selector.
|
|
124
|
+
&.has-parent:has(.block-editor-block-parent-selector__inserter) {
|
|
125
|
+
margin-left: calc(#{$grid-unit-60} + #{$grid-unit-30} + #{$grid-unit-15} + #{$grid-unit-10} + 2 * #{$border-width});
|
|
126
|
+
.show-icon-labels & {
|
|
127
|
+
margin-left: 0;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
.block-editor-block-toolbar {
|
|
@@ -149,6 +157,92 @@
|
|
|
149
157
|
position: absolute;
|
|
150
158
|
left: calc(-#{$grid-unit-60} - #{$grid-unit-10} - #{$border-width});
|
|
151
159
|
|
|
160
|
+
// With the inserter next to the parent button, the border moves to
|
|
161
|
+
// the shared container so the pair reads as one toolbar segment.
|
|
162
|
+
// The toolbar group sizing comes from the components-toolbar-group
|
|
163
|
+
// class the container carries when the inserter is in it; only the
|
|
164
|
+
// detached position and the full border are its own.
|
|
165
|
+
&:has(.block-editor-block-parent-selector__inserter) {
|
|
166
|
+
left: calc(-#{$grid-unit-60} - #{$grid-unit-30} - #{$grid-unit-15} - #{$grid-unit-10} - 3 * #{$border-width});
|
|
167
|
+
border: $border-width solid $gray-900;
|
|
168
|
+
border-radius: $radius-small;
|
|
169
|
+
// The box paints the background, like the toolbar box does for
|
|
170
|
+
// its groups.
|
|
171
|
+
background-color: $white;
|
|
172
|
+
|
|
173
|
+
// The same rule the Toolbar container has for its last group;
|
|
174
|
+
// this box stands in for it here.
|
|
175
|
+
> .components-toolbar-group:last-child {
|
|
176
|
+
border-right: none;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.block-editor-block-parent-selector__button {
|
|
180
|
+
// Buttons in a toolbar are transparent; the box paints the
|
|
181
|
+
// background and border behind them.
|
|
182
|
+
border: none;
|
|
183
|
+
background: none;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.block-editor-block-parent-selector__inserter.components-button.has-icon {
|
|
188
|
+
color: $white;
|
|
189
|
+
background: transparent;
|
|
190
|
+
|
|
191
|
+
// The black square every other inserter has, drawn under the
|
|
192
|
+
// icon in the middle of the target.
|
|
193
|
+
&::after {
|
|
194
|
+
content: "";
|
|
195
|
+
position: absolute;
|
|
196
|
+
z-index: -1;
|
|
197
|
+
top: 50%;
|
|
198
|
+
left: 50%;
|
|
199
|
+
transform: translate(-50%, -50%);
|
|
200
|
+
width: $button-size-small;
|
|
201
|
+
height: $button-size-small;
|
|
202
|
+
border-radius: $radius-small;
|
|
203
|
+
background: $gray-900;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
&:hover {
|
|
207
|
+
color: $white;
|
|
208
|
+
|
|
209
|
+
&::after {
|
|
210
|
+
background: var(--wp-admin-theme-color);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// With the text labels preference, the button shows its label
|
|
215
|
+
// like every other toolbar button, not the black square.
|
|
216
|
+
.show-icon-labels & {
|
|
217
|
+
width: auto;
|
|
218
|
+
padding: 0 $grid-unit-15;
|
|
219
|
+
color: inherit;
|
|
220
|
+
|
|
221
|
+
svg {
|
|
222
|
+
display: none;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
&::after {
|
|
226
|
+
content: attr(aria-label);
|
|
227
|
+
position: static;
|
|
228
|
+
transform: none;
|
|
229
|
+
width: auto;
|
|
230
|
+
height: auto;
|
|
231
|
+
border-radius: 0;
|
|
232
|
+
background: none;
|
|
233
|
+
white-space: nowrap;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
&:hover {
|
|
237
|
+
color: var(--wp-admin-theme-color);
|
|
238
|
+
|
|
239
|
+
&::after {
|
|
240
|
+
background: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
152
246
|
&::before {
|
|
153
247
|
content: "";
|
|
154
248
|
}
|
|
@@ -10,9 +10,10 @@ export type BlockVisibilityViewport = 'desktop' | 'tablet' | 'mobile';
|
|
|
10
10
|
/**
|
|
11
11
|
* The choices for the block visibility.
|
|
12
12
|
*
|
|
13
|
-
* Duplicated in packages/editor/src/components/preview-dropdown/index.js (choices
|
|
14
|
-
*
|
|
15
|
-
* (
|
|
13
|
+
* Duplicated in packages/editor/src/components/preview-dropdown/index.js (choices
|
|
14
|
+
* array), packages/edit-site/src/components/block-editor/viewport.js and
|
|
15
|
+
* packages/boot/src/components/canvas/viewport.ts (VALID_VIEWPORTS). Update all
|
|
16
|
+
* four when adding new viewport types.
|
|
16
17
|
*
|
|
17
18
|
* @todo create a single source of truth for the viewport types.
|
|
18
19
|
*/
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
3
3
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
4
4
|
__experimentalUnitControl as UnitControl,
|
|
5
|
-
__experimentalInputControl as
|
|
5
|
+
__experimentalInputControl as WCInputControl,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
8
8
|
__experimentalUseCustomUnits as useCustomUnits,
|
|
@@ -298,7 +298,7 @@ function GridControls( {
|
|
|
298
298
|
panelId={ panelId }
|
|
299
299
|
>
|
|
300
300
|
<FlexItem style={ { width: '50%' } }>
|
|
301
|
-
<
|
|
301
|
+
<WCInputControl
|
|
302
302
|
label={ __( 'Column span' ) }
|
|
303
303
|
type="number"
|
|
304
304
|
onChange={ ( value ) => {
|
|
@@ -322,7 +322,7 @@ function GridControls( {
|
|
|
322
322
|
/>
|
|
323
323
|
</FlexItem>
|
|
324
324
|
<FlexItem style={ { width: '50%' } }>
|
|
325
|
-
<
|
|
325
|
+
<WCInputControl
|
|
326
326
|
label={ __( 'Row span' ) }
|
|
327
327
|
type="number"
|
|
328
328
|
onChange={ ( value ) => {
|
|
@@ -359,7 +359,7 @@ function GridControls( {
|
|
|
359
359
|
panelId={ panelId }
|
|
360
360
|
>
|
|
361
361
|
<FlexItem style={ { width: '50%' } }>
|
|
362
|
-
<
|
|
362
|
+
<WCInputControl
|
|
363
363
|
label={ __( 'Column' ) }
|
|
364
364
|
type="number"
|
|
365
365
|
onChange={ ( value ) => {
|
|
@@ -393,7 +393,7 @@ function GridControls( {
|
|
|
393
393
|
/>
|
|
394
394
|
</FlexItem>
|
|
395
395
|
<FlexItem style={ { width: '50%' } }>
|
|
396
|
-
<
|
|
396
|
+
<WCInputControl
|
|
397
397
|
label={ __( 'Row' ) }
|
|
398
398
|
type="number"
|
|
399
399
|
onChange={ ( value ) => {
|
|
@@ -1,38 +1,12 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
4
|
-
.emotion-0 {
|
|
5
|
-
font-family: -apple-system,system-ui,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',sans-serif;
|
|
6
|
-
font-size: 13px;
|
|
7
|
-
box-sizing: border-box;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.emotion-0 *,
|
|
11
|
-
.emotion-0 *::before,
|
|
12
|
-
.emotion-0 *::after {
|
|
13
|
-
box-sizing: inherit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.components-panel__row .emotion-2 {
|
|
17
|
-
margin-bottom: inherit;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.emotion-4 {
|
|
21
|
-
font-size: 11px;
|
|
22
|
-
font-weight: 600;
|
|
23
|
-
line-height: 1.4;
|
|
24
|
-
text-transform: uppercase;
|
|
25
|
-
display: block;
|
|
26
|
-
margin-bottom: calc(4px * 2);
|
|
27
|
-
padding: 0;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
4
|
<div>
|
|
31
5
|
<div
|
|
32
|
-
class="components-base-control block-editor-color-gradient-control
|
|
6
|
+
class="style-wrapper components-base-control block-editor-color-gradient-control"
|
|
33
7
|
>
|
|
34
8
|
<div
|
|
35
|
-
class="components-base-control__field
|
|
9
|
+
class="style-field components-base-control__field"
|
|
36
10
|
>
|
|
37
11
|
<fieldset
|
|
38
12
|
class="block-editor-color-gradient-control__fieldset"
|
|
@@ -48,7 +22,7 @@ exports[`ColorPaletteControl matches the snapshot 1`] = `
|
|
|
48
22
|
class="block-editor-color-gradient-control__color-indicator"
|
|
49
23
|
>
|
|
50
24
|
<span
|
|
51
|
-
class="components-base-control__label
|
|
25
|
+
class="style-label components-base-control__label"
|
|
52
26
|
>
|
|
53
27
|
Test Color
|
|
54
28
|
</span>
|
|
@@ -17,17 +17,16 @@ describe( 'createCustomColorsHOC', () => {
|
|
|
17
17
|
|
|
18
18
|
expect( BaseComponent ).toHaveBeenCalledWith(
|
|
19
19
|
expect.objectContaining( {
|
|
20
|
-
attributes: {
|
|
20
|
+
attributes: expect.objectContaining( {
|
|
21
21
|
backgroundColor: null,
|
|
22
|
-
},
|
|
23
|
-
backgroundColor: {
|
|
22
|
+
} ),
|
|
23
|
+
backgroundColor: expect.objectContaining( {
|
|
24
24
|
class: undefined,
|
|
25
25
|
color: undefined,
|
|
26
|
-
},
|
|
27
|
-
colorUtils: {
|
|
26
|
+
} ),
|
|
27
|
+
colorUtils: expect.objectContaining( {
|
|
28
28
|
getMostReadableColor: expect.any( Function ),
|
|
29
|
-
},
|
|
30
|
-
colors: undefined,
|
|
29
|
+
} ),
|
|
31
30
|
setBackgroundColor: expect.any( Function ),
|
|
32
31
|
} ),
|
|
33
32
|
expect.anything()
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useMemo,
|
|
1
|
+
import { useMemo, useRef } from '@wordpress/element';
|
|
2
2
|
import { compose, createHigherOrderComponent } from '@wordpress/compose';
|
|
3
3
|
import { kebabCase } from '@wordpress/kebab-case';
|
|
4
4
|
import {
|
|
@@ -87,119 +87,93 @@ function createColorHOC( colorTypes, withColorPalette ) {
|
|
|
87
87
|
return compose( [
|
|
88
88
|
withColorPalette,
|
|
89
89
|
( WrappedComponent ) => {
|
|
90
|
-
return
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
return function WithColors( props ) {
|
|
91
|
+
const { colors: _colors, ...passedProps } = props;
|
|
92
|
+
const { attributes, setAttributes } = passedProps;
|
|
93
|
+
const prevColorPropsRef = useRef( null );
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
getMostReadableColor:
|
|
97
|
-
this.getMostReadableColor.bind( this ),
|
|
98
|
-
};
|
|
95
|
+
const colorProps = useMemo( () => {
|
|
96
|
+
const prevColorProps = prevColorPropsRef.current;
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
const result = Object.fromEntries(
|
|
99
|
+
Object.entries( colorMap ).flatMap(
|
|
100
|
+
( [ colorAttributeName, colorContext ] ) => {
|
|
101
|
+
const customAttr = `custom${ upperFirst(
|
|
102
|
+
colorAttributeName
|
|
103
|
+
) }`;
|
|
104
|
+
const upperFirstColorAttributeName =
|
|
105
|
+
upperFirst( colorAttributeName );
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
const colorObject =
|
|
108
|
+
getColorObjectByAttributeValues(
|
|
109
|
+
_colors,
|
|
110
|
+
attributes[ colorAttributeName ],
|
|
111
|
+
attributes[ customAttr ]
|
|
112
|
+
);
|
|
107
113
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
-
{}
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
createSetColor( colorAttributeName, customColorAttributeName ) {
|
|
127
|
-
return ( colorValue ) => {
|
|
128
|
-
const colorObject = getColorObjectByColorValue(
|
|
129
|
-
this.props.colors,
|
|
130
|
-
colorValue
|
|
131
|
-
);
|
|
132
|
-
this.props.setAttributes( {
|
|
133
|
-
[ colorAttributeName ]:
|
|
134
|
-
colorObject && colorObject.slug
|
|
135
|
-
? colorObject.slug
|
|
136
|
-
: undefined,
|
|
137
|
-
[ customColorAttributeName ]:
|
|
138
|
-
colorObject && colorObject.slug
|
|
139
|
-
? undefined
|
|
140
|
-
: colorValue,
|
|
141
|
-
} );
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static getDerivedStateFromProps(
|
|
146
|
-
{ attributes, colors },
|
|
147
|
-
previousState
|
|
148
|
-
) {
|
|
149
|
-
return Object.entries( colorMap ).reduce(
|
|
150
|
-
( newState, [ colorAttributeName, colorContext ] ) => {
|
|
151
|
-
const colorObject = getColorObjectByAttributeValues(
|
|
152
|
-
colors,
|
|
153
|
-
attributes[ colorAttributeName ],
|
|
154
|
-
attributes[
|
|
155
|
-
`custom${ upperFirst(
|
|
156
|
-
colorAttributeName
|
|
157
|
-
) }`
|
|
158
|
-
]
|
|
159
|
-
);
|
|
114
|
+
const prevColorValue =
|
|
115
|
+
prevColorProps?.[ colorAttributeName ];
|
|
116
|
+
const colorValue =
|
|
117
|
+
prevColorValue?.color ===
|
|
118
|
+
colorObject.color && prevColorValue
|
|
119
|
+
? prevColorValue
|
|
120
|
+
: {
|
|
121
|
+
...colorObject,
|
|
122
|
+
class: getColorClassName(
|
|
123
|
+
colorContext,
|
|
124
|
+
colorObject.slug
|
|
125
|
+
),
|
|
126
|
+
};
|
|
160
127
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
newState[ colorAttributeName ] = {
|
|
177
|
-
...colorObject,
|
|
178
|
-
class: getColorClassName(
|
|
179
|
-
colorContext,
|
|
180
|
-
colorObject.slug
|
|
181
|
-
),
|
|
128
|
+
const setter = ( newColorValue ) => {
|
|
129
|
+
const resolvedColorObject =
|
|
130
|
+
getColorObjectByColorValue(
|
|
131
|
+
_colors,
|
|
132
|
+
newColorValue
|
|
133
|
+
);
|
|
134
|
+
setAttributes( {
|
|
135
|
+
[ colorAttributeName ]:
|
|
136
|
+
resolvedColorObject?.slug ||
|
|
137
|
+
undefined,
|
|
138
|
+
[ customAttr ]:
|
|
139
|
+
resolvedColorObject?.slug
|
|
140
|
+
? undefined
|
|
141
|
+
: newColorValue,
|
|
142
|
+
} );
|
|
182
143
|
};
|
|
144
|
+
|
|
145
|
+
return [
|
|
146
|
+
[ colorAttributeName, colorValue ],
|
|
147
|
+
[
|
|
148
|
+
`set${ upperFirstColorAttributeName }`,
|
|
149
|
+
setter,
|
|
150
|
+
],
|
|
151
|
+
];
|
|
183
152
|
}
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
{}
|
|
153
|
+
)
|
|
187
154
|
);
|
|
188
|
-
}
|
|
189
155
|
|
|
190
|
-
|
|
191
|
-
return
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
156
|
+
prevColorPropsRef.current = result;
|
|
157
|
+
return result;
|
|
158
|
+
}, [ attributes, _colors, setAttributes ] );
|
|
159
|
+
|
|
160
|
+
const colorUtils = useMemo(
|
|
161
|
+
() => ( {
|
|
162
|
+
getMostReadableColor: ( colorValue ) =>
|
|
163
|
+
getMostReadableColor( _colors, colorValue ),
|
|
164
|
+
} ),
|
|
165
|
+
[ _colors ]
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
return (
|
|
169
|
+
<WrappedComponent
|
|
170
|
+
{ ...{
|
|
171
|
+
...passedProps,
|
|
172
|
+
...colorProps,
|
|
173
|
+
colorUtils,
|
|
174
|
+
} }
|
|
175
|
+
/>
|
|
176
|
+
);
|
|
203
177
|
};
|
|
204
178
|
},
|
|
205
179
|
] );
|
|
@@ -2,6 +2,7 @@ import { SelectControl } from '@wordpress/components';
|
|
|
2
2
|
import { __, _x } from '@wordpress/i18n';
|
|
3
3
|
import { useSettings } from '../use-settings';
|
|
4
4
|
import { InheritanceToolsPanelItem } from '../global-styles/inheritance';
|
|
5
|
+
import { findAspectRatioOption } from './utils';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {import('@wordpress/components/build-types/select-control/types').SelectControlProps} SelectControlProps
|
|
@@ -38,9 +39,6 @@ export default function AspectRatioTool( {
|
|
|
38
39
|
isInherited,
|
|
39
40
|
hasLocalOverride,
|
|
40
41
|
} ) {
|
|
41
|
-
// Match the CSS default so if the value is used directly in CSS it will look correct in the control.
|
|
42
|
-
const displayValue = value ?? 'auto';
|
|
43
|
-
|
|
44
42
|
const [ defaultRatios, themeRatios, showDefaultRatios ] = useSettings(
|
|
45
43
|
'dimensions.aspectRatios.default',
|
|
46
44
|
'dimensions.aspectRatios.theme',
|
|
@@ -75,6 +73,20 @@ export default function AspectRatioTool( {
|
|
|
75
73
|
},
|
|
76
74
|
];
|
|
77
75
|
|
|
76
|
+
const resolvedOptions = options ?? aspectRatioOptions;
|
|
77
|
+
|
|
78
|
+
// The value is free-form CSS, so it doesn't necessarily match an option as
|
|
79
|
+
// written, e.g. '1/1' and '1' describe the same ratio. Resolve it to the
|
|
80
|
+
// option that represents it, falling back to 'custom' so that a ratio
|
|
81
|
+
// without a matching preset isn't displayed as one of the presets. Values
|
|
82
|
+
// that are empty match the CSS default, so if the value is used directly in
|
|
83
|
+
// CSS it will look correct in the control.
|
|
84
|
+
const displayValue =
|
|
85
|
+
value === undefined || value === null || value === 'auto'
|
|
86
|
+
? 'auto'
|
|
87
|
+
: findAspectRatioOption( value, resolvedOptions )?.value ??
|
|
88
|
+
'custom';
|
|
89
|
+
|
|
78
90
|
return (
|
|
79
91
|
<InheritanceToolsPanelItem
|
|
80
92
|
className={ className }
|
|
@@ -91,7 +103,7 @@ export default function AspectRatioTool( {
|
|
|
91
103
|
<SelectControl
|
|
92
104
|
label={ __( 'Aspect ratio' ) }
|
|
93
105
|
value={ displayValue }
|
|
94
|
-
options={
|
|
106
|
+
options={ resolvedOptions }
|
|
95
107
|
onChange={ onChange }
|
|
96
108
|
/>
|
|
97
109
|
</InheritanceToolsPanelItem>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEffect, useRef } from '@wordpress/element';
|
|
2
2
|
import AspectRatioTool from './aspect-ratio-tool';
|
|
3
3
|
import ScaleTool from './scale-tool';
|
|
4
4
|
import WidthHeightTool from './width-height-tool';
|
|
@@ -68,13 +68,33 @@ function DimensionsTool( {
|
|
|
68
68
|
: value.aspectRatio;
|
|
69
69
|
const scale = value.scale === undefined ? null : value.scale;
|
|
70
70
|
|
|
71
|
-
// Keep track of state internally, so when the value is cleared by means
|
|
72
|
-
// other than directly editing that field, it's easier to restore the
|
|
73
|
-
// previous value.
|
|
74
|
-
const [ lastScale, setLastScale ] = useState( scale );
|
|
75
|
-
const [ lastAspectRatio, setLastAspectRatio ] = useState( aspectRatio );
|
|
76
71
|
const hasCustomAspectRatio = !! ( width && height );
|
|
77
72
|
|
|
73
|
+
// Keep track of the previous values, so when a value is cleared by means
|
|
74
|
+
// other than directly editing that field, it's easier to restore it. These
|
|
75
|
+
// are only ever read while handling a change, so they're kept in refs and
|
|
76
|
+
// synced from the value to stay correct when it is updated externally, e.g.
|
|
77
|
+
// by undo or by another client.
|
|
78
|
+
const lastScaleRef = useRef( scale );
|
|
79
|
+
const lastAspectRatioRef = useRef( aspectRatio );
|
|
80
|
+
|
|
81
|
+
useEffect( () => {
|
|
82
|
+
// Scale is cleared alongside the aspect ratio, so only remember the
|
|
83
|
+
// values it is actually set to.
|
|
84
|
+
if ( scale ) {
|
|
85
|
+
lastScaleRef.current = scale;
|
|
86
|
+
}
|
|
87
|
+
}, [ scale ] );
|
|
88
|
+
|
|
89
|
+
useEffect( () => {
|
|
90
|
+
// A custom aspect ratio, i.e. both a width and a height, clears the
|
|
91
|
+
// aspect ratio value. Keep the remembered one so it can be restored
|
|
92
|
+
// once the custom aspect ratio is removed.
|
|
93
|
+
if ( ! hasCustomAspectRatio ) {
|
|
94
|
+
lastAspectRatioRef.current = aspectRatio;
|
|
95
|
+
}
|
|
96
|
+
}, [ aspectRatio, hasCustomAspectRatio ] );
|
|
97
|
+
|
|
78
98
|
// 'custom' is not a valid value for CSS aspect-ratio, but it is used in the
|
|
79
99
|
// dropdown to indicate that setting both the width and height is the same
|
|
80
100
|
// as a custom aspect ratio.
|
|
@@ -97,8 +117,6 @@ function DimensionsTool( {
|
|
|
97
117
|
nextAspectRatio =
|
|
98
118
|
nextAspectRatio === 'auto' ? null : nextAspectRatio;
|
|
99
119
|
|
|
100
|
-
setLastAspectRatio( nextAspectRatio );
|
|
101
|
-
|
|
102
120
|
// Update aspectRatio.
|
|
103
121
|
if ( ! nextAspectRatio ) {
|
|
104
122
|
delete nextValue.aspectRatio;
|
|
@@ -109,11 +127,9 @@ function DimensionsTool( {
|
|
|
109
127
|
// Auto-update scale.
|
|
110
128
|
if ( ! nextAspectRatio ) {
|
|
111
129
|
delete nextValue.scale;
|
|
112
|
-
} else if ( lastScale ) {
|
|
113
|
-
nextValue.scale = lastScale;
|
|
114
130
|
} else {
|
|
115
|
-
nextValue.scale =
|
|
116
|
-
|
|
131
|
+
nextValue.scale =
|
|
132
|
+
lastScaleRef.current ?? defaultScale;
|
|
117
133
|
}
|
|
118
134
|
|
|
119
135
|
// Auto-update width and height.
|
|
@@ -154,8 +170,8 @@ function DimensionsTool( {
|
|
|
154
170
|
// Auto-update aspectRatio.
|
|
155
171
|
if ( nextWidth && nextHeight ) {
|
|
156
172
|
delete nextValue.aspectRatio;
|
|
157
|
-
} else if (
|
|
158
|
-
nextValue.aspectRatio =
|
|
173
|
+
} else if ( lastAspectRatioRef.current ) {
|
|
174
|
+
nextValue.aspectRatio = lastAspectRatioRef.current;
|
|
159
175
|
} else {
|
|
160
176
|
// No setting defaultAspectRatio here, because
|
|
161
177
|
// aspectRatio is optional in this scenario,
|
|
@@ -164,15 +180,13 @@ function DimensionsTool( {
|
|
|
164
180
|
|
|
165
181
|
// Auto-update scale.
|
|
166
182
|
if (
|
|
167
|
-
!
|
|
183
|
+
! lastAspectRatioRef.current &&
|
|
168
184
|
!! nextWidth !== !! nextHeight
|
|
169
185
|
) {
|
|
170
186
|
delete nextValue.scale;
|
|
171
|
-
} else if ( lastScale ) {
|
|
172
|
-
nextValue.scale = lastScale;
|
|
173
187
|
} else {
|
|
174
|
-
nextValue.scale =
|
|
175
|
-
|
|
188
|
+
nextValue.scale =
|
|
189
|
+
lastScaleRef.current ?? defaultScale;
|
|
176
190
|
}
|
|
177
191
|
|
|
178
192
|
onChange( nextValue );
|
|
@@ -184,12 +198,10 @@ function DimensionsTool( {
|
|
|
184
198
|
panelId={ panelId }
|
|
185
199
|
options={ scaleOptions }
|
|
186
200
|
defaultValue={ defaultScale }
|
|
187
|
-
value={
|
|
201
|
+
value={ scale }
|
|
188
202
|
onChange={ ( nextScale ) => {
|
|
189
203
|
const nextValue = { ...value };
|
|
190
204
|
|
|
191
|
-
setLastScale( nextScale );
|
|
192
|
-
|
|
193
205
|
// Update scale.
|
|
194
206
|
if ( ! nextScale ) {
|
|
195
207
|
delete nextValue.scale;
|