@wordpress/block-editor 12.5.0 → 12.6.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/README.md +0 -4
- package/build/components/block-draggable/index.js +6 -3
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-draggable/index.native.js +2 -2
- package/build/components/block-draggable/index.native.js.map +1 -1
- package/build/components/block-edit/edit.js +25 -13
- package/build/components/block-edit/edit.js.map +1 -1
- package/build/components/block-list/block-outline.native.js +14 -18
- package/build/components/block-list/block-outline.native.js.map +1 -1
- package/build/components/block-list/block.native.js +21 -42
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-mover/index.native.js +1 -1
- package/build/components/block-mover/index.native.js.map +1 -1
- package/build/components/block-removal-warning-modal/index.js +1 -4
- package/build/components/block-removal-warning-modal/index.js.map +1 -1
- package/build/components/block-settings/button.native.js +2 -2
- package/build/components/block-settings/button.native.js.map +1 -1
- package/build/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +7 -5
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build/components/block-toolbar/index.js +4 -3
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-toolbar/index.native.js +62 -3
- package/build/components/block-toolbar/index.native.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/global-styles/color-panel.js +21 -15
- package/build/components/global-styles/color-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +13 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/get-block-css-selector.js +4 -8
- package/build/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build/components/global-styles/hooks.js +13 -23
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +18 -3
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +12 -18
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +6 -6
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/iframe/index.js +36 -48
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/iframe/use-compatibility-styles.js +5 -0
- package/build/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build/components/index.js +1 -10
- package/build/components/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/index.native.js +3 -1
- package/build/components/inner-blocks/index.native.js.map +1 -1
- package/build/components/inner-blocks/use-nested-settings-update.js +33 -7
- package/build/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build/components/inserter/index.js +2 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/index.native.js +21 -32
- package/build/components/inserter/index.native.js.map +1 -1
- package/build/components/inserter/reusable-block-rename-hint.js +23 -3
- package/build/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build/components/link-control/index.js +4 -1
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/search-item.js +1 -1
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/components/list-view/use-list-view-client-ids.js +2 -2
- package/build/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build/components/media-placeholder/index.native.js +65 -31
- package/build/components/media-placeholder/index.native.js.map +1 -1
- package/build/components/preview-options/index.js +2 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/content.js +0 -36
- package/build/components/rich-text/content.js.map +1 -1
- package/build/components/rich-text/get-rich-text-values.js +118 -0
- package/build/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/axial.js +6 -2
- package/build/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/single.js +5 -1
- package/build/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build/components/spacing-sizes-control/utils.js +1 -1
- package/build/components/spacing-sizes-control/utils.js.map +1 -1
- package/build/components/use-block-display-information/index.js +7 -3
- package/build/components/use-block-display-information/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.native.js +49 -8
- package/build/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build/components/use-setting/index.js +5 -9
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/margin.js +1 -1
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +1 -1
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/utils.js +1 -7
- package/build/hooks/utils.js.map +1 -1
- package/build/private-apis.js +7 -3
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-selectors.js +5 -6
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +19 -8
- package/build/store/selectors.js.map +1 -1
- package/build/utils/object.js +38 -2
- package/build/utils/object.js.map +1 -1
- package/build-module/components/block-draggable/index.js +6 -3
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-draggable/index.native.js +2 -2
- package/build-module/components/block-draggable/index.native.js.map +1 -1
- package/build-module/components/block-edit/edit.js +27 -10
- package/build-module/components/block-edit/edit.js.map +1 -1
- package/build-module/components/block-list/block-outline.native.js +14 -18
- package/build-module/components/block-list/block-outline.native.js.map +1 -1
- package/build-module/components/block-list/block.native.js +24 -43
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-mover/index.native.js +3 -3
- package/build-module/components/block-mover/index.native.js.map +1 -1
- package/build-module/components/block-removal-warning-modal/index.js +1 -4
- package/build-module/components/block-removal-warning-modal/index.js.map +1 -1
- package/build-module/components/block-settings/button.native.js +3 -3
- package/build-module/components/block-settings/button.native.js.map +1 -1
- package/build-module/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +9 -7
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -0
- package/build-module/components/block-toolbar/index.js +4 -3
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.native.js +60 -4
- package/build-module/components/block-toolbar/index.native.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +3 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/global-styles/color-panel.js +21 -15
- package/build-module/components/global-styles/color-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +13 -2
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/get-block-css-selector.js +4 -8
- package/build-module/components/global-styles/get-block-css-selector.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +12 -22
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +18 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +13 -18
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +5 -5
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/iframe/index.js +37 -49
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/iframe/use-compatibility-styles.js +5 -0
- package/build-module/components/iframe/use-compatibility-styles.js.map +1 -1
- package/build-module/components/index.js +0 -5
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.native.js +3 -1
- package/build-module/components/inner-blocks/index.native.js.map +1 -1
- package/build-module/components/inner-blocks/use-nested-settings-update.js +30 -7
- package/build-module/components/inner-blocks/use-nested-settings-update.js.map +1 -1
- package/build-module/components/inserter/index.js +2 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/index.native.js +22 -33
- package/build-module/components/inserter/index.native.js.map +1 -1
- package/build-module/components/inserter/reusable-block-rename-hint.js +22 -3
- package/build-module/components/inserter/reusable-block-rename-hint.js.map +1 -1
- package/build-module/components/link-control/index.js +4 -1
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +1 -1
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/components/list-view/use-list-view-client-ids.js +2 -2
- package/build-module/components/list-view/use-list-view-client-ids.js.map +1 -1
- package/build-module/components/media-placeholder/index.native.js +66 -33
- package/build-module/components/media-placeholder/index.native.js.map +1 -1
- package/build-module/components/preview-options/index.js +2 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/content.js +1 -36
- package/build-module/components/rich-text/content.js.map +1 -1
- package/build-module/components/rich-text/get-rich-text-values.js +105 -0
- package/build-module/components/rich-text/get-rich-text-values.js.map +1 -0
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/axial.js +7 -3
- package/build-module/components/spacing-sizes-control/input-controls/axial.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/separated.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/separated.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/single.js +6 -2
- package/build-module/components/spacing-sizes-control/input-controls/single.js.map +1 -1
- package/build-module/components/spacing-sizes-control/utils.js +1 -1
- package/build-module/components/spacing-sizes-control/utils.js.map +1 -1
- package/build-module/components/use-block-display-information/index.js +7 -3
- package/build-module/components/use-block-display-information/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.native.js +50 -8
- package/build-module/components/use-block-drop-zone/index.native.js.map +1 -1
- package/build-module/components/use-setting/index.js +5 -9
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/margin.js +1 -1
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +1 -1
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/utils.js +2 -7
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/private-apis.js +5 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +16 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/object.js +34 -2
- package/build-module/utils/object.js.map +1 -1
- package/build-style/content-rtl.css +2 -1
- package/build-style/content.css +2 -1
- package/build-style/style-rtl.css +7 -1
- package/build-style/style.css +7 -1
- package/package.json +32 -32
- package/src/components/block-controls/README.md +89 -0
- package/src/components/block-draggable/index.js +13 -4
- package/src/components/block-draggable/index.native.js +7 -3
- package/src/components/block-draggable/test/index.native.js +0 -54
- package/src/components/block-edit/edit.js +26 -9
- package/src/components/block-edit/test/edit.js +1 -1
- package/src/components/block-list/block-outline.native.js +26 -25
- package/src/components/block-list/block.native.js +24 -38
- package/src/components/block-list/block.native.scss +18 -40
- package/src/components/block-list/style.native.scss +3 -3
- package/src/components/block-mover/index.native.js +3 -3
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +16 -6
- package/src/components/block-removal-warning-modal/index.js +0 -3
- package/src/components/block-settings/button.native.js +12 -6
- package/src/components/{block-mobile-toolbar/block-actions-menu.native.js → block-toolbar/block-toolbar-menu.native.js} +15 -10
- package/src/components/block-toolbar/index.js +2 -3
- package/src/components/block-toolbar/index.native.js +86 -6
- package/src/components/{block-mobile-toolbar/test/block-actions-menu.native.js → block-toolbar/test/block-toolbar-menu.native.js} +20 -54
- package/src/components/block-toolbar/test/index.native.js +42 -0
- package/src/components/button-block-appender/styles.native.scss +2 -2
- package/src/components/caption/README.md +49 -0
- package/src/components/colors-gradients/control.js +3 -2
- package/src/components/global-styles/color-panel.js +23 -16
- package/src/components/global-styles/dimensions-panel.js +8 -2
- package/src/components/global-styles/get-block-css-selector.js +5 -9
- package/src/components/global-styles/hooks.js +20 -26
- package/src/components/global-styles/typography-panel.js +17 -5
- package/src/components/global-styles/use-global-styles-output.js +36 -18
- package/src/components/global-styles/utils.js +15 -6
- package/src/components/iframe/index.js +30 -56
- package/src/components/iframe/use-compatibility-styles.js +5 -0
- package/src/components/index.js +0 -5
- package/src/components/inner-blocks/README.md +10 -0
- package/src/components/inner-blocks/index.js +4 -0
- package/src/components/inner-blocks/index.native.js +4 -0
- package/src/components/inner-blocks/use-nested-settings-update.js +32 -5
- package/src/components/inserter/index.js +2 -3
- package/src/components/inserter/index.native.js +17 -36
- package/src/components/inserter/reusable-block-rename-hint.js +18 -1
- package/src/components/inserter/style.native.scss +10 -15
- package/src/components/link-control/index.js +4 -1
- package/src/components/link-control/search-item.js +1 -1
- package/src/components/link-control/style.scss +8 -1
- package/src/components/link-control/test/index.js +26 -0
- package/src/components/list-view/use-list-view-client-ids.js +2 -2
- package/src/components/media-placeholder/index.native.js +108 -59
- package/src/components/media-placeholder/styles.native.scss +59 -24
- package/src/components/preview-options/README.md +18 -17
- package/src/components/preview-options/index.js +2 -2
- package/src/components/rich-text/content.js +1 -46
- package/src/components/rich-text/get-rich-text-values.js +105 -0
- package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +1 -1
- package/src/components/spacing-sizes-control/input-controls/axial.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/separated.js +17 -2
- package/src/components/spacing-sizes-control/input-controls/single.js +12 -2
- package/src/components/spacing-sizes-control/utils.js +1 -1
- package/src/components/text-transform-control/README.md +44 -0
- package/src/components/use-block-display-information/index.js +12 -5
- package/src/components/use-block-drop-zone/index.native.js +65 -28
- package/src/components/use-setting/index.js +8 -8
- package/src/hooks/margin.js +4 -1
- package/src/hooks/padding.js +4 -1
- package/src/hooks/utils.js +5 -7
- package/src/private-apis.js +7 -1
- package/src/store/actions.js +1 -2
- package/src/store/private-selectors.js +3 -6
- package/src/store/reducer.js +0 -1
- package/src/store/selectors.js +33 -5
- package/src/store/test/actions.js +3 -0
- package/src/store/test/private-selectors.js +5 -5
- package/src/store/test/reducer.js +14 -7
- package/src/store/test/selectors.js +1 -1
- package/src/utils/object.js +32 -2
- package/src/utils/test/object.js +36 -0
- package/build/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build/components/block-mobile-toolbar/index.native.js +0 -135
- package/build/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/block-actions-menu.native.js.map +0 -1
- package/build-module/components/block-mobile-toolbar/index.native.js +0 -116
- package/build-module/components/block-mobile-toolbar/index.native.js.map +0 -1
- package/src/components/block-mobile-toolbar/index.native.js +0 -127
- package/src/components/block-mobile-toolbar/style.native.scss +0 -16
- /package/src/components/{block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap → block-toolbar/test/__snapshots__/block-toolbar-menu.native.js.snap} +0 -0
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get, set } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -32,7 +27,11 @@ import { PresetDuotoneFilter } from '../duotone/components';
|
|
|
32
27
|
import { getGapCSSValue } from '../../hooks/gap';
|
|
33
28
|
import { store as blockEditorStore } from '../../store';
|
|
34
29
|
import { LAYOUT_DEFINITIONS } from '../../layouts/definitions';
|
|
35
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
getValueFromObjectPath,
|
|
32
|
+
kebabCase,
|
|
33
|
+
setImmutably,
|
|
34
|
+
} from '../../utils/object';
|
|
36
35
|
|
|
37
36
|
// List of block support features that can have their related styles
|
|
38
37
|
// generated under their own feature level selector rather than the block's.
|
|
@@ -69,7 +68,11 @@ function compileStyleValue( uncompiledValue ) {
|
|
|
69
68
|
function getPresetsDeclarations( blockPresets = {}, mergedSettings ) {
|
|
70
69
|
return PRESET_METADATA.reduce(
|
|
71
70
|
( declarations, { path, valueKey, valueFunc, cssVarInfix } ) => {
|
|
72
|
-
const presetByOrigin =
|
|
71
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
72
|
+
blockPresets,
|
|
73
|
+
path,
|
|
74
|
+
[]
|
|
75
|
+
);
|
|
73
76
|
[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
|
|
74
77
|
if ( presetByOrigin[ origin ] ) {
|
|
75
78
|
presetByOrigin[ origin ].forEach( ( value ) => {
|
|
@@ -113,7 +116,11 @@ function getPresetsClasses( blockSelector = '*', blockPresets = {} ) {
|
|
|
113
116
|
return declarations;
|
|
114
117
|
}
|
|
115
118
|
|
|
116
|
-
const presetByOrigin =
|
|
119
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
120
|
+
blockPresets,
|
|
121
|
+
path,
|
|
122
|
+
[]
|
|
123
|
+
);
|
|
117
124
|
[ 'default', 'theme', 'custom' ].forEach( ( origin ) => {
|
|
118
125
|
if ( presetByOrigin[ origin ] ) {
|
|
119
126
|
presetByOrigin[ origin ].forEach( ( { slug } ) => {
|
|
@@ -147,7 +154,11 @@ function getPresetsSvgFilters( blockPresets = {} ) {
|
|
|
147
154
|
// Duotone are the only type of filters for now.
|
|
148
155
|
( metadata ) => metadata.path.at( -1 ) === 'duotone'
|
|
149
156
|
).flatMap( ( metadata ) => {
|
|
150
|
-
const presetByOrigin =
|
|
157
|
+
const presetByOrigin = getValueFromObjectPath(
|
|
158
|
+
blockPresets,
|
|
159
|
+
metadata.path,
|
|
160
|
+
{}
|
|
161
|
+
);
|
|
151
162
|
return [ 'default', 'theme' ]
|
|
152
163
|
.filter( ( origin ) => presetByOrigin[ origin ] )
|
|
153
164
|
.flatMap( ( origin ) =>
|
|
@@ -319,7 +330,10 @@ export function getStylesDeclarations(
|
|
|
319
330
|
return declarations;
|
|
320
331
|
}
|
|
321
332
|
|
|
322
|
-
const styleValue =
|
|
333
|
+
const styleValue = getValueFromObjectPath(
|
|
334
|
+
blockStyles,
|
|
335
|
+
pathToValue
|
|
336
|
+
);
|
|
323
337
|
|
|
324
338
|
// Root-level padding styles don't currently support strings with CSS shorthand values.
|
|
325
339
|
// This may change: https://github.com/WordPress/gutenberg/issues/40132.
|
|
@@ -334,7 +348,9 @@ export function getStylesDeclarations(
|
|
|
334
348
|
Object.entries( properties ).forEach( ( entry ) => {
|
|
335
349
|
const [ name, prop ] = entry;
|
|
336
350
|
|
|
337
|
-
if (
|
|
351
|
+
if (
|
|
352
|
+
! getValueFromObjectPath( styleValue, [ prop ], false )
|
|
353
|
+
) {
|
|
338
354
|
// Do not create a declaration
|
|
339
355
|
// for sub-properties that don't have any value.
|
|
340
356
|
return;
|
|
@@ -345,17 +361,19 @@ export function getStylesDeclarations(
|
|
|
345
361
|
: kebabCase( name );
|
|
346
362
|
declarations.push(
|
|
347
363
|
`${ cssProperty }: ${ compileStyleValue(
|
|
348
|
-
|
|
364
|
+
getValueFromObjectPath( styleValue, [ prop ] )
|
|
349
365
|
) }`
|
|
350
366
|
);
|
|
351
367
|
} );
|
|
352
|
-
} else if (
|
|
368
|
+
} else if (
|
|
369
|
+
getValueFromObjectPath( blockStyles, pathToValue, false )
|
|
370
|
+
) {
|
|
353
371
|
const cssProperty = key.startsWith( '--' )
|
|
354
372
|
? key
|
|
355
373
|
: kebabCase( key );
|
|
356
374
|
declarations.push(
|
|
357
375
|
`${ cssProperty }: ${ compileStyleValue(
|
|
358
|
-
|
|
376
|
+
getValueFromObjectPath( blockStyles, pathToValue )
|
|
359
377
|
) }`
|
|
360
378
|
);
|
|
361
379
|
}
|
|
@@ -384,7 +402,7 @@ export function getStylesDeclarations(
|
|
|
384
402
|
let ruleValue = rule.value;
|
|
385
403
|
if ( typeof ruleValue !== 'string' && ruleValue?.ref ) {
|
|
386
404
|
const refPath = ruleValue.ref.split( '.' );
|
|
387
|
-
ruleValue =
|
|
405
|
+
ruleValue = getValueFromObjectPath( tree, refPath );
|
|
388
406
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
389
407
|
// Pointing to another dynamic value is not supported.
|
|
390
408
|
if ( ! ruleValue || ruleValue?.ref ) {
|
|
@@ -678,11 +696,11 @@ export const getNodesWithSettings = ( tree, blockSelectors ) => {
|
|
|
678
696
|
}
|
|
679
697
|
|
|
680
698
|
const pickPresets = ( treeToPickFrom ) => {
|
|
681
|
-
|
|
699
|
+
let presets = {};
|
|
682
700
|
PRESET_METADATA.forEach( ( { path } ) => {
|
|
683
|
-
const value =
|
|
701
|
+
const value = getValueFromObjectPath( treeToPickFrom, path, false );
|
|
684
702
|
if ( value !== false ) {
|
|
685
|
-
|
|
703
|
+
presets = setImmutably( presets, path, value );
|
|
686
704
|
}
|
|
687
705
|
} );
|
|
688
706
|
return presets;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import fastDeepEqual from 'fast-deep-equal/es6';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -11,6 +10,7 @@ import {
|
|
|
11
10
|
getTypographyFontSizeValue,
|
|
12
11
|
getFluidTypographyOptionsFromSettings,
|
|
13
12
|
} from './typography-utils';
|
|
13
|
+
import { getValueFromObjectPath } from '../../utils/object';
|
|
14
14
|
|
|
15
15
|
/* Supporting data. */
|
|
16
16
|
export const ROOT_BLOCK_NAME = 'root';
|
|
@@ -168,8 +168,12 @@ function findInPresetsBy(
|
|
|
168
168
|
) {
|
|
169
169
|
// Block presets take priority above root level presets.
|
|
170
170
|
const orderedPresetsByOrigin = [
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
getValueFromObjectPath( features, [
|
|
172
|
+
'blocks',
|
|
173
|
+
blockName,
|
|
174
|
+
...presetPath,
|
|
175
|
+
] ),
|
|
176
|
+
getValueFromObjectPath( features, presetPath ),
|
|
173
177
|
];
|
|
174
178
|
|
|
175
179
|
for ( const presetByOrigin of orderedPresetsByOrigin ) {
|
|
@@ -282,8 +286,13 @@ function getValueFromPresetVariable(
|
|
|
282
286
|
|
|
283
287
|
function getValueFromCustomVariable( features, blockName, variable, path ) {
|
|
284
288
|
const result =
|
|
285
|
-
|
|
286
|
-
|
|
289
|
+
getValueFromObjectPath( features.settings, [
|
|
290
|
+
'blocks',
|
|
291
|
+
blockName,
|
|
292
|
+
'custom',
|
|
293
|
+
...path,
|
|
294
|
+
] ) ??
|
|
295
|
+
getValueFromObjectPath( features.settings, [ 'custom', ...path ] );
|
|
287
296
|
if ( ! result ) {
|
|
288
297
|
return variable;
|
|
289
298
|
}
|
|
@@ -303,7 +312,7 @@ export function getValueFromVariable( features, blockName, variable ) {
|
|
|
303
312
|
if ( ! variable || typeof variable !== 'string' ) {
|
|
304
313
|
if ( variable?.ref && typeof variable?.ref === 'string' ) {
|
|
305
314
|
const refPath = variable.ref.split( '.' );
|
|
306
|
-
variable =
|
|
315
|
+
variable = getValueFromObjectPath( features, refPath );
|
|
307
316
|
// Presence of another ref indicates a reference to another dynamic value.
|
|
308
317
|
// Pointing to another dynamic value is not supported.
|
|
309
318
|
if ( ! variable || !! variable?.ref ) {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
createPortal,
|
|
12
12
|
forwardRef,
|
|
13
13
|
useMemo,
|
|
14
|
-
useReducer,
|
|
15
14
|
useEffect,
|
|
16
15
|
} from '@wordpress/element';
|
|
17
16
|
import { __ } from '@wordpress/i18n';
|
|
@@ -78,29 +77,6 @@ function bubbleEvents( doc ) {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
function useParsedAssets( html ) {
|
|
82
|
-
return useMemo( () => {
|
|
83
|
-
const doc = document.implementation.createHTMLDocument( '' );
|
|
84
|
-
doc.body.innerHTML = html;
|
|
85
|
-
return Array.from( doc.body.children );
|
|
86
|
-
}, [ html ] );
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async function loadScript( head, { id, src } ) {
|
|
90
|
-
return new Promise( ( resolve, reject ) => {
|
|
91
|
-
const script = head.ownerDocument.createElement( 'script' );
|
|
92
|
-
script.id = id;
|
|
93
|
-
if ( src ) {
|
|
94
|
-
script.src = src;
|
|
95
|
-
script.onload = () => resolve();
|
|
96
|
-
script.onerror = () => reject();
|
|
97
|
-
} else {
|
|
98
|
-
resolve();
|
|
99
|
-
}
|
|
100
|
-
head.appendChild( script );
|
|
101
|
-
} );
|
|
102
|
-
}
|
|
103
|
-
|
|
104
80
|
function Iframe( {
|
|
105
81
|
contentRef,
|
|
106
82
|
children,
|
|
@@ -112,21 +88,25 @@ function Iframe( {
|
|
|
112
88
|
forwardedRef: ref,
|
|
113
89
|
...props
|
|
114
90
|
} ) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
91
|
+
const { resolvedAssets, isPreviewMode } = useSelect( ( select ) => {
|
|
92
|
+
const settings = select( blockEditorStore ).getSettings();
|
|
93
|
+
return {
|
|
94
|
+
resolvedAssets: settings.__unstableResolvedAssets,
|
|
95
|
+
isPreviewMode: settings.__unstableIsPreviewMode,
|
|
96
|
+
};
|
|
97
|
+
}, [] );
|
|
98
|
+
const { styles = '', scripts = '' } = resolvedAssets;
|
|
121
99
|
const [ iframeDocument, setIframeDocument ] = useState();
|
|
122
100
|
const [ bodyClasses, setBodyClasses ] = useState( [] );
|
|
123
101
|
const compatStyles = useCompatibilityStyles();
|
|
124
|
-
const scripts = useParsedAssets( assets?.scripts );
|
|
125
102
|
const clearerRef = useBlockSelectionClearer();
|
|
126
103
|
const [ before, writingFlowRef, after ] = useWritingFlow();
|
|
127
104
|
const [ contentResizeListener, { height: contentHeight } ] =
|
|
128
105
|
useResizeObserver();
|
|
129
106
|
const setRef = useRefEffect( ( node ) => {
|
|
107
|
+
node._load = () => {
|
|
108
|
+
setIframeDocument( node.contentDocument );
|
|
109
|
+
};
|
|
130
110
|
let iFrameDocument;
|
|
131
111
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
132
112
|
function preventFileDropDefault( event ) {
|
|
@@ -138,7 +118,6 @@ function Iframe( {
|
|
|
138
118
|
iFrameDocument = contentDocument;
|
|
139
119
|
|
|
140
120
|
bubbleEvents( contentDocument );
|
|
141
|
-
setIframeDocument( contentDocument );
|
|
142
121
|
clearerRef( documentElement );
|
|
143
122
|
|
|
144
123
|
// Ideally ALL classes that are added through get_body_class should
|
|
@@ -154,7 +133,6 @@ function Iframe( {
|
|
|
154
133
|
);
|
|
155
134
|
|
|
156
135
|
contentDocument.dir = ownerDocument.dir;
|
|
157
|
-
documentElement.removeChild( contentDocument.body );
|
|
158
136
|
|
|
159
137
|
for ( const compatStyle of compatStyles ) {
|
|
160
138
|
if ( contentDocument.getElementById( compatStyle.id ) ) {
|
|
@@ -165,11 +143,13 @@ function Iframe( {
|
|
|
165
143
|
compatStyle.cloneNode( true )
|
|
166
144
|
);
|
|
167
145
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
146
|
+
if ( ! isPreviewMode ) {
|
|
147
|
+
// eslint-disable-next-line no-console
|
|
148
|
+
console.warn(
|
|
149
|
+
`${ compatStyle.id } was added to the iframe incorrectly. Please use block.json or enqueue_block_assets to add styles to the iframe.`,
|
|
150
|
+
compatStyle
|
|
151
|
+
);
|
|
152
|
+
}
|
|
173
153
|
}
|
|
174
154
|
|
|
175
155
|
iFrameDocument.addEventListener(
|
|
@@ -199,35 +179,29 @@ function Iframe( {
|
|
|
199
179
|
};
|
|
200
180
|
}, [] );
|
|
201
181
|
|
|
202
|
-
const headRef = useRefEffect( ( element ) => {
|
|
203
|
-
scripts
|
|
204
|
-
.reduce(
|
|
205
|
-
( promise, script ) =>
|
|
206
|
-
promise.then( () => loadScript( element, script ) ),
|
|
207
|
-
Promise.resolve()
|
|
208
|
-
)
|
|
209
|
-
.finally( () => {
|
|
210
|
-
// When script are loaded, re-render blocks to allow them
|
|
211
|
-
// to initialise.
|
|
212
|
-
forceRender();
|
|
213
|
-
} );
|
|
214
|
-
}, [] );
|
|
215
182
|
const disabledRef = useDisabled( { isDisabled: ! readonly } );
|
|
216
183
|
const bodyRef = useMergeRefs( [
|
|
217
184
|
contentRef,
|
|
218
185
|
clearerRef,
|
|
219
186
|
writingFlowRef,
|
|
220
187
|
disabledRef,
|
|
221
|
-
headRef,
|
|
222
188
|
] );
|
|
223
189
|
|
|
224
190
|
// Correct doctype is required to enable rendering in standards
|
|
225
191
|
// mode. Also preload the styles to avoid a flash of unstyled
|
|
226
192
|
// content.
|
|
227
|
-
const html =
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(
|
|
193
|
+
const html = `<!doctype html>
|
|
194
|
+
<html>
|
|
195
|
+
<head>
|
|
196
|
+
<script>window.frameElement._load()</script>
|
|
197
|
+
<style>html{height:auto!important;min-height:100%;}body{margin:0}</style>
|
|
198
|
+
${ styles }
|
|
199
|
+
${ scripts }
|
|
200
|
+
</head>
|
|
201
|
+
<body>
|
|
202
|
+
<script>document.currentScript.parentElement.remove()</script>
|
|
203
|
+
</body>
|
|
204
|
+
</html>`;
|
|
231
205
|
|
|
232
206
|
const [ src, cleanup ] = useMemo( () => {
|
|
233
207
|
const _src = URL.createObjectURL(
|
|
@@ -45,6 +45,11 @@ export function useCompatibilityStyles() {
|
|
|
45
45
|
return accumulator;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// Don't try to add styles without ID. Styles enqueued via the WP dependency system will always have IDs.
|
|
49
|
+
if ( ! ownerNode.id ) {
|
|
50
|
+
return accumulator;
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
function matchFromRules( _cssRules ) {
|
|
49
54
|
return Array.from( _cssRules ).find(
|
|
50
55
|
( {
|
package/src/components/index.js
CHANGED
|
@@ -165,8 +165,3 @@ export { default as __experimentalInspectorPopoverHeader } from './inspector-pop
|
|
|
165
165
|
|
|
166
166
|
export { default as BlockEditorProvider } from './provider';
|
|
167
167
|
export { default as useSetting } from './use-setting';
|
|
168
|
-
|
|
169
|
-
/*
|
|
170
|
-
* The following rename hint component can be removed in 6.4.
|
|
171
|
-
*/
|
|
172
|
-
export { default as ReusableBlocksRenameHint } from './inserter/reusable-block-rename-hint';
|
|
@@ -185,3 +185,13 @@ For example, a button block, deeply nested in several levels of block `X` that u
|
|
|
185
185
|
|
|
186
186
|
- **Type:** `Array`
|
|
187
187
|
- **Default:** - `undefined`. Determines which block types should be shown in the block inserter. For example, when inserting a block within the Navigation block we specify `core/navigation-link` and `core/navigation-link/page` as these are the most commonly used inner blocks. `prioritizedInserterBlocks` takes an array of the form {blockName}/{variationName}, where {variationName} is optional.
|
|
188
|
+
|
|
189
|
+
### `defaultBlock`
|
|
190
|
+
|
|
191
|
+
- **Type:** `Array`
|
|
192
|
+
- **Default:** - `undefined`. Determines which block type should be inserted by default and any attributes that should be set by default when the block is inserted. Takes an array in the form of `[ blockname, {blockAttributes} ]`.
|
|
193
|
+
|
|
194
|
+
### `directInsert`
|
|
195
|
+
|
|
196
|
+
- **Type:** `Boolean`
|
|
197
|
+
- **Default:** - `undefined`. Determines whether the default block should be inserted directly into the InnerBlocks area by the block appender.
|
|
@@ -46,6 +46,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
46
46
|
clientId,
|
|
47
47
|
allowedBlocks,
|
|
48
48
|
prioritizedInserterBlocks,
|
|
49
|
+
defaultBlock,
|
|
50
|
+
directInsert,
|
|
49
51
|
__experimentalDefaultBlock,
|
|
50
52
|
__experimentalDirectInsert,
|
|
51
53
|
template,
|
|
@@ -64,6 +66,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
64
66
|
clientId,
|
|
65
67
|
allowedBlocks,
|
|
66
68
|
prioritizedInserterBlocks,
|
|
69
|
+
defaultBlock,
|
|
70
|
+
directInsert,
|
|
67
71
|
__experimentalDefaultBlock,
|
|
68
72
|
__experimentalDirectInsert,
|
|
69
73
|
templateLock,
|
|
@@ -73,6 +73,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
73
73
|
clientId,
|
|
74
74
|
allowedBlocks,
|
|
75
75
|
prioritizedInserterBlocks,
|
|
76
|
+
defaultBlock,
|
|
77
|
+
directInsert,
|
|
76
78
|
__experimentalDefaultBlock,
|
|
77
79
|
__experimentalDirectInsert,
|
|
78
80
|
template,
|
|
@@ -103,6 +105,8 @@ function UncontrolledInnerBlocks( props ) {
|
|
|
103
105
|
clientId,
|
|
104
106
|
allowedBlocks,
|
|
105
107
|
prioritizedInserterBlocks,
|
|
108
|
+
defaultBlock,
|
|
109
|
+
directInsert,
|
|
106
110
|
__experimentalDefaultBlock,
|
|
107
111
|
__experimentalDirectInsert,
|
|
108
112
|
templateLock,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useLayoutEffect, useMemo } from '@wordpress/element';
|
|
5
5
|
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
6
|
+
import deprecated from '@wordpress/deprecated';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
@@ -25,9 +26,13 @@ const pendingSettingsUpdates = new WeakMap();
|
|
|
25
26
|
* @param {string[]} allowedBlocks An array of block names which are permitted
|
|
26
27
|
* in inner blocks.
|
|
27
28
|
* @param {string[]} prioritizedInserterBlocks Block names and/or block variations to be prioritized in the inserter, in the format {blockName}/{variationName}.
|
|
28
|
-
* @param {?WPDirectInsertBlock}
|
|
29
|
-
* @param {?Function|boolean}
|
|
30
|
-
*
|
|
29
|
+
* @param {?WPDirectInsertBlock} defaultBlock The default block to insert: [ blockName, { blockAttributes } ].
|
|
30
|
+
* @param {?Function|boolean} directInsert If a default block should be inserted directly by the appender.
|
|
31
|
+
*
|
|
32
|
+
* @param {?WPDirectInsertBlock} __experimentalDefaultBlock A deprecated prop for the default block to insert: [ blockName, { blockAttributes } ]. Use `defaultBlock` instead.
|
|
33
|
+
*
|
|
34
|
+
* @param {?Function|boolean} __experimentalDirectInsert A deprecated prop for whether a default block should be inserted directly by the appender. Use `directInsert` instead.
|
|
35
|
+
*
|
|
31
36
|
* @param {string} [templateLock] The template lock specified for the inner
|
|
32
37
|
* blocks component. (e.g. "all")
|
|
33
38
|
* @param {boolean} captureToolbars Whether or children toolbars should be shown
|
|
@@ -41,6 +46,8 @@ export default function useNestedSettingsUpdate(
|
|
|
41
46
|
clientId,
|
|
42
47
|
allowedBlocks,
|
|
43
48
|
prioritizedInserterBlocks,
|
|
49
|
+
defaultBlock,
|
|
50
|
+
directInsert,
|
|
44
51
|
__experimentalDefaultBlock,
|
|
45
52
|
__experimentalDirectInsert,
|
|
46
53
|
templateLock,
|
|
@@ -108,11 +115,29 @@ export default function useNestedSettingsUpdate(
|
|
|
108
115
|
}
|
|
109
116
|
|
|
110
117
|
if ( __experimentalDefaultBlock !== undefined ) {
|
|
111
|
-
|
|
118
|
+
deprecated( '__experimentalDefaultBlock', {
|
|
119
|
+
alternative: 'defaultBlock',
|
|
120
|
+
since: '6.3',
|
|
121
|
+
version: '6.4',
|
|
122
|
+
} );
|
|
123
|
+
newSettings.defaultBlock = __experimentalDefaultBlock;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if ( defaultBlock !== undefined ) {
|
|
127
|
+
newSettings.defaultBlock = defaultBlock;
|
|
112
128
|
}
|
|
113
129
|
|
|
114
130
|
if ( __experimentalDirectInsert !== undefined ) {
|
|
115
|
-
|
|
131
|
+
deprecated( '__experimentalDirectInsert', {
|
|
132
|
+
alternative: 'directInsert',
|
|
133
|
+
since: '6.3',
|
|
134
|
+
version: '6.4',
|
|
135
|
+
} );
|
|
136
|
+
newSettings.directInsert = __experimentalDirectInsert;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if ( directInsert !== undefined ) {
|
|
140
|
+
newSettings.directInsert = directInsert;
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
// Batch updates to block list settings to avoid triggering cascading renders
|
|
@@ -144,6 +169,8 @@ export default function useNestedSettingsUpdate(
|
|
|
144
169
|
_allowedBlocks,
|
|
145
170
|
_prioritizedInserterBlocks,
|
|
146
171
|
_templateLock,
|
|
172
|
+
defaultBlock,
|
|
173
|
+
directInsert,
|
|
147
174
|
__experimentalDefaultBlock,
|
|
148
175
|
__experimentalDirectInsert,
|
|
149
176
|
captureToolbars,
|
|
@@ -231,7 +231,7 @@ export const ComposedPrivateInserter = compose( [
|
|
|
231
231
|
getBlockRootClientId,
|
|
232
232
|
hasInserterItems,
|
|
233
233
|
getAllowedBlocks,
|
|
234
|
-
|
|
234
|
+
getDirectInsertBlock,
|
|
235
235
|
getSettings,
|
|
236
236
|
} = select( blockEditorStore );
|
|
237
237
|
|
|
@@ -243,8 +243,7 @@ export const ComposedPrivateInserter = compose( [
|
|
|
243
243
|
const allowedBlocks = getAllowedBlocks( rootClientId );
|
|
244
244
|
|
|
245
245
|
const directInsertBlock =
|
|
246
|
-
shouldDirectInsert &&
|
|
247
|
-
__experimentalGetDirectInsertBlock( rootClientId );
|
|
246
|
+
shouldDirectInsert && getDirectInsertBlock( rootClientId );
|
|
248
247
|
|
|
249
248
|
const settings = getSettings();
|
|
250
249
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { AccessibilityInfo, Platform
|
|
4
|
+
import { AccessibilityInfo, Platform } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -35,33 +35,17 @@ const VOICE_OVER_ANNOUNCEMENT_DELAY = 1000;
|
|
|
35
35
|
const defaultRenderToggle = ( {
|
|
36
36
|
onToggle,
|
|
37
37
|
disabled,
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
iconStyle,
|
|
39
|
+
buttonStyle,
|
|
40
40
|
onLongPress,
|
|
41
|
-
useExpandedMode,
|
|
42
41
|
} ) => {
|
|
43
|
-
// The "expanded mode" refers to the editor's appearance when no blocks
|
|
44
|
-
// are currently selected. The "add block" button has a separate style
|
|
45
|
-
// for the "expanded mode", which are added via the below "expandedModeViewProps"
|
|
46
|
-
// and "expandedModeViewText" variables.
|
|
47
|
-
const expandedModeViewProps = useExpandedMode && {
|
|
48
|
-
icon: <Icon icon={ plus } style={ style } />,
|
|
49
|
-
customContainerStyles: containerStyle,
|
|
50
|
-
fixedRatio: false,
|
|
51
|
-
};
|
|
52
|
-
const expandedModeViewText = (
|
|
53
|
-
<Text style={ styles[ 'inserter-menu__add-block-button-text' ] }>
|
|
54
|
-
{ __( 'Add blocks' ) }
|
|
55
|
-
</Text>
|
|
56
|
-
);
|
|
57
|
-
|
|
58
42
|
return (
|
|
59
43
|
<ToolbarButton
|
|
60
44
|
title={ _x(
|
|
61
45
|
'Add block',
|
|
62
46
|
'Generic label for block inserter button'
|
|
63
47
|
) }
|
|
64
|
-
icon={ <Icon icon={
|
|
48
|
+
icon={ <Icon icon={ plus } style={ iconStyle } /> }
|
|
65
49
|
onClick={ onToggle }
|
|
66
50
|
extraProps={ {
|
|
67
51
|
hint: __( 'Double tap to add a block' ),
|
|
@@ -69,12 +53,12 @@ const defaultRenderToggle = ( {
|
|
|
69
53
|
// usually required for components. See: https://github.com/WordPress/gutenberg/pull/18832#issuecomment-561411389.
|
|
70
54
|
testID: 'add-block-button',
|
|
71
55
|
onLongPress,
|
|
56
|
+
hitSlop: { top: 10, bottom: 10, left: 10, right: 10 },
|
|
72
57
|
} }
|
|
73
58
|
isDisabled={ disabled }
|
|
74
|
-
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
</ToolbarButton>
|
|
59
|
+
customContainerStyles={ buttonStyle }
|
|
60
|
+
fixedRatio={ false }
|
|
61
|
+
/>
|
|
78
62
|
);
|
|
79
63
|
};
|
|
80
64
|
|
|
@@ -249,23 +233,21 @@ export class Inserter extends Component {
|
|
|
249
233
|
renderToggle = defaultRenderToggle,
|
|
250
234
|
getStylesFromColorScheme,
|
|
251
235
|
showSeparator,
|
|
252
|
-
useExpandedMode,
|
|
253
236
|
} = this.props;
|
|
254
237
|
if ( showSeparator && isOpen ) {
|
|
255
238
|
return <BlockInsertionPoint />;
|
|
256
239
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
: getStylesFromColorScheme(
|
|
260
|
-
styles[ 'inserter-menu__add-block-button-icon' ],
|
|
261
|
-
styles[ 'inserter-menu__add-block-button-icon--dark' ]
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
const containerStyle = getStylesFromColorScheme(
|
|
240
|
+
|
|
241
|
+
const buttonStyle = getStylesFromColorScheme(
|
|
265
242
|
styles[ 'inserter-menu__add-block-button' ],
|
|
266
243
|
styles[ 'inserter-menu__add-block-button--dark' ]
|
|
267
244
|
);
|
|
268
245
|
|
|
246
|
+
const iconStyle = getStylesFromColorScheme(
|
|
247
|
+
styles[ 'inserter-menu__add-block-button-icon' ],
|
|
248
|
+
styles[ 'inserter-menu__add-block-button-icon--dark' ]
|
|
249
|
+
);
|
|
250
|
+
|
|
269
251
|
const onPress = () => {
|
|
270
252
|
this.setState(
|
|
271
253
|
{
|
|
@@ -301,10 +283,9 @@ export class Inserter extends Component {
|
|
|
301
283
|
onToggle: onPress,
|
|
302
284
|
isOpen,
|
|
303
285
|
disabled,
|
|
304
|
-
|
|
305
|
-
|
|
286
|
+
iconStyle,
|
|
287
|
+
buttonStyle,
|
|
306
288
|
onLongPress,
|
|
307
|
-
useExpandedMode,
|
|
308
289
|
} ) }
|
|
309
290
|
<Picker
|
|
310
291
|
ref={ ( instance ) => ( this.picker = instance ) }
|
|
@@ -10,7 +10,24 @@ import { close } from '@wordpress/icons';
|
|
|
10
10
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
11
11
|
|
|
12
12
|
const PREFERENCE_NAME = 'isResuableBlocksrRenameHintVisible';
|
|
13
|
+
/*
|
|
14
|
+
* This hook was added in 6.3 to help users with the transition from Reusable blocks to Patterns.
|
|
15
|
+
* It is only exported for use in the reusable-blocks package as well as block-editor.
|
|
16
|
+
* It will be removed in 6.4. and should not be used in any new code.
|
|
17
|
+
*/
|
|
18
|
+
export function useReusableBlocksRenameHint() {
|
|
19
|
+
return useSelect(
|
|
20
|
+
( select ) =>
|
|
21
|
+
select( preferencesStore ).get( 'core', PREFERENCE_NAME ) ?? true,
|
|
22
|
+
[]
|
|
23
|
+
);
|
|
24
|
+
}
|
|
13
25
|
|
|
26
|
+
/*
|
|
27
|
+
* This component was added in 6.3 to help users with the transition from Reusable blocks to Patterns.
|
|
28
|
+
* It is only exported for use in the reusable-blocks package as well as block-editor.
|
|
29
|
+
* It will be removed in 6.4. and should not be used in any new code.
|
|
30
|
+
*/
|
|
14
31
|
export default function ReusableBlocksRenameHint() {
|
|
15
32
|
const isReusableBlocksRenameHint = useSelect(
|
|
16
33
|
( select ) =>
|
|
@@ -29,7 +46,7 @@ export default function ReusableBlocksRenameHint() {
|
|
|
29
46
|
<div ref={ ref } className="reusable-blocks-menu-items__rename-hint">
|
|
30
47
|
<div className="reusable-blocks-menu-items__rename-hint-content">
|
|
31
48
|
{ __(
|
|
32
|
-
'Reusable blocks are now
|
|
49
|
+
'Reusable blocks are now synced patterns. A synced pattern will behave in exactly the same way as a reusable block.'
|
|
33
50
|
) }
|
|
34
51
|
</div>
|
|
35
52
|
<Button
|
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
/** @format */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
color: $
|
|
2
|
+
.inserter-menu__add-block-button {
|
|
3
|
+
border-radius: 2px;
|
|
4
|
+
background-color: $black;
|
|
5
|
+
margin: 9px $grid-unit-20 10px $grid-unit-20;
|
|
6
|
+
padding: 0;
|
|
5
7
|
}
|
|
6
8
|
|
|
7
|
-
.inserter-menu__add-block-button
|
|
8
|
-
color: $
|
|
9
|
+
.inserter-menu__add-block-button--dark {
|
|
10
|
+
background-color: $white;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
.inserter-menu__add-block-button-icon
|
|
13
|
+
.inserter-menu__add-block-button-icon {
|
|
12
14
|
color: $white;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
.inserter-menu__add-block-button {
|
|
16
|
-
|
|
17
|
-
background-color: $blue-50;
|
|
18
|
-
margin: 8px;
|
|
19
|
-
padding: 6px 16px 6px 12px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.inserter-menu__add-block-button--dark {
|
|
23
|
-
background-color: $blue-30;
|
|
17
|
+
.inserter-menu__add-block-button-icon--dark {
|
|
18
|
+
color: $black;
|
|
24
19
|
}
|
|
25
20
|
|
|
26
21
|
.inserter-menu__add-block-button-text {
|