@wordpress/block-library 8.3.4 → 8.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/archives/index.js +0 -1
- package/build/archives/index.js.map +1 -1
- package/build/avatar/index.js +0 -1
- package/build/avatar/index.js.map +1 -1
- package/build/calendar/index.js +0 -1
- package/build/calendar/index.js.map +1 -1
- package/build/categories/index.js +0 -1
- package/build/categories/index.js.map +1 -1
- package/build/comment-author-avatar/index.js +0 -1
- package/build/comment-author-avatar/index.js.map +1 -1
- package/build/comment-author-name/index.js +0 -1
- package/build/comment-author-name/index.js.map +1 -1
- package/build/comment-content/index.js +0 -1
- package/build/comment-content/index.js.map +1 -1
- package/build/comment-date/index.js +0 -1
- package/build/comment-date/index.js.map +1 -1
- package/build/comment-edit-link/index.js +0 -1
- package/build/comment-edit-link/index.js.map +1 -1
- package/build/comment-reply-link/index.js +0 -1
- package/build/comment-reply-link/index.js.map +1 -1
- package/build/comment-template/index.js +0 -1
- package/build/comment-template/index.js.map +1 -1
- package/build/comments/index.js +1 -2
- package/build/comments/index.js.map +1 -1
- package/build/comments-pagination/index.js +0 -1
- package/build/comments-pagination/index.js.map +1 -1
- package/build/comments-pagination-next/index.js +0 -1
- package/build/comments-pagination-next/index.js.map +1 -1
- package/build/comments-pagination-numbers/index.js +0 -1
- package/build/comments-pagination-numbers/index.js.map +1 -1
- package/build/comments-pagination-previous/index.js +0 -1
- package/build/comments-pagination-previous/index.js.map +1 -1
- package/build/home-link/index.js +0 -1
- package/build/home-link/index.js.map +1 -1
- package/build/latest-comments/index.js +0 -1
- package/build/latest-comments/index.js.map +1 -1
- package/build/latest-posts/deprecated.js +0 -1
- package/build/latest-posts/deprecated.js.map +1 -1
- package/build/latest-posts/index.js +0 -1
- package/build/latest-posts/index.js.map +1 -1
- package/build/loginout/index.js +0 -1
- package/build/loginout/index.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +3 -4
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/index.js +0 -1
- package/build/navigation/index.js.map +1 -1
- package/build/navigation-link/edit.js +9 -10
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +4 -0
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/page-list/index.js +0 -1
- package/build/page-list/index.js.map +1 -1
- package/build/post-author/index.js +0 -1
- package/build/post-author/index.js.map +1 -1
- package/build/post-author-biography/index.js +0 -1
- package/build/post-author-biography/index.js.map +1 -1
- package/build/post-author-name/index.js +0 -1
- package/build/post-author-name/index.js.map +1 -1
- package/build/post-comments-count/index.js +0 -1
- package/build/post-comments-count/index.js.map +1 -1
- package/build/post-comments-form/index.js +0 -1
- package/build/post-comments-form/index.js.map +1 -1
- package/build/post-comments-link/index.js +0 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-content/index.js +0 -1
- package/build/post-content/index.js.map +1 -1
- package/build/post-date/index.js +0 -1
- package/build/post-date/index.js.map +1 -1
- package/build/post-excerpt/index.js +0 -1
- package/build/post-excerpt/index.js.map +1 -1
- package/build/post-featured-image/index.js +0 -1
- package/build/post-featured-image/index.js.map +1 -1
- package/build/post-navigation-link/index.js +0 -1
- package/build/post-navigation-link/index.js.map +1 -1
- package/build/post-template/index.js +0 -1
- package/build/post-template/index.js.map +1 -1
- package/build/post-terms/index.js +0 -1
- package/build/post-terms/index.js.map +1 -1
- package/build/post-title/index.js +0 -1
- package/build/post-title/index.js.map +1 -1
- package/build/query/index.js +0 -1
- package/build/query/index.js.map +1 -1
- package/build/query/utils.js +0 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-no-results/index.js +0 -1
- package/build/query-no-results/index.js.map +1 -1
- package/build/query-pagination/index.js +0 -1
- package/build/query-pagination/index.js.map +1 -1
- package/build/query-pagination-next/index.js +0 -1
- package/build/query-pagination-next/index.js.map +1 -1
- package/build/query-pagination-numbers/index.js +0 -1
- package/build/query-pagination-numbers/index.js.map +1 -1
- package/build/query-pagination-previous/index.js +0 -1
- package/build/query-pagination-previous/index.js.map +1 -1
- package/build/query-title/index.js +0 -1
- package/build/query-title/index.js.map +1 -1
- package/build/read-more/index.js +0 -1
- package/build/read-more/index.js.map +1 -1
- package/build/rss/index.js +0 -1
- package/build/rss/index.js.map +1 -1
- package/build/search/index.js +0 -1
- package/build/search/index.js.map +1 -1
- package/build/site-logo/index.js +0 -1
- package/build/site-logo/index.js.map +1 -1
- package/build/site-tagline/index.js +1 -1
- package/build/site-title/index.js +0 -1
- package/build/site-title/index.js.map +1 -1
- package/build/social-link/index.js +0 -1
- package/build/social-link/index.js.map +1 -1
- package/build/social-links/edit.js +2 -1
- package/build/social-links/edit.js.map +1 -1
- package/build/tag-cloud/index.js +0 -1
- package/build/tag-cloud/index.js.map +1 -1
- package/build/template-part/edit/import-controls.js +29 -6
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build/template-part/index.js +0 -1
- package/build/template-part/index.js.map +1 -1
- package/build/term-description/index.js +0 -1
- package/build/term-description/index.js.map +1 -1
- package/build-module/archives/index.js +0 -1
- package/build-module/archives/index.js.map +1 -1
- package/build-module/avatar/index.js +0 -1
- package/build-module/avatar/index.js.map +1 -1
- package/build-module/calendar/index.js +0 -1
- package/build-module/calendar/index.js.map +1 -1
- package/build-module/categories/index.js +0 -1
- package/build-module/categories/index.js.map +1 -1
- package/build-module/comment-author-avatar/index.js +0 -1
- package/build-module/comment-author-avatar/index.js.map +1 -1
- package/build-module/comment-author-name/index.js +0 -1
- package/build-module/comment-author-name/index.js.map +1 -1
- package/build-module/comment-content/index.js +0 -1
- package/build-module/comment-content/index.js.map +1 -1
- package/build-module/comment-date/index.js +0 -1
- package/build-module/comment-date/index.js.map +1 -1
- package/build-module/comment-edit-link/index.js +0 -1
- package/build-module/comment-edit-link/index.js.map +1 -1
- package/build-module/comment-reply-link/index.js +0 -1
- package/build-module/comment-reply-link/index.js.map +1 -1
- package/build-module/comment-template/index.js +0 -1
- package/build-module/comment-template/index.js.map +1 -1
- package/build-module/comments/index.js +1 -2
- package/build-module/comments/index.js.map +1 -1
- package/build-module/comments-pagination/index.js +0 -1
- package/build-module/comments-pagination/index.js.map +1 -1
- package/build-module/comments-pagination-next/index.js +0 -1
- package/build-module/comments-pagination-next/index.js.map +1 -1
- package/build-module/comments-pagination-numbers/index.js +0 -1
- package/build-module/comments-pagination-numbers/index.js.map +1 -1
- package/build-module/comments-pagination-previous/index.js +0 -1
- package/build-module/comments-pagination-previous/index.js.map +1 -1
- package/build-module/home-link/index.js +0 -1
- package/build-module/home-link/index.js.map +1 -1
- package/build-module/latest-comments/index.js +0 -1
- package/build-module/latest-comments/index.js.map +1 -1
- package/build-module/latest-posts/deprecated.js +0 -1
- package/build-module/latest-posts/deprecated.js.map +1 -1
- package/build-module/latest-posts/index.js +0 -1
- package/build-module/latest-posts/index.js.map +1 -1
- package/build-module/loginout/index.js +0 -1
- package/build-module/loginout/index.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/index.js +0 -1
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +9 -10
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +4 -0
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/page-list/index.js +0 -1
- package/build-module/page-list/index.js.map +1 -1
- package/build-module/post-author/index.js +0 -1
- package/build-module/post-author/index.js.map +1 -1
- package/build-module/post-author-biography/index.js +0 -1
- package/build-module/post-author-biography/index.js.map +1 -1
- package/build-module/post-author-name/index.js +0 -1
- package/build-module/post-author-name/index.js.map +1 -1
- package/build-module/post-comments-count/index.js +0 -1
- package/build-module/post-comments-count/index.js.map +1 -1
- package/build-module/post-comments-form/index.js +0 -1
- package/build-module/post-comments-form/index.js.map +1 -1
- package/build-module/post-comments-link/index.js +0 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-content/index.js +0 -1
- package/build-module/post-content/index.js.map +1 -1
- package/build-module/post-date/index.js +0 -1
- package/build-module/post-date/index.js.map +1 -1
- package/build-module/post-excerpt/index.js +0 -1
- package/build-module/post-excerpt/index.js.map +1 -1
- package/build-module/post-featured-image/index.js +0 -1
- package/build-module/post-featured-image/index.js.map +1 -1
- package/build-module/post-navigation-link/index.js +0 -1
- package/build-module/post-navigation-link/index.js.map +1 -1
- package/build-module/post-template/index.js +0 -1
- package/build-module/post-template/index.js.map +1 -1
- package/build-module/post-terms/index.js +0 -1
- package/build-module/post-terms/index.js.map +1 -1
- package/build-module/post-title/index.js +0 -1
- package/build-module/post-title/index.js.map +1 -1
- package/build-module/query/index.js +0 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/query/utils.js +0 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-no-results/index.js +0 -1
- package/build-module/query-no-results/index.js.map +1 -1
- package/build-module/query-pagination/index.js +0 -1
- package/build-module/query-pagination/index.js.map +1 -1
- package/build-module/query-pagination-next/index.js +0 -1
- package/build-module/query-pagination-next/index.js.map +1 -1
- package/build-module/query-pagination-numbers/index.js +0 -1
- package/build-module/query-pagination-numbers/index.js.map +1 -1
- package/build-module/query-pagination-previous/index.js +0 -1
- package/build-module/query-pagination-previous/index.js.map +1 -1
- package/build-module/query-title/index.js +0 -1
- package/build-module/query-title/index.js.map +1 -1
- package/build-module/read-more/index.js +0 -1
- package/build-module/read-more/index.js.map +1 -1
- package/build-module/rss/index.js +0 -1
- package/build-module/rss/index.js.map +1 -1
- package/build-module/search/index.js +0 -1
- package/build-module/search/index.js.map +1 -1
- package/build-module/site-logo/index.js +0 -1
- package/build-module/site-logo/index.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -1
- package/build-module/site-title/index.js +0 -1
- package/build-module/site-title/index.js.map +1 -1
- package/build-module/social-link/index.js +0 -1
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/social-links/edit.js +2 -1
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/tag-cloud/index.js +0 -1
- package/build-module/tag-cloud/index.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +28 -6
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-module/template-part/index.js +0 -1
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/term-description/index.js +0 -1
- package/build-module/term-description/index.js.map +1 -1
- package/build-style/editor-rtl.css +3 -2
- package/build-style/editor.css +3 -2
- package/build-style/query/editor-rtl.css +1 -0
- package/build-style/query/editor.css +1 -0
- package/build-style/quote/style-rtl.css +5 -5
- package/build-style/quote/style.css +5 -5
- package/build-style/site-logo/editor-rtl.css +2 -2
- package/build-style/site-logo/editor.css +2 -2
- package/build-style/style-rtl.css +5 -5
- package/build-style/style.css +5 -5
- package/package.json +16 -16
- package/src/archives/block.json +0 -1
- package/src/avatar/block.json +0 -1
- package/src/calendar/block.json +0 -1
- package/src/categories/block.json +0 -1
- package/src/comment-author-avatar/block.json +0 -1
- package/src/comment-author-name/block.json +0 -1
- package/src/comment-content/block.json +0 -1
- package/src/comment-date/block.json +0 -1
- package/src/comment-edit-link/block.json +0 -1
- package/src/comment-reply-link/block.json +0 -1
- package/src/comment-template/block.json +0 -1
- package/src/comments/block.json +1 -2
- package/src/comments-pagination/block.json +0 -1
- package/src/comments-pagination-next/block.json +0 -1
- package/src/comments-pagination-numbers/block.json +0 -1
- package/src/comments-pagination-previous/block.json +0 -1
- package/src/home-link/block.json +0 -1
- package/src/latest-comments/block.json +0 -1
- package/src/latest-posts/block.json +0 -1
- package/src/loginout/block.json +0 -1
- package/src/navigation/block.json +0 -1
- package/src/navigation/edit/menu-inspector-controls.js +1 -3
- package/src/navigation-link/edit.js +8 -10
- package/src/navigation-submenu/edit.js +3 -0
- package/src/page-list/block.json +0 -1
- package/src/post-author/block.json +0 -1
- package/src/post-author-biography/block.json +0 -1
- package/src/post-author-name/block.json +0 -1
- package/src/post-comments-count/block.json +0 -1
- package/src/post-comments-form/block.json +0 -1
- package/src/post-comments-link/block.json +0 -1
- package/src/post-content/block.json +0 -1
- package/src/post-date/block.json +0 -1
- package/src/post-excerpt/block.json +0 -1
- package/src/post-featured-image/block.json +0 -1
- package/src/post-navigation-link/block.json +0 -1
- package/src/post-template/block.json +0 -1
- package/src/post-terms/block.json +0 -1
- package/src/post-title/block.json +0 -1
- package/src/query/block.json +0 -1
- package/src/query/editor.scss +1 -0
- package/src/query-no-results/block.json +0 -1
- package/src/query-pagination/block.json +0 -1
- package/src/query-pagination-next/block.json +0 -1
- package/src/query-pagination-numbers/block.json +0 -1
- package/src/query-pagination-previous/block.json +0 -1
- package/src/query-title/block.json +0 -1
- package/src/quote/style.scss +2 -2
- package/src/read-more/block.json +0 -1
- package/src/rss/block.json +0 -1
- package/src/search/block.json +0 -1
- package/src/site-logo/block.json +0 -1
- package/src/site-logo/editor.scss +3 -3
- package/src/site-tagline/block.json +1 -1
- package/src/site-title/block.json +0 -1
- package/src/social-link/block.json +0 -1
- package/src/social-links/edit.js +1 -0
- package/src/tag-cloud/block.json +0 -1
- package/src/template-part/block.json +0 -1
- package/src/template-part/edit/import-controls.js +24 -5
- package/src/template-part/index.php +1 -1
- package/src/term-description/block.json +0 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/navigation/leaf-more-menu.js +0 -95
- package/build/navigation/leaf-more-menu.js.map +0 -1
- package/build-module/navigation/leaf-more-menu.js +0 -76
- package/build-module/navigation/leaf-more-menu.js.map +0 -1
- package/src/navigation/leaf-more-menu.js +0 -93
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import { createElement } from "@wordpress/element";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* WordPress dependencies
|
|
6
|
-
*/
|
|
7
|
-
import { createBlock } from '@wordpress/blocks';
|
|
8
|
-
import { addSubmenu, moreVertical } from '@wordpress/icons';
|
|
9
|
-
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
|
|
10
|
-
import { useDispatch } from '@wordpress/data';
|
|
11
|
-
import { store as blockEditorStore, BlockTitle } from '@wordpress/block-editor';
|
|
12
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
13
|
-
const POPOVER_PROPS = {
|
|
14
|
-
className: 'block-editor-block-settings-menu__popover',
|
|
15
|
-
position: 'bottom right',
|
|
16
|
-
variant: 'toolbar'
|
|
17
|
-
};
|
|
18
|
-
export const LeafMoreMenu = props => {
|
|
19
|
-
const {
|
|
20
|
-
clientId,
|
|
21
|
-
block
|
|
22
|
-
} = props;
|
|
23
|
-
const {
|
|
24
|
-
insertBlock,
|
|
25
|
-
replaceBlock,
|
|
26
|
-
removeBlocks,
|
|
27
|
-
replaceInnerBlocks
|
|
28
|
-
} = useDispatch(blockEditorStore);
|
|
29
|
-
const label = sprintf(
|
|
30
|
-
/* translators: %s: block name */
|
|
31
|
-
__('Remove %s'), BlockTitle({
|
|
32
|
-
clientId,
|
|
33
|
-
maximumLength: 25
|
|
34
|
-
}));
|
|
35
|
-
return createElement(DropdownMenu, _extends({
|
|
36
|
-
icon: moreVertical,
|
|
37
|
-
label: __('Options'),
|
|
38
|
-
className: "block-editor-block-settings-menu",
|
|
39
|
-
popoverProps: POPOVER_PROPS,
|
|
40
|
-
noIcons: true
|
|
41
|
-
}, props), _ref => {
|
|
42
|
-
let {
|
|
43
|
-
onClose
|
|
44
|
-
} = _ref;
|
|
45
|
-
return createElement(MenuGroup, null, createElement(MenuItem, {
|
|
46
|
-
icon: addSubmenu,
|
|
47
|
-
onClick: () => {
|
|
48
|
-
const updateSelectionOnInsert = false;
|
|
49
|
-
const newLink = createBlock('core/navigation-link');
|
|
50
|
-
|
|
51
|
-
if (block.name === 'core/navigation-submenu') {
|
|
52
|
-
insertBlock(newLink, block.innerBlocks.length, clientId, updateSelectionOnInsert);
|
|
53
|
-
} else {
|
|
54
|
-
// Convert to a submenu if the block currently isn't one.
|
|
55
|
-
const newSubmenu = createBlock('core/navigation-submenu', block.attributes, block.innerBlocks); // The following must happen as two independent actions.
|
|
56
|
-
// Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds
|
|
57
|
-
// selector to determine which block is "active". As the UX needs the newLink to be
|
|
58
|
-
// the "active" block it must be the last block to be inserted.
|
|
59
|
-
// Therefore the Submenu is first created and **then** the newLink is inserted
|
|
60
|
-
// thus ensuring it is the last inserted block.
|
|
61
|
-
|
|
62
|
-
replaceBlock(clientId, newSubmenu);
|
|
63
|
-
replaceInnerBlocks(newSubmenu.clientId, [newLink], updateSelectionOnInsert);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
onClose();
|
|
67
|
-
}
|
|
68
|
-
}, __('Add submenu item')), createElement(MenuItem, {
|
|
69
|
-
onClick: () => {
|
|
70
|
-
removeBlocks([clientId], false);
|
|
71
|
-
onClose();
|
|
72
|
-
}
|
|
73
|
-
}, label));
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
//# sourceMappingURL=leaf-more-menu.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-library/src/navigation/leaf-more-menu.js"],"names":["createBlock","addSubmenu","moreVertical","DropdownMenu","MenuItem","MenuGroup","useDispatch","store","blockEditorStore","BlockTitle","__","sprintf","POPOVER_PROPS","className","position","variant","LeafMoreMenu","props","clientId","block","insertBlock","replaceBlock","removeBlocks","replaceInnerBlocks","label","maximumLength","onClose","updateSelectionOnInsert","newLink","name","innerBlocks","length","newSubmenu","attributes"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,mBAA5B;AACA,SAASC,UAAT,EAAqBC,YAArB,QAAyC,kBAAzC;AACA,SAASC,YAAT,EAAuBC,QAAvB,EAAiCC,SAAjC,QAAkD,uBAAlD;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,gBAAlB,EAAoCC,UAApC,QAAsD,yBAAtD;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA,MAAMC,aAAa,GAAG;AACrBC,EAAAA,SAAS,EAAE,2CADU;AAErBC,EAAAA,QAAQ,EAAE,cAFW;AAGrBC,EAAAA,OAAO,EAAE;AAHY,CAAtB;AAMA,OAAO,MAAMC,YAAY,GAAKC,KAAF,IAAa;AACxC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAsBF,KAA5B;AAEA,QAAM;AAAEG,IAAAA,WAAF;AAAeC,IAAAA,YAAf;AAA6BC,IAAAA,YAA7B;AAA2CC,IAAAA;AAA3C,MACLjB,WAAW,CAAEE,gBAAF,CADZ;AAGA,QAAMgB,KAAK,GAAGb,OAAO;AACpB;AACAD,EAAAA,EAAE,CAAE,WAAF,CAFkB,EAGpBD,UAAU,CAAE;AAAES,IAAAA,QAAF;AAAYO,IAAAA,aAAa,EAAE;AAA3B,GAAF,CAHU,CAArB;AAMA,SACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGvB,YADR;AAEC,IAAA,KAAK,EAAGQ,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,SAAS,EAAC,kCAHX;AAIC,IAAA,YAAY,EAAGE,aAJhB;AAKC,IAAA,OAAO;AALR,KAMMK,KANN,GAQG;AAAA,QAAE;AAAES,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,SAAD,QACC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGzB,UADR;AAEC,MAAA,OAAO,EAAG,MAAM;AACf,cAAM0B,uBAAuB,GAAG,KAAhC;AACA,cAAMC,OAAO,GAAG5B,WAAW,CAC1B,sBAD0B,CAA3B;;AAGA,YAAKmB,KAAK,CAACU,IAAN,KAAe,yBAApB,EAAgD;AAC/CT,UAAAA,WAAW,CACVQ,OADU,EAEVT,KAAK,CAACW,WAAN,CAAkBC,MAFR,EAGVb,QAHU,EAIVS,uBAJU,CAAX;AAMA,SAPD,MAOO;AACN;AACA,gBAAMK,UAAU,GAAGhC,WAAW,CAC7B,yBAD6B,EAE7BmB,KAAK,CAACc,UAFuB,EAG7Bd,KAAK,CAACW,WAHuB,CAA9B,CAFM,CAQN;AACA;AACA;AACA;AACA;AACA;;AACAT,UAAAA,YAAY,CAAEH,QAAF,EAAYc,UAAZ,CAAZ;AAEAT,UAAAA,kBAAkB,CACjBS,UAAU,CAACd,QADM,EAEjB,CAAEU,OAAF,CAFiB,EAGjBD,uBAHiB,CAAlB;AAKA;;AACDD,QAAAA,OAAO;AACP;AArCF,OAuCGhB,EAAE,CAAE,kBAAF,CAvCL,CADD,EA0CC,cAAC,QAAD;AACC,MAAA,OAAO,EAAG,MAAM;AACfY,QAAAA,YAAY,CAAE,CAAEJ,QAAF,CAAF,EAAgB,KAAhB,CAAZ;AACAQ,QAAAA,OAAO;AACP;AAJF,OAMGF,KANH,CA1CD,CADC;AAAA,GARH,CADD;AAgEA,CA5EM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\nimport { addSubmenu, moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore, BlockTitle } from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\nconst POPOVER_PROPS = {\n\tclassName: 'block-editor-block-settings-menu__popover',\n\tposition: 'bottom right',\n\tvariant: 'toolbar',\n};\n\nexport const LeafMoreMenu = ( props ) => {\n\tconst { clientId, block } = props;\n\n\tconst { insertBlock, replaceBlock, removeBlocks, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst label = sprintf(\n\t\t/* translators: %s: block name */\n\t\t__( 'Remove %s' ),\n\t\tBlockTitle( { clientId, maximumLength: 25 } )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Options' ) }\n\t\t\tclassName=\"block-editor-block-settings-menu\"\n\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\tnoIcons\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\ticon={ addSubmenu }\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tconst updateSelectionOnInsert = false;\n\t\t\t\t\t\t\tconst newLink = createBlock(\n\t\t\t\t\t\t\t\t'core/navigation-link'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif ( block.name === 'core/navigation-submenu' ) {\n\t\t\t\t\t\t\t\tinsertBlock(\n\t\t\t\t\t\t\t\t\tnewLink,\n\t\t\t\t\t\t\t\t\tblock.innerBlocks.length,\n\t\t\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\t\t\tupdateSelectionOnInsert\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Convert to a submenu if the block currently isn't one.\n\t\t\t\t\t\t\t\tconst newSubmenu = createBlock(\n\t\t\t\t\t\t\t\t\t'core/navigation-submenu',\n\t\t\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t// The following must happen as two independent actions.\n\t\t\t\t\t\t\t\t// Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds\n\t\t\t\t\t\t\t\t// selector to determine which block is \"active\". As the UX needs the newLink to be\n\t\t\t\t\t\t\t\t// the \"active\" block it must be the last block to be inserted.\n\t\t\t\t\t\t\t\t// Therefore the Submenu is first created and **then** the newLink is inserted\n\t\t\t\t\t\t\t\t// thus ensuring it is the last inserted block.\n\t\t\t\t\t\t\t\treplaceBlock( clientId, newSubmenu );\n\n\t\t\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\t\t\tnewSubmenu.clientId,\n\t\t\t\t\t\t\t\t\t[ newLink ],\n\t\t\t\t\t\t\t\t\tupdateSelectionOnInsert\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Add submenu item' ) }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t\t<MenuItem\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tremoveBlocks( [ clientId ], false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</MenuItem>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n};\n"]}
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createBlock } from '@wordpress/blocks';
|
|
5
|
-
import { addSubmenu, moreVertical } from '@wordpress/icons';
|
|
6
|
-
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
8
|
-
import { store as blockEditorStore, BlockTitle } from '@wordpress/block-editor';
|
|
9
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
10
|
-
|
|
11
|
-
const POPOVER_PROPS = {
|
|
12
|
-
className: 'block-editor-block-settings-menu__popover',
|
|
13
|
-
position: 'bottom right',
|
|
14
|
-
variant: 'toolbar',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export const LeafMoreMenu = ( props ) => {
|
|
18
|
-
const { clientId, block } = props;
|
|
19
|
-
|
|
20
|
-
const { insertBlock, replaceBlock, removeBlocks, replaceInnerBlocks } =
|
|
21
|
-
useDispatch( blockEditorStore );
|
|
22
|
-
|
|
23
|
-
const label = sprintf(
|
|
24
|
-
/* translators: %s: block name */
|
|
25
|
-
__( 'Remove %s' ),
|
|
26
|
-
BlockTitle( { clientId, maximumLength: 25 } )
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<DropdownMenu
|
|
31
|
-
icon={ moreVertical }
|
|
32
|
-
label={ __( 'Options' ) }
|
|
33
|
-
className="block-editor-block-settings-menu"
|
|
34
|
-
popoverProps={ POPOVER_PROPS }
|
|
35
|
-
noIcons
|
|
36
|
-
{ ...props }
|
|
37
|
-
>
|
|
38
|
-
{ ( { onClose } ) => (
|
|
39
|
-
<MenuGroup>
|
|
40
|
-
<MenuItem
|
|
41
|
-
icon={ addSubmenu }
|
|
42
|
-
onClick={ () => {
|
|
43
|
-
const updateSelectionOnInsert = false;
|
|
44
|
-
const newLink = createBlock(
|
|
45
|
-
'core/navigation-link'
|
|
46
|
-
);
|
|
47
|
-
if ( block.name === 'core/navigation-submenu' ) {
|
|
48
|
-
insertBlock(
|
|
49
|
-
newLink,
|
|
50
|
-
block.innerBlocks.length,
|
|
51
|
-
clientId,
|
|
52
|
-
updateSelectionOnInsert
|
|
53
|
-
);
|
|
54
|
-
} else {
|
|
55
|
-
// Convert to a submenu if the block currently isn't one.
|
|
56
|
-
const newSubmenu = createBlock(
|
|
57
|
-
'core/navigation-submenu',
|
|
58
|
-
block.attributes,
|
|
59
|
-
block.innerBlocks
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// The following must happen as two independent actions.
|
|
63
|
-
// Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds
|
|
64
|
-
// selector to determine which block is "active". As the UX needs the newLink to be
|
|
65
|
-
// the "active" block it must be the last block to be inserted.
|
|
66
|
-
// Therefore the Submenu is first created and **then** the newLink is inserted
|
|
67
|
-
// thus ensuring it is the last inserted block.
|
|
68
|
-
replaceBlock( clientId, newSubmenu );
|
|
69
|
-
|
|
70
|
-
replaceInnerBlocks(
|
|
71
|
-
newSubmenu.clientId,
|
|
72
|
-
[ newLink ],
|
|
73
|
-
updateSelectionOnInsert
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
onClose();
|
|
77
|
-
} }
|
|
78
|
-
>
|
|
79
|
-
{ __( 'Add submenu item' ) }
|
|
80
|
-
</MenuItem>
|
|
81
|
-
<MenuItem
|
|
82
|
-
onClick={ () => {
|
|
83
|
-
removeBlocks( [ clientId ], false );
|
|
84
|
-
onClose();
|
|
85
|
-
} }
|
|
86
|
-
>
|
|
87
|
-
{ label }
|
|
88
|
-
</MenuItem>
|
|
89
|
-
</MenuGroup>
|
|
90
|
-
) }
|
|
91
|
-
</DropdownMenu>
|
|
92
|
-
);
|
|
93
|
-
};
|