Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Mar 30, 2023
1 parent cfb65d3 commit 5619e75
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 12 additions & 11 deletions packages/block-editor/src/components/off-canvas-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ export const BLOCK_LIST_ITEM_HEIGHT = 36;
/**
* Show a hierarchical list of blocks.
*
* @param {Object} props Components props.
* @param {string} props.id An HTML element id for the root element of ListView.
* @param {string} props.parentClientId The client id of the parent block.
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {boolean} props.showBlockMovers Flag to enable block movers
* @param {boolean} props.isExpanded Flag to determine whether nested levels are expanded by default.
* @param {Object} props.LeafMoreMenu Optional more menu substitution.
* @param {string} props.description Optional accessible description for the tree grid component.
* @param {string} props.onSelect Optional callback to be invoked when a block is selected.
* @param {string} props.showAppender Flag to show or hide the block appender.
* @param {Object} ref Forwarded ref
* @param {Object} props Components props.
* @param {string} props.id An HTML element id for the root element of ListView.
* @param {string} props.parentClientId The client id of the parent block.
* @param {Array} props.blocks Custom subset of block client IDs to be used instead of the default hierarchy.
* @param {boolean} props.showBlockMovers Flag to enable block movers
* @param {boolean} props.isExpanded Flag to determine whether nested levels are expanded by default.
* @param {Object} props.LeafMoreMenu Optional more menu substitution.
* @param {string} props.description Optional accessible description for the tree grid component.
* @param {string} props.onSelect Optional callback to be invoked when a block is selected.
* @param {string} props.showAppender Flag to show or hide the block appender.
* @param {Function} props.renderAdditionalBlockUI Function that renders additional block content UI.
* @param {Object} ref Forwarded ref.
*/
function OffCanvasEditor(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import { createBlock } from '@wordpress/blocks';
import { useCallback, useState } from '@wordpress/element';
import { Popover } from '@wordpress/components';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import { unlock } from '../../private-apis';
import { NavigationMenuLoader } from './loader';

function renderAdditionalBlockUI( block, onClose ) {
function CustomLinkAdditionalBlockUI( { block, onClose } ) {
const { updateBlockAttributes } = useDispatch( blockEditorStore );
const { label, url, opensInNewTab } = block.attributes;
const link = {
Expand Down Expand Up @@ -76,10 +75,16 @@ export default function NavigationMenuContent( { rootClientId, onSelect } ) {
customLinkEditPopoverOpenId &&
block.clientId === customLinkEditPopoverOpenId
) {
return renderAdditionalBlockUI( block, () => {
setIsCustomLinkEditPopoverOpenId( false );
} );
return (
<CustomLinkAdditionalBlockUI
block={ block }
onClose={ () => {
setIsCustomLinkEditPopoverOpenId( false );
} }
/>
);
}
return null;
},
[ customLinkEditPopoverOpenId, setIsCustomLinkEditPopoverOpenId ]
);
Expand Down

0 comments on commit 5619e75

Please sign in to comment.