@wordpress/block-editor 15.10.1-next.ba3aee3a2.0 → 15.11.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-bindings/attribute-control.cjs +1 -1
- package/build/components/block-bindings/attribute-control.cjs.map +1 -1
- package/build/components/block-bindings/source-fields-list.cjs +1 -1
- package/build/components/block-bindings/source-fields-list.cjs.map +1 -1
- package/build/components/block-edit/context.cjs +5 -0
- package/build/components/block-edit/context.cjs.map +2 -2
- package/build/components/block-edit/index.cjs +3 -0
- package/build/components/block-edit/index.cjs.map +2 -2
- package/build/components/block-inspector/index.cjs +2 -9
- package/build/components/block-inspector/index.cjs.map +2 -2
- package/build/components/block-list/block.cjs +3 -0
- package/build/components/block-list/block.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +82 -70
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/block-visibility/block-visibility-info.cjs +0 -59
- package/build/components/block-visibility/block-visibility-info.cjs.map +3 -3
- package/build/components/block-visibility/constants.cjs +10 -5
- package/build/components/block-visibility/constants.cjs.map +2 -2
- package/build/components/block-visibility/index.cjs +13 -5
- package/build/components/block-visibility/index.cjs.map +3 -3
- package/build/components/block-visibility/modal.cjs +397 -0
- package/build/components/block-visibility/modal.cjs.map +7 -0
- package/build/components/block-visibility/toolbar.cjs +1 -1
- package/build/components/block-visibility/toolbar.cjs.map +2 -2
- package/build/components/block-visibility/use-block-visibility.cjs +13 -17
- package/build/components/block-visibility/use-block-visibility.cjs.map +2 -2
- package/build/components/block-visibility/utils.cjs +81 -0
- package/build/components/block-visibility/utils.cjs.map +7 -0
- package/build/components/block-visibility/viewport-menu-item.cjs +61 -0
- package/build/components/block-visibility/viewport-menu-item.cjs.map +7 -0
- package/build/components/block-visibility/viewport-toolbar.cjs +89 -0
- package/build/components/block-visibility/viewport-toolbar.cjs.map +7 -0
- package/build/components/button-block-appender/index.cjs +23 -19
- package/build/components/button-block-appender/index.cjs.map +2 -2
- package/build/components/font-sizes/font-size-picker.cjs +2 -1
- package/build/components/font-sizes/font-size-picker.cjs.map +2 -2
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs +1 -1
- package/build/components/inner-blocks/use-inner-block-template-sync.cjs.map +1 -1
- package/build/components/inserter/menu.cjs +6 -2
- package/build/components/inserter/menu.cjs.map +2 -2
- package/build/components/inspector-controls/fill.cjs +4 -25
- package/build/components/inspector-controls/fill.cjs.map +2 -2
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs +6 -6
- package/build/components/inspector-controls-tabs/use-inspector-controls-tabs.cjs.map +2 -2
- package/build/components/list-view/block-select-button.cjs +2 -2
- package/build/components/list-view/block-select-button.cjs.map +2 -2
- package/build/components/list-view/block.cjs +39 -22
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/components/rich-text/index.cjs +1 -1
- package/build/components/rich-text/index.cjs.map +1 -1
- package/build/components/url-input/index.cjs +2 -0
- package/build/components/url-input/index.cjs.map +2 -2
- package/build/components/use-block-commands/index.cjs +1 -1
- package/build/components/use-block-commands/index.cjs.map +2 -2
- package/build/hooks/block-fields/index.cjs +92 -217
- package/build/hooks/block-fields/index.cjs.map +3 -3
- package/build/hooks/block-fields/link/index.cjs +13 -32
- package/build/hooks/block-fields/link/index.cjs.map +2 -2
- package/build/hooks/block-fields/media/index.cjs +36 -67
- package/build/hooks/block-fields/media/index.cjs.map +2 -2
- package/build/hooks/block-fields/rich-text/index.cjs +1 -5
- package/build/hooks/block-fields/rich-text/index.cjs.map +2 -2
- package/build/hooks/cross-origin-isolation.cjs +102 -0
- package/build/hooks/cross-origin-isolation.cjs.map +7 -0
- package/build/hooks/index.cjs +3 -1
- package/build/hooks/index.cjs.map +3 -3
- package/build/hooks/list-view.cjs +27 -10
- package/build/hooks/list-view.cjs.map +2 -2
- package/build/hooks/utils.cjs +3 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/layouts/flex.cjs +6 -2
- package/build/layouts/flex.cjs.map +2 -2
- package/build/store/private-selectors.cjs +33 -1
- package/build/store/private-selectors.cjs.map +3 -3
- package/build/store/reducer.cjs +1 -1
- package/build/store/reducer.cjs.map +1 -1
- package/build/store/selectors.cjs +14 -9
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/block-bindings/attribute-control.mjs +1 -1
- package/build-module/components/block-bindings/attribute-control.mjs.map +1 -1
- package/build-module/components/block-bindings/source-fields-list.mjs +1 -1
- package/build-module/components/block-bindings/source-fields-list.mjs.map +1 -1
- package/build-module/components/block-edit/context.mjs +4 -0
- package/build-module/components/block-edit/context.mjs.map +2 -2
- package/build-module/components/block-edit/index.mjs +4 -0
- package/build-module/components/block-edit/index.mjs.map +2 -2
- package/build-module/components/block-inspector/index.mjs +2 -9
- package/build-module/components/block-inspector/index.mjs.map +2 -2
- package/build-module/components/block-list/block.mjs +3 -0
- package/build-module/components/block-list/block.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +85 -73
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/block-visibility/block-visibility-info.mjs +0 -59
- package/build-module/components/block-visibility/block-visibility-info.mjs.map +3 -3
- package/build-module/components/block-visibility/constants.mjs +8 -4
- package/build-module/components/block-visibility/constants.mjs.map +2 -2
- package/build-module/components/block-visibility/index.mjs +13 -6
- package/build-module/components/block-visibility/index.mjs.map +2 -2
- package/build-module/components/block-visibility/modal.mjs +384 -0
- package/build-module/components/block-visibility/modal.mjs.map +7 -0
- package/build-module/components/block-visibility/toolbar.mjs +1 -1
- package/build-module/components/block-visibility/toolbar.mjs.map +2 -2
- package/build-module/components/block-visibility/use-block-visibility.mjs +13 -13
- package/build-module/components/block-visibility/use-block-visibility.mjs.map +2 -2
- package/build-module/components/block-visibility/utils.mjs +55 -0
- package/build-module/components/block-visibility/utils.mjs.map +7 -0
- package/build-module/components/block-visibility/viewport-menu-item.mjs +40 -0
- package/build-module/components/block-visibility/viewport-menu-item.mjs.map +7 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs +68 -0
- package/build-module/components/block-visibility/viewport-toolbar.mjs.map +7 -0
- package/build-module/components/button-block-appender/index.mjs +23 -19
- package/build-module/components/button-block-appender/index.mjs.map +2 -2
- package/build-module/components/font-sizes/font-size-picker.mjs +2 -1
- package/build-module/components/font-sizes/font-size-picker.mjs.map +2 -2
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs +1 -1
- package/build-module/components/inner-blocks/use-inner-block-template-sync.mjs.map +1 -1
- package/build-module/components/inserter/menu.mjs +6 -2
- package/build-module/components/inserter/menu.mjs.map +2 -2
- package/build-module/components/inspector-controls/fill.mjs +6 -22
- package/build-module/components/inspector-controls/fill.mjs.map +2 -2
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs +6 -6
- package/build-module/components/inspector-controls-tabs/use-inspector-controls-tabs.mjs.map +2 -2
- package/build-module/components/list-view/block-select-button.mjs +2 -2
- package/build-module/components/list-view/block-select-button.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +39 -22
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/components/rich-text/index.mjs +1 -1
- package/build-module/components/rich-text/index.mjs.map +1 -1
- package/build-module/components/url-input/index.mjs +2 -0
- package/build-module/components/url-input/index.mjs.map +2 -2
- package/build-module/components/use-block-commands/index.mjs +1 -1
- package/build-module/components/use-block-commands/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/index.mjs +85 -218
- package/build-module/hooks/block-fields/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/link/index.mjs +13 -32
- package/build-module/hooks/block-fields/link/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/media/index.mjs +36 -67
- package/build-module/hooks/block-fields/media/index.mjs.map +2 -2
- package/build-module/hooks/block-fields/rich-text/index.mjs +1 -5
- package/build-module/hooks/block-fields/rich-text/index.mjs.map +2 -2
- package/build-module/hooks/cross-origin-isolation.mjs +100 -0
- package/build-module/hooks/cross-origin-isolation.mjs.map +7 -0
- package/build-module/hooks/index.mjs +3 -1
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +27 -10
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/build-module/hooks/utils.mjs +5 -3
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/layouts/flex.mjs +6 -2
- package/build-module/layouts/flex.mjs.map +2 -2
- package/build-module/store/private-selectors.mjs +34 -1
- package/build-module/store/private-selectors.mjs.map +2 -2
- package/build-module/store/reducer.mjs +1 -1
- package/build-module/store/reducer.mjs.map +1 -1
- package/build-module/store/selectors.mjs +14 -9
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/content-rtl.css +4 -1
- package/build-style/content.css +4 -1
- package/build-style/style-rtl.css +48 -0
- package/build-style/style.css +48 -0
- package/package.json +39 -39
- package/src/components/block-bindings/attribute-control.js +1 -1
- package/src/components/block-bindings/source-fields-list.js +1 -1
- package/src/components/block-edit/context.js +3 -0
- package/src/components/block-edit/index.js +6 -0
- package/src/components/block-inspector/index.js +2 -6
- package/src/components/block-list/block.js +3 -0
- package/src/components/block-list/block.native.js +5 -0
- package/src/components/block-list/content.scss +4 -1
- package/src/components/block-patterns-list/stories/index.story.jsx +1 -1
- package/src/components/block-tools/index.js +45 -33
- package/src/components/block-visibility/block-visibility-info.js +0 -1
- package/src/components/block-visibility/constants.js +7 -3
- package/src/components/block-visibility/index.js +21 -3
- package/src/components/block-visibility/modal.js +358 -0
- package/src/components/block-visibility/style.scss +58 -0
- package/src/components/block-visibility/test/use-block-visibility.js +12 -56
- package/src/components/block-visibility/test/utils.js +266 -0
- package/src/components/block-visibility/toolbar.js +1 -1
- package/src/components/block-visibility/use-block-visibility.js +18 -21
- package/src/components/block-visibility/utils.js +95 -0
- package/src/components/block-visibility/viewport-menu-item.js +42 -0
- package/src/components/block-visibility/viewport-toolbar.js +88 -0
- package/src/components/button-block-appender/index.js +2 -2
- package/src/components/font-sizes/font-size-picker.js +1 -0
- package/src/components/inner-blocks/use-inner-block-template-sync.js +1 -1
- package/src/components/inserter/menu.js +6 -2
- package/src/components/inspector-controls/fill.js +10 -20
- package/src/components/inspector-controls-tabs/use-inspector-controls-tabs.js +11 -8
- package/src/components/list-view/block-select-button.js +2 -2
- package/src/components/list-view/block.js +47 -25
- package/src/components/rich-text/index.js +1 -1
- package/src/components/url-input/index.js +2 -0
- package/src/components/use-block-commands/index.js +4 -3
- package/src/hooks/block-fields/index.js +127 -292
- package/src/hooks/block-fields/link/index.js +13 -51
- package/src/hooks/block-fields/media/index.js +35 -106
- package/src/hooks/block-fields/rich-text/index.js +1 -5
- package/src/hooks/block-fields/styles.scss +2 -0
- package/src/hooks/cross-origin-isolation.js +143 -0
- package/src/hooks/index.js +3 -1
- package/src/hooks/list-view.js +40 -10
- package/src/hooks/utils.js +4 -0
- package/src/layouts/flex.js +8 -3
- package/src/layouts/test/flex.js +53 -0
- package/src/store/private-selectors.js +64 -1
- package/src/store/reducer.js +1 -1
- package/src/store/selectors.js +21 -15
- package/src/store/test/private-selectors.js +80 -0
- package/src/style.scss +1 -0
- package/src/components/block-visibility/styles.scss +0 -10
- /package/src/components/block-icon/stories/{index.story.js → index.story.ts} +0 -0
- /package/src/components/contrast-checker/stories/{index.story.js → index.story.ts} +0 -0
package/src/store/selectors.js
CHANGED
|
@@ -2154,24 +2154,22 @@ const buildBlockTypeItem =
|
|
|
2154
2154
|
'inserter'
|
|
2155
2155
|
);
|
|
2156
2156
|
const blockVariations = getBlockVariations( blockType.name, 'block' );
|
|
2157
|
-
// Combine inserter and block variations. Block-scope variations without
|
|
2158
|
-
// inserter scope are searchable via slash commands but hidden from browse.
|
|
2159
|
-
const inserterVariationNames = new Set(
|
|
2160
|
-
inserterVariations.map( ( variation ) => variation.name )
|
|
2161
|
-
);
|
|
2162
2157
|
const allVariations = [
|
|
2163
2158
|
...inserterVariations,
|
|
2159
|
+
// Built-in heading level variations have block scope but allow
|
|
2160
|
+
// insertion via slash inserter.
|
|
2161
|
+
// See https://github.com/WordPress/gutenberg/issues/74233.
|
|
2164
2162
|
...blockVariations
|
|
2165
2163
|
.filter(
|
|
2166
2164
|
( variation ) =>
|
|
2167
|
-
|
|
2165
|
+
blockType.name === 'core/heading' &&
|
|
2166
|
+
[ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ].includes(
|
|
2167
|
+
variation.name
|
|
2168
|
+
)
|
|
2168
2169
|
)
|
|
2169
2170
|
.map( ( variation ) => ( {
|
|
2170
2171
|
...variation,
|
|
2171
2172
|
isSearchOnly: true,
|
|
2172
|
-
// Block-scope `isDefault` is for the placeholder picker,
|
|
2173
|
-
// not for the inserter, so don't carry it over.
|
|
2174
|
-
isDefault: false,
|
|
2175
2173
|
} ) ),
|
|
2176
2174
|
];
|
|
2177
2175
|
return {
|
|
@@ -2281,13 +2279,21 @@ export const getInserterItems = createRegistrySelector( ( select ) =>
|
|
|
2281
2279
|
)
|
|
2282
2280
|
);
|
|
2283
2281
|
} else {
|
|
2282
|
+
const { getClosestAllowedInsertionPoint } = unlock(
|
|
2283
|
+
select( STORE_NAME )
|
|
2284
|
+
);
|
|
2284
2285
|
blockTypeInserterItems = blockTypeInserterItems
|
|
2285
|
-
.filter(
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2286
|
+
.filter(
|
|
2287
|
+
( blockType ) =>
|
|
2288
|
+
isBlockVisibleInTheInserter(
|
|
2289
|
+
state,
|
|
2290
|
+
blockType,
|
|
2291
|
+
rootClientId
|
|
2292
|
+
) &&
|
|
2293
|
+
getClosestAllowedInsertionPoint(
|
|
2294
|
+
blockType.name,
|
|
2295
|
+
rootClientId
|
|
2296
|
+
) !== null
|
|
2291
2297
|
)
|
|
2292
2298
|
.map( ( blockType ) => ( {
|
|
2293
2299
|
...blockType,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
isRemoveLockedBlock,
|
|
21
21
|
isLockedBlock,
|
|
22
22
|
isBlockHidden,
|
|
23
|
+
areBlocksHiddenAnywhere,
|
|
23
24
|
} from '../private-selectors';
|
|
24
25
|
import { getBlockEditingMode } from '../selectors';
|
|
25
26
|
import { deviceTypeKey } from '../private-keys';
|
|
@@ -1244,4 +1245,83 @@ describe( 'private selectors', () => {
|
|
|
1244
1245
|
expect( result ).toBe( false );
|
|
1245
1246
|
} );
|
|
1246
1247
|
} );
|
|
1248
|
+
|
|
1249
|
+
describe( 'areBlocksHiddenAnywhere', () => {
|
|
1250
|
+
it( 'should return false when clientIds array is empty', () => {
|
|
1251
|
+
const state = {
|
|
1252
|
+
blocks: {
|
|
1253
|
+
attributes: new Map(),
|
|
1254
|
+
},
|
|
1255
|
+
};
|
|
1256
|
+
expect( areBlocksHiddenAnywhere( state, [] ) ).toBe( false );
|
|
1257
|
+
expect( areBlocksHiddenAnywhere( state, null ) ).toBe( false );
|
|
1258
|
+
expect( areBlocksHiddenAnywhere( state, undefined ) ).toBe( false );
|
|
1259
|
+
} );
|
|
1260
|
+
|
|
1261
|
+
it( 'should return false when no blocks are hidden', () => {
|
|
1262
|
+
const state = {
|
|
1263
|
+
blocks: {
|
|
1264
|
+
attributes: new Map( [
|
|
1265
|
+
[ 'block-1', { metadata: { blockVisibility: true } } ],
|
|
1266
|
+
[ 'block-2', { metadata: {} } ],
|
|
1267
|
+
] ),
|
|
1268
|
+
},
|
|
1269
|
+
};
|
|
1270
|
+
expect(
|
|
1271
|
+
areBlocksHiddenAnywhere( state, [ 'block-1', 'block-2' ] )
|
|
1272
|
+
).toBe( false );
|
|
1273
|
+
} );
|
|
1274
|
+
|
|
1275
|
+
it( 'should return true when a block is hidden everywhere', () => {
|
|
1276
|
+
const state = {
|
|
1277
|
+
blocks: {
|
|
1278
|
+
attributes: new Map( [
|
|
1279
|
+
[ 'block-1', { metadata: { blockVisibility: false } } ],
|
|
1280
|
+
[ 'block-2', { metadata: { blockVisibility: true } } ],
|
|
1281
|
+
] ),
|
|
1282
|
+
},
|
|
1283
|
+
};
|
|
1284
|
+
expect(
|
|
1285
|
+
areBlocksHiddenAnywhere( state, [ 'block-1', 'block-2' ] )
|
|
1286
|
+
).toBe( true );
|
|
1287
|
+
} );
|
|
1288
|
+
|
|
1289
|
+
it( 'should return true when a block is hidden in any viewport', () => {
|
|
1290
|
+
const state = {
|
|
1291
|
+
blocks: {
|
|
1292
|
+
attributes: new Map( [
|
|
1293
|
+
[
|
|
1294
|
+
'block-1',
|
|
1295
|
+
{
|
|
1296
|
+
metadata: {
|
|
1297
|
+
blockVisibility: {
|
|
1298
|
+
mobile: false,
|
|
1299
|
+
tablet: true,
|
|
1300
|
+
},
|
|
1301
|
+
},
|
|
1302
|
+
},
|
|
1303
|
+
],
|
|
1304
|
+
[ 'block-2', { metadata: { blockVisibility: true } } ],
|
|
1305
|
+
] ),
|
|
1306
|
+
},
|
|
1307
|
+
};
|
|
1308
|
+
expect(
|
|
1309
|
+
areBlocksHiddenAnywhere( state, [ 'block-1', 'block-2' ] )
|
|
1310
|
+
).toBe( true );
|
|
1311
|
+
} );
|
|
1312
|
+
|
|
1313
|
+
it( 'should return false when clientId is null or undefined', () => {
|
|
1314
|
+
const state = {
|
|
1315
|
+
blocks: {
|
|
1316
|
+
attributes: new Map( [
|
|
1317
|
+
[ 'block-1', { metadata: { blockVisibility: false } } ],
|
|
1318
|
+
] ),
|
|
1319
|
+
},
|
|
1320
|
+
};
|
|
1321
|
+
expect( areBlocksHiddenAnywhere( state, [ null ] ) ).toBe( false );
|
|
1322
|
+
expect( areBlocksHiddenAnywhere( state, [ undefined ] ) ).toBe(
|
|
1323
|
+
false
|
|
1324
|
+
);
|
|
1325
|
+
} );
|
|
1326
|
+
} );
|
|
1247
1327
|
} );
|
package/src/style.scss
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
@use "@wordpress/base-styles/variables" as *;
|
|
2
|
-
|
|
3
|
-
.block-editor-block-visibility-info {
|
|
4
|
-
padding-top: $grid-unit-05;
|
|
5
|
-
padding-bottom: $grid-unit-05;
|
|
6
|
-
margin: 0 $grid-unit-20 $grid-unit-20;
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: start;
|
|
10
|
-
}
|
|
File without changes
|
|
File without changes
|