@wordpress/block-editor 15.12.2-next.v.0 → 15.12.2-next.v.20260206T143.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 +1 -1
- package/build/components/block-card/index.cjs +1 -1
- package/build/components/block-card/index.cjs.map +2 -2
- package/build/components/block-full-height-alignment-control/index.cjs +1 -1
- package/build/components/block-full-height-alignment-control/index.cjs.map +1 -1
- package/build/components/block-rename/rename-control.cjs +9 -0
- package/build/components/block-rename/rename-control.cjs.map +3 -3
- package/build/components/block-rename/use-block-rename.cjs +1 -1
- package/build/components/block-rename/use-block-rename.cjs.map +2 -2
- package/build/components/block-tools/index.cjs +24 -0
- package/build/components/block-tools/index.cjs.map +2 -2
- package/build/components/keyboard-shortcuts/index.cjs +9 -0
- package/build/components/keyboard-shortcuts/index.cjs.map +2 -2
- package/build/components/list-view/block.cjs +18 -0
- package/build/components/list-view/block.cjs.map +2 -2
- package/build/hooks/list-view.cjs +6 -9
- package/build/hooks/list-view.cjs.map +2 -2
- package/build-module/components/block-card/index.mjs +1 -1
- package/build-module/components/block-card/index.mjs.map +2 -2
- package/build-module/components/block-full-height-alignment-control/index.mjs +2 -2
- package/build-module/components/block-full-height-alignment-control/index.mjs.map +1 -1
- package/build-module/components/block-rename/rename-control.mjs +9 -0
- package/build-module/components/block-rename/rename-control.mjs.map +2 -2
- package/build-module/components/block-rename/use-block-rename.mjs +1 -1
- package/build-module/components/block-rename/use-block-rename.mjs.map +2 -2
- package/build-module/components/block-tools/index.mjs +24 -0
- package/build-module/components/block-tools/index.mjs.map +2 -2
- package/build-module/components/keyboard-shortcuts/index.mjs +9 -0
- package/build-module/components/keyboard-shortcuts/index.mjs.map +2 -2
- package/build-module/components/list-view/block.mjs +18 -0
- package/build-module/components/list-view/block.mjs.map +2 -2
- package/build-module/hooks/list-view.mjs +6 -9
- package/build-module/hooks/list-view.mjs.map +2 -2
- package/package.json +39 -39
- package/src/components/block-card/index.js +2 -2
- package/src/components/block-full-height-alignment-control/index.js +2 -2
- package/src/components/block-rename/rename-control.js +11 -0
- package/src/components/block-rename/use-block-rename.js +1 -1
- package/src/components/block-tools/index.js +25 -0
- package/src/components/keyboard-shortcuts/index.js +10 -0
- package/src/components/letter-spacing-control/stories/index.story.jsx +80 -0
- package/src/components/list-view/block.js +18 -1
- package/src/hooks/list-view.js +12 -17
package/CHANGELOG.md
CHANGED
|
@@ -85,7 +85,7 @@ function BlockCard({
|
|
|
85
85
|
return {};
|
|
86
86
|
}
|
|
87
87
|
const { getBlockParents, getBlockName } = select(import_store.store);
|
|
88
|
-
const parents = getBlockParents(clientId,
|
|
88
|
+
const parents = getBlockParents(clientId, false);
|
|
89
89
|
const foundParentId = parents.find((parentId) => {
|
|
90
90
|
const parentName = getBlockName(parentId);
|
|
91
91
|
return parentName === "core/navigation" || (0, import_blocks.hasBlockSupport)(parentName, "listView");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-card/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tarrowRight,\n\tarrowLeft,\n} from '@wordpress/icons';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nfunction OptionalParentSelectButton( { children, onClick } ) {\n\tif ( ! onClick ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-block-card__parent-select-button\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\n/**\n * A card component that displays block information including title, icon, and description.\n * Can be used to show block metadata and navigation controls for parent blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md\n *\n * @example\n * ```jsx\n * function Example() {\n * return (\n * <BlockCard\n * title=\"My Block\"\n * icon=\"smiley\"\n * description=\"A simple block example\"\n * name=\"Custom Block\"\n * />\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.title The title of the block.\n * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.\n * @param {string} props.description The description of the block.\n * @param {Object} [props.blockType] Deprecated: Object containing block type data.\n * @param {string} [props.className] Additional classes to apply to the card.\n * @param {string} [props.name] Custom block name to display before the title.\n * @param {string} [props.allowParentNavigation] Show a back arrow to the parent block in some situations.\n * @param {string} [props.parentClientId] The parent clientId, if this card is for a parent block.\n * @param {string} [props.isChild] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {string} [props.clientId] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {Element} [props.children] Children.\n * @return {Element} Block card component.\n */\nfunction BlockCard( {\n\ttitle,\n\ticon,\n\tdescription,\n\tblockType,\n\tclassName,\n\tname,\n\tallowParentNavigation,\n\tparentClientId,\n\tisChild,\n\tchildren,\n\tclientId,\n} ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentBlockClientId, parentBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( parentClientId || isChild || ! allowParentNavigation ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\t// Find the
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAOO;AACP,kBAAuC;AACvC,wBAAuB;AACvB,kBAAmC;AACnC,mBAKO;AACP,oBAA8C;AAK9C,yBAAuB;AACvB,mBAA0C;AAC1C,wBAAsB;AAUpB;AARF,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAEhD,SAAS,2BAA4B,EAAE,UAAU,QAAQ,GAAI;AAC5D,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAU;AAAA,MACV;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;AAoCA,SAAS,UAAW;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,MAAK,WAAY;AAChB,0BAAAC,SAAY,iDAAiD;AAAA,MAC5D,OAAO;AAAA,MACP,aAAa;AAAA,IACd,CAAE;AACF,KAAE,EAAE,OAAO,MAAM,YAAY,IAAI;AAAA,EAClC;AAEA,QAAM,EAAE,qBAAqB,gBAAgB,QAAI;AAAA,IAChD,CAAE,WAAY;AACb,UAAK,kBAAkB,WAAW,CAAE,uBAAwB;AAC3D,eAAO,CAAC;AAAA,MACT;AACA,YAAM,EAAE,iBAAiB,aAAa,IACrC,OAAQ,aAAAC,KAAiB;AAK1B,YAAM,UAAU,gBAAiB,UAAU,
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tIcon,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\t__experimentalHStack as HStack,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tchevronLeft,\n\tchevronRight,\n\tarrowRight,\n\tarrowLeft,\n} from '@wordpress/icons';\nimport { getBlockType, hasBlockSupport } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as blockEditorStore } from '../../store';\nimport BlockIcon from '../block-icon';\n\nconst { Badge } = unlock( componentsPrivateApis );\n\nfunction OptionalParentSelectButton( { children, onClick } ) {\n\tif ( ! onClick ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Button\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"block-editor-block-card__parent-select-button\"\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\n/**\n * A card component that displays block information including title, icon, and description.\n * Can be used to show block metadata and navigation controls for parent blocks.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/block-card/README.md\n *\n * @example\n * ```jsx\n * function Example() {\n * return (\n * <BlockCard\n * title=\"My Block\"\n * icon=\"smiley\"\n * description=\"A simple block example\"\n * name=\"Custom Block\"\n * />\n * );\n * }\n * ```\n *\n * @param {Object} props Component props.\n * @param {string} props.title The title of the block.\n * @param {string|Object} props.icon The icon of the block. This can be any of [WordPress' Dashicons](https://developer.wordpress.org/resource/dashicons/), or a custom `svg` element.\n * @param {string} props.description The description of the block.\n * @param {Object} [props.blockType] Deprecated: Object containing block type data.\n * @param {string} [props.className] Additional classes to apply to the card.\n * @param {string} [props.name] Custom block name to display before the title.\n * @param {string} [props.allowParentNavigation] Show a back arrow to the parent block in some situations.\n * @param {string} [props.parentClientId] The parent clientId, if this card is for a parent block.\n * @param {string} [props.isChild] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {string} [props.clientId] Whether the block card is for a child block, in which case, indent the block using an arrow.\n * @param {Element} [props.children] Children.\n * @return {Element} Block card component.\n */\nfunction BlockCard( {\n\ttitle,\n\ticon,\n\tdescription,\n\tblockType,\n\tclassName,\n\tname,\n\tallowParentNavigation,\n\tparentClientId,\n\tisChild,\n\tchildren,\n\tclientId,\n} ) {\n\tif ( blockType ) {\n\t\tdeprecated( '`blockType` property in `BlockCard component`', {\n\t\t\tsince: '5.7',\n\t\t\talternative: '`title, icon and description` properties',\n\t\t} );\n\t\t( { title, icon, description } = blockType );\n\t}\n\n\tconst { parentBlockClientId, parentBlockName } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( parentClientId || isChild || ! allowParentNavigation ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst { getBlockParents, getBlockName } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\t// Find the top-most parent block that is either:\n\t\t\t// 1. A navigation block (special case for ad-hoc list view support)\n\t\t\t// 2. Any block with listView support\n\t\t\tconst parents = getBlockParents( clientId, false );\n\t\t\tconst foundParentId = parents.find( ( parentId ) => {\n\t\t\t\tconst parentName = getBlockName( parentId );\n\t\t\t\treturn (\n\t\t\t\t\tparentName === 'core/navigation' ||\n\t\t\t\t\thasBlockSupport( parentName, 'listView' )\n\t\t\t\t);\n\t\t\t} );\n\n\t\t\treturn {\n\t\t\t\tparentBlockClientId: foundParentId,\n\t\t\t\tparentBlockName: foundParentId\n\t\t\t\t\t? getBlockName( foundParentId )\n\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ clientId, allowParentNavigation, isChild, parentClientId ]\n\t);\n\n\tconst { selectBlock } = useDispatch( blockEditorStore );\n\n\tconst TitleElement = parentClientId ? 'div' : 'h2';\n\n\treturn (\n\t\t<div\n\t\t\tclassName={ clsx(\n\t\t\t\t'block-editor-block-card',\n\t\t\t\t{\n\t\t\t\t\t'is-parent': parentClientId,\n\t\t\t\t\t'is-child': isChild,\n\t\t\t\t},\n\t\t\t\tclassName\n\t\t\t) }\n\t\t>\n\t\t\t<VStack>\n\t\t\t\t<HStack justify=\"flex-start\" spacing={ 0 }>\n\t\t\t\t\t{ parentBlockClientId && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tonClick={ () => selectBlock( parentBlockClientId ) }\n\t\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\t\tparentBlockName\n\t\t\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: The name of the parent block. */\n\t\t\t\t\t\t\t\t\t\t\t__( 'Go to \"%s\" block' ),\n\t\t\t\t\t\t\t\t\t\t\tgetBlockType( parentBlockName )\n\t\t\t\t\t\t\t\t\t\t\t\t?.title\n\t\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t\t\t: __( 'Go to parent block' )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tstyle={\n\t\t\t\t\t\t\t\t// TODO: This style override is also used in ToolsPanelHeader.\n\t\t\t\t\t\t\t\t// It should be supported out-of-the-box by Button.\n\t\t\t\t\t\t\t\t{ minWidth: 24, padding: 0 }\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isChild && (\n\t\t\t\t\t\t<span className=\"block-editor-block-card__child-indicator-icon\">\n\t\t\t\t\t\t\t<Icon icon={ isRTL() ? arrowLeft : arrowRight } />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t<OptionalParentSelectButton\n\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\tparentClientId\n\t\t\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\t\t\tselectBlock( parentClientId );\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockIcon icon={ icon } showColors />\n\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t<TitleElement className=\"block-editor-block-card__title\">\n\t\t\t\t\t\t\t\t<span className=\"block-editor-block-card__name\">\n\t\t\t\t\t\t\t\t\t{ !! name?.length ? name : title }\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t{ ! parentClientId &&\n\t\t\t\t\t\t\t\t\t! isChild &&\n\t\t\t\t\t\t\t\t\t!! name?.length && (\n\t\t\t\t\t\t\t\t\t\t<Badge>{ title }</Badge>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</TitleElement>\n\t\t\t\t\t\t\t{ children }\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t</OptionalParentSelectButton>\n\t\t\t\t</HStack>\n\t\t\t\t{ ! parentClientId && ! isChild && description && (\n\t\t\t\t\t<Text className=\"block-editor-block-card__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</Text>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</div>\n\t);\n}\n\nexport default BlockCard;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,wBAOO;AACP,kBAAuC;AACvC,wBAAuB;AACvB,kBAAmC;AACnC,mBAKO;AACP,oBAA8C;AAK9C,yBAAuB;AACvB,mBAA0C;AAC1C,wBAAsB;AAUpB;AARF,IAAM,EAAE,MAAM,QAAI,2BAAQ,kBAAAA,WAAsB;AAEhD,SAAS,2BAA4B,EAAE,UAAU,QAAQ,GAAI;AAC5D,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAU;AAA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AAAA,cACA,SAAU,MAAM,YAAa,mBAAoB;AAAA,cACjD,OACC,sBACG;AAAA;AAAA,oBAEA,gBAAI,kBAAmB;AAAA,oBACvB,4BAAc,eAAgB,GAC3B;AAAA,cACH,QACA,gBAAI,oBAAqB;AAAA,cAE7B;AAAA;AAAA;AAAA,gBAGC,EAAE,UAAU,IAAI,SAAS,EAAE;AAAA;AAAA,cAE5B,UAAO,mBAAM,IAAI,4BAAe;AAAA,cAChC,MAAK;AAAA;AAAA,UACN;AAAA,UAEC,WACD,4CAAC,UAAK,WAAU,iDACf,sDAAC,0BAAK,UAAO,mBAAM,IAAI,yBAAY,yBAAa,GACjD;AAAA,UAED;AAAA,YAAC;AAAA;AAAA,cACA,SACC,iBACG,MAAM;AACN,4BAAa,cAAe;AAAA,cAC5B,IACA;AAAA,cAGJ;AAAA,4DAAC,kBAAAC,SAAA,EAAU,MAAc,YAAU,MAAC;AAAA,gBACpC,6CAAC,kBAAAF,sBAAA,EAAO,SAAU,GACjB;AAAA,+DAAC,gBAAa,WAAU,kCACvB;AAAA,gEAAC,UAAK,WAAU,iCACb,WAAC,CAAE,MAAM,SAAS,OAAO,OAC5B;AAAA,oBACE,CAAE,kBACH,CAAE,WACF,CAAC,CAAE,MAAM,UACR,4CAAC,SAAQ,iBAAO;AAAA,qBAEnB;AAAA,kBACE;AAAA,mBACH;AAAA;AAAA;AAAA,UACD;AAAA,WACD;AAAA,QACE,CAAE,kBAAkB,CAAE,WAAW,eAClC,4CAAC,kBAAAG,oBAAA,EAAK,WAAU,wCACb,uBACH;AAAA,SAEF;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,qBAAQ;",
|
|
6
6
|
"names": ["componentsPrivateApis", "deprecated", "blockEditorStore", "clsx", "VStack", "HStack", "BlockIcon", "Text"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-full-height-alignment-control/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport {
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { fullHeight } from '@wordpress/icons';\n\nfunction BlockFullHeightAlignmentControl( {\n\tisActive,\n\tlabel = __( 'Full height' ),\n\tonToggle,\n\tisDisabled,\n} ) {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tisActive={ isActive }\n\t\t\ticon={ fullHeight }\n\t\t\tlabel={ label }\n\t\t\tonClick={ () => onToggle( ! isActive ) }\n\t\t\tdisabled={ isDisabled }\n\t\t/>\n\t);\n}\n\nexport default BlockFullHeightAlignmentControl;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA8B;AAC9B,mBAA2B;AASzB;AAPF,SAAS,gCAAiC;AAAA,EACzC;AAAA,EACA,YAAQ,gBAAI,aAAc;AAAA,EAC1B;AAAA,EACA;AACD,GAAI;AACH,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA,MAAO;AAAA,MACP;AAAA,MACA,SAAU,MAAM,SAAU,CAAE,QAAS;AAAA,MACrC,UAAW;AAAA;AAAA,EACZ;AAEF;AAEA,IAAO,8CAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -36,10 +36,18 @@ module.exports = __toCommonJS(rename_control_exports);
|
|
|
36
36
|
var import_components = require("@wordpress/components");
|
|
37
37
|
var import_i18n = require("@wordpress/i18n");
|
|
38
38
|
var import_element = require("@wordpress/element");
|
|
39
|
+
var import_data = require("@wordpress/data");
|
|
40
|
+
var import_keyboard_shortcuts = require("@wordpress/keyboard-shortcuts");
|
|
39
41
|
var import_modal = __toESM(require("./modal.cjs"));
|
|
40
42
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
43
|
function BlockRenameControl({ clientId }) {
|
|
42
44
|
const [renamingBlock, setRenamingBlock] = (0, import_element.useState)(false);
|
|
45
|
+
const shortcut = (0, import_data.useSelect)(
|
|
46
|
+
(select) => select(import_keyboard_shortcuts.store).getShortcutRepresentation(
|
|
47
|
+
"core/block-editor/rename"
|
|
48
|
+
),
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
43
51
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
44
52
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
45
53
|
import_components.MenuItem,
|
|
@@ -49,6 +57,7 @@ function BlockRenameControl({ clientId }) {
|
|
|
49
57
|
},
|
|
50
58
|
"aria-expanded": renamingBlock,
|
|
51
59
|
"aria-haspopup": "dialog",
|
|
60
|
+
shortcut,
|
|
52
61
|
children: (0, import_i18n.__)("Rename")
|
|
53
62
|
}
|
|
54
63
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-rename/rename-control.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport BlockRenameModal from './modal';\n\nexport default function BlockRenameControl( { clientId } ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ renamingBlock && (\n\t\t\t\t<BlockRenameModal\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,kBAAmB;AACnB,qBAAyB;
|
|
6
|
-
"names": ["BlockRenameModal"]
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\n\n/**\n * Internal dependencies\n */\nimport BlockRenameModal from './modal';\n\nexport default function BlockRenameControl( { clientId } ) {\n\tconst [ renamingBlock, setRenamingBlock ] = useState( false );\n\n\tconst shortcut = useSelect(\n\t\t( select ) =>\n\t\t\tselect( keyboardShortcutsStore ).getShortcutRepresentation(\n\t\t\t\t'core/block-editor/rename'\n\t\t\t),\n\t\t[]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetRenamingBlock( true );\n\t\t\t\t} }\n\t\t\t\taria-expanded={ renamingBlock }\n\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\tshortcut={ shortcut }\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ renamingBlock && (\n\t\t\t\t<BlockRenameModal\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tonClose={ () => setRenamingBlock( false ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAyB;AACzB,kBAAmB;AACnB,qBAAyB;AACzB,kBAA0B;AAC1B,gCAAgD;AAKhD,mBAA6B;AAc3B;AAZa,SAAR,mBAAqC,EAAE,SAAS,GAAI;AAC1D,QAAM,CAAE,eAAe,gBAAiB,QAAI,yBAAU,KAAM;AAE5D,QAAM,eAAW;AAAA,IAChB,CAAE,WACD,OAAQ,0BAAAA,KAAuB,EAAE;AAAA,MAChC;AAAA,IACD;AAAA,IACD,CAAC;AAAA,EACF;AAEA,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,SAAU,MAAM;AACf,2BAAkB,IAAK;AAAA,QACxB;AAAA,QACA,iBAAgB;AAAA,QAChB,iBAAc;AAAA,QACd;AAAA,QAEE,8BAAI,QAAS;AAAA;AAAA,IAChB;AAAA,IACE,iBACD;AAAA,MAAC,aAAAC;AAAA,MAAA;AAAA,QACA;AAAA,QACA,SAAU,MAAM,iBAAkB,KAAM;AAAA;AAAA,IACzC;AAAA,KAEF;AAEF;",
|
|
6
|
+
"names": ["keyboardShortcutsStore", "BlockRenameModal"]
|
|
7
7
|
}
|
|
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(use_block_rename_exports);
|
|
|
26
26
|
var import_blocks = require("@wordpress/blocks");
|
|
27
27
|
function useBlockRename(name) {
|
|
28
28
|
return {
|
|
29
|
-
canRename: (0, import_blocks.getBlockSupport)(name, "renaming", true)
|
|
29
|
+
canRename: !!name && (0, import_blocks.getBlockSupport)(name, "renaming", true)
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=use-block-rename.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-rename/use-block-rename.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\n\nexport default function useBlockRename( name ) {\n\treturn {\n\t\tcanRename: getBlockSupport( name, 'renaming', true ),\n\t};\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAgC;AAEjB,SAAR,eAAiC,MAAO;AAC9C,SAAO;AAAA,IACN,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { getBlockSupport } from '@wordpress/blocks';\n\nexport default function useBlockRename( name ) {\n\treturn {\n\t\tcanRename: !! name && getBlockSupport( name, 'renaming', true ),\n\t};\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAgC;AAEjB,SAAR,eAAiC,MAAO;AAC9C,SAAO;AAAA,IACN,WAAW,CAAC,CAAE,YAAQ,+BAAiB,MAAM,YAAY,IAAK;AAAA,EAC/D;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -51,6 +51,7 @@ var import_zoom_out_mode_inserters = __toESM(require("./zoom-out-mode-inserters.
|
|
|
51
51
|
var import_use_show_block_tools = require("./use-show-block-tools.cjs");
|
|
52
52
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
53
53
|
var import_use_paste_styles = __toESM(require("../use-paste-styles/index.cjs"));
|
|
54
|
+
var import_block_rename = require("../block-rename/index.cjs");
|
|
54
55
|
var import_block_visibility = require("../block-visibility/index.cjs");
|
|
55
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
56
57
|
function selector(select) {
|
|
@@ -83,12 +84,18 @@ function BlockTools({
|
|
|
83
84
|
getBlocksByClientId,
|
|
84
85
|
getSelectedBlockClientIds,
|
|
85
86
|
getBlockRootClientId,
|
|
87
|
+
getBlockEditingMode,
|
|
88
|
+
getBlockName,
|
|
86
89
|
isGroupable,
|
|
87
90
|
getEditedContentOnlySection
|
|
88
91
|
} = (0, import_lock_unlock.unlock)((0, import_data.useSelect)(import_store.store));
|
|
89
92
|
const { getGroupingBlockName } = (0, import_data.useSelect)(import_blocks.store);
|
|
90
93
|
const { showEmptyBlockSideInserter, showBlockToolbarPopover } = (0, import_use_show_block_tools.useShowBlockTools)();
|
|
91
94
|
const pasteStyles = (0, import_use_paste_styles.default)();
|
|
95
|
+
const [renamingBlockClientId, setRenamingBlockClientId] = (0, import_element.useState)(null);
|
|
96
|
+
const { canRename } = (0, import_block_rename.useBlockRename)(
|
|
97
|
+
getBlockName(getSelectedBlockClientIds()[0])
|
|
98
|
+
);
|
|
92
99
|
const {
|
|
93
100
|
duplicateBlocks,
|
|
94
101
|
removeBlocks,
|
|
@@ -189,6 +196,16 @@ function BlockTools({
|
|
|
189
196
|
replaceBlocks(clientIds, newBlocks);
|
|
190
197
|
(0, import_a11y.speak)((0, import_i18n.__)("Selected blocks are grouped."));
|
|
191
198
|
}
|
|
199
|
+
} else if (isMatch("core/block-editor/rename", event)) {
|
|
200
|
+
const clientIds = getSelectedBlockClientIds();
|
|
201
|
+
if (clientIds.length === 1) {
|
|
202
|
+
const isContentOnly = getBlockEditingMode(clientIds[0]) === "contentOnly";
|
|
203
|
+
const canRenameBlock = canRename && !isContentOnly;
|
|
204
|
+
if (canRenameBlock) {
|
|
205
|
+
event.preventDefault();
|
|
206
|
+
setRenamingBlockClientId(clientIds[0]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
192
209
|
} else if (isMatch("core/block-editor/toggle-block-visibility", event)) {
|
|
193
210
|
const clientIds = getSelectedBlockClientIds();
|
|
194
211
|
if (clientIds.length) {
|
|
@@ -266,6 +283,13 @@ function BlockTools({
|
|
|
266
283
|
}
|
|
267
284
|
)
|
|
268
285
|
] }),
|
|
286
|
+
renamingBlockClientId && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
287
|
+
import_block_rename.BlockRenameModal,
|
|
288
|
+
{
|
|
289
|
+
clientId: renamingBlockClientId,
|
|
290
|
+
onClose: () => setRenamingBlockClientId(null)
|
|
291
|
+
}
|
|
292
|
+
),
|
|
269
293
|
visibilityModalClientIds && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
270
294
|
import_block_visibility.BlockVisibilityModal,
|
|
271
295
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/block-tools/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tswitchToBlockType,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\nimport usePasteStyles from '../use-paste-styles';\nimport { BlockVisibilityModal } from '../block-visibility';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\tconst [ visibilityModalClientIds, setVisibilityModalClientIds ] =\n\t\tuseState( null );\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tisGroupable,\n\t\tgetEditedContentOnlySection,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\n\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t\tstopEditingContentOnlySection,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst supportsBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport( block.name, 'visibility', true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! supportsBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Open the visibility breakpoints modal.\n\t\t\t\tsetVisibilityModalClientIds( clientIds );\n\t\t\t}\n\t\t}\n\n\t\t// Has the same keyboard shortcut as 'unselect', so can't be within the\n\t\t// if/else chain above.\n\t\tif ( isMatch( 'core/block-editor/stop-editing-as-blocks', event ) ) {\n\t\t\tif ( getEditedContentOnlySection() ) {\n\t\t\t\tstopEditingContentOnlySection();\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\t{ ...props }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\t// Popover slots cannot be unmounted during dragging because the\n\t\t\t// will just be rendered in a fallback popover slot instead.\n\t\t\tclassName={ clsx( props.className, {\n\t\t\t\t'block-editor-block-tools--is-dragging': isDragging,\n\t\t\t} ) }\n\t\t>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t\t{ visibilityModalClientIds && (\n\t\t\t\t<BlockVisibilityModal\n\t\t\t\t\tclientIds={ visibilityModalClientIds }\n\t\t\t\t\tonClose={ () => setVisibilityModalClientIds( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAuC;AACvC,iBAA4B;AAC5B,wBAAwB;AACxB,gCAAyE;AACzE,qBAAiC;AACjC,oBAIO;AACP,kBAAsB;AACtB,kBAAgC;AAKhC,kCAA+B;AAC/B,6BAGO;AACP,mCAAgC;AAChC,mBAA0C;AAC1C,gCAA6B;AAC7B,qCAAiC;AACjC,kCAAkC;AAClC,yBAAuB;AACvB,8BAA2B;AAC3B,8BAAqC;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { isTextField } from '@wordpress/dom';\nimport { Popover } from '@wordpress/components';\nimport { __unstableUseShortcutEventMatch as useShortcutEventMatch } from '@wordpress/keyboard-shortcuts';\nimport { useRef, useState } from '@wordpress/element';\nimport {\n\tswitchToBlockType,\n\thasBlockSupport,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { speak } from '@wordpress/a11y';\nimport { __, sprintf, _n } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport EmptyBlockInserter from './empty-block-inserter';\nimport {\n\tInsertionPointOpenRef,\n\tdefault as InsertionPoint,\n} from './insertion-point';\nimport BlockToolbarPopover from './block-toolbar-popover';\nimport { store as blockEditorStore } from '../../store';\nimport usePopoverScroll from '../block-popover/use-popover-scroll';\nimport ZoomOutModeInserters from './zoom-out-mode-inserters';\nimport { useShowBlockTools } from './use-show-block-tools';\nimport { unlock } from '../../lock-unlock';\nimport usePasteStyles from '../use-paste-styles';\nimport { BlockRenameModal, useBlockRename } from '../block-rename';\nimport { BlockVisibilityModal } from '../block-visibility';\n\nfunction selector( select ) {\n\tconst {\n\t\tgetSelectedBlockClientId,\n\t\tgetFirstMultiSelectedBlockClientId,\n\t\tgetSettings,\n\t\tisTyping,\n\t\tisDragging,\n\t\tisZoomOut,\n\t} = unlock( select( blockEditorStore ) );\n\n\tconst clientId =\n\t\tgetSelectedBlockClientId() || getFirstMultiSelectedBlockClientId();\n\n\treturn {\n\t\tclientId,\n\t\thasFixedToolbar: getSettings().hasFixedToolbar,\n\t\tisTyping: isTyping(),\n\t\tisZoomOutMode: isZoomOut(),\n\t\tisDragging: isDragging(),\n\t};\n}\n\n/**\n * Renders block tools (the block toolbar, select/navigation mode toolbar, the\n * insertion point and a slot for the inline rich text toolbar). Must be wrapped\n * around the block content and editor styles wrapper or iframe.\n *\n * @param {Object} $0 Props.\n * @param {Object} $0.children The block content and style container.\n * @param {Object} $0.__unstableContentRef Ref holding the content scroll container.\n */\nexport default function BlockTools( {\n\tchildren,\n\t__unstableContentRef,\n\t...props\n} ) {\n\tconst { clientId, hasFixedToolbar, isTyping, isZoomOutMode, isDragging } =\n\t\tuseSelect( selector, [] );\n\tconst [ visibilityModalClientIds, setVisibilityModalClientIds ] =\n\t\tuseState( null );\n\tconst isMatch = useShortcutEventMatch();\n\tconst {\n\t\tgetBlocksByClientId,\n\t\tgetSelectedBlockClientIds,\n\t\tgetBlockRootClientId,\n\t\tgetBlockEditingMode,\n\t\tgetBlockName,\n\t\tisGroupable,\n\t\tgetEditedContentOnlySection,\n\t} = unlock( useSelect( blockEditorStore ) );\n\tconst { getGroupingBlockName } = useSelect( blocksStore );\n\tconst { showEmptyBlockSideInserter, showBlockToolbarPopover } =\n\t\tuseShowBlockTools();\n\tconst pasteStyles = usePasteStyles();\n\tconst [ renamingBlockClientId, setRenamingBlockClientId ] =\n\t\tuseState( null );\n\n\tconst { canRename } = useBlockRename(\n\t\tgetBlockName( getSelectedBlockClientIds()[ 0 ] )\n\t);\n\tconst {\n\t\tduplicateBlocks,\n\t\tremoveBlocks,\n\t\treplaceBlocks,\n\t\tinsertAfterBlock,\n\t\tinsertBeforeBlock,\n\t\tselectBlock,\n\t\tmoveBlocksUp,\n\t\tmoveBlocksDown,\n\t\texpandBlock,\n\t\tstopEditingContentOnlySection,\n\t} = unlock( useDispatch( blockEditorStore ) );\n\n\tfunction onKeyDown( event ) {\n\t\tif ( event.defaultPrevented ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tisMatch( 'core/block-editor/move-up', event ) ||\n\t\t\tisMatch( 'core/block-editor/move-down', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientIds[ 0 ] );\n\t\t\t\tconst direction = isMatch( 'core/block-editor/move-up', event )\n\t\t\t\t\t? 'up'\n\t\t\t\t\t: 'down';\n\t\t\t\tif ( direction === 'up' ) {\n\t\t\t\t\tmoveBlocksUp( clientIds, rootClientId );\n\t\t\t\t} else {\n\t\t\t\t\tmoveBlocksDown( clientIds, rootClientId );\n\t\t\t\t}\n\t\t\t\tconst blockLength = Array.isArray( clientIds )\n\t\t\t\t\t? clientIds.length\n\t\t\t\t\t: 1;\n\t\t\t\tconst message = sprintf(\n\t\t\t\t\t// translators: %d: the name of the block that has been moved\n\t\t\t\t\t_n(\n\t\t\t\t\t\t'%d block moved.',\n\t\t\t\t\t\t'%d blocks moved.',\n\t\t\t\t\t\tclientIds.length\n\t\t\t\t\t),\n\t\t\t\t\tblockLength\n\t\t\t\t);\n\t\t\t\tspeak( message );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/duplicate', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tduplicateBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/remove', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tremoveBlocks( clientIds );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/paste-styles', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tpasteStyles( blocks );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-after', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertAfterBlock( clientIds[ clientIds.length - 1 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/insert-before', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tinsertBeforeBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/unselect', event ) ) {\n\t\t\tif ( event.target.closest( '[role=toolbar]' ) ) {\n\t\t\t\t// This shouldn't be necessary, but we have a combination of a few things all combining to create a situation where:\n\t\t\t\t// - Because the block toolbar uses createPortal to populate the block toolbar fills, we can't rely on the React event bubbling to hit the onKeyDown listener for the block toolbar\n\t\t\t\t// - Since we can't use the React tree, we use the DOM tree which _should_ handle the event bubbling correctly from a `createPortal` element.\n\t\t\t\t// - This bubbles via the React tree, which hits this `unselect` escape keypress before the block toolbar DOM event listener has access to it.\n\t\t\t\t// An alternative would be to remove the addEventListener on the navigableToolbar and use this event to handle it directly right here. That feels hacky too though.\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\t// If there is more than one block selected, select the first\n\t\t\t\t// block so that focus is directed back to the beginning of the selection.\n\t\t\t\t// In effect, to the user this feels like deselecting the multi-selection.\n\t\t\t\tselectBlock( clientIds[ 0 ] );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/collapse-list-view', event ) ) {\n\t\t\t// If focus is currently within a text field, such as a rich text block or other editable field,\n\t\t\t// skip collapsing the list view, and allow the keyboard shortcut to be handled by the text field.\n\t\t\t// This condition checks for both the active element and the active element within an iframed editor.\n\t\t\tif (\n\t\t\t\tisTextField( event.target ) ||\n\t\t\t\tisTextField(\n\t\t\t\t\tevent.target?.contentWindow?.document?.activeElement\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tevent.preventDefault();\n\t\t\texpandBlock( clientId );\n\t\t} else if ( isMatch( 'core/block-editor/group', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length > 1 && isGroupable( clientIds ) ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst groupingBlockName = getGroupingBlockName();\n\t\t\t\tconst newBlocks = switchToBlockType(\n\t\t\t\t\tblocks,\n\t\t\t\t\tgroupingBlockName\n\t\t\t\t);\n\t\t\t\treplaceBlocks( clientIds, newBlocks );\n\t\t\t\tspeak( __( 'Selected blocks are grouped.' ) );\n\t\t\t}\n\t\t} else if ( isMatch( 'core/block-editor/rename', event ) ) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length === 1 ) {\n\t\t\t\tconst isContentOnly =\n\t\t\t\t\tgetBlockEditingMode( clientIds[ 0 ] ) === 'contentOnly';\n\t\t\t\tconst canRenameBlock = canRename && ! isContentOnly;\n\t\t\t\tif ( canRenameBlock ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetRenamingBlockClientId( clientIds[ 0 ] );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (\n\t\t\tisMatch( 'core/block-editor/toggle-block-visibility', event )\n\t\t) {\n\t\t\tconst clientIds = getSelectedBlockClientIds();\n\t\t\tif ( clientIds.length ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tconst blocks = getBlocksByClientId( clientIds );\n\t\t\t\tconst supportsBlockVisibility = blocks.every( ( block ) =>\n\t\t\t\t\thasBlockSupport( block.name, 'visibility', true )\n\t\t\t\t);\n\n\t\t\t\tif ( ! supportsBlockVisibility ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Open the visibility breakpoints modal.\n\t\t\t\tsetVisibilityModalClientIds( clientIds );\n\t\t\t}\n\t\t}\n\n\t\t// Has the same keyboard shortcut as 'unselect', so can't be within the\n\t\t// if/else chain above.\n\t\tif ( isMatch( 'core/block-editor/stop-editing-as-blocks', event ) ) {\n\t\t\tif ( getEditedContentOnlySection() ) {\n\t\t\t\tstopEditingContentOnlySection();\n\t\t\t}\n\t\t}\n\t}\n\tconst blockToolbarRef = usePopoverScroll( __unstableContentRef );\n\tconst blockToolbarAfterRef = usePopoverScroll( __unstableContentRef );\n\n\treturn (\n\t\t// eslint-disable-next-line jsx-a11y/no-static-element-interactions\n\t\t<div\n\t\t\t{ ...props }\n\t\t\tonKeyDown={ onKeyDown }\n\t\t\t// Popover slots cannot be unmounted during dragging because the\n\t\t\t// will just be rendered in a fallback popover slot instead.\n\t\t\tclassName={ clsx( props.className, {\n\t\t\t\t'block-editor-block-tools--is-dragging': isDragging,\n\t\t\t} ) }\n\t\t>\n\t\t\t<InsertionPointOpenRef.Provider value={ useRef( false ) }>\n\t\t\t\t{ ! isTyping && ! isZoomOutMode && (\n\t\t\t\t\t<InsertionPoint\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showEmptyBlockSideInserter && (\n\t\t\t\t\t<EmptyBlockInserter\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ showBlockToolbarPopover && (\n\t\t\t\t\t<BlockToolbarPopover\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tisTyping={ isTyping }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\n\t\t\t\t{ /* Used for the inline rich text toolbar. Until this toolbar is combined into BlockToolbar, someone implementing their own BlockToolbar will also need to use this to see the image caption toolbar. */ }\n\t\t\t\t{ ! isZoomOutMode && ! hasFixedToolbar && (\n\t\t\t\t\t<Popover.Slot\n\t\t\t\t\t\tname=\"block-toolbar\"\n\t\t\t\t\t\tref={ blockToolbarRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ children }\n\t\t\t\t{ /* Used for inline rich text popovers. */ }\n\t\t\t\t<Popover.Slot\n\t\t\t\t\tname=\"__unstable-block-tools-after\"\n\t\t\t\t\tref={ blockToolbarAfterRef }\n\t\t\t\t/>\n\t\t\t\t{ isZoomOutMode && ! isDragging && (\n\t\t\t\t\t<ZoomOutModeInserters\n\t\t\t\t\t\t__unstableContentRef={ __unstableContentRef }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</InsertionPointOpenRef.Provider>\n\t\t\t{ renamingBlockClientId && (\n\t\t\t\t<BlockRenameModal\n\t\t\t\t\tclientId={ renamingBlockClientId }\n\t\t\t\t\tonClose={ () => setRenamingBlockClientId( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ visibilityModalClientIds && (\n\t\t\t\t<BlockVisibilityModal\n\t\t\t\t\tclientIds={ visibilityModalClientIds }\n\t\t\t\t\tonClose={ () => setVisibilityModalClientIds( null ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,kBAAuC;AACvC,iBAA4B;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B,CAAE,mBACtB;AAAA,cAAC,0BAAQ;AAAA,cAAR;AAAA,gBACA,MAAK;AAAA,gBACL,KAAM;AAAA;AAAA,YACP;AAAA,YAEC;AAAA,YAEF;AAAA,cAAC,0BAAQ;AAAA,cAAR;AAAA,gBACA,MAAK;AAAA,gBACL,KAAM;AAAA;AAAA,YACP;AAAA,YACE,iBAAiB,CAAE,cACpB;AAAA,cAAC,+BAAAC;AAAA,cAAA;AAAA,gBACA;AAAA;AAAA,YACD;AAAA,aAEF;AAAA,UACE,yBACD;AAAA,YAAC;AAAA;AAAA,cACA,UAAW;AAAA,cACX,SAAU,MAAM,yBAA0B,IAAK;AAAA;AAAA,UAChD;AAAA,UAEC,4BACD;AAAA,YAAC;AAAA;AAAA,cACA,WAAY;AAAA,cACZ,SAAU,MAAM,4BAA6B,IAAK;AAAA;AAAA,UACnD;AAAA;AAAA;AAAA,IAEF;AAAA;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "useShortcutEventMatch", "blocksStore", "usePasteStyles", "usePopoverScroll", "clsx", "InsertionPoint", "EmptyBlockInserter", "BlockToolbarPopover", "ZoomOutModeInserters"]
|
|
7
7
|
}
|
|
@@ -217,6 +217,15 @@ function KeyboardShortcutsRegister() {
|
|
|
217
217
|
character: "h"
|
|
218
218
|
}
|
|
219
219
|
});
|
|
220
|
+
registerShortcut({
|
|
221
|
+
name: "core/block-editor/rename",
|
|
222
|
+
category: "block",
|
|
223
|
+
description: (0, import_i18n.__)("Rename the selected block."),
|
|
224
|
+
keyCombination: {
|
|
225
|
+
modifier: "primaryAlt",
|
|
226
|
+
character: "r"
|
|
227
|
+
}
|
|
228
|
+
});
|
|
220
229
|
}, [registerShortcut]);
|
|
221
230
|
return null;
|
|
222
231
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/keyboard-shortcuts/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research \u2014 invalid character?\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/toggle-block-visibility',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Show or hide the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAA4B;AAC5B,gCAAgD;AAChD,kBAAmB;AAEnB,SAAS,oBAAoB;AAC5B,SAAO;AACR;AAEA,SAAS,4BAA4B;AAEpC,QAAM,EAAE,iBAAiB,QAAI,yBAAa,0BAAAA,KAAuB;AACjE,gCAAW,MAAM;AAChB,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,6BAA8B;AAAA,MAC/C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,4BAA6B;AAAA,MAC9C,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,8BAA+B;AAAA,MAChD,gBAAgB;AAAA,QACf,UAAU;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UAAU;AAAA,MACV,iBAAa;AAAA,QACZ;AAAA,MACD;AAAA,MACA,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAEF,qBAAkB;AAAA,MACjB,MAAM;AAAA,MACN,UAAU;AAAA,MACV,iBAAa,gBAAI,qCAAsC;AAAA,MACvD,gBAAgB;AAAA,QACf,UAAU;AAAA,QACV,WAAW;AAAA,MACZ;AAAA,IACD,CAAE;AAAA,EACH,GAAG,CAAE,gBAAiB,CAAE;AAExB,SAAO;AACR;AAEA,kBAAkB,WAAW;AAE7B,IAAO,6BAAQ;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcuts() {\n\treturn null;\n}\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/copy',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Copy the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'c',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/cut',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Cut the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'x',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Paste the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/duplicate',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Duplicate the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'd',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/remove',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Remove the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'access',\n\t\t\t\tcharacter: 'z',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/paste-styles',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Paste the copied style to the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'v',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-before',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block before the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/insert-after',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Insert a new block after the selected block(s).'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/delete-multi-selection',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Delete selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'del',\n\t\t\t},\n\t\t\taliases: [\n\t\t\t\t{\n\t\t\t\t\tcharacter: 'backspace',\n\t\t\t\t},\n\t\t\t],\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/stop-editing-as-blocks',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Finish editing a design.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/select-all',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __(\n\t\t\t\t'Select all text when typing. Press again to select all blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'a',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/unselect',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Clear selection.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tcharacter: 'escape',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/multi-text-selection',\n\t\t\tcategory: 'selection',\n\t\t\tdescription: __( 'Select text across multiple blocks.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'shift',\n\t\t\t\t// Spotted during my own research \u2014 invalid character?\n\t\t\t\tcharacter: 'arrow',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/focus-toolbar',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Navigate to the nearest toolbar.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'F10',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-up',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) up.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 't',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/move-down',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Move the selected block(s) down.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'secondary',\n\t\t\t\tcharacter: 'y',\n\t\t\t},\n\t\t} );\n\n\t\t// List view shortcuts.\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/collapse-list-view',\n\t\t\tcategory: 'list-view',\n\t\t\tdescription: __( 'Collapse all other items.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'alt',\n\t\t\t\tcharacter: 'l',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/group',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __(\n\t\t\t\t'Create a group block from the selected multiple blocks.'\n\t\t\t),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 'g',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/toggle-block-visibility',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Show or hide the selected block(s).' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryShift',\n\t\t\t\tcharacter: 'h',\n\t\t\t},\n\t\t} );\n\n\t\tregisterShortcut( {\n\t\t\tname: 'core/block-editor/rename',\n\t\t\tcategory: 'block',\n\t\t\tdescription: __( 'Rename the selected block.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primaryAlt',\n\t\t\t\tcharacter: 'r',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nKeyboardShortcuts.Register = KeyboardShortcutsRegister;\n\nexport default KeyboardShortcuts;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAA0B;AAC1B,kBAA4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
|
|
@@ -54,6 +54,7 @@ var import_utils = require("./utils.cjs");
|
|
|
54
54
|
var import_store = require("../../store/index.cjs");
|
|
55
55
|
var import_use_block_display_information = __toESM(require("../use-block-display-information/index.cjs"));
|
|
56
56
|
var import_block_lock = require("../block-lock/index.cjs");
|
|
57
|
+
var import_block_rename = require("../block-rename/index.cjs");
|
|
57
58
|
var import_aria_referenced_text = __toESM(require("./aria-referenced-text.cjs"));
|
|
58
59
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
59
60
|
var import_use_paste_styles = __toESM(require("../use-paste-styles/index.cjs"));
|
|
@@ -85,6 +86,7 @@ function ListViewBlock({
|
|
|
85
86
|
const settingsRef = (0, import_element.useRef)(null);
|
|
86
87
|
const [isHovered, setIsHovered] = (0, import_element.useState)(false);
|
|
87
88
|
const [settingsAnchorRect, setSettingsAnchorRect] = (0, import_element.useState)();
|
|
89
|
+
const [isRenameModalOpen, setIsRenameModalOpen] = (0, import_element.useState)(false);
|
|
88
90
|
const [visibilityModalClientIds, setVisibilityModalClientIds] = (0, import_element.useState)(null);
|
|
89
91
|
const { isLocked } = (0, import_block_lock.useBlockLock)(clientId);
|
|
90
92
|
const isFirstSelectedBlock = isSelected && selectedClientIds[0] === clientId;
|
|
@@ -109,6 +111,7 @@ function ListViewBlock({
|
|
|
109
111
|
getBlockRootClientId,
|
|
110
112
|
getBlockOrder,
|
|
111
113
|
getBlockParents,
|
|
114
|
+
getBlockEditingMode,
|
|
112
115
|
getBlocksByClientId,
|
|
113
116
|
canEditBlock,
|
|
114
117
|
canMoveBlock,
|
|
@@ -132,6 +135,7 @@ function ListViewBlock({
|
|
|
132
135
|
},
|
|
133
136
|
[clientId]
|
|
134
137
|
);
|
|
138
|
+
const { canRename } = (0, import_block_rename.useBlockRename)(blockName);
|
|
135
139
|
const { isBlockCurrentlyHidden, currentViewport } = (0, import_block_visibility.useBlockVisibility)({
|
|
136
140
|
blockVisibility: block?.attributes?.metadata?.blockVisibility,
|
|
137
141
|
deviceType: selectedDeviceType
|
|
@@ -308,6 +312,13 @@ function ListViewBlock({
|
|
|
308
312
|
return;
|
|
309
313
|
}
|
|
310
314
|
setVisibilityModalClientIds(blocksToUpdate);
|
|
315
|
+
} else if (isMatch("core/block-editor/rename", event)) {
|
|
316
|
+
const { blocksToUpdate } = getBlocksToUpdate();
|
|
317
|
+
const isContentOnly = getBlockEditingMode(blocksToUpdate[0]) === "contentOnly";
|
|
318
|
+
if (blocksToUpdate.length === 1 && canRename && !isContentOnly) {
|
|
319
|
+
event.preventDefault();
|
|
320
|
+
setIsRenameModalOpen(true);
|
|
321
|
+
}
|
|
311
322
|
}
|
|
312
323
|
}
|
|
313
324
|
const onMouseEnter = (0, import_element.useCallback)(() => {
|
|
@@ -560,6 +571,13 @@ function ListViewBlock({
|
|
|
560
571
|
clientIds: visibilityModalClientIds,
|
|
561
572
|
onClose: () => setVisibilityModalClientIds(null)
|
|
562
573
|
}
|
|
574
|
+
),
|
|
575
|
+
isRenameModalOpen && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
576
|
+
import_block_rename.BlockRenameModal,
|
|
577
|
+
{
|
|
578
|
+
clientId,
|
|
579
|
+
onClose: () => setIsRenameModalOpen(false)
|
|
580
|
+
}
|
|
563
581
|
)
|
|
564
582
|
]
|
|
565
583
|
}
|