@wordpress/block-editor 7.0.3 → 7.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-actions/index.js +6 -5
- package/build/components/block-actions/index.js.map +1 -1
- package/build/components/block-alignment-control/use-available-alignments.js +17 -4
- package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build/components/block-inspector/index.js +1 -1
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-html.js +5 -0
- package/build/components/block-list/block-html.js.map +1 -1
- package/build/components/block-list/block.native.js +2 -2
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-list-appender/index.js +9 -1
- package/build/components/block-list-appender/index.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-settings-menu-controls/index.js +10 -3
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/block-switcher/block-styles-menu.js +1 -1
- package/build/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build/components/block-tools/index.js +4 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +96 -7
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/border-radius-control/index.js.map +1 -1
- package/build/components/border-radius-control/utils.js +17 -8
- package/build/components/border-radius-control/utils.js.map +1 -1
- package/build/components/colors-gradients/control.js +17 -13
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/copy-handler/index.js +3 -3
- package/build/components/copy-handler/index.js.map +1 -1
- package/build/components/default-block-appender/index.js +2 -2
- package/build/components/default-block-appender/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +3 -5
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/index.js +0 -18
- package/build/components/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab.js +11 -1
- package/build/components/inserter/block-patterns-tab.js.map +1 -1
- package/build/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build/components/inserter/preview-panel.js +1 -1
- package/build/components/inserter/preview-panel.js.map +1 -1
- package/build/components/inspector-controls/block-support-slot-container.js +28 -0
- package/build/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +7 -4
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +16 -1
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/inspector-controls/slot.js +5 -2
- package/build/components/inspector-controls/slot.js.map +1 -1
- package/build/components/list-view/block-contents.js +1 -20
- package/build/components/list-view/block-contents.js.map +1 -1
- package/build/components/list-view/block.js +5 -36
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/list-item.js +3 -2
- package/build/components/list-view/list-item.js.map +1 -1
- package/build/components/media-placeholder/index.js +26 -17
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/media-replace-flow/index.js +3 -2
- package/build/components/media-replace-flow/index.js.map +1 -1
- package/build/components/plain-text/index.native.js +30 -1
- package/build/components/plain-text/index.native.js.map +1 -1
- package/build/components/rich-text/embed-handler-picker.native.js +65 -0
- package/build/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build/components/rich-text/index.js +5 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +41 -2
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +28 -9
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/rich-text/utils.js +22 -0
- package/build/components/rich-text/utils.js.map +1 -1
- package/build/hooks/align.js +10 -7
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/anchor.js +1 -1
- package/build/hooks/anchor.js.map +1 -1
- package/build/hooks/font-family.js +93 -23
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/style.js +6 -3
- package/build/hooks/style.js.map +1 -1
- package/build/layouts/flow.js +4 -1
- package/build/layouts/flow.js.map +1 -1
- package/build/store/reducer.js +11 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +1 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/transforms/wrap.js +16 -0
- package/build/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-module/components/block-actions/index.js +6 -5
- package/build-module/components/block-actions/index.js.map +1 -1
- package/build-module/components/block-alignment-control/use-available-alignments.js +17 -4
- package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -1
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-html.js +5 -0
- package/build-module/components/block-list/block-html.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -2
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-list-appender/index.js +9 -1
- package/build-module/components/block-list-appender/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-settings-menu-controls/index.js +10 -3
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js +1 -1
- package/build-module/components/block-switcher/block-styles-menu.js.map +1 -1
- package/build-module/components/block-tools/index.js +4 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +96 -8
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/border-radius-control/index.js.map +1 -1
- package/build-module/components/border-radius-control/utils.js +16 -9
- package/build-module/components/border-radius-control/utils.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +18 -14
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/copy-handler/index.js +3 -3
- package/build-module/components/copy-handler/index.js.map +1 -1
- package/build-module/components/default-block-appender/index.js +2 -2
- package/build-module/components/default-block-appender/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +3 -5
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/index.js +0 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab.js +11 -1
- package/build-module/components/inserter/block-patterns-tab.js.map +1 -1
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js +5 -4
- package/build-module/components/inserter/hooks/use-clipboard-block.native.js.map +1 -1
- package/build-module/components/inserter/preview-panel.js +1 -1
- package/build-module/components/inserter/preview-panel.js.map +1 -1
- package/build-module/components/inspector-controls/block-support-slot-container.js +18 -0
- package/build-module/components/inspector-controls/block-support-slot-container.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +7 -4
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +16 -2
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/inspector-controls/slot.js +4 -2
- package/build-module/components/inspector-controls/slot.js.map +1 -1
- package/build-module/components/list-view/block-contents.js +1 -18
- package/build-module/components/list-view/block-contents.js.map +1 -1
- package/build-module/components/list-view/block.js +7 -37
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/list-item.js +3 -2
- package/build-module/components/list-view/list-item.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +26 -17
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/media-replace-flow/index.js +3 -2
- package/build-module/components/media-replace-flow/index.js.map +1 -1
- package/build-module/components/plain-text/index.native.js +29 -2
- package/build-module/components/plain-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/embed-handler-picker.native.js +53 -0
- package/build-module/components/rich-text/embed-handler-picker.native.js.map +1 -0
- package/build-module/components/rich-text/index.js +4 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +41 -3
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +28 -9
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/rich-text/utils.js +20 -0
- package/build-module/components/rich-text/utils.js.map +1 -1
- package/build-module/hooks/align.js +10 -7
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/anchor.js +1 -1
- package/build-module/hooks/anchor.js.map +1 -1
- package/build-module/hooks/font-family.js +91 -24
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/style.js +6 -3
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/layouts/flow.js +4 -1
- package/build-module/layouts/flow.js.map +1 -1
- package/build-module/store/reducer.js +11 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +2 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/transforms/wrap.js +16 -0
- package/build-module/utils/transform-styles/transforms/wrap.js.map +1 -1
- package/build-style/style-rtl.css +52 -76
- package/build-style/style.css +52 -76
- package/package.json +14 -14
- package/src/components/block-actions/index.js +5 -5
- package/src/components/block-alignment-control/use-available-alignments.js +18 -3
- package/src/components/block-inspector/index.js +1 -1
- package/src/components/block-list/block-html.js +5 -0
- package/src/components/block-list/block.native.js +2 -2
- package/src/components/block-list-appender/index.js +8 -0
- package/src/components/block-preview/README.md +1 -1
- package/src/components/block-preview/style.scss +0 -17
- package/src/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/src/components/block-settings-menu-controls/index.js +9 -6
- package/src/components/block-switcher/block-styles-menu.js +1 -1
- package/src/components/block-tools/index.js +5 -2
- package/src/components/block-tools/insertion-point.js +97 -9
- package/src/components/block-tools/style.scss +4 -35
- package/src/components/border-radius-control/index.js +1 -0
- package/src/components/border-radius-control/test/utils.js +216 -0
- package/src/components/border-radius-control/utils.js +18 -10
- package/src/components/color-palette/test/__snapshots__/control.js.snap +103 -72
- package/src/components/colors-gradients/control.js +64 -61
- package/src/components/colors-gradients/style.scss +8 -5
- package/src/components/colors-gradients/test/control.js +43 -52
- package/src/components/copy-handler/index.js +1 -1
- package/src/components/default-block-appender/index.js +2 -2
- package/src/components/default-block-appender/test/__snapshots__/index.js.snap +3 -3
- package/src/components/font-appearance-control/index.js +12 -14
- package/src/components/font-appearance-control/style.scss +1 -1
- package/src/components/index.js +0 -2
- package/src/components/inserter/block-patterns-tab.js +11 -4
- package/src/components/inserter/hooks/use-clipboard-block.native.js +3 -2
- package/src/components/inserter/preview-panel.js +1 -1
- package/src/components/inserter/style.scss +1 -2
- package/src/components/inspector-controls/block-support-slot-container.js +10 -0
- package/src/components/inspector-controls/block-support-tools-panel.js +4 -2
- package/src/components/inspector-controls/fill.js +23 -2
- package/src/components/inspector-controls/slot.js +6 -1
- package/src/components/link-control/style.scss +9 -5
- package/src/components/list-view/block-contents.js +17 -38
- package/src/components/list-view/block.js +6 -51
- package/src/components/list-view/list-item.js +5 -4
- package/src/components/list-view/style.scss +56 -30
- package/src/components/media-placeholder/index.js +24 -17
- package/src/components/media-replace-flow/README.md +7 -0
- package/src/components/media-replace-flow/index.js +2 -0
- package/src/components/plain-text/index.native.js +26 -4
- package/src/components/rich-text/embed-handler-picker.native.js +67 -0
- package/src/components/rich-text/index.js +12 -8
- package/src/components/rich-text/index.native.js +35 -1
- package/src/components/rich-text/use-paste-handler.js +30 -12
- package/src/components/rich-text/utils.js +16 -0
- package/src/components/skip-to-selected-block/README.md +39 -0
- package/src/hooks/align.js +11 -7
- package/src/hooks/anchor.js +2 -2
- package/src/hooks/font-family.js +107 -27
- package/src/hooks/style.js +14 -8
- package/src/layouts/flow.js +4 -1
- package/src/store/reducer.js +17 -0
- package/src/store/selectors.js +2 -3
- package/src/store/test/reducer.js +22 -0
- package/src/utils/transform-styles/transforms/test/wrap.js +1 -1
- package/src/utils/transform-styles/transforms/wrap.js +16 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/list-view/block-slot.js +0 -121
- package/build/components/list-view/block-slot.js.map +0 -1
- package/build/components/list-view/editor.js +0 -35
- package/build/components/list-view/editor.js.map +0 -1
- package/build-module/components/list-view/block-slot.js +0 -96
- package/build-module/components/list-view/block-slot.js.map +0 -1
- package/build-module/components/list-view/editor.js +0 -25
- package/build-module/components/list-view/editor.js.map +0 -1
- package/src/components/list-view/block-slot.js +0 -120
- package/src/components/list-view/editor.js +0 -29
package/src/store/reducer.js
CHANGED
|
@@ -366,6 +366,23 @@ const withBlockTree = ( reducer ) => ( state = {}, action ) => {
|
|
|
366
366
|
},
|
|
367
367
|
action.blocks.map( ( b ) => b.clientId )
|
|
368
368
|
);
|
|
369
|
+
|
|
370
|
+
// If there are no replaced blocks, it means we're removing blocks so we need to update their parent.
|
|
371
|
+
const parentsOfRemovedBlocks = [];
|
|
372
|
+
for ( const clientId of action.clientIds ) {
|
|
373
|
+
if (
|
|
374
|
+
state.parents[ clientId ] !== undefined &&
|
|
375
|
+
( state.parents[ clientId ] === '' ||
|
|
376
|
+
newState.byClientId[ state.parents[ clientId ] ] )
|
|
377
|
+
) {
|
|
378
|
+
parentsOfRemovedBlocks.push( state.parents[ clientId ] );
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
newState.tree = updateParentInnerBlocksInTree(
|
|
382
|
+
newState,
|
|
383
|
+
newState.tree,
|
|
384
|
+
parentsOfRemovedBlocks
|
|
385
|
+
);
|
|
369
386
|
break;
|
|
370
387
|
}
|
|
371
388
|
case 'REMOVE_BLOCKS_AUGMENTED_WITH_CHILDREN':
|
package/src/store/selectors.js
CHANGED
|
@@ -24,6 +24,7 @@ import createSelector from 'rememo';
|
|
|
24
24
|
import {
|
|
25
25
|
getBlockType,
|
|
26
26
|
getBlockTypes,
|
|
27
|
+
getBlockVariations,
|
|
27
28
|
hasBlockSupport,
|
|
28
29
|
getPossibleBlockTransformations,
|
|
29
30
|
parse,
|
|
@@ -1514,9 +1515,7 @@ const buildBlockTypeItem = ( state, { buildScope = 'inserter' } ) => (
|
|
|
1514
1515
|
};
|
|
1515
1516
|
if ( buildScope === 'transform' ) return blockItemBase;
|
|
1516
1517
|
|
|
1517
|
-
const inserterVariations = blockType.
|
|
1518
|
-
( { scope } ) => ! scope || scope.includes( 'inserter' )
|
|
1519
|
-
);
|
|
1518
|
+
const inserterVariations = getBlockVariations( blockType.name, 'inserter' );
|
|
1520
1519
|
return {
|
|
1521
1520
|
...blockItemBase,
|
|
1522
1521
|
initialAttributes: {},
|
|
@@ -788,6 +788,28 @@ describe( 'state', () => {
|
|
|
788
788
|
} );
|
|
789
789
|
} );
|
|
790
790
|
|
|
791
|
+
it( 'Replacing the block with an empty list should remove it', () => {
|
|
792
|
+
const original = blocks( undefined, {
|
|
793
|
+
type: 'RESET_BLOCKS',
|
|
794
|
+
blocks: [
|
|
795
|
+
{
|
|
796
|
+
clientId: 'chicken',
|
|
797
|
+
name: 'core/test-block',
|
|
798
|
+
attributes: {},
|
|
799
|
+
innerBlocks: [],
|
|
800
|
+
},
|
|
801
|
+
],
|
|
802
|
+
} );
|
|
803
|
+
const state = blocks( original, {
|
|
804
|
+
type: 'REPLACE_BLOCKS',
|
|
805
|
+
clientIds: [ 'chicken' ],
|
|
806
|
+
blocks: [],
|
|
807
|
+
} );
|
|
808
|
+
|
|
809
|
+
expect( Object.keys( state.byClientId ) ).toHaveLength( 0 );
|
|
810
|
+
expect( state.tree[ '' ].innerBlocks ).toHaveLength( 0 );
|
|
811
|
+
} );
|
|
812
|
+
|
|
791
813
|
it( 'should replace the block and remove references to its inner blocks', () => {
|
|
792
814
|
const original = blocks( undefined, {
|
|
793
815
|
type: 'RESET_BLOCKS',
|
|
@@ -22,7 +22,7 @@ describe( 'CSS selector wrap', () => {
|
|
|
22
22
|
} );
|
|
23
23
|
|
|
24
24
|
it( 'should ignore selectors', () => {
|
|
25
|
-
const callback = wrap( '.my-namespace', 'body' );
|
|
25
|
+
const callback = wrap( '.my-namespace', [ 'body' ] );
|
|
26
26
|
const input = `h1, body { color: red; }`;
|
|
27
27
|
const output = traverse( input, callback );
|
|
28
28
|
|
|
@@ -3,7 +3,23 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const IS_ROOT_TAG = /^(body|html|:root).*$/;
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Creates a callback to modify selectors so they only apply within a certain
|
|
8
|
+
* namespace.
|
|
9
|
+
*
|
|
10
|
+
* @param {string} namespace Namespace to prefix selectors with.
|
|
11
|
+
* @param {string[]} ignore Selectors to not prefix.
|
|
12
|
+
*
|
|
13
|
+
* @return {(node: Object) => Object} Callback to wrap selectors.
|
|
14
|
+
*/
|
|
6
15
|
const wrap = ( namespace, ignore = [] ) => ( node ) => {
|
|
16
|
+
/**
|
|
17
|
+
* Updates selector if necessary.
|
|
18
|
+
*
|
|
19
|
+
* @param {string} selector Selector to modify.
|
|
20
|
+
*
|
|
21
|
+
* @return {string} Updated selector.
|
|
22
|
+
*/
|
|
7
23
|
const updateSelector = ( selector ) => {
|
|
8
24
|
if ( ignore.includes( selector.trim() ) ) {
|
|
9
25
|
return selector;
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"b3a4ee9791cdd4f5029b3ffe60b9cae1ac308a4238b0444f40a5222e4ecc5cc1","a7e32dcb90bf0c1b7a1e4ac89b0f7747cbcba25e7beddc1ebf17be1e161842ad",{"version":"0290ce481d9430774f1d41e757d087e9324b497e1ee0a9e908cf57a9f8bc6e0d","affectsGlobalScope":true},"e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","c45d6f4d3a20be54e46237608f537a8d85397f87b9c3318d68ed925c2f1d0b51","64edfb2b255173bc63214290f9c3ed2306d658b5895ca482a0f20f03fd544ffc","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","
|
|
1
|
+
{"program":{"fileNames":["../../node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/typescript/lib/lib.esnext.d.ts","../../node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../node_modules/@types/react/global.d.ts","../../node_modules/@types/react/node_modules/csstype/index.d.ts","../../node_modules/@types/prop-types/index.d.ts","../../node_modules/@types/react/index.d.ts","../element/build-types/react.d.ts","../element/build-types/create-interpolate-element.d.ts","../../node_modules/@types/react-dom/index.d.ts","../element/build-types/react-platform.d.ts","../element/build-types/utils.d.ts","../element/build-types/platform.d.ts","../element/build-types/serialize.d.ts","../element/build-types/raw-html.d.ts","../element/build-types/index.d.ts","./src/components/block-context/index.js","./src/utils/dom.js"],"fileInfos":[{"version":"aa9fb4c70f369237c2f45f9d969c9a59e0eae9a192962eb48581fe864aa609db","affectsGlobalScope":true},"dc47c4fa66b9b9890cf076304de2a9c5201e94b740cffdf09f87296d877d71f6","7a387c58583dfca701b6c85e0adaf43fb17d590fb16d5b2dc0a2fbd89f35c467","8a12173c586e95f4433e0c6dc446bc88346be73ffe9ca6eec7aa63c8f3dca7f9","5f4e733ced4e129482ae2186aae29fde948ab7182844c3a5a51dd346182c7b06","e6b724280c694a9f588847f754198fb96c43d805f065c3a5b28bbc9594541c84","e21c071ca3e1b4a815d5f04a7475adcaeea5d64367e840dd0154096d705c3940","eb75e89d63b3b72dd9ca8b0cac801cecae5be352307c004adeaa60bc9d6df51f","2cc028cd0bdb35b1b5eb723d84666a255933fffbea607f72cbd0c7c7b4bee144",{"version":"e54c8715a4954cfdc66cd69489f2b725c09ebf37492dbd91cff0a1688b1159e8","affectsGlobalScope":true},{"version":"51b8b27c21c066bf877646e320bf6a722b80d1ade65e686923cd9d4494aef1ca","affectsGlobalScope":true},{"version":"43fb1d932e4966a39a41b464a12a81899d9ae5f2c829063f5571b6b87e6d2f9c","affectsGlobalScope":true},{"version":"cdccba9a388c2ee3fd6ad4018c640a471a6c060e96f1232062223063b0a5ac6a","affectsGlobalScope":true},{"version":"2c8c5ee58f30e7c944e04ab1fb5506fdbb4dd507c9efa6972cf4b91cec90c503","affectsGlobalScope":true},{"version":"2bb4b3927299434052b37851a47bf5c39764f2ba88a888a107b32262e9292b7c","affectsGlobalScope":true},{"version":"810627a82ac06fb5166da5ada4159c4ec11978dfbb0805fe804c86406dab8357","affectsGlobalScope":true},{"version":"62d80405c46c3f4c527ee657ae9d43fda65a0bf582292429aea1e69144a522a6","affectsGlobalScope":true},{"version":"3013574108c36fd3aaca79764002b3717da09725a36a6fc02eac386593110f93","affectsGlobalScope":true},{"version":"75ec0bdd727d887f1b79ed6619412ea72ba3c81d92d0787ccb64bab18d261f14","affectsGlobalScope":true},{"version":"3be5a1453daa63e031d266bf342f3943603873d890ab8b9ada95e22389389006","affectsGlobalScope":true},{"version":"17bb1fc99591b00515502d264fa55dc8370c45c5298f4a5c2083557dccba5a2a","affectsGlobalScope":true},{"version":"7ce9f0bde3307ca1f944119f6365f2d776d281a393b576a18a2f2893a2d75c98","affectsGlobalScope":true},{"version":"6a6b173e739a6a99629a8594bfb294cc7329bfb7b227f12e1f7c11bc163b8577","affectsGlobalScope":true},{"version":"12a310447c5d23c7d0d5ca2af606e3bd08afda69100166730ab92c62999ebb9d","affectsGlobalScope":true},{"version":"b0124885ef82641903d232172577f2ceb5d3e60aed4da1153bab4221e1f6dd4e","affectsGlobalScope":true},{"version":"0eb85d6c590b0d577919a79e0084fa1744c1beba6fd0d4e951432fa1ede5510a","affectsGlobalScope":true},{"version":"da233fc1c8a377ba9e0bed690a73c290d843c2c3d23a7bd7ec5cd3d7d73ba1e0","affectsGlobalScope":true},{"version":"df9c8a72ca8b0ed62f5470b41208a0587f0f73f0a7db28e5a1272cf92537518e","affectsGlobalScope":true},{"version":"bb2d3fb05a1d2ffbca947cc7cbc95d23e1d053d6595391bd325deb265a18d36c","affectsGlobalScope":true},{"version":"c80df75850fea5caa2afe43b9949338ce4e2de086f91713e9af1a06f973872b8","affectsGlobalScope":true},{"version":"9d57b2b5d15838ed094aa9ff1299eecef40b190722eb619bac4616657a05f951","affectsGlobalScope":true},{"version":"6c51b5dd26a2c31dbf37f00cfc32b2aa6a92e19c995aefb5b97a3a64f1ac99de","affectsGlobalScope":true},{"version":"93544ca2f26a48716c1b6c5091842cad63129daac422dfa4bc52460465f22bb1","affectsGlobalScope":true},{"version":"2ad234885a4240522efccd77de6c7d99eecf9b4de0914adb9a35c0c22433f993","affectsGlobalScope":true},{"version":"1b3fe904465430e030c93239a348f05e1be80640d91f2f004c3512c2c2c89f34","affectsGlobalScope":true},{"version":"7435b75fdf3509622e79622dbe5091cf4b09688410ee2034e4fc17d0c99d0862","affectsGlobalScope":true},{"version":"e7e8e1d368290e9295ef18ca23f405cf40d5456fa9f20db6373a61ca45f75f40","affectsGlobalScope":true},{"version":"faf0221ae0465363c842ce6aa8a0cbda5d9296940a8e26c86e04cc4081eea21e","affectsGlobalScope":true},{"version":"06393d13ea207a1bfe08ec8d7be562549c5e2da8983f2ee074e00002629d1871","affectsGlobalScope":true},{"version":"9f1817f7c3f02f6d56e0f403b927e90bb133f371dcebc36fa7d6d208ef6899da","affectsGlobalScope":true},{"version":"cd6efb9467a8b6338ece2e2855e37765700f2cd061ca54b01b33878cf5c7677e","affectsGlobalScope":true},{"version":"fb4416144c1bf0323ccbc9afb0ab289c07312214e8820ad17d709498c865a3fe","affectsGlobalScope":true},{"version":"5b0ca94ec819d68d33da516306c15297acec88efeb0ae9e2b39f71dbd9685ef7","affectsGlobalScope":true},{"version":"4632665b87204bb1caa8b44d165bce0c50dfab177df5b561b345a567cabacf9a","affectsGlobalScope":true},{"version":"ecf78e637f710f340ec08d5d92b3f31b134a46a4fcf2e758690d8c46ce62cba6","affectsGlobalScope":true},"b3a4ee9791cdd4f5029b3ffe60b9cae1ac308a4238b0444f40a5222e4ecc5cc1","a7e32dcb90bf0c1b7a1e4ac89b0f7747cbcba25e7beddc1ebf17be1e161842ad",{"version":"0290ce481d9430774f1d41e757d087e9324b497e1ee0a9e908cf57a9f8bc6e0d","affectsGlobalScope":true},"e59d00012fb20e6746def2f4bc94650526aa6c574c49ad6a50a992f61a3ee675","e47b8ec56eb49bc1c53c9012daa9874de14ad0c5da442485aec333571c74b526","c45d6f4d3a20be54e46237608f537a8d85397f87b9c3318d68ed925c2f1d0b51","64edfb2b255173bc63214290f9c3ed2306d658b5895ca482a0f20f03fd544ffc","d2d9e98a2b167079474768593e1e7125fc3db055add8fbdb5977e3d05a8a3696","6462da67490105ba7d98cf312c2faf8794c425781128b161ea8394d66502eec8","62359da52b6c8d00c50c2e50738fac82e902f916fdf458d8159e7edb1c60c3a8","1e0ac21bc775686383ea8c8e48bd98b385e6195b25c85525a7affd08a2cd38b9","0449615e1ed03c7d54fc435a63b7ef0cb4e5cea5ac40c9a63280a46f7eeae0ff","c2785f1635be52763ea678e43064f7b5195af88fc8652781950ae12bdd8049d7","f29123409ffe930309965e27265b28e67aae92692077c7147935351ec2321cef"],"options":{"allowSyntheticDefaultImports":true,"composite":true,"declaration":true,"declarationDir":"./build-types","declarationMap":true,"emitDeclarationOnly":true,"esModuleInterop":false,"importsNotUsedAsValues":2,"jsx":1,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitReturns":true,"noUnusedLocals":true,"noUnusedParameters":true,"rootDir":"./src","strict":true,"target":99},"fileIdsList":[[48],[45,46,47],[48,57],[49],[49,50,52,53,54,55,56],[51],[48,49]],"referencedMap":[[51,1],[48,2],[58,3],[50,4],[57,5],[56,1],[52,6],[49,1],[55,7]],"exportedModulesMap":[[51,1],[48,2],[58,3],[50,4],[57,5],[56,1],[52,6],[49,1],[55,7]],"semanticDiagnosticsPerFile":[47,51,45,48,46,10,12,11,2,13,14,15,16,17,18,19,20,3,4,24,21,22,23,25,26,27,5,28,29,30,31,6,32,33,34,35,7,40,36,37,38,39,8,41,42,43,1,9,44,58,59,50,57,54,56,52,49,55,53]},"version":"4.4.2"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.ListViewBlockFill = exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
-
|
|
14
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
-
|
|
16
|
-
var _blocks = require("@wordpress/blocks");
|
|
17
|
-
|
|
18
|
-
var _components = require("@wordpress/components");
|
|
19
|
-
|
|
20
|
-
var _compose = require("@wordpress/compose");
|
|
21
|
-
|
|
22
|
-
var _data = require("@wordpress/data");
|
|
23
|
-
|
|
24
|
-
var _i18n = require("@wordpress/i18n");
|
|
25
|
-
|
|
26
|
-
var _blockIcon = _interopRequireDefault(require("../block-icon"));
|
|
27
|
-
|
|
28
|
-
var _block = require("../block-list/block");
|
|
29
|
-
|
|
30
|
-
var _blockSelectButton = _interopRequireDefault(require("./block-select-button"));
|
|
31
|
-
|
|
32
|
-
var _utils = require("./utils");
|
|
33
|
-
|
|
34
|
-
var _store = require("../../store");
|
|
35
|
-
|
|
36
|
-
var _expander = _interopRequireDefault(require("./expander"));
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* External dependencies
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* WordPress dependencies
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Internal dependencies
|
|
48
|
-
*/
|
|
49
|
-
const getSlotName = clientId => `ListViewBlock-${clientId}`;
|
|
50
|
-
|
|
51
|
-
function ListViewBlockSlot(props, ref) {
|
|
52
|
-
const {
|
|
53
|
-
clientId
|
|
54
|
-
} = props.block;
|
|
55
|
-
const {
|
|
56
|
-
name
|
|
57
|
-
} = (0, _data.useSelect)(select => select(_store.store).getBlockName(clientId), [clientId]);
|
|
58
|
-
const instanceId = (0, _compose.useInstanceId)(ListViewBlockSlot);
|
|
59
|
-
return (0, _element.createElement)(_components.Slot, {
|
|
60
|
-
name: getSlotName(clientId)
|
|
61
|
-
}, fills => {
|
|
62
|
-
if (!fills.length) {
|
|
63
|
-
return (0, _element.createElement)(_blockSelectButton.default, (0, _extends2.default)({
|
|
64
|
-
ref: ref
|
|
65
|
-
}, props));
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const {
|
|
69
|
-
className,
|
|
70
|
-
isSelected,
|
|
71
|
-
position,
|
|
72
|
-
siblingBlockCount,
|
|
73
|
-
level,
|
|
74
|
-
tabIndex,
|
|
75
|
-
onFocus,
|
|
76
|
-
onToggleExpanded
|
|
77
|
-
} = props;
|
|
78
|
-
const blockType = (0, _blocks.getBlockType)(name);
|
|
79
|
-
const descriptionId = `list-view-block-slot__${instanceId}`;
|
|
80
|
-
const blockPositionDescription = (0, _utils.getBlockPositionDescription)(position, siblingBlockCount, level);
|
|
81
|
-
const forwardedFillProps = {
|
|
82
|
-
// Ensure that the component in the slot can receive
|
|
83
|
-
// keyboard navigation.
|
|
84
|
-
tabIndex,
|
|
85
|
-
onFocus,
|
|
86
|
-
ref,
|
|
87
|
-
// Give the element rendered in the slot a description
|
|
88
|
-
// that describes its position.
|
|
89
|
-
'aria-describedby': descriptionId
|
|
90
|
-
};
|
|
91
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
92
|
-
className: (0, _classnames.default)('block-editor-list-view-block-slot', className)
|
|
93
|
-
}, (0, _element.createElement)(_expander.default, {
|
|
94
|
-
onClick: onToggleExpanded
|
|
95
|
-
}), (0, _element.createElement)(_blockIcon.default, {
|
|
96
|
-
icon: blockType.icon,
|
|
97
|
-
showColors: true
|
|
98
|
-
}), _element.Children.map(fills, fill => (0, _element.cloneElement)(fill, { ...fill.props,
|
|
99
|
-
...forwardedFillProps
|
|
100
|
-
})), isSelected && (0, _element.createElement)(_components.VisuallyHidden, null, (0, _i18n.__)('(selected block)')), (0, _element.createElement)("div", {
|
|
101
|
-
className: "block-editor-list-view-block-slot__description",
|
|
102
|
-
id: descriptionId
|
|
103
|
-
}, blockPositionDescription)));
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
var _default = (0, _element.forwardRef)(ListViewBlockSlot);
|
|
108
|
-
|
|
109
|
-
exports.default = _default;
|
|
110
|
-
|
|
111
|
-
const ListViewBlockFill = props => {
|
|
112
|
-
const {
|
|
113
|
-
clientId
|
|
114
|
-
} = (0, _element.useContext)(_block.BlockListBlockContext);
|
|
115
|
-
return (0, _element.createElement)(_components.Fill, (0, _extends2.default)({}, props, {
|
|
116
|
-
name: getSlotName(clientId)
|
|
117
|
-
}));
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
exports.ListViewBlockFill = ListViewBlockFill;
|
|
121
|
-
//# sourceMappingURL=block-slot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-slot.js"],"names":["getSlotName","clientId","ListViewBlockSlot","props","ref","block","name","select","blockEditorStore","getBlockName","instanceId","fills","length","className","isSelected","position","siblingBlockCount","level","tabIndex","onFocus","onToggleExpanded","blockType","descriptionId","blockPositionDescription","forwardedFillProps","icon","Children","map","fill","ListViewBlockFill","BlockListBlockContext"],"mappings":";;;;;;;;;AAYA;;;;AATA;;AAKA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;AAQA,MAAMA,WAAW,GAAKC,QAAF,IAAiB,iBAAiBA,QAAU,EAAhE;;AAEA,SAASC,iBAAT,CAA4BC,KAA5B,EAAmCC,GAAnC,EAAyC;AACxC,QAAM;AAAEH,IAAAA;AAAF,MAAeE,KAAK,CAACE,KAA3B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAW,qBACdC,MAAF,IAAcA,MAAM,CAAEC,YAAF,CAAN,CAA2BC,YAA3B,CAAyCR,QAAzC,CADE,EAEhB,CAAEA,QAAF,CAFgB,CAAjB;AAIA,QAAMS,UAAU,GAAG,4BAAeR,iBAAf,CAAnB;AAEA,SACC,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAGF,WAAW,CAAEC,QAAF;AAAxB,KACKU,KAAF,IAAa;AACd,QAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,aACC,4BAAC,0BAAD;AAA2B,QAAA,GAAG,EAAGR;AAAjC,SAA4CD,KAA5C,EADD;AAGA;;AAED,UAAM;AACLU,MAAAA,SADK;AAELC,MAAAA,UAFK;AAGLC,MAAAA,QAHK;AAILC,MAAAA,iBAJK;AAKLC,MAAAA,KALK;AAMLC,MAAAA,QANK;AAOLC,MAAAA,OAPK;AAQLC,MAAAA;AARK,QASFjB,KATJ;AAWA,UAAMkB,SAAS,GAAG,0BAAcf,IAAd,CAAlB;AACA,UAAMgB,aAAa,GAAI,yBAAyBZ,UAAY,EAA5D;AACA,UAAMa,wBAAwB,GAAG,wCAChCR,QADgC,EAEhCC,iBAFgC,EAGhCC,KAHgC,CAAjC;AAMA,UAAMO,kBAAkB,GAAG;AAC1B;AACA;AACAN,MAAAA,QAH0B;AAI1BC,MAAAA,OAJ0B;AAK1Bf,MAAAA,GAL0B;AAM1B;AACA;AACA,0BAAoBkB;AARM,KAA3B;AAWA,WACC,qDACC;AACC,MAAA,SAAS,EAAG,yBACX,mCADW,EAEXT,SAFW;AADb,OAMC,4BAAC,iBAAD;AAAkB,MAAA,OAAO,EAAGO;AAA5B,MAND,EAOC,4BAAC,kBAAD;AAAW,MAAA,IAAI,EAAGC,SAAS,CAACI,IAA5B;AAAmC,MAAA,UAAU;AAA7C,MAPD,EAQGC,kBAASC,GAAT,CAAchB,KAAd,EAAuBiB,IAAF,IACtB,2BAAcA,IAAd,EAAoB,EACnB,GAAGA,IAAI,CAACzB,KADW;AAEnB,SAAGqB;AAFgB,KAApB,CADC,CARH,EAcGV,UAAU,IACX,4BAAC,0BAAD,QACG,cAAI,kBAAJ,CADH,CAfF,EAmBC;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,EAAE,EAAGQ;AAFN,OAIGC,wBAJH,CAnBD,CADD,CADD;AA8BA,GApEF,CADD;AAwEA;;eAEc,yBAAYrB,iBAAZ,C;;;;AAER,MAAM2B,iBAAiB,GAAK1B,KAAF,IAAa;AAC7C,QAAM;AAAEF,IAAAA;AAAF,MAAe,yBAAY6B,4BAAZ,CAArB;AACA,SAAO,4BAAC,gBAAD,6BAAW3B,KAAX;AAAmB,IAAA,IAAI,EAAGH,WAAW,CAAEC,QAAF;AAArC,KAAP;AACA,CAHM","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { Fill, Slot, VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tChildren,\n\tcloneElement,\n\tforwardRef,\n\tuseContext,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { BlockListBlockContext } from '../block-list/block';\nimport ListViewBlockSelectButton from './block-select-button';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport ListViewExpander from './expander';\n\nconst getSlotName = ( clientId ) => `ListViewBlock-${ clientId }`;\n\nfunction ListViewBlockSlot( props, ref ) {\n\tconst { clientId } = props.block;\n\tconst { name } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst instanceId = useInstanceId( ListViewBlockSlot );\n\n\treturn (\n\t\t<Slot name={ getSlotName( clientId ) }>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ListViewBlockSelectButton ref={ ref } { ...props } />\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {\n\t\t\t\t\tclassName,\n\t\t\t\t\tisSelected,\n\t\t\t\t\tposition,\n\t\t\t\t\tsiblingBlockCount,\n\t\t\t\t\tlevel,\n\t\t\t\t\ttabIndex,\n\t\t\t\t\tonFocus,\n\t\t\t\t\tonToggleExpanded,\n\t\t\t\t} = props;\n\n\t\t\t\tconst blockType = getBlockType( name );\n\t\t\t\tconst descriptionId = `list-view-block-slot__${ instanceId }`;\n\t\t\t\tconst blockPositionDescription = getBlockPositionDescription(\n\t\t\t\t\tposition,\n\t\t\t\t\tsiblingBlockCount,\n\t\t\t\t\tlevel\n\t\t\t\t);\n\n\t\t\t\tconst forwardedFillProps = {\n\t\t\t\t\t// Ensure that the component in the slot can receive\n\t\t\t\t\t// keyboard navigation.\n\t\t\t\t\ttabIndex,\n\t\t\t\t\tonFocus,\n\t\t\t\t\tref,\n\t\t\t\t\t// Give the element rendered in the slot a description\n\t\t\t\t\t// that describes its position.\n\t\t\t\t\t'aria-describedby': descriptionId,\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-list-view-block-slot',\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t\t\t\t<BlockIcon icon={ blockType.icon } showColors />\n\t\t\t\t\t\t\t{ Children.map( fills, ( fill ) =>\n\t\t\t\t\t\t\t\tcloneElement( fill, {\n\t\t\t\t\t\t\t\t\t...fill.props,\n\t\t\t\t\t\t\t\t\t...forwardedFillProps,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( '(selected block)' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-slot__description\"\n\t\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSlot );\n\nexport const ListViewBlockFill = ( props ) => {\n\tconst { clientId } = useContext( BlockListBlockContext );\n\treturn <Fill { ...props } name={ getSlotName( clientId ) } />;\n};\n"]}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = ListViewEditor;
|
|
7
|
-
|
|
8
|
-
var _element = require("@wordpress/element");
|
|
9
|
-
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
|
|
12
|
-
var _ = require("../");
|
|
13
|
-
|
|
14
|
-
var _blockSlot = require("./block-slot");
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
function ListViewEditor({
|
|
24
|
-
value,
|
|
25
|
-
onChange
|
|
26
|
-
}) {
|
|
27
|
-
return (0, _element.createElement)(_blockSlot.ListViewBlockFill, null, (0, _element.createElement)(_.RichText, {
|
|
28
|
-
value: value,
|
|
29
|
-
onChange: onChange,
|
|
30
|
-
placeholder: (0, _i18n.__)('Navigation item'),
|
|
31
|
-
withoutInteractiveFormatting: true,
|
|
32
|
-
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough']
|
|
33
|
-
}));
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/editor.js"],"names":["ListViewEditor","value","onChange"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,cAAT,CAAyB;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAzB,EAA+C;AAC7D,SACC,4BAAC,4BAAD,QACC,4BAAC,UAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,WAAW,EAAG,cAAI,iBAAJ,CAHf;AAIC,IAAA,4BAA4B,MAJ7B;AAKC,IAAA,cAAc,EAAG,CAChB,WADgB,EAEhB,aAFgB,EAGhB,YAHgB,EAIhB,oBAJgB;AALlB,IADD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { RichText } from '../';\nimport { ListViewBlockFill } from './block-slot';\n\nexport default function ListViewEditor( { value, onChange } ) {\n\treturn (\n\t\t<ListViewBlockFill>\n\t\t\t<RichText\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tplaceholder={ __( 'Navigation item' ) }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tallowedFormats={ [\n\t\t\t\t\t'core/bold',\n\t\t\t\t\t'core/italic',\n\t\t\t\t\t'core/image',\n\t\t\t\t\t'core/strikethrough',\n\t\t\t\t] }\n\t\t\t/>\n\t\t</ListViewBlockFill>\n\t);\n}\n"]}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement, Fragment } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* External dependencies
|
|
6
|
-
*/
|
|
7
|
-
import classnames from 'classnames';
|
|
8
|
-
/**
|
|
9
|
-
* WordPress dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { getBlockType } from '@wordpress/blocks';
|
|
13
|
-
import { Fill, Slot, VisuallyHidden } from '@wordpress/components';
|
|
14
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
15
|
-
import { useSelect } from '@wordpress/data';
|
|
16
|
-
import { Children, cloneElement, forwardRef, useContext } from '@wordpress/element';
|
|
17
|
-
import { __ } from '@wordpress/i18n';
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
import BlockIcon from '../block-icon';
|
|
23
|
-
import { BlockListBlockContext } from '../block-list/block';
|
|
24
|
-
import ListViewBlockSelectButton from './block-select-button';
|
|
25
|
-
import { getBlockPositionDescription } from './utils';
|
|
26
|
-
import { store as blockEditorStore } from '../../store';
|
|
27
|
-
import ListViewExpander from './expander';
|
|
28
|
-
|
|
29
|
-
const getSlotName = clientId => `ListViewBlock-${clientId}`;
|
|
30
|
-
|
|
31
|
-
function ListViewBlockSlot(props, ref) {
|
|
32
|
-
const {
|
|
33
|
-
clientId
|
|
34
|
-
} = props.block;
|
|
35
|
-
const {
|
|
36
|
-
name
|
|
37
|
-
} = useSelect(select => select(blockEditorStore).getBlockName(clientId), [clientId]);
|
|
38
|
-
const instanceId = useInstanceId(ListViewBlockSlot);
|
|
39
|
-
return createElement(Slot, {
|
|
40
|
-
name: getSlotName(clientId)
|
|
41
|
-
}, fills => {
|
|
42
|
-
if (!fills.length) {
|
|
43
|
-
return createElement(ListViewBlockSelectButton, _extends({
|
|
44
|
-
ref: ref
|
|
45
|
-
}, props));
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const {
|
|
49
|
-
className,
|
|
50
|
-
isSelected,
|
|
51
|
-
position,
|
|
52
|
-
siblingBlockCount,
|
|
53
|
-
level,
|
|
54
|
-
tabIndex,
|
|
55
|
-
onFocus,
|
|
56
|
-
onToggleExpanded
|
|
57
|
-
} = props;
|
|
58
|
-
const blockType = getBlockType(name);
|
|
59
|
-
const descriptionId = `list-view-block-slot__${instanceId}`;
|
|
60
|
-
const blockPositionDescription = getBlockPositionDescription(position, siblingBlockCount, level);
|
|
61
|
-
const forwardedFillProps = {
|
|
62
|
-
// Ensure that the component in the slot can receive
|
|
63
|
-
// keyboard navigation.
|
|
64
|
-
tabIndex,
|
|
65
|
-
onFocus,
|
|
66
|
-
ref,
|
|
67
|
-
// Give the element rendered in the slot a description
|
|
68
|
-
// that describes its position.
|
|
69
|
-
'aria-describedby': descriptionId
|
|
70
|
-
};
|
|
71
|
-
return createElement(Fragment, null, createElement("div", {
|
|
72
|
-
className: classnames('block-editor-list-view-block-slot', className)
|
|
73
|
-
}, createElement(ListViewExpander, {
|
|
74
|
-
onClick: onToggleExpanded
|
|
75
|
-
}), createElement(BlockIcon, {
|
|
76
|
-
icon: blockType.icon,
|
|
77
|
-
showColors: true
|
|
78
|
-
}), Children.map(fills, fill => cloneElement(fill, { ...fill.props,
|
|
79
|
-
...forwardedFillProps
|
|
80
|
-
})), isSelected && createElement(VisuallyHidden, null, __('(selected block)')), createElement("div", {
|
|
81
|
-
className: "block-editor-list-view-block-slot__description",
|
|
82
|
-
id: descriptionId
|
|
83
|
-
}, blockPositionDescription)));
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export default forwardRef(ListViewBlockSlot);
|
|
88
|
-
export const ListViewBlockFill = props => {
|
|
89
|
-
const {
|
|
90
|
-
clientId
|
|
91
|
-
} = useContext(BlockListBlockContext);
|
|
92
|
-
return createElement(Fill, _extends({}, props, {
|
|
93
|
-
name: getSlotName(clientId)
|
|
94
|
-
}));
|
|
95
|
-
};
|
|
96
|
-
//# sourceMappingURL=block-slot.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/block-slot.js"],"names":["classnames","getBlockType","Fill","Slot","VisuallyHidden","useInstanceId","useSelect","Children","cloneElement","forwardRef","useContext","__","BlockIcon","BlockListBlockContext","ListViewBlockSelectButton","getBlockPositionDescription","store","blockEditorStore","ListViewExpander","getSlotName","clientId","ListViewBlockSlot","props","ref","block","name","select","getBlockName","instanceId","fills","length","className","isSelected","position","siblingBlockCount","level","tabIndex","onFocus","onToggleExpanded","blockType","descriptionId","blockPositionDescription","forwardedFillProps","icon","map","fill","ListViewBlockFill"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,mBAA7B;AACA,SAASC,IAAT,EAAeC,IAAf,EAAqBC,cAArB,QAA2C,uBAA3C;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SACCC,QADD,EAECC,YAFD,EAGCC,UAHD,EAICC,UAJD,QAKO,oBALP;AAMA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,SAAP,MAAsB,eAAtB;AACA,SAASC,qBAAT,QAAsC,qBAAtC;AACA,OAAOC,yBAAP,MAAsC,uBAAtC;AACA,SAASC,2BAAT,QAA4C,SAA5C;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,aAA1C;AACA,OAAOC,gBAAP,MAA6B,YAA7B;;AAEA,MAAMC,WAAW,GAAKC,QAAF,IAAiB,iBAAiBA,QAAU,EAAhE;;AAEA,SAASC,iBAAT,CAA4BC,KAA5B,EAAmCC,GAAnC,EAAyC;AACxC,QAAM;AAAEH,IAAAA;AAAF,MAAeE,KAAK,CAACE,KAA3B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAWnB,SAAS,CACvBoB,MAAF,IAAcA,MAAM,CAAET,gBAAF,CAAN,CAA2BU,YAA3B,CAAyCP,QAAzC,CADW,EAEzB,CAAEA,QAAF,CAFyB,CAA1B;AAIA,QAAMQ,UAAU,GAAGvB,aAAa,CAAEgB,iBAAF,CAAhC;AAEA,SACC,cAAC,IAAD;AAAM,IAAA,IAAI,EAAGF,WAAW,CAAEC,QAAF;AAAxB,KACKS,KAAF,IAAa;AACd,QAAK,CAAEA,KAAK,CAACC,MAAb,EAAsB;AACrB,aACC,cAAC,yBAAD;AAA2B,QAAA,GAAG,EAAGP;AAAjC,SAA4CD,KAA5C,EADD;AAGA;;AAED,UAAM;AACLS,MAAAA,SADK;AAELC,MAAAA,UAFK;AAGLC,MAAAA,QAHK;AAILC,MAAAA,iBAJK;AAKLC,MAAAA,KALK;AAMLC,MAAAA,QANK;AAOLC,MAAAA,OAPK;AAQLC,MAAAA;AARK,QASFhB,KATJ;AAWA,UAAMiB,SAAS,GAAGtC,YAAY,CAAEwB,IAAF,CAA9B;AACA,UAAMe,aAAa,GAAI,yBAAyBZ,UAAY,EAA5D;AACA,UAAMa,wBAAwB,GAAG1B,2BAA2B,CAC3DkB,QAD2D,EAE3DC,iBAF2D,EAG3DC,KAH2D,CAA5D;AAMA,UAAMO,kBAAkB,GAAG;AAC1B;AACA;AACAN,MAAAA,QAH0B;AAI1BC,MAAAA,OAJ0B;AAK1Bd,MAAAA,GAL0B;AAM1B;AACA;AACA,0BAAoBiB;AARM,KAA3B;AAWA,WACC,8BACC;AACC,MAAA,SAAS,EAAGxC,UAAU,CACrB,mCADqB,EAErB+B,SAFqB;AADvB,OAMC,cAAC,gBAAD;AAAkB,MAAA,OAAO,EAAGO;AAA5B,MAND,EAOC,cAAC,SAAD;AAAW,MAAA,IAAI,EAAGC,SAAS,CAACI,IAA5B;AAAmC,MAAA,UAAU;AAA7C,MAPD,EAQGpC,QAAQ,CAACqC,GAAT,CAAcf,KAAd,EAAuBgB,IAAF,IACtBrC,YAAY,CAAEqC,IAAF,EAAQ,EACnB,GAAGA,IAAI,CAACvB,KADW;AAEnB,SAAGoB;AAFgB,KAAR,CADX,CARH,EAcGV,UAAU,IACX,cAAC,cAAD,QACGrB,EAAE,CAAE,kBAAF,CADL,CAfF,EAmBC;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,EAAE,EAAG6B;AAFN,OAIGC,wBAJH,CAnBD,CADD,CADD;AA8BA,GApEF,CADD;AAwEA;;AAED,eAAehC,UAAU,CAAEY,iBAAF,CAAzB;AAEA,OAAO,MAAMyB,iBAAiB,GAAKxB,KAAF,IAAa;AAC7C,QAAM;AAAEF,IAAAA;AAAF,MAAeV,UAAU,CAAEG,qBAAF,CAA/B;AACA,SAAO,cAAC,IAAD,eAAWS,KAAX;AAAmB,IAAA,IAAI,EAAGH,WAAW,CAAEC,QAAF;AAArC,KAAP;AACA,CAHM","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { getBlockType } from '@wordpress/blocks';\nimport { Fill, Slot, VisuallyHidden } from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tChildren,\n\tcloneElement,\n\tforwardRef,\n\tuseContext,\n} from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { BlockListBlockContext } from '../block-list/block';\nimport ListViewBlockSelectButton from './block-select-button';\nimport { getBlockPositionDescription } from './utils';\nimport { store as blockEditorStore } from '../../store';\nimport ListViewExpander from './expander';\n\nconst getSlotName = ( clientId ) => `ListViewBlock-${ clientId }`;\n\nfunction ListViewBlockSlot( props, ref ) {\n\tconst { clientId } = props.block;\n\tconst { name } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockName( clientId ),\n\t\t[ clientId ]\n\t);\n\tconst instanceId = useInstanceId( ListViewBlockSlot );\n\n\treturn (\n\t\t<Slot name={ getSlotName( clientId ) }>\n\t\t\t{ ( fills ) => {\n\t\t\t\tif ( ! fills.length ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ListViewBlockSelectButton ref={ ref } { ...props } />\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tconst {\n\t\t\t\t\tclassName,\n\t\t\t\t\tisSelected,\n\t\t\t\t\tposition,\n\t\t\t\t\tsiblingBlockCount,\n\t\t\t\t\tlevel,\n\t\t\t\t\ttabIndex,\n\t\t\t\t\tonFocus,\n\t\t\t\t\tonToggleExpanded,\n\t\t\t\t} = props;\n\n\t\t\t\tconst blockType = getBlockType( name );\n\t\t\t\tconst descriptionId = `list-view-block-slot__${ instanceId }`;\n\t\t\t\tconst blockPositionDescription = getBlockPositionDescription(\n\t\t\t\t\tposition,\n\t\t\t\t\tsiblingBlockCount,\n\t\t\t\t\tlevel\n\t\t\t\t);\n\n\t\t\t\tconst forwardedFillProps = {\n\t\t\t\t\t// Ensure that the component in the slot can receive\n\t\t\t\t\t// keyboard navigation.\n\t\t\t\t\ttabIndex,\n\t\t\t\t\tonFocus,\n\t\t\t\t\tref,\n\t\t\t\t\t// Give the element rendered in the slot a description\n\t\t\t\t\t// that describes its position.\n\t\t\t\t\t'aria-describedby': descriptionId,\n\t\t\t\t};\n\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-list-view-block-slot',\n\t\t\t\t\t\t\t\tclassName\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ListViewExpander onClick={ onToggleExpanded } />\n\t\t\t\t\t\t\t<BlockIcon icon={ blockType.icon } showColors />\n\t\t\t\t\t\t\t{ Children.map( fills, ( fill ) =>\n\t\t\t\t\t\t\t\tcloneElement( fill, {\n\t\t\t\t\t\t\t\t\t...fill.props,\n\t\t\t\t\t\t\t\t\t...forwardedFillProps,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ isSelected && (\n\t\t\t\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t\t\t\t{ __( '(selected block)' ) }\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclassName=\"block-editor-list-view-block-slot__description\"\n\t\t\t\t\t\t\t\tid={ descriptionId }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ blockPositionDescription }\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t);\n\t\t\t} }\n\t\t</Slot>\n\t);\n}\n\nexport default forwardRef( ListViewBlockSlot );\n\nexport const ListViewBlockFill = ( props ) => {\n\tconst { clientId } = useContext( BlockListBlockContext );\n\treturn <Fill { ...props } name={ getSlotName( clientId ) } />;\n};\n"]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* WordPress dependencies
|
|
5
|
-
*/
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { RichText } from '../';
|
|
12
|
-
import { ListViewBlockFill } from './block-slot';
|
|
13
|
-
export default function ListViewEditor({
|
|
14
|
-
value,
|
|
15
|
-
onChange
|
|
16
|
-
}) {
|
|
17
|
-
return createElement(ListViewBlockFill, null, createElement(RichText, {
|
|
18
|
-
value: value,
|
|
19
|
-
onChange: onChange,
|
|
20
|
-
placeholder: __('Navigation item'),
|
|
21
|
-
withoutInteractiveFormatting: true,
|
|
22
|
-
allowedFormats: ['core/bold', 'core/italic', 'core/image', 'core/strikethrough']
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=editor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/list-view/editor.js"],"names":["__","RichText","ListViewBlockFill","ListViewEditor","value","onChange"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,KAAzB;AACA,SAASC,iBAAT,QAAkC,cAAlC;AAEA,eAAe,SAASC,cAAT,CAAyB;AAAEC,EAAAA,KAAF;AAASC,EAAAA;AAAT,CAAzB,EAA+C;AAC7D,SACC,cAAC,iBAAD,QACC,cAAC,QAAD;AACC,IAAA,KAAK,EAAGD,KADT;AAEC,IAAA,QAAQ,EAAGC,QAFZ;AAGC,IAAA,WAAW,EAAGL,EAAE,CAAE,iBAAF,CAHjB;AAIC,IAAA,4BAA4B,MAJ7B;AAKC,IAAA,cAAc,EAAG,CAChB,WADgB,EAEhB,aAFgB,EAGhB,YAHgB,EAIhB,oBAJgB;AALlB,IADD,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { RichText } from '../';\nimport { ListViewBlockFill } from './block-slot';\n\nexport default function ListViewEditor( { value, onChange } ) {\n\treturn (\n\t\t<ListViewBlockFill>\n\t\t\t<RichText\n\t\t\t\tvalue={ value }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tplaceholder={ __( 'Navigation item' ) }\n\t\t\t\twithoutInteractiveFormatting\n\t\t\t\tallowedFormats={ [\n\t\t\t\t\t'core/bold',\n\t\t\t\t\t'core/italic',\n\t\t\t\t\t'core/image',\n\t\t\t\t\t'core/strikethrough',\n\t\t\t\t] }\n\t\t\t/>\n\t\t</ListViewBlockFill>\n\t);\n}\n"]}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { getBlockType } from '@wordpress/blocks';
|
|
10
|
-
import { Fill, Slot, VisuallyHidden } from '@wordpress/components';
|
|
11
|
-
import { useInstanceId } from '@wordpress/compose';
|
|
12
|
-
import { useSelect } from '@wordpress/data';
|
|
13
|
-
import {
|
|
14
|
-
Children,
|
|
15
|
-
cloneElement,
|
|
16
|
-
forwardRef,
|
|
17
|
-
useContext,
|
|
18
|
-
} from '@wordpress/element';
|
|
19
|
-
import { __ } from '@wordpress/i18n';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Internal dependencies
|
|
23
|
-
*/
|
|
24
|
-
import BlockIcon from '../block-icon';
|
|
25
|
-
import { BlockListBlockContext } from '../block-list/block';
|
|
26
|
-
import ListViewBlockSelectButton from './block-select-button';
|
|
27
|
-
import { getBlockPositionDescription } from './utils';
|
|
28
|
-
import { store as blockEditorStore } from '../../store';
|
|
29
|
-
import ListViewExpander from './expander';
|
|
30
|
-
|
|
31
|
-
const getSlotName = ( clientId ) => `ListViewBlock-${ clientId }`;
|
|
32
|
-
|
|
33
|
-
function ListViewBlockSlot( props, ref ) {
|
|
34
|
-
const { clientId } = props.block;
|
|
35
|
-
const { name } = useSelect(
|
|
36
|
-
( select ) => select( blockEditorStore ).getBlockName( clientId ),
|
|
37
|
-
[ clientId ]
|
|
38
|
-
);
|
|
39
|
-
const instanceId = useInstanceId( ListViewBlockSlot );
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Slot name={ getSlotName( clientId ) }>
|
|
43
|
-
{ ( fills ) => {
|
|
44
|
-
if ( ! fills.length ) {
|
|
45
|
-
return (
|
|
46
|
-
<ListViewBlockSelectButton ref={ ref } { ...props } />
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const {
|
|
51
|
-
className,
|
|
52
|
-
isSelected,
|
|
53
|
-
position,
|
|
54
|
-
siblingBlockCount,
|
|
55
|
-
level,
|
|
56
|
-
tabIndex,
|
|
57
|
-
onFocus,
|
|
58
|
-
onToggleExpanded,
|
|
59
|
-
} = props;
|
|
60
|
-
|
|
61
|
-
const blockType = getBlockType( name );
|
|
62
|
-
const descriptionId = `list-view-block-slot__${ instanceId }`;
|
|
63
|
-
const blockPositionDescription = getBlockPositionDescription(
|
|
64
|
-
position,
|
|
65
|
-
siblingBlockCount,
|
|
66
|
-
level
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
const forwardedFillProps = {
|
|
70
|
-
// Ensure that the component in the slot can receive
|
|
71
|
-
// keyboard navigation.
|
|
72
|
-
tabIndex,
|
|
73
|
-
onFocus,
|
|
74
|
-
ref,
|
|
75
|
-
// Give the element rendered in the slot a description
|
|
76
|
-
// that describes its position.
|
|
77
|
-
'aria-describedby': descriptionId,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<>
|
|
82
|
-
<div
|
|
83
|
-
className={ classnames(
|
|
84
|
-
'block-editor-list-view-block-slot',
|
|
85
|
-
className
|
|
86
|
-
) }
|
|
87
|
-
>
|
|
88
|
-
<ListViewExpander onClick={ onToggleExpanded } />
|
|
89
|
-
<BlockIcon icon={ blockType.icon } showColors />
|
|
90
|
-
{ Children.map( fills, ( fill ) =>
|
|
91
|
-
cloneElement( fill, {
|
|
92
|
-
...fill.props,
|
|
93
|
-
...forwardedFillProps,
|
|
94
|
-
} )
|
|
95
|
-
) }
|
|
96
|
-
{ isSelected && (
|
|
97
|
-
<VisuallyHidden>
|
|
98
|
-
{ __( '(selected block)' ) }
|
|
99
|
-
</VisuallyHidden>
|
|
100
|
-
) }
|
|
101
|
-
<div
|
|
102
|
-
className="block-editor-list-view-block-slot__description"
|
|
103
|
-
id={ descriptionId }
|
|
104
|
-
>
|
|
105
|
-
{ blockPositionDescription }
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
</>
|
|
109
|
-
);
|
|
110
|
-
} }
|
|
111
|
-
</Slot>
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export default forwardRef( ListViewBlockSlot );
|
|
116
|
-
|
|
117
|
-
export const ListViewBlockFill = ( props ) => {
|
|
118
|
-
const { clientId } = useContext( BlockListBlockContext );
|
|
119
|
-
return <Fill { ...props } name={ getSlotName( clientId ) } />;
|
|
120
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { RichText } from '../';
|
|
10
|
-
import { ListViewBlockFill } from './block-slot';
|
|
11
|
-
|
|
12
|
-
export default function ListViewEditor( { value, onChange } ) {
|
|
13
|
-
return (
|
|
14
|
-
<ListViewBlockFill>
|
|
15
|
-
<RichText
|
|
16
|
-
value={ value }
|
|
17
|
-
onChange={ onChange }
|
|
18
|
-
placeholder={ __( 'Navigation item' ) }
|
|
19
|
-
withoutInteractiveFormatting
|
|
20
|
-
allowedFormats={ [
|
|
21
|
-
'core/bold',
|
|
22
|
-
'core/italic',
|
|
23
|
-
'core/image',
|
|
24
|
-
'core/strikethrough',
|
|
25
|
-
] }
|
|
26
|
-
/>
|
|
27
|
-
</ListViewBlockFill>
|
|
28
|
-
);
|
|
29
|
-
}
|