@wordpress/block-editor 10.0.2 → 10.1.1-next.4d3b314fd5.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/build/components/block-draggable/index.js +1 -1
- package/build/components/block-draggable/index.js.map +1 -1
- package/build/components/block-list/index.js +19 -5
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +7 -1
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-in-between-inserter.js +14 -5
- package/build/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build/components/block-popover/inbetween.js +24 -9
- package/build/components/block-popover/inbetween.js.map +1 -1
- package/build/components/block-popover/index.js +29 -3
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/auto.js +23 -11
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-styles/index.js +1 -3
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/block-tools/index.js +18 -13
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +5 -3
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +6 -3
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-variation-picker/index.native.js +2 -1
- package/build/components/block-variation-picker/index.native.js.map +1 -1
- package/build/components/button-block-appender/index.native.js +1 -0
- package/build/components/button-block-appender/index.native.js.map +1 -1
- package/build/components/index.js +9 -0
- package/build/components/index.js.map +1 -1
- package/build/components/list-view/index.js +2 -1
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +8 -1
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +12 -0
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/url-input/index.js +1 -3
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/url-popover/image-url-input-ui.js +1 -1
- package/build/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +19 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-on-block-drop/index.js +62 -20
- package/build/components/use-on-block-drop/index.js.map +1 -1
- package/build/components/use-setting/index.js +16 -12
- package/build/components/use-setting/index.js.map +1 -1
- package/build/components/writing-flow/use-arrow-nav.js +21 -8
- package/build/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build/hooks/index.js +13 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +76 -23
- package/build/hooks/layout.js.map +1 -1
- package/build/index.js +14 -0
- package/build/index.js.map +1 -1
- package/build/store/reducer.js +33 -19
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +5 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-draggable/index.js +1 -1
- package/build-module/components/block-draggable/index.js.map +1 -1
- package/build-module/components/block-list/index.js +22 -8
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +8 -2
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-in-between-inserter.js +15 -6
- package/build-module/components/block-list/use-in-between-inserter.js.map +1 -1
- package/build-module/components/block-popover/inbetween.js +24 -9
- package/build-module/components/block-popover/inbetween.js.map +1 -1
- package/build-module/components/block-popover/index.js +29 -4
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/auto.js +22 -10
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-styles/index.js +1 -2
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +18 -12
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +5 -3
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +6 -3
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-variation-picker/index.native.js +2 -1
- package/build-module/components/block-variation-picker/index.native.js.map +1 -1
- package/build-module/components/button-block-appender/index.native.js +1 -0
- package/build-module/components/button-block-appender/index.native.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/list-view/index.js +2 -1
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +6 -1
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +12 -0
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/url-input/index.js +1 -2
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js +1 -1
- package/build-module/components/url-popover/image-url-input-ui.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +19 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-on-block-drop/index.js +62 -21
- package/build-module/components/use-on-block-drop/index.js.map +1 -1
- package/build-module/components/use-setting/index.js +16 -12
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/components/writing-flow/use-arrow-nav.js +22 -9
- package/build-module/components/writing-flow/use-arrow-nav.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +73 -23
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/reducer.js +29 -18
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +5 -5
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +24 -6
- package/build-style/style.css +24 -6
- package/package.json +29 -29
- package/src/components/block-controls/test/index.js +84 -8
- package/src/components/block-draggable/index.js +1 -1
- package/src/components/block-draggable/test/index.native.js +0 -9
- package/src/components/block-list/index.js +42 -6
- package/src/components/block-list/use-block-props/index.js +6 -1
- package/src/components/block-list/use-in-between-inserter.js +14 -8
- package/src/components/block-mover/style.scss +2 -7
- package/src/components/block-popover/inbetween.js +34 -10
- package/src/components/block-popover/index.js +47 -3
- package/src/components/block-preview/auto.js +77 -65
- package/src/components/block-preview/style.scss +13 -0
- package/src/components/block-styles/index.js +1 -2
- package/src/components/block-tools/index.js +16 -10
- package/src/components/block-tools/insertion-point.js +3 -3
- package/src/components/block-tools/use-block-toolbar-popover-props.js +6 -0
- package/src/components/block-variation-picker/index.native.js +1 -0
- package/src/components/button-block-appender/index.native.js +1 -0
- package/src/components/index.js +1 -0
- package/src/components/link-control/test/index.js +1 -2
- package/src/components/list-view/index.js +1 -0
- package/src/components/rich-text/format-toolbar-container.js +8 -2
- package/src/components/rich-text/index.js +14 -0
- package/src/components/url-input/index.js +6 -2
- package/src/components/url-popover/image-url-input-ui.js +1 -1
- package/src/components/use-block-drop-zone/index.js +26 -1
- package/src/components/use-on-block-drop/index.js +110 -35
- package/src/components/use-on-block-drop/test/index.js +33 -43
- package/src/components/use-setting/index.js +18 -16
- package/src/components/warning/style.scss +1 -0
- package/src/components/writing-flow/use-arrow-nav.js +23 -9
- package/src/hooks/index.js +1 -0
- package/src/hooks/layout.js +64 -21
- package/src/index.js +2 -0
- package/src/store/reducer.js +22 -14
- package/src/store/selectors.js +5 -4
- package/src/store/test/reducer.js +0 -17
- package/src/components/block-controls/test/__snapshots__/index.js.snap +0 -64
package/src/hooks/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import './metadata';
|
|
|
20
20
|
import './metadata-name';
|
|
21
21
|
|
|
22
22
|
export { useCustomSides } from './dimensions';
|
|
23
|
+
export { useLayoutClasses, useLayoutStyles } from './layout';
|
|
23
24
|
export { getBorderClassesAndStyles, useBorderProps } from './use-border-props';
|
|
24
25
|
export { getColorClassesAndStyles, useColorProps } from './use-color-props';
|
|
25
26
|
export { getSpacingClassesAndStyles } from './use-spacing-props';
|
package/src/hooks/layout.js
CHANGED
|
@@ -37,58 +37,101 @@ import { getLayoutType, getLayoutTypes } from '../layouts';
|
|
|
37
37
|
const layoutBlockSupportKey = '__experimentalLayout';
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* Generates the utility classnames for the given
|
|
41
|
-
* This method was primarily added to reintroduce classnames that were removed
|
|
42
|
-
* in the 5.9 release (https://github.com/WordPress/gutenberg/issues/38719), rather
|
|
43
|
-
* than providing an extensive list of all possible layout classes. The plan is to
|
|
44
|
-
* have the style engine generate a more extensive list of utility classnames which
|
|
45
|
-
* will then replace this method.
|
|
40
|
+
* Generates the utility classnames for the given block's layout attributes.
|
|
46
41
|
*
|
|
47
|
-
* @param { Object }
|
|
48
|
-
* @param { Object } layoutDefinitions An object containing layout definitions, stored in theme.json.
|
|
42
|
+
* @param { Object } block Block object.
|
|
49
43
|
*
|
|
50
44
|
* @return { Array } Array of CSS classname strings.
|
|
51
45
|
*/
|
|
52
|
-
function useLayoutClasses(
|
|
46
|
+
export function useLayoutClasses( block = {} ) {
|
|
53
47
|
const rootPaddingAlignment = useSelect( ( select ) => {
|
|
54
48
|
const { getSettings } = select( blockEditorStore );
|
|
55
49
|
return getSettings().__experimentalFeatures
|
|
56
50
|
?.useRootPaddingAwareAlignments;
|
|
57
51
|
}, [] );
|
|
52
|
+
const globalLayoutSettings = useSetting( 'layout' ) || {};
|
|
53
|
+
|
|
54
|
+
const { attributes = {}, name } = block;
|
|
55
|
+
const { layout } = attributes;
|
|
56
|
+
|
|
57
|
+
const { default: defaultBlockLayout } =
|
|
58
|
+
getBlockSupport( name, layoutBlockSupportKey ) || {};
|
|
59
|
+
const usedLayout =
|
|
60
|
+
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
61
|
+
? { ...layout, type: 'constrained' }
|
|
62
|
+
: layout || defaultBlockLayout || {};
|
|
63
|
+
|
|
58
64
|
const layoutClassnames = [];
|
|
59
65
|
|
|
60
|
-
if (
|
|
66
|
+
if (
|
|
67
|
+
globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
|
|
68
|
+
?.className
|
|
69
|
+
) {
|
|
61
70
|
layoutClassnames.push(
|
|
62
|
-
|
|
71
|
+
globalLayoutSettings?.definitions?.[ usedLayout?.type || 'default' ]
|
|
72
|
+
?.className
|
|
63
73
|
);
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
if (
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
77
|
+
( usedLayout?.inherit ||
|
|
78
|
+
usedLayout?.contentSize ||
|
|
79
|
+
usedLayout?.type === 'constrained' ) &&
|
|
70
80
|
rootPaddingAlignment
|
|
71
81
|
) {
|
|
72
82
|
layoutClassnames.push( 'has-global-padding' );
|
|
73
83
|
}
|
|
74
84
|
|
|
75
|
-
if (
|
|
76
|
-
layoutClassnames.push( `is-${ kebabCase(
|
|
85
|
+
if ( usedLayout?.orientation ) {
|
|
86
|
+
layoutClassnames.push( `is-${ kebabCase( usedLayout.orientation ) }` );
|
|
77
87
|
}
|
|
78
88
|
|
|
79
|
-
if (
|
|
89
|
+
if ( usedLayout?.justifyContent ) {
|
|
80
90
|
layoutClassnames.push(
|
|
81
|
-
`is-content-justification-${ kebabCase(
|
|
91
|
+
`is-content-justification-${ kebabCase(
|
|
92
|
+
usedLayout.justifyContent
|
|
93
|
+
) }`
|
|
82
94
|
);
|
|
83
95
|
}
|
|
84
96
|
|
|
85
|
-
if (
|
|
97
|
+
if ( usedLayout?.flexWrap && usedLayout.flexWrap === 'nowrap' ) {
|
|
86
98
|
layoutClassnames.push( 'is-nowrap' );
|
|
87
99
|
}
|
|
88
100
|
|
|
89
101
|
return layoutClassnames;
|
|
90
102
|
}
|
|
91
103
|
|
|
104
|
+
/**
|
|
105
|
+
* Generates a CSS rule with the given block's layout styles.
|
|
106
|
+
*
|
|
107
|
+
* @param { Object } block Block object.
|
|
108
|
+
* @param { string } selector A selector to use in generating the CSS rule.
|
|
109
|
+
*
|
|
110
|
+
* @return { string } CSS rule.
|
|
111
|
+
*/
|
|
112
|
+
export function useLayoutStyles( block = {}, selector ) {
|
|
113
|
+
const { attributes = {}, name } = block;
|
|
114
|
+
const { layout = {}, style = {} } = attributes;
|
|
115
|
+
// Update type for blocks using legacy layouts.
|
|
116
|
+
const usedLayout =
|
|
117
|
+
layout?.inherit || layout?.contentSize || layout?.wideSize
|
|
118
|
+
? { ...layout, type: 'constrained' }
|
|
119
|
+
: layout || {};
|
|
120
|
+
const fullLayoutType = getLayoutType( usedLayout?.type || 'default' );
|
|
121
|
+
const globalLayoutSettings = useSetting( 'layout' ) || {};
|
|
122
|
+
const blockGapSupport = useSetting( 'spacing.blockGap' );
|
|
123
|
+
const hasBlockGapSupport = blockGapSupport !== null;
|
|
124
|
+
const css = fullLayoutType?.getLayoutStyle?.( {
|
|
125
|
+
blockName: name,
|
|
126
|
+
selector,
|
|
127
|
+
layout,
|
|
128
|
+
layoutDefinitions: globalLayoutSettings?.definitions,
|
|
129
|
+
style,
|
|
130
|
+
hasBlockGapSupport,
|
|
131
|
+
} );
|
|
132
|
+
return css;
|
|
133
|
+
}
|
|
134
|
+
|
|
92
135
|
function LayoutPanel( { setAttributes, attributes, name: blockName } ) {
|
|
93
136
|
const { layout } = attributes;
|
|
94
137
|
const defaultThemeLayout = useSetting( 'layout' );
|
|
@@ -299,7 +342,7 @@ export const withInspectorControls = createHigherOrderComponent(
|
|
|
299
342
|
*/
|
|
300
343
|
export const withLayoutStyles = createHigherOrderComponent(
|
|
301
344
|
( BlockListBlock ) => ( props ) => {
|
|
302
|
-
const { name, attributes } = props;
|
|
345
|
+
const { name, attributes, block } = props;
|
|
303
346
|
const hasLayoutBlockSupport = hasBlockSupport(
|
|
304
347
|
name,
|
|
305
348
|
layoutBlockSupportKey
|
|
@@ -321,7 +364,7 @@ export const withLayoutStyles = createHigherOrderComponent(
|
|
|
321
364
|
? { ...layout, type: 'constrained' }
|
|
322
365
|
: layout || defaultBlockLayout || {};
|
|
323
366
|
const layoutClasses = hasLayoutBlockSupport
|
|
324
|
-
? useLayoutClasses(
|
|
367
|
+
? useLayoutClasses( block )
|
|
325
368
|
: null;
|
|
326
369
|
const selector = `.${ getBlockDefaultClassName(
|
|
327
370
|
name
|
package/src/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export {
|
|
|
12
12
|
getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
|
|
13
13
|
getGapCSSValue as __experimentalGetGapCSSValue,
|
|
14
14
|
useCachedTruthy,
|
|
15
|
+
useLayoutClasses as __experimentaluseLayoutClasses,
|
|
16
|
+
useLayoutStyles as __experimentaluseLayoutStyles,
|
|
15
17
|
} from './hooks';
|
|
16
18
|
export * from './components';
|
|
17
19
|
export * from './elements';
|
package/src/store/reducer.js
CHANGED
|
@@ -614,7 +614,6 @@ const withBlockReset = ( reducer ) => ( state, action ) => {
|
|
|
614
614
|
order: mapBlockOrder( action.blocks ),
|
|
615
615
|
parents: mapBlockParents( action.blocks ),
|
|
616
616
|
controlledInnerBlocks: {},
|
|
617
|
-
visibility: {},
|
|
618
617
|
};
|
|
619
618
|
|
|
620
619
|
const subTree = buildBlockTree( newState, action.blocks );
|
|
@@ -1162,17 +1161,6 @@ export const blocks = flow(
|
|
|
1162
1161
|
}
|
|
1163
1162
|
return state;
|
|
1164
1163
|
},
|
|
1165
|
-
|
|
1166
|
-
visibility( state = {}, action ) {
|
|
1167
|
-
if ( action.type === 'SET_BLOCK_VISIBILITY' ) {
|
|
1168
|
-
return {
|
|
1169
|
-
...state,
|
|
1170
|
-
...action.updates,
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
return state;
|
|
1175
|
-
},
|
|
1176
1164
|
} );
|
|
1177
1165
|
|
|
1178
1166
|
/**
|
|
@@ -1215,6 +1203,25 @@ export function draggedBlocks( state = [], action ) {
|
|
|
1215
1203
|
return state;
|
|
1216
1204
|
}
|
|
1217
1205
|
|
|
1206
|
+
/**
|
|
1207
|
+
* Reducer tracking the visible blocks.
|
|
1208
|
+
*
|
|
1209
|
+
* @param {Record<string,boolean>} state Current state.
|
|
1210
|
+
* @param {Object} action Dispatched action.
|
|
1211
|
+
*
|
|
1212
|
+
* @return {Record<string,boolean>} Block visibility.
|
|
1213
|
+
*/
|
|
1214
|
+
export function blockVisibility( state = {}, action ) {
|
|
1215
|
+
if ( action.type === 'SET_BLOCK_VISIBILITY' ) {
|
|
1216
|
+
return {
|
|
1217
|
+
...state,
|
|
1218
|
+
...action.updates,
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
return state;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1218
1225
|
/**
|
|
1219
1226
|
* Internal helper reducer for selectionStart and selectionEnd. Can hold a block
|
|
1220
1227
|
* selection, represented by an object with property clientId.
|
|
@@ -1660,7 +1667,7 @@ export function hasBlockMovingClientId( state = null, action ) {
|
|
|
1660
1667
|
*
|
|
1661
1668
|
* @return {[string,Object]} Updated state.
|
|
1662
1669
|
*/
|
|
1663
|
-
export function lastBlockAttributesChange( state, action ) {
|
|
1670
|
+
export function lastBlockAttributesChange( state = null, action ) {
|
|
1664
1671
|
switch ( action.type ) {
|
|
1665
1672
|
case 'UPDATE_BLOCK':
|
|
1666
1673
|
if ( ! action.updates.attributes ) {
|
|
@@ -1681,7 +1688,7 @@ export function lastBlockAttributesChange( state, action ) {
|
|
|
1681
1688
|
);
|
|
1682
1689
|
}
|
|
1683
1690
|
|
|
1684
|
-
return
|
|
1691
|
+
return state;
|
|
1685
1692
|
}
|
|
1686
1693
|
|
|
1687
1694
|
/**
|
|
@@ -1813,4 +1820,5 @@ export default combineReducers( {
|
|
|
1813
1820
|
highlightedBlock,
|
|
1814
1821
|
lastBlockInserted,
|
|
1815
1822
|
temporarilyEditingAsBlocks,
|
|
1823
|
+
blockVisibility,
|
|
1816
1824
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -2670,7 +2670,7 @@ export function wasBlockJustInserted( state, clientId, source ) {
|
|
|
2670
2670
|
* @return {boolean} True if the block is visible.
|
|
2671
2671
|
*/
|
|
2672
2672
|
export function isBlockVisible( state, clientId ) {
|
|
2673
|
-
return state.
|
|
2673
|
+
return state.blockVisibility?.[ clientId ] ?? true;
|
|
2674
2674
|
}
|
|
2675
2675
|
|
|
2676
2676
|
/**
|
|
@@ -2682,12 +2682,12 @@ export function isBlockVisible( state, clientId ) {
|
|
|
2682
2682
|
export const __unstableGetVisibleBlocks = createSelector(
|
|
2683
2683
|
( state ) => {
|
|
2684
2684
|
return new Set(
|
|
2685
|
-
Object.keys( state.
|
|
2686
|
-
( key ) => state.
|
|
2685
|
+
Object.keys( state.blockVisibility ).filter(
|
|
2686
|
+
( key ) => state.blockVisibility[ key ]
|
|
2687
2687
|
)
|
|
2688
2688
|
);
|
|
2689
2689
|
},
|
|
2690
|
-
( state ) => [ state.
|
|
2690
|
+
( state ) => [ state.blockVisibility ]
|
|
2691
2691
|
);
|
|
2692
2692
|
|
|
2693
2693
|
export const __unstableGetContentLockingParent = createSelector(
|
|
@@ -2720,6 +2720,7 @@ export function __unstableHasActiveBlockOverlayActive( state, clientId ) {
|
|
|
2720
2720
|
// In zoom-out mode, the block overlay is always active for top level blocks.
|
|
2721
2721
|
if (
|
|
2722
2722
|
editorMode === 'zoom-out' &&
|
|
2723
|
+
clientId &&
|
|
2723
2724
|
! getBlockRootClientId( state, clientId )
|
|
2724
2725
|
) {
|
|
2725
2726
|
return true;
|
|
@@ -292,7 +292,6 @@ describe( 'state', () => {
|
|
|
292
292
|
chicken: '',
|
|
293
293
|
},
|
|
294
294
|
controlledInnerBlocks: {},
|
|
295
|
-
visibility: {},
|
|
296
295
|
} );
|
|
297
296
|
expect( state.tree.chicken ).not.toBe(
|
|
298
297
|
existingState.tree.chicken
|
|
@@ -375,7 +374,6 @@ describe( 'state', () => {
|
|
|
375
374
|
chicken: '',
|
|
376
375
|
},
|
|
377
376
|
controlledInnerBlocks: {},
|
|
378
|
-
visibility: {},
|
|
379
377
|
} );
|
|
380
378
|
expect( state.tree.chicken ).not.toBe(
|
|
381
379
|
existingState.tree.chicken
|
|
@@ -525,7 +523,6 @@ describe( 'state', () => {
|
|
|
525
523
|
[ newChildBlockId3 ]: 'chicken',
|
|
526
524
|
},
|
|
527
525
|
controlledInnerBlocks: {},
|
|
528
|
-
visibility: {},
|
|
529
526
|
} );
|
|
530
527
|
|
|
531
528
|
expect( state.tree[ '' ].innerBlocks[ 0 ] ).toBe(
|
|
@@ -635,7 +632,6 @@ describe( 'state', () => {
|
|
|
635
632
|
[ newChildBlockId ]: 'chicken',
|
|
636
633
|
},
|
|
637
634
|
controlledInnerBlocks: {},
|
|
638
|
-
visibility: {},
|
|
639
635
|
} );
|
|
640
636
|
|
|
641
637
|
// The block object of the parent should be updated.
|
|
@@ -657,7 +653,6 @@ describe( 'state', () => {
|
|
|
657
653
|
isIgnoredChange: false,
|
|
658
654
|
tree: {},
|
|
659
655
|
controlledInnerBlocks: {},
|
|
660
|
-
visibility: {},
|
|
661
656
|
} );
|
|
662
657
|
} );
|
|
663
658
|
|
|
@@ -3085,18 +3080,6 @@ describe( 'state', () => {
|
|
|
3085
3080
|
'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1': { food: 'banana' },
|
|
3086
3081
|
} );
|
|
3087
3082
|
} );
|
|
3088
|
-
|
|
3089
|
-
it( 'returns null on anything other than block attributes update', () => {
|
|
3090
|
-
const original = deepFreeze( {
|
|
3091
|
-
'afd1cb17-2c08-4e7a-91be-007ba7ddc3a1': { food: 'banana' },
|
|
3092
|
-
} );
|
|
3093
|
-
|
|
3094
|
-
const state = lastBlockAttributesChange( original, {
|
|
3095
|
-
type: '__INERT__',
|
|
3096
|
-
} );
|
|
3097
|
-
|
|
3098
|
-
expect( state ).toBe( null );
|
|
3099
|
-
} );
|
|
3100
3083
|
} );
|
|
3101
3084
|
|
|
3102
3085
|
describe( 'lastBlockInserted', () => {
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`BlockControls should render a dynamic toolbar of controls 1`] = `
|
|
4
|
-
<ContextProvider
|
|
5
|
-
value={
|
|
6
|
-
Object {
|
|
7
|
-
"clientId": undefined,
|
|
8
|
-
"isSelected": true,
|
|
9
|
-
"name": undefined,
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
>
|
|
13
|
-
<WithFilters(Edit)
|
|
14
|
-
isSelected={true}
|
|
15
|
-
>
|
|
16
|
-
<BlockControlsFill
|
|
17
|
-
controls={
|
|
18
|
-
Array [
|
|
19
|
-
Object {
|
|
20
|
-
"align": "left",
|
|
21
|
-
"icon": <SVG
|
|
22
|
-
viewBox="0 0 24 24"
|
|
23
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
24
|
-
>
|
|
25
|
-
<Path
|
|
26
|
-
d="M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"
|
|
27
|
-
/>
|
|
28
|
-
</SVG>,
|
|
29
|
-
"title": "Align left",
|
|
30
|
-
},
|
|
31
|
-
Object {
|
|
32
|
-
"align": "center",
|
|
33
|
-
"icon": <SVG
|
|
34
|
-
viewBox="0 0 24 24"
|
|
35
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
36
|
-
>
|
|
37
|
-
<Path
|
|
38
|
-
d="M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"
|
|
39
|
-
/>
|
|
40
|
-
</SVG>,
|
|
41
|
-
"title": "Align center",
|
|
42
|
-
},
|
|
43
|
-
Object {
|
|
44
|
-
"align": "right",
|
|
45
|
-
"icon": <SVG
|
|
46
|
-
viewBox="0 0 24 24"
|
|
47
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
48
|
-
>
|
|
49
|
-
<Path
|
|
50
|
-
d="M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"
|
|
51
|
-
/>
|
|
52
|
-
</SVG>,
|
|
53
|
-
"title": "Align right",
|
|
54
|
-
},
|
|
55
|
-
]
|
|
56
|
-
}
|
|
57
|
-
>
|
|
58
|
-
<p>
|
|
59
|
-
Child
|
|
60
|
-
</p>
|
|
61
|
-
</BlockControlsFill>
|
|
62
|
-
</WithFilters(Edit)>
|
|
63
|
-
</ContextProvider>
|
|
64
|
-
`;
|