@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
|
@@ -54,51 +54,50 @@ function SocialLinksEdit(props) {
|
|
|
54
54
|
} = props;
|
|
55
55
|
const {
|
|
56
56
|
iconBackgroundColorValue,
|
|
57
|
-
customIconBackgroundColor,
|
|
58
57
|
iconColorValue,
|
|
59
58
|
openInNewTab,
|
|
60
59
|
showLabels,
|
|
61
60
|
size
|
|
62
61
|
} = attributes;
|
|
63
|
-
const
|
|
62
|
+
const {
|
|
63
|
+
hasSocialIcons,
|
|
64
|
+
hasSelectedChild
|
|
65
|
+
} = (0, _data.useSelect)(select => {
|
|
66
|
+
const {
|
|
67
|
+
getBlockCount,
|
|
68
|
+
hasSelectedInnerBlock
|
|
69
|
+
} = select(_blockEditor.store);
|
|
70
|
+
return {
|
|
71
|
+
hasSocialIcons: getBlockCount(clientId) > 0,
|
|
72
|
+
hasSelectedChild: hasSelectedInnerBlock(clientId)
|
|
73
|
+
};
|
|
74
|
+
}, [clientId]);
|
|
64
75
|
const hasAnySelected = isSelected || hasSelectedChild;
|
|
65
76
|
const logosOnly = attributes.className?.includes('is-style-logos-only');
|
|
66
77
|
const dropdownMenuProps = (0, _hooks.useToolsPanelDropdownMenuProps)();
|
|
67
78
|
|
|
68
79
|
// Remove icon background color when logos only style is selected or
|
|
69
80
|
// restore it when any other style is selected.
|
|
70
|
-
const backgroundBackupRef = (0, _element.useRef)({});
|
|
71
81
|
(0, _element.useEffect)(() => {
|
|
72
82
|
if (logosOnly) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
let restore;
|
|
84
|
+
setAttributes(prev => {
|
|
85
|
+
restore = {
|
|
86
|
+
iconBackgroundColor: prev.iconBackgroundColor,
|
|
87
|
+
iconBackgroundColorValue: prev.iconBackgroundColorValue,
|
|
88
|
+
customIconBackgroundColor: prev.customIconBackgroundColor
|
|
89
|
+
};
|
|
90
|
+
return {
|
|
91
|
+
iconBackgroundColor: undefined,
|
|
92
|
+
iconBackgroundColorValue: undefined,
|
|
93
|
+
customIconBackgroundColor: undefined
|
|
94
|
+
};
|
|
82
95
|
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
...backgroundBackupRef.current
|
|
96
|
+
return () => setAttributes({
|
|
97
|
+
...restore
|
|
86
98
|
});
|
|
87
99
|
}
|
|
88
|
-
}, [logosOnly]);
|
|
89
|
-
const SocialPlaceholder = /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
90
|
-
className: "wp-block-social-links__social-placeholder",
|
|
91
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
92
|
-
className: "wp-block-social-links__social-placeholder-icons",
|
|
93
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
94
|
-
className: "wp-social-link wp-social-link-twitter"
|
|
95
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
-
className: "wp-social-link wp-social-link-facebook"
|
|
97
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
-
className: "wp-social-link wp-social-link-instagram"
|
|
99
|
-
})]
|
|
100
|
-
})
|
|
101
|
-
});
|
|
100
|
+
}, [logosOnly, setAttributes]);
|
|
102
101
|
|
|
103
102
|
// Fallback color values are used maintain selections in case switching
|
|
104
103
|
// themes and named colors in palette do not match.
|
|
@@ -111,11 +110,10 @@ function SocialLinksEdit(props) {
|
|
|
111
110
|
className
|
|
112
111
|
});
|
|
113
112
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
114
|
-
placeholder: !isSelected && SocialPlaceholder,
|
|
115
113
|
templateLock: false,
|
|
116
114
|
orientation: (_attributes$layout$or = attributes.layout?.orientation) !== null && _attributes$layout$or !== void 0 ? _attributes$layout$or : 'horizontal',
|
|
117
115
|
__experimentalAppenderTagName: 'li',
|
|
118
|
-
renderAppender: hasAnySelected
|
|
116
|
+
renderAppender: !hasSocialIcons || hasAnySelected ? _blockEditor.InnerBlocks.ButtonBlockAppender : undefined
|
|
119
117
|
});
|
|
120
118
|
const POPOVER_PROPS = {
|
|
121
119
|
position: 'bottom right'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_blockEditor","_components","_i18n","_icons","_data","_hooks","_jsxRuntime","sizeOptions","name","__","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","customIconBackgroundColor","iconColorValue","openInNewTab","showLabels","size","hasSelectedChild","useSelect","select","blockEditorStore","hasSelectedInnerBlock","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","useToolsPanelDropdownMenuProps","backgroundBackupRef","useRef","useEffect","current","undefined","SocialPlaceholder","jsx","children","jsxs","clsx","color","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","placeholder","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","InnerBlocks","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","useMultipleOriginColorsAndGradients","Fragment","BlockControls","group","ToolbarDropdownMenu","text","icon","popoverProps","onClose","MenuGroup","map","entry","MenuItem","check","onClick","role","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","ContrastChecker","textColor","backgroundColor","isLargeText","iconColorAttributes","_default","exports","default","withColors"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAA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,eACD,IAAAtG,WAAA,CAAAuC,GAAA;MAAA,GAASO;IAAgB,CAAI,CAAC;EAAA,CAC7B,CAAC;AAEL;AAEA,MAAMyD,mBAAmB,GAAG;EAC3B5F,SAAS,EAAE,YAAY;EACvBD,mBAAmB,EAAE;AACtB,CAAC;AAAC,IAAA8F,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,uBAAU,EAAEJ,mBAAoB,CAAC,CAAElG,eAAgB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_element","_blockEditor","_components","_i18n","_icons","_data","_hooks","_jsxRuntime","sizeOptions","name","__","value","SocialLinksEdit","props","_attributes$layout$or","clientId","attributes","iconBackgroundColor","iconColor","isSelected","setAttributes","setIconBackgroundColor","setIconColor","iconBackgroundColorValue","iconColorValue","openInNewTab","showLabels","size","hasSocialIcons","hasSelectedChild","useSelect","select","getBlockCount","hasSelectedInnerBlock","blockEditorStore","hasAnySelected","logosOnly","className","includes","dropdownMenuProps","useToolsPanelDropdownMenuProps","useEffect","restore","prev","customIconBackgroundColor","undefined","clsx","color","blockProps","useBlockProps","innerBlocksProps","useInnerBlocksProps","templateLock","orientation","layout","__experimentalAppenderTagName","renderAppender","InnerBlocks","ButtonBlockAppender","POPOVER_PROPS","position","colorSettings","onChange","colorValue","label","resetAllFilter","push","colorGradientSettings","useMultipleOriginColorsAndGradients","jsxs","Fragment","children","jsx","BlockControls","group","ToolbarDropdownMenu","text","icon","popoverProps","onClose","MenuGroup","map","entry","MenuItem","check","onClick","role","InspectorControls","__experimentalToolsPanel","resetAll","__experimentalToolsPanelItem","isShownByDefault","hasValue","onDeselect","ToggleControl","__nextHasNoMarginBottom","checked","hasColorsOrGradients","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","onColorChange","enableAlpha","clearable","panelId","ContrastChecker","textColor","backgroundColor","isLargeText","iconColorAttributes","_default","exports","default","withColors"],"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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAYA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAAgE,IAAAQ,WAAA,GAAAR,OAAA;AApChE;AACA;AACA;;AAGA;AACA;AACA;;AA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AACpE,YAAA,CAAAsF,iBAAiB;MAACb,KAAK,EAAC,OAAO;MAAAH,QAAA,GAC7BV,aAAa,CAACoB,GAAG,CAClB,CAAE;QAAEnB,QAAQ;QAAEE,KAAK;QAAErD,KAAK;QAAEsD;MAAe,CAAC,kBAC3C,IAAA1D,WAAA,CAAAiE,GAAA,EAACvE,YAAA,CAAAiG,2CAA6B;QAE7BC,iCAAiC;QACjCC,QAAQ,EAAG,CACV;UACCrC,UAAU,EAAEpD,KAAK;UACjBqD,KAAK;UACLqC,aAAa,EAAEvC,QAAQ;UACvB6B,gBAAgB,EAAE,IAAI;UACtB1B,cAAc;UACdqC,WAAW,EAAE,IAAI;UACjBC,SAAS,EAAE;QACZ,CAAC,CACC;QACHC,OAAO,EAAGzF,QAAU;QAAA,GACfoD;MAAqB,GAdpB,sBAAuBH,KAAK,EAelC,CAEH,CAAC,EACC,CAAE5B,SAAS,iBACZ,IAAA7B,WAAA,CAAAiE,GAAA,EAACvE,YAAA,CAAAwG,eAAe;QAEdC,SAAS,EAAElF,cAAc;QACzBmF,eAAe,EAAEpF,wBAAwB;QAE1CqF,WAAW,EAAG;MAAO,CACrB,CACD;IAAA,CACiB,CACnB,eACD,IAAArG,WAAA,CAAAiE,GAAA;MAAA,GAAStB;IAAgB,CAAI,CAAC;EAAA,CAC7B,CAAC;AAEL;AAEA,MAAM2D,mBAAmB,GAAG;EAC3B3F,SAAS,EAAE,YAAY;EACvBD,mBAAmB,EAAE;AACtB,CAAC;AAAC,IAAA6F,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,IAAAC,uBAAU,EAAEJ,mBAAoB,CAAC,CAAEjG,eAAgB,CAAC","ignoreList":[]}
|
package/build/table/index.js
CHANGED
|
@@ -259,7 +259,7 @@ const settings = exports.settings = {
|
|
|
259
259
|
content: '5.2',
|
|
260
260
|
tag: 'td'
|
|
261
261
|
}, {
|
|
262
|
-
content: 'Jaco Pastorius',
|
|
262
|
+
content: (0, _i18n.__)('Jaco Pastorius'),
|
|
263
263
|
tag: 'td'
|
|
264
264
|
}, {
|
|
265
265
|
content: (0, _i18n.__)('May 7, 2019'),
|
|
@@ -270,7 +270,7 @@ const settings = exports.settings = {
|
|
|
270
270
|
content: '5.1',
|
|
271
271
|
tag: 'td'
|
|
272
272
|
}, {
|
|
273
|
-
content: 'Betty Carter',
|
|
273
|
+
content: (0, _i18n.__)('Betty Carter'),
|
|
274
274
|
tag: 'td'
|
|
275
275
|
}, {
|
|
276
276
|
content: (0, _i18n.__)('February 21, 2019'),
|
|
@@ -281,7 +281,7 @@ const settings = exports.settings = {
|
|
|
281
281
|
content: '5.0',
|
|
282
282
|
tag: 'td'
|
|
283
283
|
}, {
|
|
284
|
-
content: 'Bebo Valdés',
|
|
284
|
+
content: (0, _i18n.__)('Bebo Valdés'),
|
|
285
285
|
tag: 'td'
|
|
286
286
|
}, {
|
|
287
287
|
content: (0, _i18n.__)('December 6, 2018'),
|
package/build/table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$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","settings","icon","example","__","viewportWidth","transforms","edit","save","deprecated","init","initBlock"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAQ,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,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;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UACxB1C,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,eAAgB,CAAC;UAC9B1C,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,cAAe,CAAC;UAC7B1C,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":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_deprecated","_edit","_save","_transforms","metadata","exports","$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","settings","icon","example","__","viewportWidth","transforms","edit","save","deprecated","init","initBlock"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,WAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAEA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,WAAA,GAAAJ,sBAAA,CAAAH,OAAA;AAdA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAQ,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,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,QAAA;UAAAE,KAAA;YAAAE,OAAA;cAAAP,IAAA;cAAAE,MAAA;YAAA;YAAAM,GAAA;cAAAR,IAAA;cAAA;cAAAE,MAAA;YAAA;YAAAO,KAAA;cAAAT,IAAA;cAAAE,MAAA;cAAAQ,SAAA;YAAA;YAAAC,KAAA;cAAAX,IAAA;cAAAE,MAAA;cAAAQ,SAAA;YAAA;YAAAE,OAAA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AK,EAAE,CACN;UACCC,OAAO,EAAE,KAAK;UACdC,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,gBAAiB,CAAC;UAC/B1C,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,aAAc,CAAC;UAC5B1C,GAAG,EAAE;QACN,CAAC;MAEH,CAAC,EACD;QACCF,KAAK,EAAE,CACN;UACCC,OAAO,EAAE,KAAK;UACdC,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,cAAe,CAAC;UAC7B1C,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,mBAAoB,CAAC;UAClC1C,GAAG,EAAE;QACN,CAAC;MAEH,CAAC,EACD;QACCF,KAAK,EAAE,CACN;UACCC,OAAO,EAAE,KAAK;UACdC,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,aAAc,CAAC;UAC5B1C,GAAG,EAAE;QACN,CAAC,EACD;UACCD,OAAO,EAAE,IAAA2C,QAAE,EAAE,kBAAmB,CAAC;UACjC1C,GAAG,EAAE;QACN,CAAC;MAEH,CAAC;IAEH,CAAC;IACD2C,aAAa,EAAE;EAChB,CAAC;EACDC,UAAU,EAAVA,mBAAU;EACVC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA,aAAI;EACJC,UAAU,EAAVA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEhE,IAAI;EAAEJ,QAAQ;EAAE0D;AAAS,CAAE,CAAC;AAACzD,OAAA,CAAAkE,IAAA,GAAAA,IAAA","ignoreList":[]}
|
|
@@ -23,12 +23,12 @@ const tableContentPasteSchema = ({
|
|
|
23
23
|
th: {
|
|
24
24
|
allowEmpty: true,
|
|
25
25
|
children: phrasingContentSchema,
|
|
26
|
-
attributes: ['scope', 'colspan', 'rowspan']
|
|
26
|
+
attributes: ['scope', 'colspan', 'rowspan', 'style']
|
|
27
27
|
},
|
|
28
28
|
td: {
|
|
29
29
|
allowEmpty: true,
|
|
30
30
|
children: phrasingContentSchema,
|
|
31
|
-
attributes: ['colspan', 'rowspan']
|
|
31
|
+
attributes: ['colspan', 'rowspan', 'style']
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
}
|
|
@@ -69,11 +69,19 @@ const transforms = {
|
|
|
69
69
|
const rowAttributes = Array.from(row.children).reduce((colAcc, col) => {
|
|
70
70
|
const rowspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('rowspan'));
|
|
71
71
|
const colspan = (0, _utils.normalizeRowColSpan)(col.getAttribute('colspan'));
|
|
72
|
+
const {
|
|
73
|
+
textAlign
|
|
74
|
+
} = col.style || {};
|
|
75
|
+
let align;
|
|
76
|
+
if (textAlign === 'left' || textAlign === 'center' || textAlign === 'right') {
|
|
77
|
+
align = textAlign;
|
|
78
|
+
}
|
|
72
79
|
colAcc.push({
|
|
73
80
|
tag: col.nodeName.toLowerCase(),
|
|
74
81
|
content: col.innerHTML,
|
|
75
82
|
rowspan,
|
|
76
|
-
colspan
|
|
83
|
+
colspan,
|
|
84
|
+
align
|
|
77
85
|
});
|
|
78
86
|
return colAcc;
|
|
79
87
|
}, []);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_utils","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","normalizeRowColSpan","getAttribute","colspan","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,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":["_blocks","require","_utils","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","normalizeRowColSpan","getAttribute","colspan","textAlign","style","align","push","tag","content","innerHTML","cells","createBlock","_default","exports","default"],"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":";;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,MAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAME,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,EAAE,IAAI;QAChBC,QAAQ,EAAEJ,uBAAuB,CAAES,IAAK;MACzC,CA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AM;cAAEE;YAAU,CAAC,GAAGL,GAAG,CAACM,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;YAEAN,MAAM,CAACS,IAAI,CAAE;cACZC,GAAG,EAAET,GAAG,CAACR,QAAQ,CAACC,WAAW,CAAC,CAAC;cAC/BiB,OAAO,EAAEV,GAAG,CAACW,SAAS;cACtBV,OAAO;cACPG,OAAO;cACPG;YACD,CAAE,CAAC;YAEH,OAAOR,MAAM;UACd,CAAC,EAAE,EAAG,CAAC;UAEPH,MAAM,CAACY,IAAI,CAAE;YACZI,KAAK,EAAEd;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,OAAO,IAAAyB,mBAAW,EAAE,YAAY,EAAE1C,UAAW,CAAC;IAC/C;EACD,CAAC;AAEH,CAAC;AAAC,IAAA2C,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEarC,UAAU","ignoreList":[]}
|
|
@@ -34,16 +34,18 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
34
34
|
*
|
|
35
35
|
* @param {Object} props The props.
|
|
36
36
|
* @param {Object} props.attributes The block attributes.
|
|
37
|
-
* @param {HeadingData[]} props.attributes.headings
|
|
37
|
+
* @param {HeadingData[]} props.attributes.headings The list of data for each heading in the post.
|
|
38
38
|
* @param {boolean} props.attributes.onlyIncludeCurrentPage Whether to only include headings from the current page (if the post is paginated).
|
|
39
|
-
* @param {
|
|
40
|
-
* @param {
|
|
39
|
+
* @param {number|undefined} props.attributes.maxLevel The maximum heading level to include, or null to include all levels.
|
|
40
|
+
* @param {string} props.clientId The client id.
|
|
41
|
+
* @param {(attributes: Object) => void} props.setAttributes The set attributes function.
|
|
41
42
|
*
|
|
42
43
|
* @return {Component} The component.
|
|
43
44
|
*/function TableOfContentsEdit({
|
|
44
45
|
attributes: {
|
|
45
46
|
headings = [],
|
|
46
|
-
onlyIncludeCurrentPage
|
|
47
|
+
onlyIncludeCurrentPage,
|
|
48
|
+
maxLevel
|
|
47
49
|
},
|
|
48
50
|
clientId,
|
|
49
51
|
setAttributes
|
|
@@ -90,15 +92,16 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
90
92
|
})
|
|
91
93
|
});
|
|
92
94
|
const inspectorControls = /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
93
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
95
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalToolsPanel, {
|
|
94
96
|
label: (0, _i18n.__)('Settings'),
|
|
95
97
|
resetAll: () => {
|
|
96
98
|
setAttributes({
|
|
97
|
-
onlyIncludeCurrentPage: false
|
|
99
|
+
onlyIncludeCurrentPage: false,
|
|
100
|
+
maxLevel: undefined
|
|
98
101
|
});
|
|
99
102
|
},
|
|
100
103
|
dropdownMenuProps: dropdownMenuProps,
|
|
101
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
104
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
102
105
|
hasValue: () => !!onlyIncludeCurrentPage,
|
|
103
106
|
label: (0, _i18n.__)('Only include current page'),
|
|
104
107
|
onDeselect: () => setAttributes({
|
|
@@ -114,7 +117,46 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
114
117
|
}),
|
|
115
118
|
help: onlyIncludeCurrentPage ? (0, _i18n.__)('Only including headings from the current page (if the post is paginated).') : (0, _i18n.__)('Include headings from all pages (if the post is paginated).')
|
|
116
119
|
})
|
|
117
|
-
})
|
|
120
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalToolsPanelItem, {
|
|
121
|
+
hasValue: () => !!maxLevel,
|
|
122
|
+
label: (0, _i18n.__)('Limit heading levels'),
|
|
123
|
+
onDeselect: () => setAttributes({
|
|
124
|
+
maxLevel: undefined
|
|
125
|
+
}),
|
|
126
|
+
isShownByDefault: true,
|
|
127
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
128
|
+
__nextHasNoMarginBottom: true,
|
|
129
|
+
__next40pxDefaultSize: true,
|
|
130
|
+
label: (0, _i18n.__)('Include headings down to level'),
|
|
131
|
+
value: maxLevel || '',
|
|
132
|
+
options: [{
|
|
133
|
+
value: '',
|
|
134
|
+
label: (0, _i18n.__)('All levels')
|
|
135
|
+
}, {
|
|
136
|
+
value: '1',
|
|
137
|
+
label: (0, _i18n.__)('Heading 1')
|
|
138
|
+
}, {
|
|
139
|
+
value: '2',
|
|
140
|
+
label: (0, _i18n.__)('Heading 2')
|
|
141
|
+
}, {
|
|
142
|
+
value: '3',
|
|
143
|
+
label: (0, _i18n.__)('Heading 3')
|
|
144
|
+
}, {
|
|
145
|
+
value: '4',
|
|
146
|
+
label: (0, _i18n.__)('Heading 4')
|
|
147
|
+
}, {
|
|
148
|
+
value: '5',
|
|
149
|
+
label: (0, _i18n.__)('Heading 5')
|
|
150
|
+
}, {
|
|
151
|
+
value: '6',
|
|
152
|
+
label: (0, _i18n.__)('Heading 6')
|
|
153
|
+
}],
|
|
154
|
+
onChange: value => setAttributes({
|
|
155
|
+
maxLevel: value ? parseInt(value) : undefined
|
|
156
|
+
}),
|
|
157
|
+
help: !maxLevel ? (0, _i18n.__)('Including all heading levels in the table of contents.') : (0, _i18n.__)('Only include headings up to and including this level.')
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
118
160
|
})
|
|
119
161
|
});
|
|
120
162
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_hooks2","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","dropdownMenuProps","useToolsPanelDropdownMenuProps","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","__experimentalToolsPanel","label","resetAll","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","value","help","length","jsxs","Fragment","Placeholder","icon","BlockIcon","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":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAQA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OA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IAAApC,WAAA,CAAAkC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAApC,WAAA,CAAAkC,GAAA;QAAAE,QAAA,eACC,IAAApC,WAAA,CAAAkC,GAAA,EAACvC,KAAA,CAAAiD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjCqC,qBAAqB;UACrB7B,OAAO,EAAGxB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJkB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_blocks","_components","_data","_element","_i18n","_compose","_notices","_icons","_list","_interopRequireDefault","_utils","_hooks","_hooks2","_jsxRuntime","TableOfContentsEdit","attributes","headings","onlyIncludeCurrentPage","maxLevel","clientId","setAttributes","useObserveHeadings","blockProps","useBlockProps","instanceId","useInstanceId","createWarningNotice","useDispatch","noticeStore","showRedirectionPreventedNotice","event","preventDefault","__","id","type","canInsertList","useSelect","select","getBlockRootClientId","canInsertBlockType","blockEditorStore","rootClientId","replaceBlocks","dropdownMenuProps","useToolsPanelDropdownMenuProps","headingTree","linearToNestedHeadingList","toolbarControls","jsx","BlockControls","children","ToolbarGroup","ToolbarButton","onClick","createBlock","ordered","values","renderToString","default","nestedHeadingList","inspectorControls","InspectorControls","jsxs","__experimentalToolsPanel","label","resetAll","undefined","__experimentalToolsPanelItem","hasValue","onDeselect","isShownByDefault","ToggleControl","__nextHasNoMarginBottom","checked","onChange","value","help","SelectControl","__next40pxDefaultSize","options","parseInt","length","Fragment","Placeholder","icon","BlockIcon","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{ toolbarControls }\n\t\t\t{ inspectorControls }\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAKA,IAAAS,KAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAAgE,IAAAc,WAAA,GAAAd,OAAA;AAjChE;AACA;AACA;;AAyBA;AACA;AACA;;AAMA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GACe,SAASe,mBAAmBA,CAAE;EAC5CC,UAAU,EAAE;IAAEC,QAAQ,GAAG,EAAE;IAAEC,sBAAsB;IAAEC;EAAS,CAAC;EAC/DC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,IAAAC,yBAAkB,EAAEF,QAAS,CAAC;EAE9B,MAAMG,UAAU,GAAG,IAAAC,0BAAa,EAAC,CAAC;EAClC,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAC/BX,mBAAmB,EACnB,mBACD,CAAC;;EAED;EACA,MAAM;IAAEY;EAAoB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAY,CAAC;EAC1D,MAAMC,8BAA8B,GAAKC,KAAK,IAAM;IACnDA,KAAK,CAACC,cAAc,CAAC,CAAC;IACtBL,mBAA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,CACN;EAAC,CACK,CACnB;;EAED;EACA;EACA;EACA,IAAKhB,QAAQ,CAACiE,MAAM,KAAK,CAAC,EAAG;IAC5B,oBACC,IAAApE,WAAA,CAAAiD,IAAA,EAAAjD,WAAA,CAAAqE,QAAA;MAAAhC,QAAA,gBACC,IAAArC,WAAA,CAAAmC,GAAA;QAAA,GAAU1B,UAAU;QAAA4B,QAAA,eACnB,IAAArC,WAAA,CAAAmC,GAAA,EAAC/C,WAAA,CAAAkF,WAAW;UACXC,IAAI,eAAG,IAAAvE,WAAA,CAAAmC,GAAA,EAAClD,YAAA,CAAAuF,SAAS;YAACD,IAAI,EAAGA;UAAM,CAAE,CAAG;UACpCpB,KAAK,EAAG,IAAAhC,QAAE,EAAE,mBAAoB,CAAG;UACnCsD,YAAY,EAAG,IAAAtD,QAAE,EAChB,4GACD;QAAG,CACH;MAAC,CACE,CAAC,EACJ4B,iBAAiB;IAAA,CAClB,CAAC;EAEL;EAEA,oBACC,IAAA/C,WAAA,CAAAiD,IAAA,EAAAjD,WAAA,CAAAqE,QAAA;IAAAhC,QAAA,gBACC,IAAArC,WAAA,CAAAmC,GAAA;MAAA,GAAU1B,UAAU;MAAA4B,QAAA,eACnB,IAAArC,WAAA,CAAAmC,GAAA;QAAAE,QAAA,eACC,IAAArC,WAAA,CAAAmC,GAAA,EAACxC,KAAA,CAAAkD,OAAmB;UACnBC,iBAAiB,EAAGd,WAAa;UACjC0C,qBAAqB;UACrBlC,OAAO,EAAGxB;QAAgC,CAC1C;MAAC,CACC;IAAC,CACD,CAAC,EACJkB,eAAe,EACfa,iBAAiB;EAAA,CAClB,CAAC;AAEL","ignoreList":[]}
|
|
@@ -37,7 +37,8 @@ function getLatestHeadings(select, clientId) {
|
|
|
37
37
|
const permalink = (_select$getPermalink = select('core/editor').getPermalink()) !== null && _select$getPermalink !== void 0 ? _select$getPermalink : null;
|
|
38
38
|
const isPaginated = getBlocksByName('core/nextpage').length !== 0;
|
|
39
39
|
const {
|
|
40
|
-
onlyIncludeCurrentPage
|
|
40
|
+
onlyIncludeCurrentPage,
|
|
41
|
+
maxLevel
|
|
41
42
|
} = (_getBlockAttributes = getBlockAttributes(clientId)) !== null && _getBlockAttributes !== void 0 ? _getBlockAttributes : {};
|
|
42
43
|
|
|
43
44
|
// Get post-content block client ID.
|
|
@@ -99,6 +100,11 @@ function getLatestHeadings(select, clientId) {
|
|
|
99
100
|
else if (!onlyIncludeCurrentPage || headingPage === tocPage) {
|
|
100
101
|
if (blockName === 'core/heading') {
|
|
101
102
|
const headingAttributes = getBlockAttributes(blockClientId);
|
|
103
|
+
|
|
104
|
+
// Skip headings that are deeper than maxLevel
|
|
105
|
+
if (maxLevel && headingAttributes.level > maxLevel) {
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
102
108
|
const canBeLinked = typeof headingPageLink === 'string' && typeof headingAttributes.anchor === 'string' && headingAttributes.anchor !== '';
|
|
103
109
|
latestHeadings.push({
|
|
104
110
|
// Convert line breaks to spaces, and get rid of HTML tags in the headings.
|
|
@@ -131,9 +137,12 @@ function observeCallback(select, dispatch, clientId) {
|
|
|
131
137
|
}
|
|
132
138
|
const headings = getLatestHeadings(select, clientId);
|
|
133
139
|
if (!(0, _es.default)(headings, attributes.headings)) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
140
|
+
// Executing the update in a microtask ensures that the non-persistent marker doesn't affect an attribute triggering the change.
|
|
141
|
+
window.queueMicrotask(() => {
|
|
142
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
143
|
+
updateBlockAttributes(clientId, {
|
|
144
|
+
headings
|
|
145
|
+
});
|
|
137
146
|
});
|
|
138
147
|
}
|
|
139
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","canBeLinked","anchor","push","content","stripHTML","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","useObserveHeadings","registry","useRegistry","useEffect","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\tob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D,CAAC;EACF,CAAC,EAAE,CAAE6C,QAAQ,EAAE7C,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_es","_interopRequireDefault","require","_data","_dom","_element","_url","_blockEditor","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","blockEditorStore","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","maxLevel","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","addQueryArgs","page","blockName","removeQueryArgs","headingAttributes","level","canBeLinked","anchor","push","content","stripHTML","replace","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","fastDeepEqual","window","queueMicrotask","useObserveHeadings","registry","useRegistry","useEffect","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":";;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAZA;AACA;AACA;;AAGA;AACA;AACA;;AAOA,SAASM,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,eAAe;IACfC;EACD,CAAC,GAAGP,MAAM,CAAEQ,kBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMC,SAAS,IAAAP,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACU,YAAY,CAAC,CAAC,cAAAR,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMS,WAAW,GAAGL,eAAe,CAAE,eAAgB,CAAC,CAACM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kBAAkB,CAAEH,QAAS,CAAC;EACjD,IAAK0C,UAAU,KAAK,IAAI,EAAG;IAC1B;EACD;EAEA,MAAMC,QAAQ,GAAG7C,iBAAiB,CAAEC,MAAM,EAAEC,QAAS,CAAC;EACtD,IAAK,CAAE,IAAA4C,WAAa,EAAED,QAAQ,EAAED,UAAU,CAACC,QAAS,CAAC,EAAG;IACvD;IACAE,MAAM,CAACC,cAAc,CAAE,MAAM;MAC5BL,uCAAuC,CAAC,CAAC;MACzCD,qBAAqB,CAAExC,QAAQ,EAAE;QAAE2C;MAAS,CAAE,CAAC;IAChD,CAAE,CAAC;EACJ;AACD;AAEO,SAASI,kBAAkBA,CAAE/C,QAAQ,EAAG;EAC9C,MAAMgD,QAAQ,GAAG,IAAAC,iBAAW,EAAC,CAAC;EAC9B,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA;IACA,OAAOF,QAAQ,CAACG,SAAS,CAAE,MAC1Bb,eAAe,CAAEU,QAAQ,CAACjD,MAAM,EAAEiD,QAAQ,CAACT,QAAQ,EAAEvC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAEgD,QAAQ,EAAEhD,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_edit","_save","metadata","exports","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","attributes","headings","type","items","onlyIncludeCurrentPage","supports","html","color","text","background","gradients","link","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","interactivity","clientNavigation","__experimentalBorder","radius","width","style","settings","icon","edit","save","example","innerBlocks","level","content","__","init","initBlock"],"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAZA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAM,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,QAAA;MAAAC,IAAA;MAAAC,KAAA;QAAAD,IAAA;MAAA;MAAA;IAAA;IAAAE,sBAAA;MAAAF,IAAA;MAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_initBlock","_interopRequireDefault","_edit","_save","metadata","exports","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","attributes","headings","type","items","onlyIncludeCurrentPage","maxLevel","supports","html","color","text","background","gradients","link","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","interactivity","clientNavigation","__experimentalBorder","radius","width","style","settings","icon","edit","save","example","innerBlocks","level","content","__","init","initBlock"],"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AAZA;AACA;AACA;AAIA;AACA;AACA;AAFA,MAAAM,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA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