@wordpress/block-editor 14.21.0 → 15.0.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 +6 -0
- package/build/components/background-image-control/index.js +0 -4
- package/build/components/background-image-control/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.native.js +1 -1
- package/build/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build/components/block-list/use-block-props/index.js +1 -3
- package/build/components/block-list/use-block-props/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-is-hovered.js +8 -25
- package/build/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/child-layout-control/index.js +53 -34
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/image-size-control/index.js +1 -1
- package/build/components/image-size-control/index.js.map +1 -1
- package/build/components/link-control/search-input.js +4 -2
- package/build/components/link-control/search-input.js.map +1 -1
- package/build/components/list-view/block.js +5 -4
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/use-list-view-images.js +62 -30
- package/build/components/list-view/use-list-view-images.js.map +1 -1
- package/build/components/use-paste-styles/index.js +2 -2
- package/build/components/use-paste-styles/index.js.map +1 -1
- package/build/layouts/grid.js +2 -0
- package/build/layouts/grid.js.map +1 -1
- package/build/store/actions.js +7 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/reducer.js +0 -18
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +13 -9
- package/build/store/selectors.js.map +1 -1
- package/build/utils/use-notify-copy.js +2 -2
- package/build/utils/use-notify-copy.js.map +1 -1
- package/build-module/components/background-image-control/index.js +0 -4
- package/build-module/components/background-image-control/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js +1 -1
- package/build-module/components/block-list/block-invalid-warning.native.js.map +1 -1
- package/build-module/components/block-list/use-block-props/index.js +1 -3
- package/build-module/components/block-list/use-block-props/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-is-hovered.js +8 -26
- package/build-module/components/block-list/use-block-props/use-is-hovered.js.map +1 -1
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +7 -4
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +54 -35
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/image-size-control/index.js +1 -1
- package/build-module/components/image-size-control/index.js.map +1 -1
- package/build-module/components/link-control/search-input.js +4 -2
- package/build-module/components/link-control/search-input.js.map +1 -1
- package/build-module/components/list-view/block.js +6 -5
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/use-list-view-images.js +62 -30
- package/build-module/components/list-view/use-list-view-images.js.map +1 -1
- package/build-module/components/use-paste-styles/index.js +2 -2
- package/build-module/components/use-paste-styles/index.js.map +1 -1
- package/build-module/layouts/grid.js +2 -0
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/store/actions.js +7 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/reducer.js +0 -17
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +12 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/use-notify-copy.js +2 -2
- package/build-module/utils/use-notify-copy.js.map +1 -1
- package/build-style/style-rtl.css +48 -19
- package/build-style/style.css +48 -19
- package/package.json +34 -34
- package/src/components/background-image-control/index.js +1 -8
- package/src/components/background-image-control/style.scss +3 -7
- package/src/components/block-list/block-invalid-warning.native.js +1 -1
- package/src/components/block-list/use-block-props/index.js +1 -1
- package/src/components/block-list/use-block-props/use-is-hovered.js +12 -26
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +9 -5
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-variation-transforms/style.scss +7 -0
- package/src/components/border-radius-control/style.scss +5 -0
- package/src/components/child-layout-control/index.js +66 -42
- package/src/components/colors-gradients/style.scss +5 -0
- package/src/components/image-size-control/index.js +1 -1
- package/src/components/inserter-list-item/style.scss +9 -6
- package/src/components/link-control/search-input.js +9 -2
- package/src/components/link-control/style.scss +7 -0
- package/src/components/link-control/test/index.js +44 -44
- package/src/components/list-view/block.js +9 -5
- package/src/components/list-view/use-list-view-images.js +57 -36
- package/src/components/media-replace-flow/test/index.js +1 -1
- package/src/components/spacing-sizes-control/style.scss +5 -0
- package/src/components/use-paste-styles/index.js +2 -2
- package/src/hooks/layout.scss +8 -0
- package/src/layouts/grid.js +2 -2
- package/src/store/actions.js +7 -6
- package/src/store/reducer.js +0 -18
- package/src/store/selectors.js +29 -31
- package/src/utils/use-notify-copy.js +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockCommentIconSlot","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_blockParentSelectorMenuItem","_store","_lockUnlock","_useNotifyCopy","_jsxRuntime","POPOVER_PROPS","className","placement","CopyMenuItem","clientIds","onCopy","label","shortcut","eventType","__experimentalUpdateSelection","updateSelection","getBlocksByClientId","useSelect","blockEditorStore","removeBlocks","useDispatch","notifyCopy","useNotifyCopy","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","jsx","MenuItem","children","BlockSettingsDropdown","block","__experimentalSelectBlock","props","currentClientId","clientId","count","length","firstBlockClientId","firstParentClientId","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","isContentOnly","select","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","getBlockEditingMode","unlock","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","setOpenedBlockSettingsMenu","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","copy","cut","duplicate","remove","insertAfter","insertBefore","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","shouldShowBlockParentMenuItem","default","canCopyStyles","canDuplicate","canInsertBlock","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","isEmpty","DropdownMenu","icon","moreVertical","popoverProps","noIcons","onClose","jsxs","Fragment","MenuGroup","Slot","fillProps","parentClientId","onClick","pipe","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport CommentIconSlotFill from '../../components/collab/block-comment-icon-slot';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( {\n\tclientIds,\n\tonCopy,\n\tlabel,\n\tshortcut,\n\teventType = 'copy',\n\t__experimentalUpdateSelection: updateSelection = false,\n} ) {\n\tconst { getBlocksByClientId } = useSelect( blockEditorStore );\n\tconst { removeBlocks } = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\tconst ref = useCopyToClipboard(\n\t\t() => serialize( getBlocksByClientId( clientIds ) ),\n\t\t() => {\n\t\t\tswitch ( eventType ) {\n\t\t\t\tcase 'copy':\n\t\t\t\tcase 'copyStyles':\n\t\t\t\t\tonCopy();\n\t\t\t\t\tnotifyCopy( eventType, clientIds );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'cut':\n\t\t\t\t\tnotifyCopy( eventType, clientIds );\n\t\t\t\t\tremoveBlocks( clientIds, updateSelection );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t);\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn (\n\t\t<MenuItem ref={ ref } shortcut={ shortcut }>\n\t\t\t{ copyMenuItemLabel }\n\t\t</MenuItem>\n\t);\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\tchildren,\n\t__experimentalSelectBlock,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst count = clientIds.length;\n\tconst firstBlockClientId = clientIds[ 0 ];\n\n\tconst {\n\t\tfirstParentClientId,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t\tisContentOnly,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( firstBlockClientId ) === 'contentOnly',\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tcopy: getShortcutRepresentation( 'core/block-editor/copy' ),\n\t\t\tcut: getShortcutRepresentation( 'core/block-editor/cut' ),\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tasync function updateSelectionAfterDuplicate( clientIdsPromise ) {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst ids = await clientIdsPromise;\n\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t}\n\t}\n\n\tfunction updateSelectionAfterRemove() {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t// Focus the first block if there's no previous block nor parent block.\n\t\tif ( ! blockToFocus ) {\n\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t}\n\n\t\t// Only update the selection if the original selection is removed.\n\t\tconst shouldUpdateSelection =\n\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t}\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tfunction onToggle( localOpen ) {\n\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t} else if (\n\t\t\t! localOpen &&\n\t\t\topenedBlockSettingsMenu &&\n\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t) {\n\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t}\n\t}\n\n\tconst shouldShowBlockParentMenuItem =\n\t\t! parentBlockIsSelected && !! firstParentClientId;\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertBlock,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t} ) => {\n\t\t\t\t// It is possible that some plugins register fills for this menu\n\t\t\t\t// even if Core doesn't render anything in the block settings menu.\n\t\t\t\t// in which case, we may want to render the menu anyway.\n\t\t\t\t// That said for now, we can start more conservative.\n\t\t\t\tconst isEmpty =\n\t\t\t\t\t! canRemove &&\n\t\t\t\t\t! canDuplicate &&\n\t\t\t\t\t! canInsertBlock &&\n\t\t\t\t\tisContentOnly;\n\n\t\t\t\tif ( isEmpty ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t\topen={ open }\n\t\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\t\tnoIcons\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ shouldShowBlockParentMenuItem && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.copy }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Cut' ) }\n\t\t\t\t\t\t\t\t\t\teventType=\"cut\"\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.cut }\n\t\t\t\t\t\t\t\t\t\t__experimentalUpdateSelection={\n\t\t\t\t\t\t\t\t\t\t\t! __experimentalSelectBlock\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ canInsertBlock && ! isContentOnly && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshortcuts.insertBefore\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshortcuts.insertAfter\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<CommentIconSlotFill.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t{ canCopyStyles && ! isContentOnly && (\n\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t\t\teventType=\"copyStyles\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! isContentOnly && (\n\t\t\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\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\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</MenuGroup>\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</DropdownMenu>\n\t\t\t\t);\n\t\t\t} }\n\t\t</BlockActions>\n\t);\n}\n\nexport default BlockSettingsDropdown;\n"],"mappings":";;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,kBAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAKA,IAAAQ,aAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,qBAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,uBAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,2BAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,0BAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,4BAAA,GA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AAGA,SAAW;cACvBC,MAAM,EAAGA,MAAQ;cACjBC,KAAK,EAAG,IAAAgB,QAAE,EAAE,aAAc,CAAG;cAC7Bd,SAAS,EAAC;YAAY,CACtB,CAAC,eACF,IAAAT,WAAA,CAAAwB,GAAA,EAACzC,WAAA,CAAA0C,QAAQ;cAAC+E,OAAO,EAAGd,aAAe;cAAAhE,QAAA,EAChC,IAAAH,QAAE,EAAE,cAAe;YAAC,CACb,CAAC;UAAA,CACD,CACX,EACC,CAAEkB,aAAa,iBAChB,IAAAzC,WAAA,CAAAwB,GAAA,EAAC7B,0BAAA,CAAAsF,OAAyB,CAACoB,IAAI;YAC9BC,SAAS,EAAG;cACXL,OAAO;cACPhE,KAAK;cACLE;YACD,CAAG;YACH9B,SAAS,EAAGA;UAAW,CACvB,CACD,EACC,OAAOqB,QAAQ,KAAK,UAAU,GAC7BA,QAAQ,CAAE;YAAEuE;UAAQ,CAAE,CAAC,GACvBS,iBAAQ,CAACC,GAAG,CAAIC,KAAK,IACrB,IAAAC,qBAAY,EAAED,KAAK,EAAE;YAAEX;UAAQ,CAAE,CACjC,CAAC,EACFZ,SAAS,iBACV,IAAArF,WAAA,CAAAwB,GAAA,EAACzC,WAAA,CAAAqH,SAAS;YAAA1E,QAAA,eACT,IAAA1B,WAAA,CAAAwB,GAAA,EAACzC,WAAA,CAAA0C,QAAQ;cACR+E,OAAO,EAAG,IAAAC,aAAI,EACbR,OAAO,EACPR,QAAQ,EACRlB,0BACD,CAAG;cACH/D,QAAQ,EAAGkD,SAAS,CAACM,MAAQ;cAAAtC,QAAA,EAE3B,IAAAH,QAAE,EAAE,QAAS;YAAC,CACP;UAAC,CACD,CACX;QAAA,CACA;MACF,CACY,CAAC;IAEjB;EAAC,CACY,CAAC;AAEjB;AAAC,IAAAuF,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEctD,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_components","_data","_icons","_element","_i18n","_keyboardShortcuts","_compose","_blockActions","_interopRequireDefault","_blockCommentIconSlot","_blockHtmlConvertButton","_blockSettingsMenuFirstItem","_blockSettingsMenuControls","_blockParentSelectorMenuItem","_store","_lockUnlock","_useNotifyCopy","_jsxRuntime","POPOVER_PROPS","className","placement","CopyMenuItem","clientIds","onCopy","label","shortcut","eventType","__experimentalUpdateSelection","updateSelection","getBlocksByClientId","useSelect","blockEditorStore","removeBlocks","useDispatch","notifyCopy","useNotifyCopy","ref","useCopyToClipboard","serialize","copyMenuItemLabel","__","jsx","MenuItem","children","BlockSettingsDropdown","block","__experimentalSelectBlock","props","currentClientId","clientId","count","length","firstBlockClientId","firstParentClientId","parentBlockType","previousBlockClientId","selectedBlockClientIds","openedBlockSettingsMenu","isContentOnly","isZoomOut","select","getBlockName","getBlockRootClientId","getPreviousBlockClientId","getSelectedBlockClientIds","getBlockAttributes","getOpenedBlockSettingsMenu","getBlockEditingMode","_isZoomOut","unlock","getActiveBlockVariation","blocksStore","_firstParentClientId","parentBlockName","getBlockType","getBlockOrder","setOpenedBlockSettingsMenu","shortcuts","getShortcutRepresentation","keyboardShortcutsStore","copy","cut","duplicate","remove","insertAfter","insertBefore","hasSelectedBlocks","updateSelectionAfterDuplicate","clientIdsPromise","ids","updateSelectionAfterRemove","blockToFocus","shouldUpdateSelection","parentBlockIsSelected","includes","open","undefined","onToggle","localOpen","shouldShowBlockParentMenuItem","default","canCopyStyles","canDuplicate","canInsertBlock","canRemove","onDuplicate","onInsertAfter","onInsertBefore","onRemove","onPasteStyles","isEmpty","DropdownMenu","icon","moreVertical","popoverProps","noIcons","onClose","jsxs","Fragment","MenuGroup","Slot","fillProps","parentClientId","onClick","pipe","Children","map","child","cloneElement","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-settings-menu/block-settings-dropdown.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tgetBlockType,\n\tserialize,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { moreVertical } from '@wordpress/icons';\nimport { Children, cloneElement } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { pipe, useCopyToClipboard } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport BlockActions from '../block-actions';\nimport CommentIconSlotFill from '../../components/collab/block-comment-icon-slot';\nimport BlockHTMLConvertButton from './block-html-convert-button';\nimport __unstableBlockSettingsMenuFirstItem from './block-settings-menu-first-item';\nimport BlockSettingsMenuControls from '../block-settings-menu-controls';\nimport BlockParentSelectorMenuItem from './block-parent-selector-menu-item';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { useNotifyCopy } from '../../utils/use-notify-copy';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tplacement: 'bottom-start',\n};\n\nfunction CopyMenuItem( {\n\tclientIds,\n\tonCopy,\n\tlabel,\n\tshortcut,\n\teventType = 'copy',\n\t__experimentalUpdateSelection: updateSelection = false,\n} ) {\n\tconst { getBlocksByClientId } = useSelect( blockEditorStore );\n\tconst { removeBlocks } = useDispatch( blockEditorStore );\n\tconst notifyCopy = useNotifyCopy();\n\tconst ref = useCopyToClipboard(\n\t\t() => serialize( getBlocksByClientId( clientIds ) ),\n\t\t() => {\n\t\t\tswitch ( eventType ) {\n\t\t\t\tcase 'copy':\n\t\t\t\tcase 'copyStyles':\n\t\t\t\t\tonCopy();\n\t\t\t\t\tnotifyCopy( eventType, clientIds );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'cut':\n\t\t\t\t\tnotifyCopy( eventType, clientIds );\n\t\t\t\t\tremoveBlocks( clientIds, updateSelection );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t);\n\tconst copyMenuItemLabel = label ? label : __( 'Copy' );\n\treturn (\n\t\t<MenuItem ref={ ref } shortcut={ shortcut }>\n\t\t\t{ copyMenuItemLabel }\n\t\t</MenuItem>\n\t);\n}\n\nexport function BlockSettingsDropdown( {\n\tblock,\n\tclientIds,\n\tchildren,\n\t__experimentalSelectBlock,\n\t...props\n} ) {\n\t// Get the client id of the current block for this menu, if one is set.\n\tconst currentClientId = block?.clientId;\n\tconst count = clientIds.length;\n\tconst firstBlockClientId = clientIds[ 0 ];\n\n\tconst {\n\t\tfirstParentClientId,\n\t\tparentBlockType,\n\t\tpreviousBlockClientId,\n\t\tselectedBlockClientIds,\n\t\topenedBlockSettingsMenu,\n\t\tisContentOnly,\n\t\tisZoomOut,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockName,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t\tgetPreviousBlockClientId,\n\t\t\t\tgetSelectedBlockClientIds,\n\t\t\t\tgetBlockAttributes,\n\t\t\t\tgetOpenedBlockSettingsMenu,\n\t\t\t\tgetBlockEditingMode,\n\t\t\t\tisZoomOut: _isZoomOut,\n\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\tconst { getActiveBlockVariation } = select( blocksStore );\n\n\t\t\tconst _firstParentClientId =\n\t\t\t\tgetBlockRootClientId( firstBlockClientId );\n\t\t\tconst parentBlockName =\n\t\t\t\t_firstParentClientId && getBlockName( _firstParentClientId );\n\n\t\t\treturn {\n\t\t\t\tfirstParentClientId: _firstParentClientId,\n\t\t\t\tparentBlockType:\n\t\t\t\t\t_firstParentClientId &&\n\t\t\t\t\t( getActiveBlockVariation(\n\t\t\t\t\t\tparentBlockName,\n\t\t\t\t\t\tgetBlockAttributes( _firstParentClientId )\n\t\t\t\t\t) ||\n\t\t\t\t\t\tgetBlockType( parentBlockName ) ),\n\t\t\t\tpreviousBlockClientId:\n\t\t\t\t\tgetPreviousBlockClientId( firstBlockClientId ),\n\t\t\t\tselectedBlockClientIds: getSelectedBlockClientIds(),\n\t\t\t\topenedBlockSettingsMenu: getOpenedBlockSettingsMenu(),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( firstBlockClientId ) === 'contentOnly',\n\t\t\t\tisZoomOut: _isZoomOut(),\n\t\t\t};\n\t\t},\n\t\t[ firstBlockClientId ]\n\t);\n\n\tconst { getBlockOrder, getSelectedBlockClientIds } =\n\t\tuseSelect( blockEditorStore );\n\n\tconst { setOpenedBlockSettingsMenu } = unlock(\n\t\tuseDispatch( blockEditorStore )\n\t);\n\n\tconst shortcuts = useSelect( ( select ) => {\n\t\tconst { getShortcutRepresentation } = select( keyboardShortcutsStore );\n\t\treturn {\n\t\t\tcopy: getShortcutRepresentation( 'core/block-editor/copy' ),\n\t\t\tcut: getShortcutRepresentation( 'core/block-editor/cut' ),\n\t\t\tduplicate: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/duplicate'\n\t\t\t),\n\t\t\tremove: getShortcutRepresentation( 'core/block-editor/remove' ),\n\t\t\tinsertAfter: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-after'\n\t\t\t),\n\t\t\tinsertBefore: getShortcutRepresentation(\n\t\t\t\t'core/block-editor/insert-before'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst hasSelectedBlocks = selectedBlockClientIds.length > 0;\n\n\tasync function updateSelectionAfterDuplicate( clientIdsPromise ) {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst ids = await clientIdsPromise;\n\t\tif ( ids && ids[ 0 ] ) {\n\t\t\t__experimentalSelectBlock( ids[ 0 ], false );\n\t\t}\n\t}\n\n\tfunction updateSelectionAfterRemove() {\n\t\tif ( ! __experimentalSelectBlock ) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet blockToFocus = previousBlockClientId || firstParentClientId;\n\n\t\t// Focus the first block if there's no previous block nor parent block.\n\t\tif ( ! blockToFocus ) {\n\t\t\tblockToFocus = getBlockOrder()[ 0 ];\n\t\t}\n\n\t\t// Only update the selection if the original selection is removed.\n\t\tconst shouldUpdateSelection =\n\t\t\thasSelectedBlocks && getSelectedBlockClientIds().length === 0;\n\n\t\t__experimentalSelectBlock( blockToFocus, shouldUpdateSelection );\n\t}\n\n\t// This can occur when the selected block (the parent)\n\t// displays child blocks within a List View.\n\tconst parentBlockIsSelected =\n\t\tselectedBlockClientIds?.includes( firstParentClientId );\n\n\t// When a currentClientId is in use, treat the menu as a controlled component.\n\t// This ensures that only one block settings menu is open at a time.\n\t// This is a temporary solution to work around an issue with `onFocusOutside`\n\t// where it does not allow a dropdown to be closed if focus was never within\n\t// the dropdown to begin with. Examples include a user either CMD+Clicking or\n\t// right clicking into an inactive window.\n\t// See: https://github.com/WordPress/gutenberg/pull/54083\n\tconst open = ! currentClientId\n\t\t? undefined\n\t\t: openedBlockSettingsMenu === currentClientId || false;\n\n\tfunction onToggle( localOpen ) {\n\t\tif ( localOpen && openedBlockSettingsMenu !== currentClientId ) {\n\t\t\tsetOpenedBlockSettingsMenu( currentClientId );\n\t\t} else if (\n\t\t\t! localOpen &&\n\t\t\topenedBlockSettingsMenu &&\n\t\t\topenedBlockSettingsMenu === currentClientId\n\t\t) {\n\t\t\tsetOpenedBlockSettingsMenu( undefined );\n\t\t}\n\t}\n\n\tconst shouldShowBlockParentMenuItem =\n\t\t! parentBlockIsSelected && !! firstParentClientId;\n\n\treturn (\n\t\t<BlockActions\n\t\t\tclientIds={ clientIds }\n\t\t\t__experimentalUpdateSelection={ ! __experimentalSelectBlock }\n\t\t>\n\t\t\t{ ( {\n\t\t\t\tcanCopyStyles,\n\t\t\t\tcanDuplicate,\n\t\t\t\tcanInsertBlock,\n\t\t\t\tcanRemove,\n\t\t\t\tonDuplicate,\n\t\t\t\tonInsertAfter,\n\t\t\t\tonInsertBefore,\n\t\t\t\tonRemove,\n\t\t\t\tonCopy,\n\t\t\t\tonPasteStyles,\n\t\t\t} ) => {\n\t\t\t\t// It is possible that some plugins register fills for this menu\n\t\t\t\t// even if Core doesn't render anything in the block settings menu.\n\t\t\t\t// in which case, we may want to render the menu anyway.\n\t\t\t\t// That said for now, we can start more conservative.\n\t\t\t\tconst isEmpty =\n\t\t\t\t\t! canRemove &&\n\t\t\t\t\t! canDuplicate &&\n\t\t\t\t\t! canInsertBlock &&\n\t\t\t\t\tisContentOnly;\n\n\t\t\t\tif ( isEmpty ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\t\tlabel={ __( 'Options' ) }\n\t\t\t\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t\topen={ open }\n\t\t\t\t\t\tonToggle={ onToggle }\n\t\t\t\t\t\tnoIcons\n\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t<__unstableBlockSettingsMenuFirstItem.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ shouldShowBlockParentMenuItem && (\n\t\t\t\t\t\t\t\t\t\t<BlockParentSelectorMenuItem\n\t\t\t\t\t\t\t\t\t\t\tparentClientId={\n\t\t\t\t\t\t\t\t\t\t\t\tfirstParentClientId\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tparentBlockType={ parentBlockType }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ count === 1 && (\n\t\t\t\t\t\t\t\t\t\t<BlockHTMLConvertButton\n\t\t\t\t\t\t\t\t\t\t\tclientId={ firstBlockClientId }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.copy }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Cut' ) }\n\t\t\t\t\t\t\t\t\t\teventType=\"cut\"\n\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.cut }\n\t\t\t\t\t\t\t\t\t\t__experimentalUpdateSelection={\n\t\t\t\t\t\t\t\t\t\t\t! __experimentalSelectBlock\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t{ canDuplicate && (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonDuplicate,\n\t\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterDuplicate\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.duplicate }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t{ canInsertBlock && ! isZoomOut && (\n\t\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\t\tonInsertBefore\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshortcuts.insertBefore\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add before' ) }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\t\tonInsertAfter\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t\tshortcut={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshortcuts.insertAfter\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __( 'Add after' ) }\n\t\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t<CommentIconSlotFill.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t{ canCopyStyles && ! isContentOnly && (\n\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t<CopyMenuItem\n\t\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\t\t\t\t\t\t\tonCopy={ onCopy }\n\t\t\t\t\t\t\t\t\t\t\tlabel={ __( 'Copy styles' ) }\n\t\t\t\t\t\t\t\t\t\t\teventType=\"copyStyles\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<MenuItem onClick={ onPasteStyles }>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Paste styles' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t{ ! isContentOnly && (\n\t\t\t\t\t\t\t\t\t<BlockSettingsMenuControls.Slot\n\t\t\t\t\t\t\t\t\t\tfillProps={ {\n\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\t\tfirstBlockClientId,\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tclientIds={ clientIds }\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\t{ typeof children === 'function'\n\t\t\t\t\t\t\t\t\t? children( { onClose } )\n\t\t\t\t\t\t\t\t\t: Children.map( ( child ) =>\n\t\t\t\t\t\t\t\t\t\t\tcloneElement( child, { onClose } )\n\t\t\t\t\t\t\t\t\t ) }\n\t\t\t\t\t\t\t\t{ canRemove && (\n\t\t\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tonClick={ pipe(\n\t\t\t\t\t\t\t\t\t\t\t\tonClose,\n\t\t\t\t\t\t\t\t\t\t\t\tonRemove,\n\t\t\t\t\t\t\t\t\t\t\t\tupdateSelectionAfterRemove\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tshortcut={ shortcuts.remove }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\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AK,UAAU,GAC7BA,QAAQ,CAAE;YAAEyE;UAAQ,CAAE,CAAC,GACvBS,iBAAQ,CAACC,GAAG,CAAIC,KAAK,IACrB,IAAAC,qBAAY,EAAED,KAAK,EAAE;YAAEX;UAAQ,CAAE,CACjC,CAAC,EACFZ,SAAS,iBACV,IAAAvF,WAAA,CAAAwB,GAAA,EAACzC,WAAA,CAAAuH,SAAS;YAAA5E,QAAA,eACT,IAAA1B,WAAA,CAAAwB,GAAA,EAACzC,WAAA,CAAA0C,QAAQ;cACRiF,OAAO,EAAG,IAAAC,aAAI,EACbR,OAAO,EACPR,QAAQ,EACRlB,0BACD,CAAG;cACHjE,QAAQ,EAAGoD,SAAS,CAACM,MAAQ;cAAAxC,QAAA,EAE3B,IAAAH,QAAE,EAAE,QAAS;YAAC,CACP;UAAC,CACD,CACX;QAAA,CACA;MACF,CACY,CAAC;IAEjB;EAAC,CACY,CAAC;AAEjB;AAAC,IAAAyF,QAAA,GAAAC,OAAA,CAAA9B,OAAA,GAEcxD,qBAAqB","ignoreList":[]}
|
|
@@ -183,7 +183,7 @@ function GridControls({
|
|
|
183
183
|
rowSpan
|
|
184
184
|
} = childLayout;
|
|
185
185
|
const {
|
|
186
|
-
columnCount
|
|
186
|
+
columnCount,
|
|
187
187
|
rowCount
|
|
188
188
|
} = parentLayout !== null && parentLayout !== void 0 ? parentLayout : {};
|
|
189
189
|
const rootClientId = (0, _data.useSelect)(select => select(_store.store).getBlockRootClientId(panelId));
|
|
@@ -191,7 +191,7 @@ function GridControls({
|
|
|
191
191
|
moveBlocksToPosition,
|
|
192
192
|
__unstableMarkNextChangeAsNotPersistent
|
|
193
193
|
} = (0, _data.useDispatch)(_store.store);
|
|
194
|
-
const getNumberOfBlocksBeforeCell = (0, _useGetNumberOfBlocksBeforeCell.useGetNumberOfBlocksBeforeCell)(rootClientId, columnCount);
|
|
194
|
+
const getNumberOfBlocksBeforeCell = (0, _useGetNumberOfBlocksBeforeCell.useGetNumberOfBlocksBeforeCell)(rootClientId, columnCount || 3);
|
|
195
195
|
const hasStartValue = () => !!columnStart || !!rowStart;
|
|
196
196
|
const hasSpanValue = () => !!columnSpan || !!rowSpan;
|
|
197
197
|
const resetGridStarts = () => {
|
|
@@ -206,48 +206,67 @@ function GridControls({
|
|
|
206
206
|
rowSpan: undefined
|
|
207
207
|
});
|
|
208
208
|
};
|
|
209
|
+
|
|
210
|
+
// Calculate max column span based on current position and grid width
|
|
211
|
+
const maxColumnSpan = columnCount ? columnCount - (columnStart !== null && columnStart !== void 0 ? columnStart : 1) + 1 : undefined;
|
|
212
|
+
|
|
213
|
+
// Calculate max row span based on current position and grid height
|
|
214
|
+
const maxRowSpan = window.__experimentalEnableGridInteractivity && rowCount ? rowCount - (rowStart !== null && rowStart !== void 0 ? rowStart : 1) + 1 : undefined;
|
|
209
215
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
210
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.
|
|
216
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.Flex, {
|
|
211
217
|
as: _components.__experimentalToolsPanelItem,
|
|
212
218
|
hasValue: hasSpanValue,
|
|
213
219
|
label: (0, _i18n.__)('Grid span'),
|
|
214
220
|
onDeselect: resetGridSpans,
|
|
215
221
|
isShownByDefault: isShownByDefault,
|
|
216
222
|
panelId: panelId,
|
|
217
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
type: "number",
|
|
221
|
-
onChange: value => {
|
|
222
|
-
// Don't allow unsetting.
|
|
223
|
-
const newColumnSpan = value === '' ? 1 : parseInt(value, 10);
|
|
224
|
-
onChange({
|
|
225
|
-
columnStart,
|
|
226
|
-
rowStart,
|
|
227
|
-
rowSpan,
|
|
228
|
-
columnSpan: newColumnSpan
|
|
229
|
-
});
|
|
223
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
224
|
+
style: {
|
|
225
|
+
width: '50%'
|
|
230
226
|
},
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
227
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
228
|
+
size: "__unstable-large",
|
|
229
|
+
label: (0, _i18n.__)('Column span'),
|
|
230
|
+
type: "number",
|
|
231
|
+
onChange: value => {
|
|
232
|
+
// Don't allow unsetting.
|
|
233
|
+
const newColumnSpan = value === '' ? 1 : parseInt(value, 10);
|
|
234
|
+
const constrainedValue = maxColumnSpan ? Math.min(newColumnSpan, maxColumnSpan) : newColumnSpan;
|
|
235
|
+
onChange({
|
|
236
|
+
columnStart,
|
|
237
|
+
rowStart,
|
|
238
|
+
rowSpan,
|
|
239
|
+
columnSpan: constrainedValue
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
value: columnSpan !== null && columnSpan !== void 0 ? columnSpan : 1,
|
|
243
|
+
min: 1,
|
|
244
|
+
max: maxColumnSpan
|
|
245
|
+
})
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.FlexItem, {
|
|
247
|
+
style: {
|
|
248
|
+
width: '50%'
|
|
246
249
|
},
|
|
247
|
-
|
|
248
|
-
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalInputControl, {
|
|
251
|
+
size: "__unstable-large",
|
|
252
|
+
label: (0, _i18n.__)('Row span'),
|
|
253
|
+
type: "number",
|
|
254
|
+
onChange: value => {
|
|
255
|
+
const newRowSpan = value === '' ? 1 : parseInt(value, 10);
|
|
256
|
+
const constrainedValue = maxRowSpan ? Math.min(newRowSpan, maxRowSpan) : newRowSpan;
|
|
257
|
+
onChange({
|
|
258
|
+
columnStart,
|
|
259
|
+
rowStart,
|
|
260
|
+
columnSpan,
|
|
261
|
+
rowSpan: constrainedValue
|
|
262
|
+
});
|
|
263
|
+
},
|
|
264
|
+
value: rowSpan !== null && rowSpan !== void 0 ? rowSpan : 1,
|
|
265
|
+
min: 1,
|
|
266
|
+
max: maxRowSpan
|
|
267
|
+
})
|
|
249
268
|
})]
|
|
250
|
-
}), window.__experimentalEnableGridInteractivity &&
|
|
269
|
+
}), window.__experimentalEnableGridInteractivity &&
|
|
251
270
|
/*#__PURE__*/
|
|
252
271
|
// Use Flex with an explicit width on the FlexItem instead of HStack to
|
|
253
272
|
// work around an issue in webkit where inputs with a max attribute are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_data","_useGetNumberOfBlocksBeforeCell","_store","_useSettings","_jsxRuntime","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","isShownByDefault","panelId","type","parentType","default","defaultParentType","parentLayoutType","jsx","FlexControls","GridControls","flexSize","hasFlexValue","flexResetLabel","availableUnits","useSettings","units","useCustomUnits","resetFlex","undefined","useEffect","jsxs","__experimentalVStack","as","ToolsPanelItem","spacing","hasValue","label","onDeselect","children","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","_x","__experimentalUnitControl","min","hideLabelFromVision","columnStart","rowStart","columnSpan","rowSpan","columnCount","rowCount","rootClientId","useSelect","select","blockEditorStore","getBlockRootClientId","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","hasStartValue","hasSpanValue","resetGridStarts","resetGridSpans","Fragment","__experimentalHStack","__experimentalInputControl","newColumnSpan","parseInt","newRowSpan","window","__experimentalEnableGridInteractivity","Flex","FlexItem","style","width","newColumnStart","max","newRowStart"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useGetNumberOfBlocksBeforeCell } from '../grid/use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\nimport { useSettings } from '../use-settings';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @param {boolean} props.isShownByDefault\n * @param {string} props.panelId\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tif ( parentLayoutType === 'flex' ) {\n\t\treturn (\n\t\t\t<FlexControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t} else if ( parentLayoutType === 'grid' ) {\n\t\treturn (\n\t\t\t<GridControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction FlexControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\tconst { orientation = 'horizontal' } = parentLayout ?? {};\n\tconst hasFlexValue = () => !! selfStretch;\n\tconst flexResetLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vh',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst resetFlex = () => {\n\t\tonChange( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\thasValue={ hasFlexValue }\n\t\t\tlabel={ flexResetLabel }\n\t\t\tonDeselect={ resetFlex }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize = value !== 'fixed' ? null : flexSize;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tisBlock\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fit\"\n\t\t\t\t\tvalue=\"fit\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fit',\n\t\t\t\t\t\t'Intrinsic block width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fill\"\n\t\t\t\t\tvalue=\"fill\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Grow',\n\t\t\t\t\t\t'Block with expanding width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fixed\"\n\t\t\t\t\tvalue=\"fixed\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fixed',\n\t\t\t\t\t\t'Block with fixed width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tlabel={ flexResetLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n\nfunction GridControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = childLayout;\n\tconst { columnCount = 3, rowCount } = parentLayout ?? {};\n\tconst rootClientId = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).getBlockRootClientId( panelId )\n\t);\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\trootClientId,\n\t\tcolumnCount\n\t);\n\tconst hasStartValue = () => !! columnStart || !! rowStart;\n\tconst hasSpanValue = () => !! columnSpan || !! rowSpan;\n\tconst resetGridStarts = () => {\n\t\tonChange( {\n\t\t\tcolumnStart: undefined,\n\t\t\trowStart: undefined,\n\t\t} );\n\t};\n\tconst resetGridSpans = () => {\n\t\tonChange( {\n\t\t\tcolumnSpan: undefined,\n\t\t\trowSpan: undefined,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<HStack\n\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\thasValue={ hasSpanValue }\n\t\t\t\tlabel={ __( 'Grid span' ) }\n\t\t\t\tonDeselect={ resetGridSpans }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Column span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newColumnSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\tcolumnSpan: newColumnSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ columnSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t\t<InputControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tlabel={ __( 'Row span' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\tconst newRowSpan =\n\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\trowSpan: newRowSpan,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ rowSpan ?? 1 }\n\t\t\t\t\tmin={ 1 }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t\t{ window.__experimentalEnableGridInteractivity && columnCount && (\n\t\t\t\t// Use Flex with an explicit width on the FlexItem instead of HStack to\n\t\t\t\t// work around an issue in webkit where inputs with a max attribute are\n\t\t\t\t// sized incorrectly.\n\t\t\t\t<Flex\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\thasValue={ hasStartValue }\n\t\t\t\t\tlabel={ __( 'Grid placement' ) }\n\t\t\t\t\tonDeselect={ resetGridStarts }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Column' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newColumnStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tnewColumnStart,\n\t\t\t\t\t\t\t\t\t\trowStart\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\tvalue={ columnStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tcolumnCount\n\t\t\t\t\t\t\t\t\t? columnCount - ( columnSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Row' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newRowStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\t\tnewRowStart\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\tvalue={ rowStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\trowCount\n\t\t\t\t\t\t\t\t\t? rowCount - ( rowSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAYA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAA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K,IAAM;YACvB;YACA,MAAM8E,WAAW,GAChB9E,KAAK,KAAK,EAAE,GAAG,CAAC,GAAGoE,QAAQ,CAAEpE,KAAK,EAAE,EAAG,CAAC;YACzCE,QAAQ,CAAE;cACT0C,WAAW;cACXC,QAAQ,EAAEiC,WAAW;cACrBhC,UAAU;cACVC;YACD,CAAE,CAAC;YACHS,uCAAuC,CAAC,CAAC;YACzCD,oBAAoB,CACnB,CAAEnD,OAAO,CAAE,EACX8C,YAAY,EACZA,YAAY,EACZQ,2BAA2B,CAC1Bd,WAAW,EACXkC,WACD,CACD,CAAC;UACF,CAAG;UACH9E,KAAK,EAAG6C,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAI,CAAG;UACvBH,GAAG,EAAG,CAAG;UACTmC,GAAG,EACF5B,QAAQ,GACLA,QAAQ,IAAKF,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,CAAC,CAAE,GAAG,CAAC,GAC/B1B;QACH,CACD;MAAC,CACO,CAAC;IAAA,CACN,CACN;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_data","_useGetNumberOfBlocksBeforeCell","_store","_useSettings","_jsxRuntime","helpText","selfStretch","parentLayout","orientation","__","ChildLayoutControl","value","childLayout","onChange","isShownByDefault","panelId","type","parentType","default","defaultParentType","parentLayoutType","jsx","FlexControls","GridControls","flexSize","hasFlexValue","flexResetLabel","availableUnits","useSettings","units","useCustomUnits","resetFlex","undefined","useEffect","jsxs","__experimentalVStack","as","ToolsPanelItem","spacing","hasValue","label","onDeselect","children","__experimentalToggleGroupControl","__nextHasNoMarginBottom","size","childLayoutOrientation","help","newFlexSize","isBlock","__experimentalToggleGroupControlOption","_x","__experimentalUnitControl","min","hideLabelFromVision","columnStart","rowStart","columnSpan","rowSpan","columnCount","rowCount","rootClientId","useSelect","select","blockEditorStore","getBlockRootClientId","moveBlocksToPosition","__unstableMarkNextChangeAsNotPersistent","useDispatch","getNumberOfBlocksBeforeCell","useGetNumberOfBlocksBeforeCell","hasStartValue","hasSpanValue","resetGridStarts","resetGridSpans","maxColumnSpan","maxRowSpan","window","__experimentalEnableGridInteractivity","Fragment","Flex","FlexItem","style","width","__experimentalInputControl","newColumnSpan","parseInt","constrainedValue","Math","max","newRowSpan","newColumnStart","newRowStart"],"sources":["@wordpress/block-editor/src/components/child-layout-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalInputControl as InputControl,\n\t__experimentalVStack as VStack,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\tFlex,\n\tFlexItem,\n} from '@wordpress/components';\nimport { __, _x } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useGetNumberOfBlocksBeforeCell } from '../grid/use-get-number-of-blocks-before-cell';\nimport { store as blockEditorStore } from '../../store';\nimport { useSettings } from '../use-settings';\n\nfunction helpText( selfStretch, parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\n\tif ( selfStretch === 'fill' ) {\n\t\treturn __( 'Stretch to fill available space.' );\n\t}\n\tif ( selfStretch === 'fixed' && orientation === 'horizontal' ) {\n\t\treturn __( 'Specify a fixed width.' );\n\t} else if ( selfStretch === 'fixed' ) {\n\t\treturn __( 'Specify a fixed height.' );\n\t}\n\treturn __( 'Fit contents.' );\n}\n\n/**\n * Form to edit the child layout value.\n *\n * @param {Object} props Props.\n * @param {Object} props.value The child layout value.\n * @param {Function} props.onChange Function to update the child layout value.\n * @param {Object} props.parentLayout The parent layout value.\n *\n * @param {boolean} props.isShownByDefault\n * @param {string} props.panelId\n * @return {Element} child layout edit element.\n */\nexport default function ChildLayoutControl( {\n\tvalue: childLayout = {},\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst {\n\t\ttype: parentType,\n\t\tdefault: { type: defaultParentType = 'default' } = {},\n\t} = parentLayout ?? {};\n\tconst parentLayoutType = parentType || defaultParentType;\n\n\tif ( parentLayoutType === 'flex' ) {\n\t\treturn (\n\t\t\t<FlexControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t} else if ( parentLayoutType === 'grid' ) {\n\t\treturn (\n\t\t\t<GridControls\n\t\t\t\tchildLayout={ childLayout }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\nfunction FlexControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { selfStretch, flexSize } = childLayout;\n\tconst { orientation = 'horizontal' } = parentLayout ?? {};\n\tconst hasFlexValue = () => !! selfStretch;\n\tconst flexResetLabel =\n\t\torientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [\n\t\t\t'%',\n\t\t\t'px',\n\t\t\t'em',\n\t\t\t'rem',\n\t\t\t'vh',\n\t\t\t'vw',\n\t\t],\n\t} );\n\tconst resetFlex = () => {\n\t\tonChange( {\n\t\t\tselfStretch: undefined,\n\t\t\tflexSize: undefined,\n\t\t} );\n\t};\n\n\tuseEffect( () => {\n\t\tif ( selfStretch === 'fixed' && ! flexSize ) {\n\t\t\tonChange( {\n\t\t\t\t...childLayout,\n\t\t\t\tselfStretch: 'fit',\n\t\t\t} );\n\t\t}\n\t}, [] );\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\thasValue={ hasFlexValue }\n\t\t\tlabel={ flexResetLabel }\n\t\t\tonDeselect={ resetFlex }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tpanelId={ panelId }\n\t\t>\n\t\t\t<ToggleGroupControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\tlabel={ childLayoutOrientation( parentLayout ) }\n\t\t\t\tvalue={ selfStretch || 'fit' }\n\t\t\t\thelp={ helpText( selfStretch, parentLayout ) }\n\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\tconst newFlexSize = value !== 'fixed' ? null : flexSize;\n\t\t\t\t\tonChange( {\n\t\t\t\t\t\tselfStretch: value,\n\t\t\t\t\t\tflexSize: newFlexSize,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tisBlock\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fit\"\n\t\t\t\t\tvalue=\"fit\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fit',\n\t\t\t\t\t\t'Intrinsic block width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fill\"\n\t\t\t\t\tvalue=\"fill\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Grow',\n\t\t\t\t\t\t'Block with expanding width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey=\"fixed\"\n\t\t\t\t\tvalue=\"fixed\"\n\t\t\t\t\tlabel={ _x(\n\t\t\t\t\t\t'Fixed',\n\t\t\t\t\t\t'Block with fixed width in flex layout'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ selfStretch === 'fixed' && (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\tunits={ units }\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\tselfStretch,\n\t\t\t\t\t\t\tflexSize: value,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tvalue={ flexSize }\n\t\t\t\t\tmin={ 0 }\n\t\t\t\t\tlabel={ flexResetLabel }\n\t\t\t\t\thideLabelFromVision\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function childLayoutOrientation( parentLayout ) {\n\tconst { orientation = 'horizontal' } = parentLayout;\n\treturn orientation === 'horizontal' ? __( 'Width' ) : __( 'Height' );\n}\n\nfunction GridControls( {\n\tchildLayout,\n\tonChange,\n\tparentLayout,\n\tisShownByDefault,\n\tpanelId,\n} ) {\n\tconst { columnStart, rowStart, columnSpan, rowSpan } = childLayout;\n\tconst { columnCount, rowCount } = parentLayout ?? {};\n\tconst rootClientId = useSelect( ( select ) =>\n\t\tselect( blockEditorStore ).getBlockRootClientId( panelId )\n\t);\n\tconst { moveBlocksToPosition, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst getNumberOfBlocksBeforeCell = useGetNumberOfBlocksBeforeCell(\n\t\trootClientId,\n\t\tcolumnCount || 3\n\t);\n\tconst hasStartValue = () => !! columnStart || !! rowStart;\n\tconst hasSpanValue = () => !! columnSpan || !! rowSpan;\n\tconst resetGridStarts = () => {\n\t\tonChange( {\n\t\t\tcolumnStart: undefined,\n\t\t\trowStart: undefined,\n\t\t} );\n\t};\n\tconst resetGridSpans = () => {\n\t\tonChange( {\n\t\t\tcolumnSpan: undefined,\n\t\t\trowSpan: undefined,\n\t\t} );\n\t};\n\n\t// Calculate max column span based on current position and grid width\n\tconst maxColumnSpan = columnCount\n\t\t? columnCount - ( columnStart ?? 1 ) + 1\n\t\t: undefined;\n\n\t// Calculate max row span based on current position and grid height\n\tconst maxRowSpan =\n\t\twindow.__experimentalEnableGridInteractivity && rowCount\n\t\t\t? rowCount - ( rowStart ?? 1 ) + 1\n\t\t\t: undefined;\n\n\treturn (\n\t\t<>\n\t\t\t<Flex\n\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\thasValue={ hasSpanValue }\n\t\t\t\tlabel={ __( 'Grid span' ) }\n\t\t\t\tonDeselect={ resetGridSpans }\n\t\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\t\tpanelId={ panelId }\n\t\t\t>\n\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tlabel={ __( 'Column span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\tconst newColumnSpan =\n\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\tconst constrainedValue = maxColumnSpan\n\t\t\t\t\t\t\t\t? Math.min( newColumnSpan, maxColumnSpan )\n\t\t\t\t\t\t\t\t: newColumnSpan;\n\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\tcolumnSpan: constrainedValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ columnSpan ?? 1 }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ maxColumnSpan }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\tlabel={ __( 'Row span' ) }\n\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tconst newRowSpan =\n\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\tconst constrainedValue = maxRowSpan\n\t\t\t\t\t\t\t\t? Math.min( newRowSpan, maxRowSpan )\n\t\t\t\t\t\t\t\t: newRowSpan;\n\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\trowSpan: constrainedValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ rowSpan ?? 1 }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ maxRowSpan }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\n\t\t\t{ window.__experimentalEnableGridInteractivity && (\n\t\t\t\t// Use Flex with an explicit width on the FlexItem instead of HStack to\n\t\t\t\t// work around an issue in webkit where inputs with a max attribute are\n\t\t\t\t// sized incorrectly.\n\t\t\t\t<Flex\n\t\t\t\t\tas={ ToolsPanelItem }\n\t\t\t\t\thasValue={ hasStartValue }\n\t\t\t\t\tlabel={ __( 'Grid placement' ) }\n\t\t\t\t\tonDeselect={ resetGridStarts }\n\t\t\t\t\tisShownByDefault={ false }\n\t\t\t\t\tpanelId={ panelId }\n\t\t\t\t>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Column' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newColumnStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart: newColumnStart,\n\t\t\t\t\t\t\t\t\trowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tnewColumnStart,\n\t\t\t\t\t\t\t\t\t\trowStart\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\tvalue={ columnStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\tcolumnCount\n\t\t\t\t\t\t\t\t\t? columnCount - ( columnSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem style={ { width: '50%' } }>\n\t\t\t\t\t\t<InputControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tlabel={ __( 'Row' ) }\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t// Don't allow unsetting.\n\t\t\t\t\t\t\t\tconst newRowStart =\n\t\t\t\t\t\t\t\t\tvalue === '' ? 1 : parseInt( value, 10 );\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\trowStart: newRowStart,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tmoveBlocksToPosition(\n\t\t\t\t\t\t\t\t\t[ panelId ],\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\t\t\t\tgetNumberOfBlocksBeforeCell(\n\t\t\t\t\t\t\t\t\t\tcolumnStart,\n\t\t\t\t\t\t\t\t\t\tnewRowStart\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\tvalue={ rowStart ?? 1 }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t\trowCount\n\t\t\t\t\t\t\t\t\t? rowCount - ( rowSpan ?? 1 ) + 1\n\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAWA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,+BAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAA8C,IAAAO,WAAA,GAAAP,OAAA;AAvB9C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASQ,QAAQA,CAAEC,WAAW,EAAEC,YAAY,EAAG;EAC9C,MAAM;IAAEC,WAAW,GAAG;EAAa,CAAC,GAAGD,YAAY;EAEnD,IAAKD,WAAW,KAAK,M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123
123
|
children: IMAGE_SIZE_PRESETS.map(scale => {
|
|
124
124
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToggleGroupControlOption, {
|
|
125
125
|
value: scale,
|
|
126
|
-
label: (0, _i18n.sprintf)(/* translators: Percentage value. */
|
|
126
|
+
label: (0, _i18n.sprintf)(/* translators: %d: Percentage value. */
|
|
127
127
|
(0, _i18n.__)('%d%%'), scale)
|
|
128
128
|
}, scale);
|
|
129
129
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_useDimensionHandler","_interopRequireDefault","_jsxRuntime","IMAGE_SIZE_PRESETS","noop","getScaledWidthAndHeight","scale","imageWidth","imageHeight","scaledWidth","Math","round","scaledHeight","ImageSizeControl","imageSizeHelp","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","useDimensionHandler","handleUpdateDimensions","undefined","selectedValue","find","jsxs","__experimentalVStack","className","spacing","children","length","jsx","SelectControl","__nextHasNoMarginBottom","label","__","value","options","help","size","Fragment","__experimentalHStack","align","__experimentalNumberControl","min","__experimentalToggleGroupControl","hideLabelFromVision","isBlock","__next40pxDefaultSize","map","__experimentalToggleGroupControlOption","sprintf"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\n/**\n * Get scaled width and height for the given scale.\n *\n * @param {number} scale The scale to get the scaled width and height for.\n * @param {number} imageWidth The image width.\n * @param {number} imageHeight The image height.\n *\n * @return {Object} The scaled width and height.\n */\nfunction getScaledWidthAndHeight( scale, imageWidth, imageHeight ) {\n\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\treturn {\n\t\tscaledWidth,\n\t\tscaledHeight,\n\t};\n}\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\t/**\n\t * Updates the dimensions for the given scale.\n\t * Handler for toggle group control change.\n\t *\n\t * @param {number} scale The scale to update the dimensions for.\n\t */\n\tconst handleUpdateDimensions = ( scale ) => {\n\t\tif ( undefined === scale ) {\n\t\t\tupdateDimensions();\n\t\t\treturn;\n\t\t}\n\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\tupdateDimensions( scaledHeight, scaledWidth );\n\t};\n\n\t/**\n\t * Add the stored image preset value to toggle group control.\n\t */\n\tconst selectedValue = IMAGE_SIZE_PRESETS.find( ( scale ) => {\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\treturn currentWidth === scaledWidth && currentHeight === scaledHeight;\n\t} );\n\n\treturn (\n\t\t<VStack className=\"block-editor-image-size-control\" spacing=\"4\">\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<>\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"4\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Image size presets' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tonChange={ handleUpdateDimensions }\n\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t>\n\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\t\t\t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;UAAG,GANGA,KAON,CAAC;QAEJ,CAAE;MAAC,CACgB,CAAC;IAAA,CACpB,CACF;EAAA,CACM,CAAC;AAEX","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_useDimensionHandler","_interopRequireDefault","_jsxRuntime","IMAGE_SIZE_PRESETS","noop","getScaledWidthAndHeight","scale","imageWidth","imageHeight","scaledWidth","Math","round","scaledHeight","ImageSizeControl","imageSizeHelp","imageSizeOptions","isResizable","slug","width","height","onChange","onChangeImage","currentHeight","currentWidth","updateDimension","updateDimensions","useDimensionHandler","handleUpdateDimensions","undefined","selectedValue","find","jsxs","__experimentalVStack","className","spacing","children","length","jsx","SelectControl","__nextHasNoMarginBottom","label","__","value","options","help","size","Fragment","__experimentalHStack","align","__experimentalNumberControl","min","__experimentalToggleGroupControl","hideLabelFromVision","isBlock","__next40pxDefaultSize","map","__experimentalToggleGroupControlOption","sprintf"],"sources":["@wordpress/block-editor/src/components/image-size-control/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tSelectControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDimensionHandler from './use-dimension-handler';\n\nconst IMAGE_SIZE_PRESETS = [ 25, 50, 75, 100 ];\nconst noop = () => {};\n\n/**\n * Get scaled width and height for the given scale.\n *\n * @param {number} scale The scale to get the scaled width and height for.\n * @param {number} imageWidth The image width.\n * @param {number} imageHeight The image height.\n *\n * @return {Object} The scaled width and height.\n */\nfunction getScaledWidthAndHeight( scale, imageWidth, imageHeight ) {\n\tconst scaledWidth = Math.round( imageWidth * ( scale / 100 ) );\n\tconst scaledHeight = Math.round( imageHeight * ( scale / 100 ) );\n\n\treturn {\n\t\tscaledWidth,\n\t\tscaledHeight,\n\t};\n}\n\nexport default function ImageSizeControl( {\n\timageSizeHelp,\n\timageWidth,\n\timageHeight,\n\timageSizeOptions = [],\n\tisResizable = true,\n\tslug,\n\twidth,\n\theight,\n\tonChange,\n\tonChangeImage = noop,\n} ) {\n\tconst { currentHeight, currentWidth, updateDimension, updateDimensions } =\n\t\tuseDimensionHandler( height, width, imageHeight, imageWidth, onChange );\n\n\t/**\n\t * Updates the dimensions for the given scale.\n\t * Handler for toggle group control change.\n\t *\n\t * @param {number} scale The scale to update the dimensions for.\n\t */\n\tconst handleUpdateDimensions = ( scale ) => {\n\t\tif ( undefined === scale ) {\n\t\t\tupdateDimensions();\n\t\t\treturn;\n\t\t}\n\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\tupdateDimensions( scaledHeight, scaledWidth );\n\t};\n\n\t/**\n\t * Add the stored image preset value to toggle group control.\n\t */\n\tconst selectedValue = IMAGE_SIZE_PRESETS.find( ( scale ) => {\n\t\tconst { scaledWidth, scaledHeight } = getScaledWidthAndHeight(\n\t\t\tscale,\n\t\t\timageWidth,\n\t\t\timageHeight\n\t\t);\n\n\t\treturn currentWidth === scaledWidth && currentHeight === scaledHeight;\n\t} );\n\n\treturn (\n\t\t<VStack className=\"block-editor-image-size-control\" spacing=\"4\">\n\t\t\t{ imageSizeOptions && imageSizeOptions.length > 0 && (\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Resolution' ) }\n\t\t\t\t\tvalue={ slug }\n\t\t\t\t\toptions={ imageSizeOptions }\n\t\t\t\t\tonChange={ onChangeImage }\n\t\t\t\t\thelp={ imageSizeHelp }\n\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isResizable && (\n\t\t\t\t<>\n\t\t\t\t\t<HStack align=\"baseline\" spacing=\"4\">\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tlabel={ __( 'Width' ) }\n\t\t\t\t\t\t\tvalue={ currentWidth }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'width', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tlabel={ __( 'Height' ) }\n\t\t\t\t\t\t\tvalue={ currentHeight }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tupdateDimension( 'height', value )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t</HStack>\n\t\t\t\t\t<ToggleGroupControl\n\t\t\t\t\t\tlabel={ __( 'Image size presets' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tonChange={ handleUpdateDimensions }\n\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\tisBlock\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t>\n\t\t\t\t\t\t{ IMAGE_SIZE_PRESETS.map( ( scale ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\t\t\t\t\tkey={ scale }\n\t\t\t\t\t\t\t\t\tvalue={ scale }\n\t\t\t\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %d: Percentage value. */\n\t\t\t\t\t\t\t\t\t\t__( '%d%%' ),\n\t\t\t\t\t\t\t\t\t\tscale\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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
104
|
};
|
|
105
|
+
const _placeholder = placeholder !== null && placeholder !== void 0 ? placeholder : (0, _i18n.__)('Search or type URL');
|
|
106
|
+
const label = hideLabelFromVision && placeholder !== '' ? _placeholder : (0, _i18n.__)('Link');
|
|
105
107
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
106
108
|
className: "block-editor-link-control__search-input-container",
|
|
107
109
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.URLInput, {
|
|
108
110
|
disableSuggestions: currentLink?.url === value,
|
|
109
|
-
label:
|
|
111
|
+
label: label,
|
|
110
112
|
hideLabelFromVision: hideLabelFromVision,
|
|
111
113
|
className: className,
|
|
112
114
|
value: value,
|
|
113
115
|
onChange: onInputChange,
|
|
114
|
-
placeholder:
|
|
116
|
+
placeholder: _placeholder,
|
|
115
117
|
__experimentalRenderSuggestions: showSuggestions ? handleRenderSuggestions : null,
|
|
116
118
|
__experimentalFetchLinkSuggestions: searchHandler,
|
|
117
119
|
__experimentalHandleURLSuggestions: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_i18n","_","_searchResults","_interopRequireDefault","_constants","_useSearchHandler","_deprecated","_jsxRuntime","noopSearchHandler","Promise","resolve","noop","LinkControlSearchInput","forwardRef","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","onChange","onSelect","showSuggestions","renderSuggestions","props","jsx","default","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","hideLabelFromVision","suffix","ref","genericSearchHandler","useSearchHandler","searchHandler","focusedSuggestion","setFocusedSuggestion","useState","onInputChange","selection","suggestion","handleRenderSuggestions","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","id","restLinkProps","jsxs","URLInput","disableSuggestions","label","__","__experimentalRenderSuggestions","__experimentalFetchLinkSuggestions","__experimentalHandleURLSuggestions","__experimentalShowInitialSuggestions","onSubmit","event","hasSuggestion","trim","preventDefault","_default","exports","__experimentalLinkControlSearchInput","deprecated","since"],"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\nimport deprecated from '@wordpress/deprecated';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t\tsuffix,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tconst { id, url, ...restLinkProps } = currentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ placeholder ?? __( 'Search or type URL' ) }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\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\tref={ ref }\n\t\t\t\t\tsuffix={ suffix }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n\nexport const __experimentalLinkControlSearchInput = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', {\n\t\tsince: '6.8',\n\t} );\n\n\treturn <LinkControlSearchInput { ...props } />;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAA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AAMgE,oCAAoC,GAAKnD,KAAK,IAAM;EAChE,IAAAoD,mBAAU,EAAE,qDAAqD,EAAE;IAClEC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,oBAAO,IAAAvE,WAAA,CAAAmB,GAAA,EAACd,sBAAsB;IAAA,GAAMa;EAAK,CAAI,CAAC;AAC/C,CAAC;AAACkD,OAAA,CAAAC,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_element","require","_i18n","_","_searchResults","_interopRequireDefault","_constants","_useSearchHandler","_deprecated","_jsxRuntime","noopSearchHandler","Promise","resolve","noop","LinkControlSearchInput","forwardRef","value","children","currentLink","className","placeholder","withCreateSuggestion","onCreateSuggestion","onChange","onSelect","showSuggestions","renderSuggestions","props","jsx","default","fetchSuggestions","allowDirectEntry","showInitialSuggestions","suggestionsQuery","withURLSuggestion","createSuggestionButtonText","hideLabelFromVision","suffix","ref","genericSearchHandler","useSearchHandler","searchHandler","focusedSuggestion","setFocusedSuggestion","useState","onInputChange","selection","suggestion","handleRenderSuggestions","handleSuggestionClick","onSuggestionSelected","selectedSuggestion","CREATE_TYPE","type","title","url","e","Object","keys","length","id","restLinkProps","_placeholder","__","label","jsxs","URLInput","disableSuggestions","__experimentalRenderSuggestions","__experimentalFetchLinkSuggestions","__experimentalHandleURLSuggestions","__experimentalShowInitialSuggestions","onSubmit","event","hasSuggestion","trim","preventDefault","_default","exports","__experimentalLinkControlSearchInput","deprecated","since"],"sources":["@wordpress/block-editor/src/components/link-control/search-input.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { forwardRef, useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { URLInput } from '../';\nimport LinkControlSearchResults from './search-results';\nimport { CREATE_TYPE } from './constants';\nimport useSearchHandler from './use-search-handler';\nimport deprecated from '@wordpress/deprecated';\n\n// Must be a function as otherwise URLInput will default\n// to the fetchLinkSuggestions passed in block editor settings\n// which will cause an unintended http request.\nconst noopSearchHandler = () => Promise.resolve( [] );\n\nconst noop = () => {};\n\nconst LinkControlSearchInput = forwardRef(\n\t(\n\t\t{\n\t\t\tvalue,\n\t\t\tchildren,\n\t\t\tcurrentLink = {},\n\t\t\tclassName = null,\n\t\t\tplaceholder = null,\n\t\t\twithCreateSuggestion = false,\n\t\t\tonCreateSuggestion = noop,\n\t\t\tonChange = noop,\n\t\t\tonSelect = noop,\n\t\t\tshowSuggestions = true,\n\t\t\trenderSuggestions = ( props ) => (\n\t\t\t\t<LinkControlSearchResults { ...props } />\n\t\t\t),\n\t\t\tfetchSuggestions = null,\n\t\t\tallowDirectEntry = true,\n\t\t\tshowInitialSuggestions = false,\n\t\t\tsuggestionsQuery = {},\n\t\t\twithURLSuggestion = true,\n\t\t\tcreateSuggestionButtonText,\n\t\t\thideLabelFromVision = false,\n\t\t\tsuffix,\n\t\t},\n\t\tref\n\t) => {\n\t\tconst genericSearchHandler = useSearchHandler(\n\t\t\tsuggestionsQuery,\n\t\t\tallowDirectEntry,\n\t\t\twithCreateSuggestion,\n\t\t\twithURLSuggestion\n\t\t);\n\n\t\tconst searchHandler = showSuggestions\n\t\t\t? fetchSuggestions || genericSearchHandler\n\t\t\t: noopSearchHandler;\n\n\t\tconst [ focusedSuggestion, setFocusedSuggestion ] = useState();\n\n\t\t/**\n\t\t * Handles the user moving between different suggestions. Does not handle\n\t\t * choosing an individual item.\n\t\t *\n\t\t * @param {string} selection the url of the selected suggestion.\n\t\t * @param {Object} suggestion the suggestion object.\n\t\t */\n\t\tconst onInputChange = ( selection, suggestion ) => {\n\t\t\tonChange( selection );\n\t\t\tsetFocusedSuggestion( suggestion );\n\t\t};\n\n\t\tconst handleRenderSuggestions = ( props ) =>\n\t\t\trenderSuggestions( {\n\t\t\t\t...props,\n\t\t\t\twithCreateSuggestion,\n\t\t\t\tcreateSuggestionButtonText,\n\t\t\t\tsuggestionsQuery,\n\t\t\t\thandleSuggestionClick: ( suggestion ) => {\n\t\t\t\t\tif ( props.handleSuggestionClick ) {\n\t\t\t\t\t\tprops.handleSuggestionClick( suggestion );\n\t\t\t\t\t}\n\t\t\t\t\tonSuggestionSelected( suggestion );\n\t\t\t\t},\n\t\t\t} );\n\n\t\tconst onSuggestionSelected = async ( selectedSuggestion ) => {\n\t\t\tlet suggestion = selectedSuggestion;\n\t\t\tif ( CREATE_TYPE === selectedSuggestion.type ) {\n\t\t\t\t// Create a new page and call onSelect with the output from the onCreateSuggestion callback.\n\t\t\t\ttry {\n\t\t\t\t\tsuggestion = await onCreateSuggestion(\n\t\t\t\t\t\tselectedSuggestion.title\n\t\t\t\t\t);\n\t\t\t\t\tif ( suggestion?.url ) {\n\t\t\t\t\t\tonSelect( suggestion );\n\t\t\t\t\t}\n\t\t\t\t} catch ( e ) {}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tallowDirectEntry ||\n\t\t\t\t( suggestion && Object.keys( suggestion ).length >= 1 )\n\t\t\t) {\n\t\t\t\tconst { id, url, ...restLinkProps } = currentLink ?? {};\n\t\t\t\tonSelect(\n\t\t\t\t\t// Some direct entries don't have types or IDs, and we still need to clear the previous ones.\n\t\t\t\t\t{ ...restLinkProps, ...suggestion },\n\t\t\t\t\tsuggestion\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\tconst _placeholder = placeholder ?? __( 'Search or type URL' );\n\n\t\tconst label =\n\t\t\thideLabelFromVision && placeholder !== ''\n\t\t\t\t? _placeholder\n\t\t\t\t: __( 'Link' );\n\n\t\treturn (\n\t\t\t<div className=\"block-editor-link-control__search-input-container\">\n\t\t\t\t<URLInput\n\t\t\t\t\tdisableSuggestions={ currentLink?.url === value }\n\t\t\t\t\tlabel={ label }\n\t\t\t\t\thideLabelFromVision={ hideLabelFromVision }\n\t\t\t\t\tclassName={ className }\n\t\t\t\t\tvalue={ value }\n\t\t\t\t\tonChange={ onInputChange }\n\t\t\t\t\tplaceholder={ _placeholder }\n\t\t\t\t\t__experimentalRenderSuggestions={\n\t\t\t\t\t\tshowSuggestions ? handleRenderSuggestions : null\n\t\t\t\t\t}\n\t\t\t\t\t__experimentalFetchLinkSuggestions={ searchHandler }\n\t\t\t\t\t__experimentalHandleURLSuggestions\n\t\t\t\t\t__experimentalShowInitialSuggestions={\n\t\t\t\t\t\tshowInitialSuggestions\n\t\t\t\t\t}\n\t\t\t\t\tonSubmit={ ( suggestion, event ) => {\n\t\t\t\t\t\tconst hasSuggestion = suggestion || focusedSuggestion;\n\n\t\t\t\t\t\t// If there is no suggestion and the value (ie: any manually entered URL) is empty\n\t\t\t\t\t\t// then don't allow submission otherwise we get empty links.\n\t\t\t\t\t\tif ( ! hasSuggestion && ! value?.trim()?.length ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tonSuggestionSelected(\n\t\t\t\t\t\t\t\thasSuggestion || { url: value }\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\tref={ ref }\n\t\t\t\t\tsuffix={ suffix }\n\t\t\t\t/>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t);\n\t}\n);\n\nexport default LinkControlSearchInput;\n\nexport const __experimentalLinkControlSearchInput = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', {\n\t\tsince: '6.8',\n\t} );\n\n\treturn <LinkControlSearchInput { ...props } />;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,CAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAF,sBAAA,CAAAJ,OAAA;AACA,IAAAO,WAAA,GAAAH,sBAAA,CAAAJ,OAAA;AAA+C,IAAAQ,WAAA,GAAAR,OAAA;AAb/C;AACA;AACA;;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GAAA,EAACd,sBAAsB;IAAA,GAAMa;EAAK,CAAI,CAAC;AAC/C,CAAC;AAACmD,OAAA,CAAAC,oCAAA,GAAAA,oCAAA","ignoreList":[]}
|
|
@@ -85,6 +85,7 @@ function ListViewBlock({
|
|
|
85
85
|
insertBeforeBlock,
|
|
86
86
|
setOpenedBlockSettingsMenu
|
|
87
87
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
88
|
+
const debouncedToggleBlockHighlight = (0, _compose.useDebounce)(toggleBlockHighlight, 50);
|
|
88
89
|
const {
|
|
89
90
|
canInsertBlockType,
|
|
90
91
|
getSelectedBlockClientIds,
|
|
@@ -307,12 +308,12 @@ function ListViewBlock({
|
|
|
307
308
|
}
|
|
308
309
|
const onMouseEnter = (0, _element.useCallback)(() => {
|
|
309
310
|
setIsHovered(true);
|
|
310
|
-
|
|
311
|
-
}, [clientId, setIsHovered,
|
|
311
|
+
debouncedToggleBlockHighlight(clientId, true);
|
|
312
|
+
}, [clientId, setIsHovered, debouncedToggleBlockHighlight]);
|
|
312
313
|
const onMouseLeave = (0, _element.useCallback)(() => {
|
|
313
314
|
setIsHovered(false);
|
|
314
|
-
|
|
315
|
-
}, [clientId, setIsHovered,
|
|
315
|
+
debouncedToggleBlockHighlight(clientId, false);
|
|
316
|
+
}, [clientId, setIsHovered, debouncedToggleBlockHighlight]);
|
|
316
317
|
const selectEditorBlock = (0, _element.useCallback)(event => {
|
|
317
318
|
selectBlock(event, clientId);
|
|
318
319
|
event.preventDefault();
|