@wordpress/block-library 9.20.0 → 9.22.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 +4 -0
- package/build/categories/edit.js +3 -3
- package/build/categories/edit.js.map +1 -1
- package/build/cover/index.js +1 -1
- package/build/cover/index.js.map +1 -1
- package/build/details/edit.js +1 -5
- package/build/details/edit.js.map +1 -1
- package/build/details/index.js +1 -1
- package/build/details/index.js.map +1 -1
- package/build/embed/edit.js +4 -1
- package/build/embed/edit.js.map +1 -1
- package/build/image/edit.js +3 -2
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +13 -8
- package/build/image/image.js.map +1 -1
- package/build/navigation/edit/index.js +8 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/view.js +2 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +27 -29
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +0 -3
- package/build/navigation-link/index.js.map +1 -1
- package/build/navigation-link/transforms.js +0 -2
- package/build/navigation-link/transforms.js.map +1 -1
- package/build/navigation-link/update-attributes.js +0 -1
- package/build/navigation-link/update-attributes.js.map +1 -1
- package/build/navigation-submenu/edit.js +1 -24
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/navigation-submenu/index.js +0 -3
- package/build/navigation-submenu/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-link/index.js +0 -1
- package/build/post-comments-link/index.js.map +1 -1
- package/build/post-featured-image/edit.js +14 -3
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +47 -59
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +2 -2
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/query-content.js +4 -17
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query-total/index.js +3 -0
- package/build/query-total/index.js.map +1 -1
- package/build/quote/index.js +1 -1
- package/build/quote/index.js.map +1 -1
- package/build/rss/edit.js +21 -1
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +7 -0
- package/build/rss/index.js.map +1 -1
- package/build/site-title/edit.js +1 -1
- package/build/site-title/edit.js.map +1 -1
- package/build/social-links/edit.js +29 -31
- package/build/social-links/edit.js.map +1 -1
- package/build/table/index.js +3 -3
- package/build/table/index.js.map +1 -1
- package/build/table/transforms.js +11 -3
- package/build/table/transforms.js.map +1 -1
- package/build/table-of-contents/edit.js +50 -8
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/hooks.js +13 -4
- package/build/table-of-contents/hooks.js.map +1 -1
- package/build/table-of-contents/index.js +3 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/cover/index.js +1 -1
- package/build-module/cover/index.js.map +1 -1
- package/build-module/details/edit.js +1 -5
- package/build-module/details/edit.js.map +1 -1
- package/build-module/details/index.js +1 -1
- package/build-module/details/index.js.map +1 -1
- package/build-module/embed/edit.js +4 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/image/edit.js +3 -2
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +14 -9
- package/build-module/image/image.js.map +1 -1
- package/build-module/navigation/edit/index.js +8 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/view.js +2 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +28 -30
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +0 -3
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/navigation-link/transforms.js +0 -2
- package/build-module/navigation-link/transforms.js.map +1 -1
- package/build-module/navigation-link/update-attributes.js +0 -1
- package/build-module/navigation-link/update-attributes.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +1 -24
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/navigation-submenu/index.js +0 -3
- package/build-module/navigation-submenu/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-link/index.js +0 -1
- package/build-module/post-comments-link/index.js.map +1 -1
- package/build-module/post-featured-image/edit.js +14 -3
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +49 -61
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +2 -2
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/query-content.js +4 -17
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query-total/index.js +3 -0
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/quote/index.js +1 -1
- package/build-module/quote/index.js.map +1 -1
- package/build-module/rss/edit.js +22 -2
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +7 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/site-title/edit.js +1 -1
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/social-links/edit.js +30 -32
- package/build-module/social-links/edit.js.map +1 -1
- package/build-module/table/index.js +3 -3
- package/build-module/table/index.js.map +1 -1
- package/build-module/table/transforms.js +11 -3
- package/build-module/table/transforms.js.map +1 -1
- package/build-module/table-of-contents/edit.js +52 -10
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/hooks.js +13 -4
- package/build-module/table-of-contents/hooks.js.map +1 -1
- package/build-module/table-of-contents/index.js +3 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-style/editor-rtl.css +1 -50
- package/build-style/editor.css +1 -50
- package/build-style/media-text/style-rtl.css +0 -2
- package/build-style/media-text/style.css +0 -2
- package/build-style/post-comments-form/style-rtl.css +3 -0
- package/build-style/post-comments-form/style.css +3 -0
- package/build-style/search/style-rtl.css +1 -0
- package/build-style/search/style.css +1 -0
- package/build-style/social-links/editor-rtl.css +1 -50
- package/build-style/social-links/editor.css +1 -50
- package/build-style/style-rtl.css +4 -6
- package/build-style/style.css +4 -6
- package/build-style/tag-cloud/style-rtl.css +0 -4
- package/build-style/tag-cloud/style.css +0 -4
- package/package.json +35 -35
- package/src/button/index.php +2 -3
- package/src/categories/edit.js +3 -3
- package/src/cover/index.js +1 -1
- package/src/details/edit.js +6 -8
- package/src/details/index.js +1 -1
- package/src/embed/edit.js +7 -1
- package/src/file/index.php +2 -3
- package/src/image/edit.js +3 -3
- package/src/image/image.js +9 -12
- package/src/latest-comments/index.php +1 -1
- package/src/latest-posts/index.php +3 -0
- package/src/media-text/style.scss +0 -2
- package/src/navigation/edit/index.js +4 -0
- package/src/navigation/index.php +1 -1
- package/src/navigation/view.js +2 -1
- package/src/navigation-link/block.json +0 -3
- package/src/navigation-link/edit.js +46 -33
- package/src/navigation-link/index.php +1 -5
- package/src/navigation-link/transforms.js +1 -2
- package/src/navigation-link/update-attributes.js +0 -1
- package/src/navigation-submenu/block.json +0 -3
- package/src/navigation-submenu/edit.js +1 -24
- package/src/navigation-submenu/index.php +0 -4
- package/src/post-comments-count/block.json +0 -1
- package/src/post-comments-count/index.php +4 -0
- package/src/post-comments-form/style.scss +5 -0
- package/src/post-comments-link/block.json +0 -1
- package/src/post-comments-link/index.php +4 -0
- package/src/post-featured-image/edit.js +93 -75
- package/src/query/edit/inspector-controls/index.js +66 -91
- package/src/query/edit/inspector-controls/parent-control.js +2 -2
- package/src/query/edit/inspector-controls/taxonomy-controls.js +2 -2
- package/src/query/edit/query-content.js +7 -16
- package/src/query-total/block.json +3 -0
- package/src/query-total/index.php +1 -1
- package/src/quote/index.js +1 -1
- package/src/rss/block.json +7 -0
- package/src/rss/edit.js +21 -0
- package/src/rss/index.php +27 -9
- package/src/search/index.php +12 -9
- package/src/search/style.scss +1 -0
- package/src/site-title/edit.js +1 -1
- package/src/site-title/index.php +1 -1
- package/src/social-links/edit.js +29 -30
- package/src/social-links/editor.scss +1 -59
- package/src/table/index.js +3 -3
- package/src/table/transforms.js +14 -2
- package/src/table-of-contents/block.json +3 -0
- package/src/table-of-contents/edit.js +45 -4
- package/src/table-of-contents/hooks.js +12 -3
- package/src/tag-cloud/style.scss +0 -5
|
@@ -6,7 +6,7 @@ import clsx from 'clsx';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useEffect
|
|
9
|
+
import { useEffect } from '@wordpress/element';
|
|
10
10
|
import { BlockControls, useInnerBlocksProps, useBlockProps, InspectorControls, ContrastChecker, withColors, InnerBlocks, __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown, __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients, store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
11
|
import { MenuGroup, MenuItem, ToggleControl, ToolbarDropdownMenu, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
@@ -45,51 +45,50 @@ export function SocialLinksEdit(props) {
|
|
|
45
45
|
} = props;
|
|
46
46
|
const {
|
|
47
47
|
iconBackgroundColorValue,
|
|
48
|
-
customIconBackgroundColor,
|
|
49
48
|
iconColorValue,
|
|
50
49
|
openInNewTab,
|
|
51
50
|
showLabels,
|
|
52
51
|
size
|
|
53
52
|
} = attributes;
|
|
54
|
-
const
|
|
53
|
+
const {
|
|
54
|
+
hasSocialIcons,
|
|
55
|
+
hasSelectedChild
|
|
56
|
+
} = useSelect(select => {
|
|
57
|
+
const {
|
|
58
|
+
getBlockCount,
|
|
59
|
+
hasSelectedInnerBlock
|
|
60
|
+
} = select(blockEditorStore);
|
|
61
|
+
return {
|
|
62
|
+
hasSocialIcons: getBlockCount(clientId) > 0,
|
|
63
|
+
hasSelectedChild: hasSelectedInnerBlock(clientId)
|
|
64
|
+
};
|
|
65
|
+
}, [clientId]);
|
|
55
66
|
const hasAnySelected = isSelected || hasSelectedChild;
|
|
56
67
|
const logosOnly = attributes.className?.includes('is-style-logos-only');
|
|
57
68
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
58
69
|
|
|
59
70
|
// Remove icon background color when logos only style is selected or
|
|
60
71
|
// restore it when any other style is selected.
|
|
61
|
-
const backgroundBackupRef = useRef({});
|
|
62
72
|
useEffect(() => {
|
|
63
73
|
if (logosOnly) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
74
|
+
let restore;
|
|
75
|
+
setAttributes(prev => {
|
|
76
|
+
restore = {
|
|
77
|
+
iconBackgroundColor: prev.iconBackgroundColor,
|
|
78
|
+
iconBackgroundColorValue: prev.iconBackgroundColorValue,
|
|
79
|
+
customIconBackgroundColor: prev.customIconBackgroundColor
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
iconBackgroundColor: undefined,
|
|
83
|
+
iconBackgroundColorValue: undefined,
|
|
84
|
+
customIconBackgroundColor: undefined
|
|
85
|
+
};
|
|
73
86
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
...backgroundBackupRef.current
|
|
87
|
+
return () => setAttributes({
|
|
88
|
+
...restore
|
|
77
89
|
});
|
|
78
90
|
}
|
|
79
|
-
}, [logosOnly]);
|
|
80
|
-
const SocialPlaceholder = /*#__PURE__*/_jsx("li", {
|
|
81
|
-
className: "wp-block-social-links__social-placeholder",
|
|
82
|
-
children: /*#__PURE__*/_jsxs("div", {
|
|
83
|
-
className: "wp-block-social-links__social-placeholder-icons",
|
|
84
|
-
children: [/*#__PURE__*/_jsx("div", {
|
|
85
|
-
className: "wp-social-link wp-social-link-twitter"
|
|
86
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
87
|
-
className: "wp-social-link wp-social-link-facebook"
|
|
88
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
89
|
-
className: "wp-social-link wp-social-link-instagram"
|
|
90
|
-
})]
|
|
91
|
-
})
|
|
92
|
-
});
|
|
91
|
+
}, [logosOnly, setAttributes]);
|
|
93
92
|
|
|
94
93
|
// Fallback color values are used maintain selections in case switching
|
|
95
94
|
// themes and named colors in palette do not match.
|
|
@@ -102,11 +101,10 @@ export function SocialLinksEdit(props) {
|
|
|
102
101
|
className
|
|
103
102
|
});
|
|
104
103
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
105
|
-
placeholder: !isSelected && SocialPlaceholder,
|
|
106
104
|
templateLock: false,
|
|
107
105
|
orientation: (_attributes$layout$or = attributes.layout?.orientation) !== null && _attributes$layout$or !== void 0 ? _attributes$layout$or : 'horizontal',
|
|
108
106
|
__experimentalAppenderTagName: 'li',
|
|
109
|
-
renderAppender: hasAnySelected
|
|
107
|
+
renderAppender: !hasSocialIcons || hasAnySelected ? InnerBlocks.ButtonBlockAppender : undefined
|
|
110
108
|
});
|
|
111
109
|
const POPOVER_PROPS = {
|
|
112
110
|
position: 'bottom right'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useEffect","useRef","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","withColors","InnerBlocks","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","store","blockEditorStore","MenuGroup","MenuItem","ToggleControl","ToolbarDropdownMenu","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","check","useSelect","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","sizeOptions","name","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","hasSelectedChild","select","hasSelectedInnerBlock","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","backgroundBackupRef","current","undefined","SocialPlaceholder","children","color","blockProps","innerBlocksProps","placeholder","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","group","text","icon","popoverProps","onClose","map","entry","onClick","role","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","textColor","backgroundColor","isLargeText","iconColorAttributes"],"sources":["@wordpress/block-library/src/social-links/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\tcustomIconBackgroundColor,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst hasSelectedChild = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).hasSelectedInnerBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tconst backgroundBackupRef = useRef( {} );\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tbackgroundBackupRef.current = {\n\t\t\t\ticonBackgroundColor,\n\t\t\t\ticonBackgroundColorValue,\n\t\t\t\tcustomIconBackgroundColor,\n\t\t\t};\n\t\t\tsetAttributes( {\n\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t} );\n\t\t} else {\n\t\t\tsetAttributes( { ...backgroundBackupRef.current } );\n\t\t}\n\t}, [ logosOnly ] );\n\n\tconst SocialPlaceholder = (\n\t\t<li className=\"wp-block-social-links__social-placeholder\">\n\t\t\t<div className=\"wp-block-social-links__social-placeholder-icons\">\n\t\t\t\t<div className=\"wp-social-link wp-social-link-twitter\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-facebook\"></div>\n\t\t\t\t<div className=\"wp-social-link wp-social-link-instagram\"></div>\n\t\t\t</div>\n\t\t</li>\n\t);\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tplaceholder: ! isSelected && SocialPlaceholder,\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender: hasAnySelected && InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\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</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\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\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\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\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SACCC,aAAa,EACbC,mBAAmB,EACnBC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,UAAU,EACVC,WAAW,EACXC,2CAA2C,IAAIC,6BAA6B,EAC5EC,iDAAiD,IAAIC,mCAAmC,EACxFC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SACCC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9B,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,QAAQ,kBAAkB;AACxC,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,8BAA8B,QAAQ,gBAAgB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AAEhE,MAAMC,WAAW,GAAG,CACnB;EAAEC,IAAI,EAAEX,EAAE,CAAE,OAAQ,CAAC;EAAEY,KAAK,EAAE;AAAsB,CAAC,EACrD;EAAED,IAAI,EAAEX,EAAE,CAAE,QAAS,CAAC;EAAEY,KAAK,EAAE;AAAuB,CAAC,EACvD;EAAED,IAAI,EAAEX,EAAE,CAAE,OAAQ,CAAC;EAAEY,KAAK,EAAE;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AgB,CAAI,CAAC;EAAA,CAC7B,CAAC;AAEL;AAEA,MAAM0C,mBAAmB,GAAG;EAC3BpE,SAAS,EAAE,YAAY;EACvBD,mBAAmB,EAAE;AACtB,CAAC;AAED,eAAelC,UAAU,CAAEuG,mBAAoB,CAAC,CAAE1E,eAAgB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useEffect","BlockControls","useInnerBlocksProps","useBlockProps","InspectorControls","ContrastChecker","withColors","InnerBlocks","__experimentalColorGradientSettingsDropdown","ColorGradientSettingsDropdown","__experimentalUseMultipleOriginColorsAndGradients","useMultipleOriginColorsAndGradients","store","blockEditorStore","MenuGroup","MenuItem","ToggleControl","ToolbarDropdownMenu","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","__","check","useSelect","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","sizeOptions","name","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","showLabels","size","hasSocialIcons","hasSelectedChild","select","getBlockCount","hasSelectedInnerBlock","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","restore","prev","customIconBackgroundColor","undefined","color","blockProps","innerBlocksProps","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","children","group","text","icon","popoverProps","onClose","map","entry","onClick","role","resetAll","isShownByDefault","hasValue","onDeselect","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","textColor","backgroundColor","isLargeText","iconColorAttributes"],"sources":["@wordpress/block-library/src/social-links/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tuseInnerBlocksProps,\n\tuseBlockProps,\n\tInspectorControls,\n\tContrastChecker,\n\twithColors,\n\tInnerBlocks,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tMenuGroup,\n\tMenuItem,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst sizeOptions = [\n\t{ name: __( 'Small' ), value: 'has-small-icon-size' },\n\t{ name: __( 'Normal' ), value: 'has-normal-icon-size' },\n\t{ name: __( 'Large' ), value: 'has-large-icon-size' },\n\t{ name: __( 'Huge' ), value: 'has-huge-icon-size' },\n];\n\nexport function SocialLinksEdit( props ) {\n\tconst {\n\t\tclientId,\n\t\tattributes,\n\t\ticonBackgroundColor,\n\t\ticonColor,\n\t\tisSelected,\n\t\tsetAttributes,\n\t\tsetIconBackgroundColor,\n\t\tsetIconColor,\n\t} = props;\n\n\tconst {\n\t\ticonBackgroundColorValue,\n\t\ticonColorValue,\n\t\topenInNewTab,\n\t\tshowLabels,\n\t\tsize,\n\t} = attributes;\n\n\tconst { hasSocialIcons, hasSelectedChild } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, hasSelectedInnerBlock } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\thasSocialIcons: getBlockCount( clientId ) > 0,\n\t\t\t\thasSelectedChild: hasSelectedInnerBlock( clientId ),\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst hasAnySelected = isSelected || hasSelectedChild;\n\n\tconst logosOnly = attributes.className?.includes( 'is-style-logos-only' );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t// Remove icon background color when logos only style is selected or\n\t// restore it when any other style is selected.\n\tuseEffect( () => {\n\t\tif ( logosOnly ) {\n\t\t\tlet restore;\n\t\t\tsetAttributes( ( prev ) => {\n\t\t\t\trestore = {\n\t\t\t\t\ticonBackgroundColor: prev.iconBackgroundColor,\n\t\t\t\t\ticonBackgroundColorValue: prev.iconBackgroundColorValue,\n\t\t\t\t\tcustomIconBackgroundColor: prev.customIconBackgroundColor,\n\t\t\t\t};\n\t\t\t\treturn {\n\t\t\t\t\ticonBackgroundColor: undefined,\n\t\t\t\t\ticonBackgroundColorValue: undefined,\n\t\t\t\t\tcustomIconBackgroundColor: undefined,\n\t\t\t\t};\n\t\t\t} );\n\n\t\t\treturn () => setAttributes( { ...restore } );\n\t\t}\n\t}, [ logosOnly, setAttributes ] );\n\n\t// Fallback color values are used maintain selections in case switching\n\t// themes and named colors in palette do not match.\n\tconst className = clsx( size, {\n\t\t'has-visible-labels': showLabels,\n\t\t'has-icon-color': iconColor.color || iconColorValue,\n\t\t'has-icon-background-color':\n\t\t\ticonBackgroundColor.color || iconBackgroundColorValue,\n\t} );\n\n\tconst blockProps = useBlockProps( { className } );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: false,\n\t\torientation: attributes.layout?.orientation ?? 'horizontal',\n\t\t__experimentalAppenderTagName: 'li',\n\t\trenderAppender:\n\t\t\t! hasSocialIcons || hasAnySelected\n\t\t\t\t? InnerBlocks.ButtonBlockAppender\n\t\t\t\t: undefined,\n\t} );\n\n\tconst POPOVER_PROPS = {\n\t\tposition: 'bottom right',\n\t};\n\n\tconst colorSettings = [\n\t\t{\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconColor.color || iconColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconColor( colorValue );\n\t\t\t\tsetAttributes( { iconColorValue: colorValue } );\n\t\t\t},\n\t\t\tlabel: __( 'Icon color' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconColor( undefined );\n\t\t\t\tsetAttributes( { iconColorValue: undefined } );\n\t\t\t},\n\t\t},\n\t];\n\n\tif ( ! logosOnly ) {\n\t\tcolorSettings.push( {\n\t\t\t// Use custom attribute as fallback to prevent loss of named color selection when\n\t\t\t// switching themes to a new theme that does not have a matching named color.\n\t\t\tvalue: iconBackgroundColor.color || iconBackgroundColorValue,\n\t\t\tonChange: ( colorValue ) => {\n\t\t\t\tsetIconBackgroundColor( colorValue );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\ticonBackgroundColorValue: colorValue,\n\t\t\t\t} );\n\t\t\t},\n\t\t\tlabel: __( 'Icon background' ),\n\t\t\tresetAllFilter: () => {\n\t\t\t\tsetIconBackgroundColor( undefined );\n\t\t\t\tsetAttributes( { iconBackgroundColorValue: undefined } );\n\t\t\t},\n\t\t} );\n\t}\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls group=\"other\">\n\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\t\ttext={ __( 'Size' ) }\n\t\t\t\t\ticon={ null }\n\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t>\n\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ sizeOptions.map( ( entry ) => {\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t( size === entry.value ||\n\t\t\t\t\t\t\t\t\t\t\t\t( ! size &&\n\t\t\t\t\t\t\t\t\t\t\t\t\tentry.value ===\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'has-normal-icon-size' ) ) &&\n\t\t\t\t\t\t\t\t\t\t\tcheck\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tisSelected={ size === entry.value }\n\t\t\t\t\t\t\t\t\t\tkey={ entry.value }\n\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\t\t\tsize: entry.value,\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ entry.name }\n\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t) }\n\t\t\t\t</ToolbarDropdownMenu>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\topenInNewTab: false,\n\t\t\t\t\t\t\tshowLabels: false,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\thasValue={ () => !! openInNewTab }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { openInNewTab: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Open links in new tab' ) }\n\t\t\t\t\t\t\tchecked={ openInNewTab }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenInNewTab: ! openInNewTab,\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</ToolsPanelItem>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\thasValue={ () => !! showLabels }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { showLabels: false } )\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Show text' ) }\n\t\t\t\t\t\t\tchecked={ showLabels }\n\t\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\t\tsetAttributes( { showLabels: ! showLabels } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t{ colorSettings.map(\n\t\t\t\t\t\t( { onChange, label, value, resetAllFilter } ) => (\n\t\t\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t\t\tkey={ `social-links-color-${ label }` }\n\t\t\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcolorValue: value,\n\t\t\t\t\t\t\t\t\t\tlabel,\n\t\t\t\t\t\t\t\t\t\tonColorChange: onChange,\n\t\t\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\t\t\tresetAllFilter,\n\t\t\t\t\t\t\t\t\t\tenableAlpha: true,\n\t\t\t\t\t\t\t\t\t\tclearable: true,\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\tpanelId={ clientId }\n\t\t\t\t\t\t\t\t{ ...colorGradientSettings }\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\t{ ! logosOnly && (\n\t\t\t\t\t\t<ContrastChecker\n\t\t\t\t\t\t\t{ ...{\n\t\t\t\t\t\t\t\ttextColor: iconColorValue,\n\t\t\t\t\t\t\t\tbackgroundColor: iconBackgroundColorValue,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tisLargeText={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<ul { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nconst iconColorAttributes = {\n\ticonColor: 'icon-color',\n\ticonBackgroundColor: 'icon-background-color',\n};\n\nexport default withColors( iconColorAttributes )( SocialLinksEdit );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,aAAa,EACbC,mBAAmB,EACnBC,aAAa,EACbC,iBAAiB,EACjBC,eAAe,EACfC,UAAU,EACVC,WAAW,EACXC,2CAA2C,IAAIC,6BAA6B,EAC5EC,iDAAiD,IAAIC,mCAAmC,EACxFC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SACCC,SAAS,EACTC,QAAQ,EACRC,aAAa,EACbC,mBAAmB,EACnBC,wBAAwB,IAAIC,UAAU,EACtCC,4BAA4B,IAAIC,cAAc,QACxC,uBAAuB;AAC9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BiB,gBAAgB,EAAE,IAAI;UACtBd,cAAc;UACduB,WAAW,EAAE,IAAI;UACjBC,SAAS,EAAE;QACZ,CAAC,CACC;QACHC,OAAO,EAAGnE,QAAU;QAAA,GACf4C;MAAqB,GAdpB,sBAAuBH,KAAK,EAelC,CAEH,CAAC,EACC,CAAEtB,SAAS,iBACZ9B,IAAA,CAACtB,eAAe;QAEdqG,SAAS,EAAE3D,cAAc;QACzB4D,eAAe,EAAE7D,wBAAwB;QAE1C8D,WAAW,EAAG;MAAO,CACrB,CACD;IAAA,CACiB,CACnB,eACDjF,IAAA;MAAA,GAASwC;IAAgB,CAAI,CAAC;EAAA,CAC7B,CAAC;AAEL;AAEA,MAAM0C,mBAAmB,GAAG;EAC3BpE,SAAS,EAAE,YAAY;EACvBD,mBAAmB,EAAE;AACtB,CAAC;AAED,eAAelC,UAAU,CAAEuG,mBAAoB,CAAC,CAAE1E,eAAgB,CAAC","ignoreList":[]}
|
|
@@ -253,7 +253,7 @@ export const settings = {
|
|
|
253
253
|
content: '5.2',
|
|
254
254
|
tag: 'td'
|
|
255
255
|
}, {
|
|
256
|
-
content: 'Jaco Pastorius',
|
|
256
|
+
content: __('Jaco Pastorius'),
|
|
257
257
|
tag: 'td'
|
|
258
258
|
}, {
|
|
259
259
|
content: __('May 7, 2019'),
|
|
@@ -264,7 +264,7 @@ export const settings = {
|
|
|
264
264
|
content: '5.1',
|
|
265
265
|
tag: 'td'
|
|
266
266
|
}, {
|
|
267
|
-
content: 'Betty Carter',
|
|
267
|
+
content: __('Betty Carter'),
|
|
268
268
|
tag: 'td'
|
|
269
269
|
}, {
|
|
270
270
|
content: __('February 21, 2019'),
|
|
@@ -275,7 +275,7 @@ export const settings = {
|
|
|
275
275
|
content: '5.0',
|
|
276
276
|
tag: 'td'
|
|
277
277
|
}, {
|
|
278
|
-
content: 'Bebo Valdés',
|
|
278
|
+
content: __('Bebo Valdés'),
|
|
279
279
|
tag: 'td'
|
|
280
280
|
}, {
|
|
281
281
|
content: __('December 6, 2018'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","blockTable","icon","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","hasFixedLayout","type","caption","source","selector","head","query","cells","content","tag","scope","attribute","align","colspan","rowspan","body","foot","supports","anchor","color","__experimentalSkipSerialization","gradients","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalBorder","style","width","interactivity","clientNavigation","selectors","root","styles","label","isDefault","editorStyle","save","transforms","settings","example","viewportWidth","init"],"sources":["@wordpress/block-library/src/table/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Jaco Pastorius',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Betty Carter',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: 'Bebo Valdés',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,IAAIC,IAAI,QAAQ,kBAAkB;;AAErD;A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B,OAAA;EAAA;EAAAmB,MAAA;IAAAlD,IAAA;IAAAmD,KAAA;IAAAC,SAAA;EAAA;IAAApD,IAAA;IAAAmD,KAAA;EAAA;EAAAE,WAAA;EAAAT,KAAA;AAAA;AAE1B,OAAOU,IAAI,MAAM,QAAQ;AACzB,OAAOC,UAAU,MAAM,cAAc;AAErC,MAAM;EAAEvD;AAAK,CAAC,GAAGH,QAAQ;AAEzB,SAASA,QAAQ,EAAEG,IAAI;AAEvB,OAAO,MAAMwD,QAAQ,GAAG;EACvB/D,IAAI;EACJgE,OAAO,EAAE;IACRpD,UAAU,EAAE;MACXM,IAAI,EAAE,CACL;QACCE,KAAK,EAAE,CACN;UACCC,OAAO,EAAEvB,EAAE,CAAE,SAAU,CAAC;UACxBwB,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAEvB,EAAE,CAAE,eAAgB,CAAC;UAC9BwB,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAEvB,EAAE,CAAE,cAAe,CAAC;UAC7BwB,GAAG,EAAE;QACN,CAAC;MAEH,CAAC,CACD;MACDM,IAAI,EAAE,CACL;QACCR,KAAK,EAAE,CACN;UACCC,OAAO,EAAE,KAAK;UACdC,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"names":["__","blockTable","icon","initBlock","deprecated","edit","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","hasFixedLayout","type","caption","source","selector","head","query","cells","content","tag","scope","attribute","align","colspan","rowspan","body","foot","supports","anchor","color","__experimentalSkipSerialization","gradients","__experimentalDefaultControls","background","text","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontStyle","__experimentalFontWeight","__experimentalLetterSpacing","__experimentalTextTransform","__experimentalTextDecoration","__experimentalBorder","style","width","interactivity","clientNavigation","selectors","root","styles","label","isDefault","editorStyle","save","transforms","settings","example","viewportWidth","init"],"sources":["@wordpress/block-library/src/table/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { blockTable as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport deprecated from './deprecated';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\thead: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Version' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jazz Musician' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Release Date' ),\n\t\t\t\t\t\t\ttag: 'th',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t\tbody: [\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.2',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Jaco Pastorius' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'May 7, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.1',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Betty Carter' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'February 21, 2019' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcells: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: '5.0',\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'Bebo Valdés' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcontent: __( 'December 6, 2018' ),\n\t\t\t\t\t\t\ttag: 'td',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tviewportWidth: 450,\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,IAAIC,IAAI,QAAQ,kBAAkB;;AAErD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAC3C,OAAOC,UAAU,MAAM,cAAc;AACrC,OAAOC,IAAI,MAAM,QAAQ;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,cAAA;MAAAC,IAAA;MAAA;IAAA;IAAAC,OAAA;MAAAD,IAAA;MAAAE,MAAA;MAAAC,QAAA;IAAA;IAAAC,IAAA;MAAAJ,IAAA;MAAA;MAAAE,MAAA;MAAAC,QAAA;MAAAE,KAAA;QAAAC,KAAA;UAAAN,IAAA;UAAA;UAAAE,MAAA;UAAAC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","ignoreList":[]}
|
|
@@ -16,12 +16,12 @@ const tableContentPasteSchema = ({
|
|
|
16
16
|
th: {
|
|
17
17
|
allowEmpty: true,
|
|
18
18
|
children: phrasingContentSchema,
|
|
19
|
-
attributes: ['scope', 'colspan', 'rowspan']
|
|
19
|
+
attributes: ['scope', 'colspan', 'rowspan', 'style']
|
|
20
20
|
},
|
|
21
21
|
td: {
|
|
22
22
|
allowEmpty: true,
|
|
23
23
|
children: phrasingContentSchema,
|
|
24
|
-
attributes: ['colspan', 'rowspan']
|
|
24
|
+
attributes: ['colspan', 'rowspan', 'style']
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -62,11 +62,19 @@ const transforms = {
|
|
|
62
62
|
const rowAttributes = Array.from(row.children).reduce((colAcc, col) => {
|
|
63
63
|
const rowspan = normalizeRowColSpan(col.getAttribute('rowspan'));
|
|
64
64
|
const colspan = normalizeRowColSpan(col.getAttribute('colspan'));
|
|
65
|
+
const {
|
|
66
|
+
textAlign
|
|
67
|
+
} = col.style || {};
|
|
68
|
+
let align;
|
|
69
|
+
if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
|
|
70
|
+
align = textAlign;
|
|
71
|
+
}
|
|
65
72
|
colAcc.push({
|
|
66
73
|
tag: col.nodeName.toLowerCase(),
|
|
67
74
|
content: col.innerHTML,
|
|
68
75
|
rowspan,
|
|
69
|
-
colspan
|
|
76
|
+
colspan,
|
|
77
|
+
align
|
|
70
78
|
});
|
|
71
79
|
return colAcc;
|
|
72
80
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createBlock","normalizeRowColSpan","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","getAttribute","colspan","push","tag","content","innerHTML","cells"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,SAAS;AAE7C,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAsB,CAAC,MAAQ;EAClEC,EAAE,EAAE;IACHC,UAAU,EAAE,IAAI;IAChBC,QAAQ,EAAE;MACTC,EAAE,EAAE;QACHF,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS;
|
|
1
|
+
{"version":3,"names":["createBlock","normalizeRowColSpan","tableContentPasteSchema","phrasingContentSchema","tr","allowEmpty","children","th","attributes","td","tablePasteSchema","args","table","thead","tfoot","tbody","transforms","from","type","selector","schema","transform","node","Array","reduce","sectionAcc","section","length","sectionName","nodeName","toLowerCase","slice","sectionAttributes","rowAcc","row","rowAttributes","colAcc","col","rowspan","getAttribute","colspan","textAlign","style","align","push","tag","content","innerHTML","cells"],"sources":["@wordpress/block-library/src/table/transforms.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { normalizeRowColSpan } from './utils';\n\nconst tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {\n\ttr: {\n\t\tallowEmpty: true,\n\t\tchildren: {\n\t\t\tth: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'scope', 'colspan', 'rowspan', 'style' ],\n\t\t\t},\n\t\t\ttd: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: phrasingContentSchema,\n\t\t\t\tattributes: [ 'colspan', 'rowspan', 'style' ],\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst tablePasteSchema = ( args ) => ( {\n\ttable: {\n\t\tchildren: {\n\t\t\tthead: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttfoot: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t\ttbody: {\n\t\t\t\tallowEmpty: true,\n\t\t\t\tchildren: tableContentPasteSchema( args ),\n\t\t\t},\n\t\t},\n\t},\n} );\n\nconst transforms = {\n\tfrom: [\n\t\t{\n\t\t\ttype: 'raw',\n\t\t\tselector: 'table',\n\t\t\tschema: tablePasteSchema,\n\t\t\ttransform: ( node ) => {\n\t\t\t\tconst attributes = Array.from( node.children ).reduce(\n\t\t\t\t\t( sectionAcc, section ) => {\n\t\t\t\t\t\tif ( ! section.children.length ) {\n\t\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst sectionName = section.nodeName\n\t\t\t\t\t\t\t.toLowerCase()\n\t\t\t\t\t\t\t.slice( 1 );\n\n\t\t\t\t\t\tconst sectionAttributes = Array.from(\n\t\t\t\t\t\t\tsection.children\n\t\t\t\t\t\t).reduce( ( rowAcc, row ) => {\n\t\t\t\t\t\t\tif ( ! row.children.length ) {\n\t\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst rowAttributes = Array.from(\n\t\t\t\t\t\t\t\trow.children\n\t\t\t\t\t\t\t).reduce( ( colAcc, col ) => {\n\t\t\t\t\t\t\t\tconst rowspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'rowspan' )\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst colspan = normalizeRowColSpan(\n\t\t\t\t\t\t\t\t\tcol.getAttribute( 'colspan' )\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tconst { textAlign } = col.style || {};\n\n\t\t\t\t\t\t\t\tlet align;\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\ttextAlign === 'left' ||\n\t\t\t\t\t\t\t\t\ttextAlign === 'center' ||\n\t\t\t\t\t\t\t\t\ttextAlign === 'right'\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\talign = textAlign;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tcolAcc.push( {\n\t\t\t\t\t\t\t\t\ttag: col.nodeName.toLowerCase(),\n\t\t\t\t\t\t\t\t\tcontent: col.innerHTML,\n\t\t\t\t\t\t\t\t\trowspan,\n\t\t\t\t\t\t\t\t\tcolspan,\n\t\t\t\t\t\t\t\t\talign,\n\t\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\t\treturn colAcc;\n\t\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\t\trowAcc.push( {\n\t\t\t\t\t\t\t\tcells: rowAttributes,\n\t\t\t\t\t\t\t} );\n\n\t\t\t\t\t\t\treturn rowAcc;\n\t\t\t\t\t\t}, [] );\n\n\t\t\t\t\t\tsectionAcc[ sectionName ] = sectionAttributes;\n\t\t\t\t\t\treturn sectionAcc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\n\t\t\t\treturn createBlock( 'core/table', attributes );\n\t\t\t},\n\t\t},\n\t],\n};\n\nexport default transforms;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,mBAAmB;;AAE/C;AACA;AACA;AACA,SAASC,mBAAmB,QAAQ,SAAS;AAE7C,MAAMC,uBAAuB,GAAGA,CAAE;EAAEC;AAAsB,CAAC,MAAQ;EAClEC,EAAE,EAAE;IACHC,UAAU,EAAE,IAAI;IAChBC,QAAQ,EAAE;MACTC,EAAE,EAAE;QACHF,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO;MACrD,CAAC;MACDC,EAAE,EAAE;QACHJ,UAAU,EAAE,IAAI;QAChBC,QAAQ,EAAEH,qBAAqB;QAC/BK,UAAU,EAAE,CAAE,SAAS,EAAE,SAAS,EAAE,OAAO;MAC5C;IACD;EACD;AACD,CAAC,CAAE;AAEH,MAAME,gBAAgB,GAAKC,IAAI,KAAQ;EACtCC,KAAK,EAAE;IACNN,QAAQ,EAAE;MACTO,KAAK,EAAE;QACNR,UAAU,EAA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C,GAAG,CAACE,YAAY,CAAE,SAAU,CAC7B,CAAC;YAED,MAAM;cAAEE;YAAU,CAAC,GAAGJ,GAAG,CAACK,KAAK,IAAI,CAAC,CAAC;YAErC,IAAIC,KAAK;YACT,IACCF,SAAS,KAAK,MAAM,IACpBA,SAAS,KAAK,QAAQ,IACtBA,SAAS,KAAK,OAAO,EACpB;cACDE,KAAK,GAAGF,SAAS;YAClB;YAEAL,MAAM,CAACQ,IAAI,CAAE;cACZC,GAAG,EAAER,GAAG,CAACR,QAAQ,CAACC,WAAW,CAAC,CAAC;cAC/BgB,OAAO,EAAET,GAAG,CAACU,SAAS;cACtBT,OAAO;cACPE,OAAO;cACPG;YACD,CAAE,CAAC;YAEH,OAAOP,MAAM;UACd,CAAC,EAAE,EAAG,CAAC;UAEPH,MAAM,CAACW,IAAI,CAAE;YACZI,KAAK,EAAEb;UACR,CAAE,CAAC;UAEH,OAAOF,MAAM;QACd,CAAC,EAAE,EAAG,CAAC;QAEPR,UAAU,CAAEG,WAAW,CAAE,GAAGI,iBAAiB;QAC7C,OAAOP,UAAU;MAClB,CAAC,EACD,CAAC,CACF,CAAC;MAED,OAAOzB,WAAW,CAAE,YAAY,EAAEQ,UAAW,CAAC;IAC/C;EACD,CAAC;AAEH,CAAC;AAED,eAAeQ,UAAU","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { BlockControls, BlockIcon, InspectorControls, store as blockEditorStore, useBlockProps } from '@wordpress/block-editor';
|
|
5
5
|
import { createBlock } from '@wordpress/blocks';
|
|
6
|
-
import { Placeholder, ToggleControl, ToolbarButton, ToolbarGroup, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
6
|
+
import { Placeholder, ToggleControl, SelectControl, ToolbarButton, ToolbarGroup, __experimentalToolsPanel as ToolsPanel, __experimentalToolsPanelItem as ToolsPanelItem } from '@wordpress/components';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
8
|
import { renderToString } from '@wordpress/element';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
@@ -26,18 +26,20 @@ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
|
26
26
|
*
|
|
27
27
|
* @param {Object} props The props.
|
|
28
28
|
* @param {Object} props.attributes The block attributes.
|
|
29
|
-
* @param {HeadingData[]} props.attributes.headings
|
|
29
|
+
* @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.
|
|
30
30
|
* @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
31
|
+
* @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.
|
|
32
|
+
* @param {string} props.clientId The client id.
|
|
33
|
+
* @param {(attributes: Object) => void} props.setAttributes The set attributes function.
|
|
33
34
|
*
|
|
34
35
|
* @return {Component} The component.
|
|
35
36
|
*/
|
|
36
|
-
import { jsx as _jsx,
|
|
37
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
37
38
|
export default function TableOfContentsEdit({
|
|
38
39
|
attributes: {
|
|
39
40
|
headings = [],
|
|
40
|
-
onlyIncludeCurrentPage
|
|
41
|
+
onlyIncludeCurrentPage,
|
|
42
|
+
maxLevel
|
|
41
43
|
},
|
|
42
44
|
clientId,
|
|
43
45
|
setAttributes
|
|
@@ -84,15 +86,16 @@ export default function TableOfContentsEdit({
|
|
|
84
86
|
})
|
|
85
87
|
});
|
|
86
88
|
const inspectorControls = /*#__PURE__*/_jsx(InspectorControls, {
|
|
87
|
-
children: /*#__PURE__*/
|
|
89
|
+
children: /*#__PURE__*/_jsxs(ToolsPanel, {
|
|
88
90
|
label: __('Settings'),
|
|
89
91
|
resetAll: () => {
|
|
90
92
|
setAttributes({
|
|
91
|
-
onlyIncludeCurrentPage: false
|
|
93
|
+
onlyIncludeCurrentPage: false,
|
|
94
|
+
maxLevel: undefined
|
|
92
95
|
});
|
|
93
96
|
},
|
|
94
97
|
dropdownMenuProps: dropdownMenuProps,
|
|
95
|
-
children: /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
98
|
+
children: [/*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
96
99
|
hasValue: () => !!onlyIncludeCurrentPage,
|
|
97
100
|
label: __('Only include current page'),
|
|
98
101
|
onDeselect: () => setAttributes({
|
|
@@ -108,7 +111,46 @@ export default function TableOfContentsEdit({
|
|
|
108
111
|
}),
|
|
109
112
|
help: onlyIncludeCurrentPage ? __('Only including headings from the current page (if the post is paginated).') : __('Include headings from all pages (if the post is paginated).')
|
|
110
113
|
})
|
|
111
|
-
})
|
|
114
|
+
}), /*#__PURE__*/_jsx(ToolsPanelItem, {
|
|
115
|
+
hasValue: () => !!maxLevel,
|
|
116
|
+
label: __('Limit heading levels'),
|
|
117
|
+
onDeselect: () => setAttributes({
|
|
118
|
+
maxLevel: undefined
|
|
119
|
+
}),
|
|
120
|
+
isShownByDefault: true,
|
|
121
|
+
children: /*#__PURE__*/_jsx(SelectControl, {
|
|
122
|
+
__nextHasNoMarginBottom: true,
|
|
123
|
+
__next40pxDefaultSize: true,
|
|
124
|
+
label: __('Include headings down to level'),
|
|
125
|
+
value: maxLevel || '',
|
|
126
|
+
options: [{
|
|
127
|
+
value: '',
|
|
128
|
+
label: __('All levels')
|
|
129
|
+
}, {
|
|
130
|
+
value: '1',
|
|
131
|
+
label: __('Heading 1')
|
|
132
|
+
}, {
|
|
133
|
+
value: '2',
|
|
134
|
+
label: __('Heading 2')
|
|
135
|
+
}, {
|
|
136
|
+
value: '3',
|
|
137
|
+
label: __('Heading 3')
|
|
138
|
+
}, {
|
|
139
|
+
value: '4',
|
|
140
|
+
label: __('Heading 4')
|
|
141
|
+
}, {
|
|
142
|
+
value: '5',
|
|
143
|
+
label: __('Heading 5')
|
|
144
|
+
}, {
|
|
145
|
+
value: '6',
|
|
146
|
+
label: __('Heading 6')
|
|
147
|
+
}],
|
|
148
|
+
onChange: value => setAttributes({
|
|
149
|
+
maxLevel: value ? parseInt(value) : undefined
|
|
150
|
+
}),
|
|
151
|
+
help: !maxLevel ? __('Including all heading levels in the table of contents.') : __('Only include headings up to and including this level.')
|
|
152
|
+
})
|
|
153
|
+
})]
|
|
112
154
|
})
|
|
113
155
|
});
|
|
114
156
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","Placeholder","ToggleControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useDispatch","useSelect","renderToString","__","useInstanceId","noticeStore","tableOfContents","icon","TableOfContentsList","linearToNestedHeadingList","useObserveHeadings","useToolsPanelDropdownMenuProps","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","blockProps","instanceId","createWarningNotice","showRedirectionPreventedNotice","event","preventDefault","id","type","canInsertList","select","getBlockRootClientId","canInsertBlockType","rootClientId","replaceBlocks","dropdownMenuProps","headingTree","toolbarControls","children","onClick","ordered","values","nestedHeadingList","inspectorControls","label","resetAll","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","checked","onChange","value","help","length","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tToggleControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings A list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {string} props.clientId\n * @param {(attributes: Object) => void} props.setAttributes\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tonlyIncludeCurrentPage: false,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! onlyIncludeCurrentPage }\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\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\t\t'Include headings from all pages (if the post is paginated).'\n\t\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</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SACC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A;MAAA,GAAUW,UAAU;MAAAiB,QAAA,eACnB5B,IAAA;QAAA4B,QAAA,eACC5B,IAAA,CAACL,mBAAmB;UACnBqC,iBAAiB,EAAGN,WAAa;UACjCoB,qBAAqB;UACrBjB,OAAO,EAAGf;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJa,eAAe,EACfM,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["BlockControls","BlockIcon","InspectorControls","store","blockEditorStore","useBlockProps","createBlock","Placeholder","ToggleControl","SelectControl","ToolbarButton","ToolbarGroup","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useDispatch","useSelect","renderToString","__","useInstanceId","noticeStore","tableOfContents","icon","TableOfContentsList","linearToNestedHeadingList","useObserveHeadings","useToolsPanelDropdownMenuProps","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","maxLevel","clientId","setAttributes","blockProps","instanceId","createWarningNotice","showRedirectionPreventedNotice","event","preventDefault","id","type","canInsertList","select","getBlockRootClientId","canInsertBlockType","rootClientId","replaceBlocks","dropdownMenuProps","headingTree","toolbarControls","children","onClick","ordered","values","nestedHeadingList","inspectorControls","label","resetAll","undefined","hasValue","onDeselect","isShownByDefault","__nextHasNoMarginBottom","checked","onChange","value","help","__next40pxDefaultSize","options","parseInt","length","instructions","disableLinkActivation"],"sources":["@wordpress/block-library/src/table-of-contents/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tBlockIcon,\n\tInspectorControls,\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\nimport {\n\tPlaceholder,\n\tToggleControl,\n\tSelectControl,\n\tToolbarButton,\n\tToolbarGroup,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { renderToString } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { useInstanceId } from '@wordpress/compose';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport TableOfContentsList from './list';\nimport { linearToNestedHeadingList } from './utils';\nimport { useObserveHeadings } from './hooks';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\n/** @typedef {import('./utils').HeadingData} HeadingData */\n\n/**\n * Table of Contents block edit component.\n *\n * @param {Object} props The props.\n * @param {Object} props.attributes The block attributes.\n * @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.\n * @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).\n * @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.\n * @param {string} props.clientId The client id.\n * @param {(attributes: Object) => void} props.setAttributes The set attributes function.\n *\n * @return {Component} The component.\n */\nexport default function TableOfContentsEdit( {\n\tattributes: { headings = [], onlyIncludeCurrentPage, maxLevel },\n\tclientId,\n\tsetAttributes,\n} ) {\n\tuseObserveHeadings( clientId );\n\n\tconst blockProps = useBlockProps();\n\tconst instanceId = useInstanceId(\n\t\tTableOfContentsEdit,\n\t\t'table-of-contents'\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice } = useDispatch( noticeStore );\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst canInsertList = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockRootClientId, canInsertBlockType } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\n\t\t\treturn canInsertBlockType( 'core/list', rootClientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst headingTree = linearToNestedHeadingList( headings );\n\n\tconst toolbarControls = canInsertList && (\n\t\t<BlockControls>\n\t\t\t<ToolbarGroup>\n\t\t\t\t<ToolbarButton\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\treplaceBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlock( 'core/list', {\n\t\t\t\t\t\t\t\tordered: true,\n\t\t\t\t\t\t\t\tvalues: renderToString(\n\t\t\t\t\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Convert to static list' ) }\n\t\t\t\t</ToolbarButton>\n\t\t\t</ToolbarGroup>\n\t\t</BlockControls>\n\t);\n\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<ToolsPanel\n\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\tresetAll={ () => {\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tonlyIncludeCurrentPage: false,\n\t\t\t\t\t\tmaxLevel: undefined,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! onlyIncludeCurrentPage }\n\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: false } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Only include current page' ) }\n\t\t\t\t\t\tchecked={ onlyIncludeCurrentPage }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { onlyIncludeCurrentPage: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\tonlyIncludeCurrentPage\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Only including headings from the current page (if the post is paginated).'\n\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\t\t'Include headings from all pages (if the post is paginated).'\n\t\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</ToolsPanelItem>\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! maxLevel }\n\t\t\t\t\tlabel={ __( 'Limit heading levels' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( { maxLevel: undefined } )\n\t\t\t\t\t}\n\t\t\t\t\tisShownByDefault\n\t\t\t\t>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Include headings down to level' ) }\n\t\t\t\t\t\tvalue={ maxLevel || '' }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ value: '', label: __( 'All levels' ) },\n\t\t\t\t\t\t\t{ value: '1', label: __( 'Heading 1' ) },\n\t\t\t\t\t\t\t{ value: '2', label: __( 'Heading 2' ) },\n\t\t\t\t\t\t\t{ value: '3', label: __( 'Heading 3' ) },\n\t\t\t\t\t\t\t{ value: '4', label: __( 'Heading 4' ) },\n\t\t\t\t\t\t\t{ value: '5', label: __( 'Heading 5' ) },\n\t\t\t\t\t\t\t{ value: '6', label: __( 'Heading 6' ) },\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tmaxLevel: value ? parseInt( value ) : undefined,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t! maxLevel\n\t\t\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t\t\t'Including all heading levels in the table of contents.'\n\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\t\t'Only include headings up to and including this level.'\n\t\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</ToolsPanelItem>\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\t// If there are no headings or the only heading is empty.\n\t// Note that the toolbar controls are intentionally omitted since the\n\t// \"Convert to static list\" option is useless to the placeholder state.\n\tif ( headings.length === 0 ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder\n\t\t\t\t\t\ticon={ <BlockIcon icon={ icon } /> }\n\t\t\t\t\t\tlabel={ __( 'Table of Contents' ) }\n\t\t\t\t\t\tinstructions={ __(\n\t\t\t\t\t\t\t'Start adding Heading blocks to create a table of contents. Headings with HTML anchors will be linked here.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t{ inspectorControls }\n\t\t\t</>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<nav { ...blockProps }>\n\t\t\t\t<ol>\n\t\t\t\t\t<TableOfContentsList\n\t\t\t\t\t\tnestedHeadingList={ headingTree }\n\t\t\t\t\t\tdisableLinkActivation\n\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t/>\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t\t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G;UACnC4D,YAAY,EAAG5D,EAAE,CAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ4C,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACChC,KAAA,CAAAE,SAAA;IAAAyB,QAAA,gBACC7B,IAAA;MAAA,GAAUY,UAAU;MAAAiB,QAAA,eACnB7B,IAAA;QAAA6B,QAAA,eACC7B,IAAA,CAACL,mBAAmB;UACnBsC,iBAAiB,EAAGN,WAAa;UACjCwB,qBAAqB;UACrBrB,OAAO,EAAGf;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJa,eAAe,EACfM,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -29,7 +29,8 @@ function getLatestHeadings(select, clientId) {
|
|
|
29
29
|
const permalink = (_select$getPermalink = select('core/editor').getPermalink()) !== null && _select$getPermalink !== void 0 ? _select$getPermalink : null;
|
|
30
30
|
const isPaginated = getBlocksByName('core/nextpage').length !== 0;
|
|
31
31
|
const {
|
|
32
|
-
onlyIncludeCurrentPage
|
|
32
|
+
onlyIncludeCurrentPage,
|
|
33
|
+
maxLevel
|
|
33
34
|
} = (_getBlockAttributes = getBlockAttributes(clientId)) !== null && _getBlockAttributes !== void 0 ? _getBlockAttributes : {};
|
|
34
35
|
|
|
35
36
|
// Get post-content block client ID.
|
|
@@ -91,6 +92,11 @@ function getLatestHeadings(select, clientId) {
|
|
|
91
92
|
else if (!onlyIncludeCurrentPage || headingPage === tocPage) {
|
|
92
93
|
if (blockName === 'core/heading') {
|
|
93
94
|
const headingAttributes = getBlockAttributes(blockClientId);
|
|
95
|
+
|
|
96
|
+
// Skip headings that are deeper than maxLevel
|
|
97
|
+
if (maxLevel && headingAttributes.level > maxLevel) {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
94
100
|
const canBeLinked = typeof headingPageLink === 'string' && typeof headingAttributes.anchor === 'string' && headingAttributes.anchor !== '';
|
|
95
101
|
latestHeadings.push({
|
|
96
102
|
// Convert line breaks to spaces, and get rid of HTML tags in the headings.
|
|
@@ -123,9 +129,12 @@ function observeCallback(select, dispatch, clientId) {
|
|
|
123
129
|
}
|
|
124
130
|
const headings = getLatestHeadings(select, clientId);
|
|
125
131
|
if (!fastDeepEqual(headings, attributes.headings)) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
// Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.
|
|
133
|
+
window.queueMicrotask(() => {
|
|
134
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
135
|
+
updateBlockAttributes(clientId, {
|
|
136
|
+
headings
|
|
137
|
+
});
|
|
129
138
|
});
|
|
130
139
|
}
|
|
131
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","useRegistry","__unstableStripHTML","stripHTML","useEffect","addQueryArgs","removeQueryArgs","store","blockEditorStore","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","useObserveHeadings","registry","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAEnE,SAASC,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,eAAe;IACfC;EACD,CAAC,GAAGP,MAAM,CAAEF,gBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMU,SAAS,IAAAN,oBAAA,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AMwC,UAAU,GAAGlC,kBAAkB,CAAEH,QAAS,CAAC;EACjD,IAAKqC,UAAU,KAAK,IAAI,EAAG;IAC1B;EACD;EAEA,MAAMC,QAAQ,GAAGxC,iBAAiB,CAAEC,MAAM,EAAEC,QAAS,CAAC;EACtD,IAAK,CAAEX,aAAa,CAAEiD,QAAQ,EAAED,UAAU,CAACC,QAAS,CAAC,EAAG;IACvDF,uCAAuC,CAAC,CAAC;IACzCD,qBAAqB,CAAEnC,QAAQ,EAAE;MAAEsC;IAAS,CAAE,CAAC;EAChD;AACD;AAEA,OAAO,SAASC,kBAAkBA,CAAEvC,QAAQ,EAAG;EAC9C,MAAMwC,QAAQ,GAAGlD,WAAW,CAAC,CAAC;EAC9BG,SAAS,CAAE,MAAM;IAChB;IACA;IACA,OAAO+C,QAAQ,CAACC,SAAS,CAAE,MAC1BR,eAAe,CAAEO,QAAQ,CAACzC,MAAM,EAAEyC,QAAQ,CAACN,QAAQ,EAAElC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAEwC,QAAQ,EAAExC,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","useRegistry","__unstableStripHTML","stripHTML","useEffect","addQueryArgs","removeQueryArgs","store","blockEditorStore","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","maxLevel","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","page","blockName","headingAttributes","level","canBeLinked","anchor","push","content","replace","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","window","queueMicrotask","useObserveHeadings","registry","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage, maxLevel } =\n\t\tgetBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\t// Skip headings that are deeper than maxLevel\n\t\t\t\tif ( maxLevel && headingAttributes.level > maxLevel ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\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\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t// Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.\n\t\twindow.queueMicrotask( () => {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( clientId, { headings } );\n\t\t} );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,WA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