@wordpress/block-editor 12.14.0 → 12.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +1 -1
- package/build/components/block-list/block.native.js +2 -0
- package/build/components/block-list/block.native.js.map +1 -1
- package/build/components/block-parent-selector/index.js +1 -1
- package/build/components/block-parent-selector/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +25 -16
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build/components/block-patterns-list/index.js +36 -19
- package/build/components/block-patterns-list/index.js.map +1 -1
- 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 +87 -0
- package/build/components/block-rename/modal.js.map +1 -0
- package/build/components/block-rename/rename-control.js +74 -0
- package/build/components/block-rename/rename-control.js.map +1 -0
- package/build/components/block-rename/use-block-rename.js +17 -0
- package/build/components/block-rename/use-block-rename.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +33 -20
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- 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/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build/components/block-types-list/index.js +6 -2
- package/build/components/block-types-list/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +8 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +1 -1
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/image-size-control/index.js +0 -5
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/inner-blocks/index.js +3 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js +29 -31
- package/build/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +3 -4
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build/components/inserter-listbox/index.js +11 -6
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +24 -23
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +5 -5
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build/components/preview-options/index.js +4 -2
- package/build/components/preview-options/index.js.map +1 -1
- package/build/components/rich-text/index.native.js +1 -1
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +34 -3
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/components/rich-text/use-input-rules.js +30 -1
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +4 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/components/use-moving-animation/index.js +2 -1
- package/build/components/use-moving-animation/index.js.map +1 -1
- package/build/components/use-settings/index.js +2 -2
- package/build/components/use-settings/index.js.map +1 -1
- package/build/hooks/block-renaming.js +42 -0
- package/build/hooks/block-renaming.js.map +1 -1
- package/build/hooks/custom-fields.js +53 -48
- package/build/hooks/custom-fields.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/layout.js +13 -7
- package/build/hooks/layout.js.map +1 -1
- package/build/layouts/constrained.js +4 -3
- package/build/layouts/constrained.js.map +1 -1
- package/build/store/selectors.js +2 -0
- package/build/store/selectors.js.map +1 -1
- package/build/utils/transform-styles/index.js +26 -6
- package/build/utils/transform-styles/index.js.map +1 -1
- package/build-module/components/block-list/block.native.js +2 -0
- package/build-module/components/block-list/block.native.js.map +1 -1
- package/build-module/components/block-parent-selector/index.js +1 -1
- package/build-module/components/block-parent-selector/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +24 -15
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/setup-toolbar.js +4 -2
- package/build-module/components/block-pattern-setup/setup-toolbar.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +36 -19
- package/build-module/components/block-patterns-list/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 +10 -0
- package/build-module/components/block-rename/use-block-rename.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +34 -21
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- 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/block-toolbar/block-toolbar-menu.native.js +1 -1
- package/build-module/components/block-toolbar/block-toolbar-menu.native.js.map +1 -1
- package/build-module/components/block-types-list/index.js +6 -2
- package/build-module/components/block-types-list/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +8 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +1 -1
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/image-size-control/index.js +0 -5
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/inner-blocks/index.js +3 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js +30 -32
- package/build-module/components/inner-blocks/warning-max-depth-exceeded.native.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -4
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +2 -2
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +3 -4
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js +2 -1
- package/build-module/components/inserter/hooks/use-patterns-state.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +13 -8
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +25 -23
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +6 -5
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/list-view/use-list-view-expand-selected-item.js +2 -3
- package/build-module/components/list-view/use-list-view-expand-selected-item.js.map +1 -1
- package/build-module/components/preview-options/index.js +4 -2
- package/build-module/components/preview-options/index.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +1 -1
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +34 -3
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/components/rich-text/use-input-rules.js +31 -2
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +4 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/components/use-moving-animation/index.js +2 -1
- package/build-module/components/use-moving-animation/index.js.map +1 -1
- package/build-module/components/use-settings/index.js +2 -2
- package/build-module/components/use-settings/index.js.map +1 -1
- package/build-module/hooks/block-renaming.js +40 -0
- package/build-module/hooks/block-renaming.js.map +1 -1
- package/build-module/hooks/custom-fields.js +53 -48
- package/build-module/hooks/custom-fields.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/layout.js +13 -7
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/layouts/constrained.js +4 -3
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/store/selectors.js +2 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/transform-styles/index.js +24 -7
- package/build-module/utils/transform-styles/index.js.map +1 -1
- package/build-style/content-rtl.css +6 -6
- package/build-style/content.css +6 -6
- package/build-style/style-rtl.css +10 -5
- package/build-style/style.css +10 -5
- package/package.json +31 -31
- package/src/components/block-list/block.native.js +2 -0
- package/src/components/block-parent-selector/index.js +1 -1
- package/src/components/block-pattern-setup/index.js +38 -22
- package/src/components/block-pattern-setup/setup-toolbar.js +2 -0
- package/src/components/block-pattern-setup/style.scss +4 -1
- package/src/components/block-patterns-list/README.md +4 -4
- package/src/components/block-patterns-list/index.js +60 -34
- package/src/components/block-patterns-list/style.scss +7 -0
- 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 +10 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +38 -34
- package/src/components/block-settings-menu-controls/index.js +9 -0
- package/src/components/block-toolbar/block-toolbar-menu.native.js +1 -4
- package/src/components/block-types-list/index.js +5 -4
- package/src/components/button-block-appender/content.scss +2 -2
- package/src/components/date-format-picker/index.js +7 -0
- package/src/components/editable-text/README.md +0 -36
- package/src/components/global-styles/advanced-panel.js +1 -1
- package/src/components/image-size-control/index.js +0 -6
- package/src/components/inner-blocks/index.js +6 -2
- package/src/components/inner-blocks/warning-max-depth-exceeded.native.js +57 -33
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +5 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +7 -3
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +6 -1
- package/src/components/inserter/block-patterns-tab/utils.js +6 -4
- package/src/components/inserter/hooks/use-patterns-state.js +3 -1
- package/src/components/inserter-listbox/index.js +11 -7
- package/src/components/inserter-listbox/item.js +11 -12
- package/src/components/inserter-listbox/row.js +6 -12
- package/src/components/list-view/use-list-view-expand-selected-item.js +7 -8
- package/src/components/plain-text/README.md +0 -28
- package/src/components/preview-options/index.js +2 -0
- package/src/components/rich-text/README.md +0 -58
- package/src/components/rich-text/index.native.js +1 -1
- package/src/components/rich-text/native/index.native.js +45 -2
- package/src/components/rich-text/use-input-rules.js +30 -2
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +1 -1
- package/src/components/url-input/README.md +1 -74
- package/src/components/use-block-drop-zone/index.js +4 -1
- package/src/components/use-moving-animation/index.js +1 -1
- package/src/components/use-settings/index.js +2 -2
- package/src/components/use-settings/test/index.js +1 -1
- package/src/hooks/block-renaming.js +47 -0
- package/src/hooks/custom-fields.js +68 -65
- package/src/hooks/index.js +0 -1
- package/src/hooks/layout.js +12 -8
- package/src/hooks/test/__snapshots__/align.native.js.snap +5 -5
- package/src/layouts/constrained.js +57 -50
- package/src/store/selectors.js +2 -0
- package/src/style.scss +1 -1
- package/src/utils/test/transform-styles.js +49 -0
- package/src/utils/transform-styles/index.js +39 -13
- package/build/hooks/block-rename-ui.js +0 -167
- package/build/hooks/block-rename-ui.js.map +0 -1
- package/build-module/hooks/block-rename-ui.js +0 -159
- package/build-module/hooks/block-rename-ui.js.map +0 -1
- package/src/hooks/block-rename-ui.js +0 -228
- /package/src/{hooks/block-rename-ui.scss → components/block-rename/style.scss} +0 -0
package/src/store/selectors.js
CHANGED
|
@@ -27,6 +27,7 @@ import { createRegistrySelector } from '@wordpress/data';
|
|
|
27
27
|
* Internal dependencies
|
|
28
28
|
*/
|
|
29
29
|
import { orderBy } from '../utils/sorting';
|
|
30
|
+
import { PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* A block selection object.
|
|
@@ -2287,6 +2288,7 @@ function getUserPatterns( state ) {
|
|
|
2287
2288
|
return {
|
|
2288
2289
|
name: `core/block/${ userPattern.id }`,
|
|
2289
2290
|
id: userPattern.id,
|
|
2291
|
+
type: PATTERN_TYPES.user,
|
|
2290
2292
|
title: userPattern.title.raw,
|
|
2291
2293
|
categories: userPattern.wp_pattern_category.map( ( catId ) =>
|
|
2292
2294
|
categories && categories.get( catId )
|
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";
|
|
@@ -4,6 +4,55 @@
|
|
|
4
4
|
import transformStyles from '../transform-styles';
|
|
5
5
|
|
|
6
6
|
describe( 'transformStyles', () => {
|
|
7
|
+
describe( 'error handling', () => {
|
|
8
|
+
beforeEach( () => {
|
|
9
|
+
// Intentionally suppress the expected console errors and warnings to reduce
|
|
10
|
+
// noise in the test output.
|
|
11
|
+
jest.spyOn( console, 'warn' ).mockImplementation( jest.fn() );
|
|
12
|
+
} );
|
|
13
|
+
|
|
14
|
+
it( 'should not throw error in case of invalid css', () => {
|
|
15
|
+
const run = () =>
|
|
16
|
+
transformStyles(
|
|
17
|
+
[
|
|
18
|
+
{
|
|
19
|
+
css: 'h1 { color: red;', // invalid CSS
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'.my-namespace'
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect( run ).not.toThrow();
|
|
26
|
+
expect( console ).toHaveWarned();
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
it( 'should warn invalid css in the console', () => {
|
|
30
|
+
const run = () =>
|
|
31
|
+
transformStyles(
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
css: 'h1 { color: red; }', // valid CSS
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
css: 'h1 { color: red;', // invalid CSS
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
'.my-namespace'
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const [ validCSS, invalidCSS ] = run();
|
|
44
|
+
|
|
45
|
+
expect( validCSS ).toBe( '.my-namespace h1 { color: red; }' );
|
|
46
|
+
expect( invalidCSS ).toBe( null );
|
|
47
|
+
|
|
48
|
+
expect( console ).toHaveWarnedWith(
|
|
49
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
50
|
+
'<css input>:1:1: Unclosed block\n> 1 | h1 { color: red;\n | ^'
|
|
51
|
+
// ^^^^ In PostCSS, a tab is equal four spaces
|
|
52
|
+
);
|
|
53
|
+
} );
|
|
54
|
+
} );
|
|
55
|
+
|
|
7
56
|
describe( 'selector wrap', () => {
|
|
8
57
|
it( 'should wrap regular selectors', () => {
|
|
9
58
|
const input = `h1 { color: red; }`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import postcss from 'postcss';
|
|
4
|
+
import postcss, { CssSyntaxError } from 'postcss';
|
|
5
5
|
import wrap from 'postcss-prefixwrap';
|
|
6
6
|
import rebaseUrl from 'postcss-urlrebase';
|
|
7
7
|
|
|
@@ -19,18 +19,44 @@ import rebaseUrl from 'postcss-urlrebase';
|
|
|
19
19
|
*/
|
|
20
20
|
const transformStyles = ( styles, wrapperSelector = '' ) => {
|
|
21
21
|
return styles.map( ( { css, ignoredSelectors = [], baseURL } ) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
// When there is no wrapper selector or base URL, there is no need
|
|
23
|
+
// to transform the CSS. This is most cases because in the default
|
|
24
|
+
// iframed editor, no wrapping is needed, and not many styles
|
|
25
|
+
// provide a base URL.
|
|
26
|
+
if ( ! wrapperSelector && ! baseURL ) {
|
|
27
|
+
return css;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
return postcss(
|
|
32
|
+
[
|
|
33
|
+
wrapperSelector &&
|
|
34
|
+
wrap( wrapperSelector, {
|
|
35
|
+
ignoredSelectors: [
|
|
36
|
+
...ignoredSelectors,
|
|
37
|
+
wrapperSelector,
|
|
38
|
+
],
|
|
39
|
+
} ),
|
|
40
|
+
baseURL && rebaseUrl( { rootUrl: baseURL } ),
|
|
41
|
+
].filter( Boolean )
|
|
42
|
+
).process( css, {} ).css; // use sync PostCSS API
|
|
43
|
+
} catch ( error ) {
|
|
44
|
+
if ( error instanceof CssSyntaxError ) {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn(
|
|
47
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
48
|
+
error.message + '\n' + error.showSourceCode( false )
|
|
49
|
+
);
|
|
50
|
+
} else {
|
|
51
|
+
// eslint-disable-next-line no-console
|
|
52
|
+
console.warn(
|
|
53
|
+
'wp.blockEditor.transformStyles Failed to transform CSS.',
|
|
54
|
+
error
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
34
60
|
} );
|
|
35
61
|
};
|
|
36
62
|
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.withBlockRenameControls = void 0;
|
|
7
|
-
var _react = require("react");
|
|
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 _element = require("@wordpress/element");
|
|
14
|
-
var _a11y = require("@wordpress/a11y");
|
|
15
|
-
var _components2 = require("../components");
|
|
16
|
-
/**
|
|
17
|
-
* WordPress dependencies
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Internal dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
const emptyString = testString => testString?.trim()?.length === 0;
|
|
25
|
-
function RenameModal({
|
|
26
|
-
blockName,
|
|
27
|
-
originalBlockName,
|
|
28
|
-
onClose,
|
|
29
|
-
onSave
|
|
30
|
-
}) {
|
|
31
|
-
const [editedBlockName, setEditedBlockName] = (0, _element.useState)(blockName);
|
|
32
|
-
const nameHasChanged = editedBlockName !== blockName;
|
|
33
|
-
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
34
|
-
const nameIsEmpty = emptyString(editedBlockName);
|
|
35
|
-
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
36
|
-
const autoSelectInputText = event => event.target.select();
|
|
37
|
-
const dialogDescription = (0, _compose.useInstanceId)(RenameModal, `block-editor-rename-modal__description`);
|
|
38
|
-
const handleSubmit = () => {
|
|
39
|
-
const message = nameIsOriginal || nameIsEmpty ? (0, _i18n.sprintf)( /* translators: %s: new name/label for the block */
|
|
40
|
-
(0, _i18n.__)('Block name reset to: "%s".'), editedBlockName) : (0, _i18n.sprintf)( /* translators: %s: new name/label for the block */
|
|
41
|
-
(0, _i18n.__)('Block name changed to: "%s".'), editedBlockName);
|
|
42
|
-
|
|
43
|
-
// Must be assertive to immediately announce change.
|
|
44
|
-
(0, _a11y.speak)(message, 'assertive');
|
|
45
|
-
onSave(editedBlockName);
|
|
46
|
-
|
|
47
|
-
// Immediate close avoids ability to hit save multiple times.
|
|
48
|
-
onClose();
|
|
49
|
-
};
|
|
50
|
-
return (0, _react.createElement)(_components.Modal, {
|
|
51
|
-
title: (0, _i18n.__)('Rename'),
|
|
52
|
-
onRequestClose: onClose,
|
|
53
|
-
overlayClassName: "block-editor-block-rename-modal",
|
|
54
|
-
aria: {
|
|
55
|
-
describedby: dialogDescription
|
|
56
|
-
},
|
|
57
|
-
focusOnMount: "firstContentElement"
|
|
58
|
-
}, (0, _react.createElement)("p", {
|
|
59
|
-
id: dialogDescription
|
|
60
|
-
}, (0, _i18n.__)('Enter a custom name for this block.')), (0, _react.createElement)("form", {
|
|
61
|
-
onSubmit: e => {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
if (!isNameValid) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
handleSubmit();
|
|
67
|
-
}
|
|
68
|
-
}, (0, _react.createElement)(_components.__experimentalVStack, {
|
|
69
|
-
spacing: "3"
|
|
70
|
-
}, (0, _react.createElement)(_components.TextControl, {
|
|
71
|
-
__nextHasNoMarginBottom: true,
|
|
72
|
-
__next40pxDefaultSize: true,
|
|
73
|
-
value: editedBlockName,
|
|
74
|
-
label: (0, _i18n.__)('Block name'),
|
|
75
|
-
hideLabelFromVision: true,
|
|
76
|
-
placeholder: originalBlockName,
|
|
77
|
-
onChange: setEditedBlockName,
|
|
78
|
-
onFocus: autoSelectInputText
|
|
79
|
-
}), (0, _react.createElement)(_components.__experimentalHStack, {
|
|
80
|
-
justify: "right"
|
|
81
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
82
|
-
variant: "tertiary",
|
|
83
|
-
onClick: onClose
|
|
84
|
-
}, (0, _i18n.__)('Cancel')), (0, _react.createElement)(_components.Button, {
|
|
85
|
-
"aria-disabled": !isNameValid,
|
|
86
|
-
variant: "primary",
|
|
87
|
-
type: "submit"
|
|
88
|
-
}, (0, _i18n.__)('Save'))))));
|
|
89
|
-
}
|
|
90
|
-
function BlockRenameControl(props) {
|
|
91
|
-
const [renamingBlock, setRenamingBlock] = (0, _element.useState)(false);
|
|
92
|
-
const {
|
|
93
|
-
clientId,
|
|
94
|
-
customName,
|
|
95
|
-
onChange
|
|
96
|
-
} = props;
|
|
97
|
-
const blockInformation = (0, _components2.useBlockDisplayInformation)(clientId);
|
|
98
|
-
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components2.InspectorControls, {
|
|
99
|
-
group: "advanced"
|
|
100
|
-
}, (0, _react.createElement)(_components.TextControl, {
|
|
101
|
-
__nextHasNoMarginBottom: true,
|
|
102
|
-
__next40pxDefaultSize: true,
|
|
103
|
-
label: (0, _i18n.__)('Block name'),
|
|
104
|
-
value: customName || '',
|
|
105
|
-
onChange: onChange
|
|
106
|
-
})), (0, _react.createElement)(_components2.BlockSettingsMenuControls, null, ({
|
|
107
|
-
selectedClientIds
|
|
108
|
-
}) => {
|
|
109
|
-
// Only enabled for single selections.
|
|
110
|
-
const canRename = selectedClientIds.length === 1 && clientId === selectedClientIds[0];
|
|
111
|
-
|
|
112
|
-
// This check ensures the `BlockSettingsMenuControls` fill
|
|
113
|
-
// doesn't render multiple times and also that it renders for
|
|
114
|
-
// the block from which the menu was triggered.
|
|
115
|
-
if (!canRename) {
|
|
116
|
-
return null;
|
|
117
|
-
}
|
|
118
|
-
return (0, _react.createElement)(_components.MenuItem, {
|
|
119
|
-
onClick: () => {
|
|
120
|
-
setRenamingBlock(true);
|
|
121
|
-
},
|
|
122
|
-
"aria-expanded": renamingBlock,
|
|
123
|
-
"aria-haspopup": "dialog"
|
|
124
|
-
}, (0, _i18n.__)('Rename'));
|
|
125
|
-
}), renamingBlock && (0, _react.createElement)(RenameModal, {
|
|
126
|
-
blockName: customName || '',
|
|
127
|
-
originalBlockName: blockInformation?.title,
|
|
128
|
-
onClose: () => setRenamingBlock(false),
|
|
129
|
-
onSave: newName => {
|
|
130
|
-
// If the new value is the block's original name (e.g. `Group`)
|
|
131
|
-
// or it is an empty string then assume the intent is to reset
|
|
132
|
-
// the value. Therefore reset the metadata.
|
|
133
|
-
if (newName === blockInformation?.title || emptyString(newName)) {
|
|
134
|
-
newName = undefined;
|
|
135
|
-
}
|
|
136
|
-
onChange(newName);
|
|
137
|
-
}
|
|
138
|
-
}));
|
|
139
|
-
}
|
|
140
|
-
const withBlockRenameControls = (0, _compose.createHigherOrderComponent)(BlockEdit => props => {
|
|
141
|
-
const {
|
|
142
|
-
clientId,
|
|
143
|
-
name,
|
|
144
|
-
attributes,
|
|
145
|
-
setAttributes,
|
|
146
|
-
isSelected
|
|
147
|
-
} = props;
|
|
148
|
-
const supportsBlockNaming = (0, _blocks.hasBlockSupport)(name, 'renaming', true);
|
|
149
|
-
return (0, _react.createElement)(_react.Fragment, null, isSelected && supportsBlockNaming && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(BlockRenameControl, {
|
|
150
|
-
clientId: clientId,
|
|
151
|
-
customName: attributes?.metadata?.name,
|
|
152
|
-
onChange: newName => {
|
|
153
|
-
setAttributes({
|
|
154
|
-
metadata: {
|
|
155
|
-
...attributes?.metadata,
|
|
156
|
-
name: newName
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
})), (0, _react.createElement)(BlockEdit, {
|
|
161
|
-
key: "edit",
|
|
162
|
-
...props
|
|
163
|
-
}));
|
|
164
|
-
}, 'withBlockRenameControls');
|
|
165
|
-
exports.withBlockRenameControls = withBlockRenameControls;
|
|
166
|
-
(0, _hooks.addFilter)('editor.BlockEdit', 'core/block-rename-ui/with-block-rename-controls', withBlockRenameControls);
|
|
167
|
-
//# sourceMappingURL=block-rename-ui.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_hooks","_i18n","_blocks","_components","_element","_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","_react","createElement","Modal","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","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","withBlockRenameControls","createHigherOrderComponent","BlockEdit","name","attributes","setAttributes","isSelected","supportsBlockNaming","hasBlockSupport","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 { hasBlockSupport } 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\t__next40pxDefaultSize\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\t__next40pxDefaultSize\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 withBlockRenameControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes, isSelected } = props;\n\n\t\tconst supportsBlockNaming = hasBlockSupport( name, 'renaming', true );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isSelected && 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\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'withBlockRenameControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-controls',\n\twithBlockRenameControls\n);\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAA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ACdI,QAAQ,EAAE;UACT,GAAGL,UAAU,EAAEK,QAAQ;UACvBN,IAAI,EAAEL;QACP;MACD,CAAE,CAAC;IACJ;EAAG,CACH,CACA,CACF,EAED,IAAA7C,MAAA,CAAAC,aAAA,EAACgD,SAAS;IAACQ,GAAG,EAAC,MAAM;IAAA,GAAM1B;EAAK,CAAI,CACnC,CAAC;AAEL,CAAC,EACD,yBACD,CAAC;AAAC2B,OAAA,CAAAX,uBAAA,GAAAA,uBAAA;AAEF,IAAAY,gBAAS,EACR,kBAAkB,EAClB,iDAAiD,EACjDZ,uBACD,CAAC"}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose';
|
|
6
|
-
import { addFilter } from '@wordpress/hooks';
|
|
7
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
-
import { hasBlockSupport } from '@wordpress/blocks';
|
|
9
|
-
import { MenuItem, __experimentalHStack as HStack, __experimentalVStack as VStack, Button, TextControl, Modal } from '@wordpress/components';
|
|
10
|
-
import { useState } from '@wordpress/element';
|
|
11
|
-
import { speak } from '@wordpress/a11y';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { BlockSettingsMenuControls, useBlockDisplayInformation, InspectorControls } from '../components';
|
|
17
|
-
const emptyString = testString => testString?.trim()?.length === 0;
|
|
18
|
-
function RenameModal({
|
|
19
|
-
blockName,
|
|
20
|
-
originalBlockName,
|
|
21
|
-
onClose,
|
|
22
|
-
onSave
|
|
23
|
-
}) {
|
|
24
|
-
const [editedBlockName, setEditedBlockName] = useState(blockName);
|
|
25
|
-
const nameHasChanged = editedBlockName !== blockName;
|
|
26
|
-
const nameIsOriginal = editedBlockName === originalBlockName;
|
|
27
|
-
const nameIsEmpty = emptyString(editedBlockName);
|
|
28
|
-
const isNameValid = nameHasChanged || nameIsOriginal;
|
|
29
|
-
const autoSelectInputText = event => event.target.select();
|
|
30
|
-
const dialogDescription = useInstanceId(RenameModal, `block-editor-rename-modal__description`);
|
|
31
|
-
const handleSubmit = () => {
|
|
32
|
-
const message = nameIsOriginal || nameIsEmpty ? sprintf( /* translators: %s: new name/label for the block */
|
|
33
|
-
__('Block name reset to: "%s".'), editedBlockName) : sprintf( /* translators: %s: new name/label for the block */
|
|
34
|
-
__('Block name changed to: "%s".'), editedBlockName);
|
|
35
|
-
|
|
36
|
-
// Must be assertive to immediately announce change.
|
|
37
|
-
speak(message, 'assertive');
|
|
38
|
-
onSave(editedBlockName);
|
|
39
|
-
|
|
40
|
-
// Immediate close avoids ability to hit save multiple times.
|
|
41
|
-
onClose();
|
|
42
|
-
};
|
|
43
|
-
return createElement(Modal, {
|
|
44
|
-
title: __('Rename'),
|
|
45
|
-
onRequestClose: onClose,
|
|
46
|
-
overlayClassName: "block-editor-block-rename-modal",
|
|
47
|
-
aria: {
|
|
48
|
-
describedby: dialogDescription
|
|
49
|
-
},
|
|
50
|
-
focusOnMount: "firstContentElement"
|
|
51
|
-
}, createElement("p", {
|
|
52
|
-
id: dialogDescription
|
|
53
|
-
}, __('Enter a custom name for this block.')), createElement("form", {
|
|
54
|
-
onSubmit: e => {
|
|
55
|
-
e.preventDefault();
|
|
56
|
-
if (!isNameValid) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
handleSubmit();
|
|
60
|
-
}
|
|
61
|
-
}, createElement(VStack, {
|
|
62
|
-
spacing: "3"
|
|
63
|
-
}, createElement(TextControl, {
|
|
64
|
-
__nextHasNoMarginBottom: true,
|
|
65
|
-
__next40pxDefaultSize: true,
|
|
66
|
-
value: editedBlockName,
|
|
67
|
-
label: __('Block name'),
|
|
68
|
-
hideLabelFromVision: true,
|
|
69
|
-
placeholder: originalBlockName,
|
|
70
|
-
onChange: setEditedBlockName,
|
|
71
|
-
onFocus: autoSelectInputText
|
|
72
|
-
}), createElement(HStack, {
|
|
73
|
-
justify: "right"
|
|
74
|
-
}, createElement(Button, {
|
|
75
|
-
variant: "tertiary",
|
|
76
|
-
onClick: onClose
|
|
77
|
-
}, __('Cancel')), createElement(Button, {
|
|
78
|
-
"aria-disabled": !isNameValid,
|
|
79
|
-
variant: "primary",
|
|
80
|
-
type: "submit"
|
|
81
|
-
}, __('Save'))))));
|
|
82
|
-
}
|
|
83
|
-
function BlockRenameControl(props) {
|
|
84
|
-
const [renamingBlock, setRenamingBlock] = useState(false);
|
|
85
|
-
const {
|
|
86
|
-
clientId,
|
|
87
|
-
customName,
|
|
88
|
-
onChange
|
|
89
|
-
} = props;
|
|
90
|
-
const blockInformation = useBlockDisplayInformation(clientId);
|
|
91
|
-
return createElement(Fragment, null, createElement(InspectorControls, {
|
|
92
|
-
group: "advanced"
|
|
93
|
-
}, createElement(TextControl, {
|
|
94
|
-
__nextHasNoMarginBottom: true,
|
|
95
|
-
__next40pxDefaultSize: true,
|
|
96
|
-
label: __('Block name'),
|
|
97
|
-
value: customName || '',
|
|
98
|
-
onChange: onChange
|
|
99
|
-
})), createElement(BlockSettingsMenuControls, null, ({
|
|
100
|
-
selectedClientIds
|
|
101
|
-
}) => {
|
|
102
|
-
// Only enabled for single selections.
|
|
103
|
-
const canRename = selectedClientIds.length === 1 && clientId === selectedClientIds[0];
|
|
104
|
-
|
|
105
|
-
// This check ensures the `BlockSettingsMenuControls` fill
|
|
106
|
-
// doesn't render multiple times and also that it renders for
|
|
107
|
-
// the block from which the menu was triggered.
|
|
108
|
-
if (!canRename) {
|
|
109
|
-
return null;
|
|
110
|
-
}
|
|
111
|
-
return createElement(MenuItem, {
|
|
112
|
-
onClick: () => {
|
|
113
|
-
setRenamingBlock(true);
|
|
114
|
-
},
|
|
115
|
-
"aria-expanded": renamingBlock,
|
|
116
|
-
"aria-haspopup": "dialog"
|
|
117
|
-
}, __('Rename'));
|
|
118
|
-
}), renamingBlock && createElement(RenameModal, {
|
|
119
|
-
blockName: customName || '',
|
|
120
|
-
originalBlockName: blockInformation?.title,
|
|
121
|
-
onClose: () => setRenamingBlock(false),
|
|
122
|
-
onSave: newName => {
|
|
123
|
-
// If the new value is the block's original name (e.g. `Group`)
|
|
124
|
-
// or it is an empty string then assume the intent is to reset
|
|
125
|
-
// the value. Therefore reset the metadata.
|
|
126
|
-
if (newName === blockInformation?.title || emptyString(newName)) {
|
|
127
|
-
newName = undefined;
|
|
128
|
-
}
|
|
129
|
-
onChange(newName);
|
|
130
|
-
}
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
export const withBlockRenameControls = createHigherOrderComponent(BlockEdit => props => {
|
|
134
|
-
const {
|
|
135
|
-
clientId,
|
|
136
|
-
name,
|
|
137
|
-
attributes,
|
|
138
|
-
setAttributes,
|
|
139
|
-
isSelected
|
|
140
|
-
} = props;
|
|
141
|
-
const supportsBlockNaming = hasBlockSupport(name, 'renaming', true);
|
|
142
|
-
return createElement(Fragment, null, isSelected && supportsBlockNaming && createElement(Fragment, null, createElement(BlockRenameControl, {
|
|
143
|
-
clientId: clientId,
|
|
144
|
-
customName: attributes?.metadata?.name,
|
|
145
|
-
onChange: newName => {
|
|
146
|
-
setAttributes({
|
|
147
|
-
metadata: {
|
|
148
|
-
...attributes?.metadata,
|
|
149
|
-
name: newName
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
})), createElement(BlockEdit, {
|
|
154
|
-
key: "edit",
|
|
155
|
-
...props
|
|
156
|
-
}));
|
|
157
|
-
}, 'withBlockRenameControls');
|
|
158
|
-
addFilter('editor.BlockEdit', 'core/block-rename-ui/with-block-rename-controls', withBlockRenameControls);
|
|
159
|
-
//# sourceMappingURL=block-rename-ui.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createHigherOrderComponent","useInstanceId","addFilter","__","sprintf","hasBlockSupport","MenuItem","__experimentalHStack","HStack","__experimentalVStack","VStack","Button","TextControl","Modal","useState","speak","BlockSettingsMenuControls","useBlockDisplayInformation","InspectorControls","emptyString","testString","trim","length","RenameModal","blockName","originalBlockName","onClose","onSave","editedBlockName","setEditedBlockName","nameHasChanged","nameIsOriginal","nameIsEmpty","isNameValid","autoSelectInputText","event","target","select","dialogDescription","handleSubmit","message","createElement","title","onRequestClose","overlayClassName","aria","describedby","focusOnMount","id","onSubmit","e","preventDefault","spacing","__nextHasNoMarginBottom","__next40pxDefaultSize","value","label","hideLabelFromVision","placeholder","onChange","onFocus","justify","variant","onClick","type","BlockRenameControl","props","renamingBlock","setRenamingBlock","clientId","customName","blockInformation","Fragment","group","selectedClientIds","canRename","newName","undefined","withBlockRenameControls","BlockEdit","name","attributes","setAttributes","isSelected","supportsBlockNaming","metadata","key"],"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 { hasBlockSupport } 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\t__next40pxDefaultSize\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\t__next40pxDefaultSize\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 withBlockRenameControls = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { clientId, name, attributes, setAttributes, isSelected } = props;\n\n\t\tconst supportsBlockNaming = hasBlockSupport( name, 'renaming', true );\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ isSelected && 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\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'withBlockRenameControls'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/block-rename-ui/with-block-rename-controls',\n\twithBlockRenameControls\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,0BAA0B,EAAEC,aAAa,QAAQ,oBAAoB;AAC9E,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACCC,QAAQ,EACRC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,MAAM,EACNC,WAAW,EACXC,KAAK,QACC,uBAAuB;AAC9B,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,KAAK,QAAQ,iBAAiB;;AAEvC;AACA;AACA;AACA,SACCC,yBAAyB,EACzBC,0BAA0B,EAC1BC,iBAAiB,QACX,eAAe;AAEtB,MAAMC,WAAW,GAAKC,UAAU,IAAMA,UAAU,EAAEC,IAAI,CAAC,CAAC,EAAEC,MAAM,KAAK,CAAC;AAEtE,SAASC,WAAWA,CAAE;EAAEC,SAAS;EAAEC,iBAAiB;EAAEC,OAAO;EAAEC;AAAO,CAAC,EAAG;EACzE,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAGf,QAAQ,CAAEU,SAAU,CAAC;EAErE,MAAMM,cAAc,GAAGF,eAAe,KAAKJ,SAAS;EACpD,MAAMO,cAAc,GAAGH,eAAe,KAAKH,iBAAiB;EAC5D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