@wordpress/block-editor 12.10.9 → 12.10.10
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-rename/index.js +28 -0
- package/build/components/block-rename/index.js.map +1 -0
- package/build/components/block-rename/is-empty-string.js +10 -0
- package/build/components/block-rename/is-empty-string.js.map +1 -0
- package/build/components/block-rename/modal.js +86 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +73 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +19 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings-menu-controls/index.js +7 -0
- package/build/components/block-settings-menu-controls/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +6 -1
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/hooks/block-rename.js +51 -0
- package/build/hooks/block-rename.js.map +1 -0
- package/build/hooks/index.js +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build-module/components/block-rename/index.js +4 -0
- package/build-module/components/block-rename/index.js.map +1 -0
- package/build-module/components/block-rename/is-empty-string.js +4 -0
- package/build-module/components/block-rename/is-empty-string.js.map +1 -0
- package/build-module/components/block-rename/modal.js +79 -0
- package/build-module/components/block-rename/modal.js.map +1 -0
- package/build-module/components/block-rename/rename-control.js +66 -0
- package/build-module/components/block-rename/rename-control.js.map +1 -0
- package/build-module/components/block-rename/use-block-rename.js +12 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings-menu-controls/index.js +7 -0
- package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +5 -1
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/hooks/block-rename.js +43 -0
- package/build-module/hooks/block-rename.js.map +1 -0
- package/build-module/hooks/index.js +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -4
- package/build-style/style.css +4 -4
- package/package.json +32 -32
- package/src/components/block-rename/index.js +3 -0
- package/src/components/block-rename/is-empty-string.js +3 -0
- package/src/components/block-rename/modal.js +115 -0
- package/src/components/block-rename/rename-control.js +80 -0
- package/src/components/block-rename/use-block-rename.js +20 -0
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/use-block-commands/index.js +2 -1
- package/src/hooks/block-rename.js +52 -0
- package/src/hooks/index.js +1 -1
- package/src/style.scss +1 -1
- package/build/hooks/block-rename-ui.js +0 -164
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -157
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/src/hooks/block-rename-ui.js +0 -235
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
__experimentalHStack as HStack,
|
|
6
|
+
__experimentalVStack as VStack,
|
|
7
|
+
Button,
|
|
8
|
+
TextControl,
|
|
9
|
+
Modal,
|
|
10
|
+
} from '@wordpress/components';
|
|
11
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
12
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
+
import { useState } from '@wordpress/element';
|
|
14
|
+
import { speak } from '@wordpress/a11y';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
import isEmptyString from './is-empty-string';
|
|
20
|
+
|
|
21
|
+
export default function BlockRenameModal( {
|
|
22
|
+
blockName,
|
|
23
|
+
originalBlockName,
|
|
24
|
+
onClose,
|
|
25
|
+
onSave,
|
|
26
|
+
} ) {
|
|
27
|
+
const [ editedBlockName, setEditedBlockName ] = useState( blockName );
|
|
28
|
+
|
|
29
|
+
const nameHasChanged = editedBlockName !== blockName;
|
|
30
|
+
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
31
|
+
const nameIsEmpty = isEmptyString( editedBlockName );
|
|
32
|
+
|
|
33
|
+
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
34
|
+
|
|
35
|
+
const autoSelectInputText = ( event ) => event.target.select();
|
|
36
|
+
|
|
37
|
+
const dialogDescription = useInstanceId(
|
|
38
|
+
BlockRenameModal,
|
|
39
|
+
`block-editor-rename-modal__description`
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
const handleSubmit = () => {
|
|
43
|
+
const message =
|
|
44
|
+
nameIsOriginal || nameIsEmpty
|
|
45
|
+
? sprintf(
|
|
46
|
+
/* translators: %s: new name/label for the block */
|
|
47
|
+
__( 'Block name reset to: "%s".' ),
|
|
48
|
+
editedBlockName
|
|
49
|
+
)
|
|
50
|
+
: sprintf(
|
|
51
|
+
/* translators: %s: new name/label for the block */
|
|
52
|
+
__( 'Block name changed to: "%s".' ),
|
|
53
|
+
editedBlockName
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Must be assertive to immediately announce change.
|
|
57
|
+
speak( message, 'assertive' );
|
|
58
|
+
onSave( editedBlockName );
|
|
59
|
+
|
|
60
|
+
// Immediate close avoids ability to hit save multiple times.
|
|
61
|
+
onClose();
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<Modal
|
|
66
|
+
title={ __( 'Rename' ) }
|
|
67
|
+
onRequestClose={ onClose }
|
|
68
|
+
overlayClassName="block-editor-block-rename-modal"
|
|
69
|
+
aria={ {
|
|
70
|
+
describedby: dialogDescription,
|
|
71
|
+
} }
|
|
72
|
+
focusOnMount="firstContentElement"
|
|
73
|
+
>
|
|
74
|
+
<p id={ dialogDescription }>
|
|
75
|
+
{ __( 'Enter a custom name for this block.' ) }
|
|
76
|
+
</p>
|
|
77
|
+
<form
|
|
78
|
+
onSubmit={ ( e ) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
|
|
81
|
+
if ( ! isNameValid ) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
handleSubmit();
|
|
86
|
+
} }
|
|
87
|
+
>
|
|
88
|
+
<VStack spacing="3">
|
|
89
|
+
<TextControl
|
|
90
|
+
__nextHasNoMarginBottom
|
|
91
|
+
value={ editedBlockName }
|
|
92
|
+
label={ __( 'Block name' ) }
|
|
93
|
+
hideLabelFromVision={ true }
|
|
94
|
+
placeholder={ originalBlockName }
|
|
95
|
+
onChange={ setEditedBlockName }
|
|
96
|
+
onFocus={ autoSelectInputText }
|
|
97
|
+
/>
|
|
98
|
+
<HStack justify="right">
|
|
99
|
+
<Button variant="tertiary" onClick={ onClose }>
|
|
100
|
+
{ __( 'Cancel' ) }
|
|
101
|
+
</Button>
|
|
102
|
+
|
|
103
|
+
<Button
|
|
104
|
+
aria-disabled={ ! isNameValid }
|
|
105
|
+
variant="primary"
|
|
106
|
+
type="submit"
|
|
107
|
+
>
|
|
108
|
+
{ __( 'Save' ) }
|
|
109
|
+
</Button>
|
|
110
|
+
</HStack>
|
|
111
|
+
</VStack>
|
|
112
|
+
</form>
|
|
113
|
+
</Modal>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as blockEditorStore } from '../../store';
|
|
13
|
+
import { useBlockDisplayInformation } from '..';
|
|
14
|
+
import isEmptyString from './is-empty-string';
|
|
15
|
+
import BlockRenameModal from './modal';
|
|
16
|
+
|
|
17
|
+
export default function BlockRenameControl( { clientId } ) {
|
|
18
|
+
const [ renamingBlock, setRenamingBlock ] = useState( false );
|
|
19
|
+
|
|
20
|
+
const { metadata } = useSelect(
|
|
21
|
+
( select ) => {
|
|
22
|
+
const { getBlockAttributes } = select( blockEditorStore );
|
|
23
|
+
|
|
24
|
+
const _metadata = getBlockAttributes( clientId )?.metadata;
|
|
25
|
+
return {
|
|
26
|
+
metadata: _metadata,
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
[ clientId ]
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const { updateBlockAttributes } = useDispatch( blockEditorStore );
|
|
33
|
+
|
|
34
|
+
const customName = metadata?.name;
|
|
35
|
+
|
|
36
|
+
function onChange( newName ) {
|
|
37
|
+
updateBlockAttributes( [ clientId ], {
|
|
38
|
+
metadata: {
|
|
39
|
+
...( metadata && metadata ),
|
|
40
|
+
name: newName,
|
|
41
|
+
},
|
|
42
|
+
} );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const blockInformation = useBlockDisplayInformation( clientId );
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<MenuItem
|
|
50
|
+
onClick={ () => {
|
|
51
|
+
setRenamingBlock( true );
|
|
52
|
+
} }
|
|
53
|
+
aria-expanded={ renamingBlock }
|
|
54
|
+
aria-haspopup="dialog"
|
|
55
|
+
>
|
|
56
|
+
{ __( 'Rename' ) }
|
|
57
|
+
</MenuItem>
|
|
58
|
+
{ renamingBlock && (
|
|
59
|
+
<BlockRenameModal
|
|
60
|
+
blockName={ customName || '' }
|
|
61
|
+
originalBlockName={ blockInformation?.title }
|
|
62
|
+
onClose={ () => setRenamingBlock( false ) }
|
|
63
|
+
onSave={ ( newName ) => {
|
|
64
|
+
// If the new value is the block's original name (e.g. `Group`)
|
|
65
|
+
// or it is an empty string then assume the intent is to reset
|
|
66
|
+
// the value. Therefore reset the metadata.
|
|
67
|
+
if (
|
|
68
|
+
newName === blockInformation?.title ||
|
|
69
|
+
isEmptyString( newName )
|
|
70
|
+
) {
|
|
71
|
+
newName = undefined;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
onChange( newName );
|
|
75
|
+
} }
|
|
76
|
+
/>
|
|
77
|
+
) }
|
|
78
|
+
</>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getBlockSupport } from '@wordpress/blocks';
|
|
5
|
+
|
|
6
|
+
export default function useBlockRename( name ) {
|
|
7
|
+
const metaDataSupport = getBlockSupport(
|
|
8
|
+
name,
|
|
9
|
+
'__experimentalMetadata',
|
|
10
|
+
false
|
|
11
|
+
);
|
|
12
|
+
|
|
13
|
+
const supportsBlockNaming = !! (
|
|
14
|
+
true === metaDataSupport || metaDataSupport?.name
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
canRename: supportsBlockNaming,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -22,6 +22,8 @@ import { BlockLockMenuItem, useBlockLock } from '../block-lock';
|
|
|
22
22
|
import { store as blockEditorStore } from '../../store';
|
|
23
23
|
import BlockModeToggle from '../block-settings-menu/block-mode-toggle';
|
|
24
24
|
|
|
25
|
+
import { BlockRenameControl, useBlockRename } from '../block-rename';
|
|
26
|
+
|
|
25
27
|
const { Fill, Slot } = createSlotFill( 'BlockSettingsMenuControls' );
|
|
26
28
|
|
|
27
29
|
const BlockSettingsMenuControlsSlot = ( {
|
|
@@ -44,7 +46,9 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
44
46
|
);
|
|
45
47
|
|
|
46
48
|
const { canLock } = useBlockLock( selectedClientIds[ 0 ] );
|
|
49
|
+
const { canRename } = useBlockRename( selectedBlocks[ 0 ] );
|
|
47
50
|
const showLockButton = selectedClientIds.length === 1 && canLock;
|
|
51
|
+
const showRenameButton = selectedClientIds.length === 1 && canRename;
|
|
48
52
|
|
|
49
53
|
// Check if current selection of blocks is Groupable or Ungroupable
|
|
50
54
|
// and pass this props down to ConvertToGroupButton.
|
|
@@ -84,6 +88,11 @@ const BlockSettingsMenuControlsSlot = ( {
|
|
|
84
88
|
clientId={ selectedClientIds[ 0 ] }
|
|
85
89
|
/>
|
|
86
90
|
) }
|
|
91
|
+
{ showRenameButton && (
|
|
92
|
+
<BlockRenameControl
|
|
93
|
+
clientId={ selectedClientIds[ 0 ] }
|
|
94
|
+
/>
|
|
95
|
+
) }
|
|
87
96
|
{ fills }
|
|
88
97
|
{ fillProps?.canMove && ! fillProps?.onlyBlock && (
|
|
89
98
|
<MenuItem
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
/**
|
|
23
23
|
* Internal dependencies
|
|
24
24
|
*/
|
|
25
|
+
import BlockIcon from '../block-icon';
|
|
25
26
|
import { store as blockEditorStore } from '../../store';
|
|
26
27
|
|
|
27
28
|
export const useTransformCommands = () => {
|
|
@@ -100,7 +101,7 @@ export const useTransformCommands = () => {
|
|
|
100
101
|
name: 'core/block-editor/transform-to-' + name.replace( '/', '-' ),
|
|
101
102
|
// translators: %s: block title/name.
|
|
102
103
|
label: sprintf( __( 'Transform to %s' ), title ),
|
|
103
|
-
icon: icon
|
|
104
|
+
icon: <BlockIcon icon={ icon } />,
|
|
104
105
|
callback: ( { close } ) => {
|
|
105
106
|
onBlockTransform( name );
|
|
106
107
|
close();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
5
|
+
import { addFilter } from '@wordpress/hooks';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { hasBlockSupport } from '@wordpress/blocks';
|
|
8
|
+
import { TextControl } from '@wordpress/components';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import { InspectorControls } from '../components';
|
|
14
|
+
|
|
15
|
+
export const withBlockRenameControl = createHigherOrderComponent(
|
|
16
|
+
( BlockEdit ) => ( props ) => {
|
|
17
|
+
const { name, attributes, setAttributes, isSelected } = props;
|
|
18
|
+
|
|
19
|
+
const supportsBlockNaming = hasBlockSupport( name, 'renaming', true );
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
{ isSelected && supportsBlockNaming && (
|
|
24
|
+
<InspectorControls group="advanced">
|
|
25
|
+
<TextControl
|
|
26
|
+
__nextHasNoMarginBottom
|
|
27
|
+
label={ __( 'Block name' ) }
|
|
28
|
+
value={ attributes?.metadata?.name || '' }
|
|
29
|
+
onChange={ ( newName ) => {
|
|
30
|
+
setAttributes( {
|
|
31
|
+
metadata: {
|
|
32
|
+
...attributes?.metadata,
|
|
33
|
+
name: newName,
|
|
34
|
+
},
|
|
35
|
+
} );
|
|
36
|
+
} }
|
|
37
|
+
/>
|
|
38
|
+
</InspectorControls>
|
|
39
|
+
) }
|
|
40
|
+
|
|
41
|
+
<BlockEdit key="edit" { ...props } />
|
|
42
|
+
</>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
'withToolbarControls'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
addFilter(
|
|
49
|
+
'editor.BlockEdit',
|
|
50
|
+
'core/block-rename-ui/with-block-rename-control',
|
|
51
|
+
withBlockRenameControl
|
|
52
|
+
);
|
package/src/hooks/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import './metadata';
|
|
|
22
22
|
import './metadata-name';
|
|
23
23
|
import './custom-fields';
|
|
24
24
|
import './block-hooks';
|
|
25
|
-
import './block-rename
|
|
25
|
+
import './block-rename';
|
|
26
26
|
|
|
27
27
|
export { useCustomSides } from './dimensions';
|
|
28
28
|
export { useLayoutClasses, useLayoutStyles } from './layout';
|
package/src/style.scss
CHANGED
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@import "./components/block-patterns-paging/style.scss";
|
|
16
16
|
@import "./components/block-popover/style.scss";
|
|
17
17
|
@import "./components/block-preview/style.scss";
|
|
18
|
+
@import "./components/block-rename/style.scss";
|
|
18
19
|
@import "./components/block-settings-menu/style.scss";
|
|
19
20
|
@import "./components/block-styles/style.scss";
|
|
20
21
|
@import "./components/block-switcher/style.scss";
|
|
@@ -56,7 +57,6 @@
|
|
|
56
57
|
@import "./hooks/padding.scss";
|
|
57
58
|
@import "./hooks/position.scss";
|
|
58
59
|
@import "./hooks/typography.scss";
|
|
59
|
-
@import "./hooks/block-rename-ui.scss";
|
|
60
60
|
|
|
61
61
|
@import "./components/block-toolbar/style.scss";
|
|
62
62
|
@import "./components/inserter/style.scss";
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.withBlockRenameControl = void 0;
|
|
7
|
-
var _element = require("@wordpress/element");
|
|
8
|
-
var _compose = require("@wordpress/compose");
|
|
9
|
-
var _hooks = require("@wordpress/hooks");
|
|
10
|
-
var _i18n = require("@wordpress/i18n");
|
|
11
|
-
var _blocks = require("@wordpress/blocks");
|
|
12
|
-
var _components = require("@wordpress/components");
|
|
13
|
-
var _a11y = require("@wordpress/a11y");
|
|
14
|
-
var _components2 = require("../components");
|
|
15
|
-
/**
|
|
16
|
-
* WordPress dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const emptyString = testString => testString?.trim()?.length === 0;
|
|
24
|
-
function RenameModal({
|
|
25
|
-
blockName,
|
|
26
|
-
originalBlockName,
|
|
27
|
-
onClose,
|
|
28
|
-
onSave
|
|
29
|
-
}) {
|
|
30
|
-
const [editedBlockName, setEditedBlockName] = (0, _element.useState)(blockName);
|
|
31
|
-
const nameHasChanged = editedBlockName !== blockName;
|
|
32
|
-
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
33
|
-
const nameIsEmpty = emptyString(editedBlockName);
|
|
34
|
-
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
35
|
-
const autoSelectInputText = event => event.target.select();
|
|
36
|
-
const dialogDescription = (0, _compose.useInstanceId)(RenameModal, `block-editor-rename-modal__description`);
|
|
37
|
-
const handleSubmit = () => {
|
|
38
|
-
const message = nameIsOriginal || nameIsEmpty ? (0, _i18n.sprintf)( /* translators: %s: new name/label for the block */
|
|
39
|
-
(0, _i18n.__)('Block name reset to: "%s".'), editedBlockName) : (0, _i18n.sprintf)( /* translators: %s: new name/label for the block */
|
|
40
|
-
(0, _i18n.__)('Block name changed to: "%s".'), editedBlockName);
|
|
41
|
-
|
|
42
|
-
// Must be assertive to immediately announce change.
|
|
43
|
-
(0, _a11y.speak)(message, 'assertive');
|
|
44
|
-
onSave(editedBlockName);
|
|
45
|
-
|
|
46
|
-
// Immediate close avoids ability to hit save multiple times.
|
|
47
|
-
onClose();
|
|
48
|
-
};
|
|
49
|
-
return (0, _element.createElement)(_components.Modal, {
|
|
50
|
-
title: (0, _i18n.__)('Rename'),
|
|
51
|
-
onRequestClose: onClose,
|
|
52
|
-
overlayClassName: "block-editor-block-rename-modal",
|
|
53
|
-
aria: {
|
|
54
|
-
describedby: dialogDescription
|
|
55
|
-
},
|
|
56
|
-
focusOnMount: "firstContentElement"
|
|
57
|
-
}, (0, _element.createElement)("p", {
|
|
58
|
-
id: dialogDescription
|
|
59
|
-
}, (0, _i18n.__)('Enter a custom name for this block.')), (0, _element.createElement)("form", {
|
|
60
|
-
onSubmit: e => {
|
|
61
|
-
e.preventDefault();
|
|
62
|
-
if (!isNameValid) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
handleSubmit();
|
|
66
|
-
}
|
|
67
|
-
}, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
68
|
-
spacing: "3"
|
|
69
|
-
}, (0, _element.createElement)(_components.TextControl, {
|
|
70
|
-
__nextHasNoMarginBottom: true,
|
|
71
|
-
value: editedBlockName,
|
|
72
|
-
label: (0, _i18n.__)('Block name'),
|
|
73
|
-
hideLabelFromVision: true,
|
|
74
|
-
placeholder: originalBlockName,
|
|
75
|
-
onChange: setEditedBlockName,
|
|
76
|
-
onFocus: autoSelectInputText
|
|
77
|
-
}), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
78
|
-
justify: "right"
|
|
79
|
-
}, (0, _element.createElement)(_components.Button, {
|
|
80
|
-
variant: "tertiary",
|
|
81
|
-
onClick: onClose
|
|
82
|
-
}, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
|
|
83
|
-
"aria-disabled": !isNameValid,
|
|
84
|
-
variant: "primary",
|
|
85
|
-
type: "submit"
|
|
86
|
-
}, (0, _i18n.__)('Save'))))));
|
|
87
|
-
}
|
|
88
|
-
function BlockRenameControl(props) {
|
|
89
|
-
const [renamingBlock, setRenamingBlock] = (0, _element.useState)(false);
|
|
90
|
-
const {
|
|
91
|
-
clientId,
|
|
92
|
-
customName,
|
|
93
|
-
onChange
|
|
94
|
-
} = props;
|
|
95
|
-
const blockInformation = (0, _components2.useBlockDisplayInformation)(clientId);
|
|
96
|
-
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components2.InspectorControls, {
|
|
97
|
-
group: "advanced"
|
|
98
|
-
}, (0, _element.createElement)(_components.TextControl, {
|
|
99
|
-
__nextHasNoMarginBottom: true,
|
|
100
|
-
label: (0, _i18n.__)('Block name'),
|
|
101
|
-
value: customName || '',
|
|
102
|
-
onChange: onChange
|
|
103
|
-
})), (0, _element.createElement)(_components2.BlockSettingsMenuControls, null, ({
|
|
104
|
-
selectedClientIds
|
|
105
|
-
}) => {
|
|
106
|
-
// Only enabled for single selections.
|
|
107
|
-
const canRename = selectedClientIds.length === 1 && clientId === selectedClientIds[0];
|
|
108
|
-
|
|
109
|
-
// This check ensures the `BlockSettingsMenuControls` fill
|
|
110
|
-
// doesn't render multiple times and also that it renders for
|
|
111
|
-
// the block from which the menu was triggered.
|
|
112
|
-
if (!canRename) {
|
|
113
|
-
return null;
|
|
114
|
-
}
|
|
115
|
-
return (0, _element.createElement)(_components.MenuItem, {
|
|
116
|
-
onClick: () => {
|
|
117
|
-
setRenamingBlock(true);
|
|
118
|
-
},
|
|
119
|
-
"aria-expanded": renamingBlock,
|
|
120
|
-
"aria-haspopup": "dialog"
|
|
121
|
-
}, (0, _i18n.__)('Rename'));
|
|
122
|
-
}), renamingBlock && (0, _element.createElement)(RenameModal, {
|
|
123
|
-
blockName: customName || '',
|
|
124
|
-
originalBlockName: blockInformation?.title,
|
|
125
|
-
onClose: () => setRenamingBlock(false),
|
|
126
|
-
onSave: newName => {
|
|
127
|
-
// If the new value is the block's original name (e.g. `Group`)
|
|
128
|
-
// or it is an empty string then assume the intent is to reset
|
|
129
|
-
// the value. Therefore reset the metadata.
|
|
130
|
-
if (newName === blockInformation?.title || emptyString(newName)) {
|
|
131
|
-
newName = undefined;
|
|
132
|
-
}
|
|
133
|
-
onChange(newName);
|
|
134
|
-
}
|
|
135
|
-
}));
|
|
136
|
-
}
|
|
137
|
-
const withBlockRenameControl = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
138
|
-
const {
|
|
139
|
-
clientId,
|
|
140
|
-
name,
|
|
141
|
-
attributes,
|
|
142
|
-
setAttributes
|
|
143
|
-
} = props;
|
|
144
|
-
const metaDataSupport = (0, _blocks.getBlockSupport)(name, '__experimentalMetadata', false);
|
|
145
|
-
const supportsBlockNaming = !!(true === metaDataSupport || metaDataSupport?.name);
|
|
146
|
-
return (0, _element.createElement)(_element.Fragment, null, supportsBlockNaming && (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(BlockRenameControl, {
|
|
147
|
-
clientId: clientId,
|
|
148
|
-
customName: attributes?.metadata?.name,
|
|
149
|
-
onChange: newName => {
|
|
150
|
-
setAttributes({
|
|
151
|
-
metadata: {
|
|
152
|
-
...(attributes?.metadata && attributes?.metadata),
|
|
153
|
-
name: newName
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
})), (0, _element.createElement)(BlockEdit, {
|
|
158
|
-
key: "edit",
|
|
159
|
-
...props
|
|
160
|
-
}));
|
|
161
|
-
}, 'withToolbarControls');
|
|
162
|
-
exports.withBlockRenameControl = withBlockRenameControl;
|
|
163
|
-
(0, _hooks.addFilter)('editor.BlockEdit', 'core/block-rename-ui/with-block-rename-control', withBlockRenameControl);
|
|
164
|
-
//# sourceMappingURL=block-rename-ui.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_compose","_hooks","_i18n","_blocks","_components","_a11y","_components2","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","useState","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","useInstanceId","handleSubmit","message","sprintf","__","speak","createElement","Modal","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","value","label","hideLabelFromVision","placeholder","onChange","onFocus","__experimentalHStack","justify","Button","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","useBlockDisplayInformation","Fragment","InspectorControls","group","BlockSettingsMenuControls","selectedClientIds","canRename","MenuItem","newName","undefined","withBlockRenameControl","createHigherOrderComponent","BlockEdit","name","attributes","setAttributes","metaDataSupport","getBlockSupport","supportsBlockNaming","metadata","key","exports","addFilter"],"sources":["@wordpress/block-editor/src/hooks/block-rename-ui.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport {\n\tMenuItem,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockDisplayInformation,\n\tInspectorControls,\n} from '../components';\n\nconst emptyString = ( testString ) => testString?.trim()?.length === 0;\n\nfunction RenameModal( { blockName, originalBlockName, onClose, onSave } ) {\n\tconst [ editedBlockName, setEditedBlockName ] = useState( blockName );\n\n\tconst nameHasChanged = editedBlockName !== blockName;\n\tconst nameIsOriginal = editedBlockName === originalBlockName;\n\tconst nameIsEmpty = emptyString( editedBlockName );\n\n\tconst isNameValid = nameHasChanged || nameIsOriginal;\n\n\tconst autoSelectInputText = ( event ) => event.target.select();\n\n\tconst dialogDescription = useInstanceId(\n\t\tRenameModal,\n\t\t`block-editor-rename-modal__description`\n\t);\n\n\tconst handleSubmit = () => {\n\t\tconst message =\n\t\t\tnameIsOriginal || nameIsEmpty\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name reset to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: new name/label for the block */\n\t\t\t\t\t\t__( 'Block name changed to: \"%s\".' ),\n\t\t\t\t\t\teditedBlockName\n\t\t\t\t );\n\n\t\t// Must be assertive to immediately announce change.\n\t\tspeak( message, 'assertive' );\n\t\tonSave( editedBlockName );\n\n\t\t// Immediate close avoids ability to hit save multiple times.\n\t\tonClose();\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Rename' ) }\n\t\t\tonRequestClose={ onClose }\n\t\t\toverlayClassName=\"block-editor-block-rename-modal\"\n\t\t\taria={ {\n\t\t\t\tdescribedby: dialogDescription,\n\t\t\t} }\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t>\n\t\t\t<p id={ dialogDescription }>\n\t\t\t\t{ __( 'Enter a custom name for this block.' ) }\n\t\t\t</p>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( e ) => {\n\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\tif ( ! isNameValid ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\thandleSubmit();\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedBlockName }\n\t\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\t\thideLabelFromVision={ true }\n\t\t\t\t\t\tplaceholder={ originalBlockName }\n\t\t\t\t\t\tonChange={ setEditedBlockName }\n\t\t\t\t\t\tonFocus={ autoSelectInputText }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\taria-disabled={ ! isNameValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n\nfunction BlockRenameControl( props ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst { clientId, customName, onChange } = props;\n\n\tconst blockInformation = useBlockDisplayInformation( clientId );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Block name' ) }\n\t\t\t\t\tvalue={ customName || '' }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t// Only enabled for single selections.\n\t\t\t\t\tconst canRename =\n\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\tclientId === selectedClientIds[ 0 ];\n\n\t\t\t\t\t// This check ensures the `BlockSettingsMenuControls` fill\n\t\t\t\t\t// doesn't render multiple times and also that it renders for\n\t\t\t\t\t// the block from which the menu was triggered.\n\t\t\t\t\tif ( ! canRename ) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t);\n\t\t\t\t} }\n\t\t\t</BlockSettingsMenuControls>\n\n\t\t\t{ renamingBlock && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tblockName={ customName || '' }\n\t\t\t\t\toriginalBlockName={ blockInformation?.title }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t\tonSave={ ( newName ) => {\n\t\t\t\t\t\t// If the new value is the block's original name (e.g. `Group`)\n\t\t\t\t\t\t// or it is an empty string then assume the intent is to reset\n\t\t\t\t\t\t// the value. Therefore reset the metadata.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tnewName === blockInformation?.title ||\n\t\t\t\t\t\t\temptyString( newName )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tnewName = undefined;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tonChange( newName );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport const withBlockRenameControl = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes } = props;\n\n\t\tconst metaDataSupport = getBlockSupport(\n\t\t\tname,\n\t\t\t'__experimentalMetadata',\n\t\t\tfalse\n\t\t);\n\n\t\tconst supportsBlockNaming = !! (\n\t\t\ttrue === metaDataSupport || metaDataSupport?.name\n\t\t);\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ supportsBlockNaming && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<BlockRenameControl\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tcustomName={ attributes?.metadata?.name }\n\t\t\t\t\t\t\tonChange={ ( newName ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tmetadata: {\n\t\t\t\t\t\t\t\t\t\t...( attributes?.metadata &&\n\t\t\t\t\t\t\t\t\t\t\tattributes?.metadata ),\n\t\t\t\t\t\t\t\t\t\tname: newName,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\n\t\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t</>\n\t\t);\n\t},\n\t'withToolbarControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-control',\n\twithBlockRenameControl\n);\n"],"mappings":";;;;;;AAeA,IAAAA,QAAA,GAAAC,OAAA;AAZA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AASA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAP,OAAA;AArBA;AACA;AACA;;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