@wordpress/block-library 9.36.1-next.738bb1424.0 → 9.36.2-next.8fd3f8831.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/accordion-heading/deprecated.cjs +120 -1
- package/build/accordion-heading/deprecated.cjs.map +2 -2
- package/build/accordion-heading/edit.cjs +9 -1
- package/build/accordion-heading/edit.cjs.map +3 -3
- package/build/accordion-heading/save.cjs +1 -0
- package/build/accordion-heading/save.cjs.map +2 -2
- package/build/accordion-item/block.json +3 -0
- package/build/accordion-item/edit.cjs +3 -37
- package/build/accordion-item/edit.cjs.map +2 -2
- package/build/accordion-panel/block.json +1 -4
- package/build/accordion-panel/edit.cjs +3 -2
- package/build/accordion-panel/edit.cjs.map +2 -2
- package/build/breadcrumbs/block.json +1 -2
- package/build/breadcrumbs/edit.cjs +2 -1
- package/build/breadcrumbs/edit.cjs.map +2 -2
- package/build/button/index.cjs +9 -1
- package/build/button/index.cjs.map +2 -2
- package/build/buttons/block.json +1 -0
- package/build/comment-author-name/block.json +1 -3
- package/build/comment-author-name/deprecated.cjs +57 -1
- package/build/comment-author-name/deprecated.cjs.map +3 -3
- package/build/comment-author-name/edit.cjs +9 -19
- package/build/comment-author-name/edit.cjs.map +3 -3
- package/build/freeform/edit.cjs +48 -174
- package/build/freeform/edit.cjs.map +2 -2
- package/build/freeform/modal.cjs +51 -67
- package/build/freeform/modal.cjs.map +2 -2
- package/build/index.cjs +2 -2
- package/build/index.cjs.map +2 -2
- package/build/list/block.json +2 -1
- package/build/query/edit/query-content.cjs +4 -3
- package/build/query/edit/query-content.cjs.map +2 -2
- package/build/query/edit/query-placeholder.cjs +4 -3
- package/build/query/edit/query-placeholder.cjs.map +2 -2
- package/build/query/edit/query-toolbar.cjs +19 -7
- package/build/query/edit/query-toolbar.cjs.map +3 -3
- package/build/social-links/block.json +2 -1
- package/build-module/accordion-heading/deprecated.js +122 -2
- package/build-module/accordion-heading/deprecated.js.map +2 -2
- package/build-module/accordion-heading/edit.js +11 -2
- package/build-module/accordion-heading/edit.js.map +2 -2
- package/build-module/accordion-heading/save.js +1 -0
- package/build-module/accordion-heading/save.js.map +2 -2
- package/build-module/accordion-item/block.json +3 -0
- package/build-module/accordion-item/edit.js +3 -37
- package/build-module/accordion-item/edit.js.map +2 -2
- package/build-module/accordion-panel/block.json +1 -4
- package/build-module/accordion-panel/edit.js +3 -2
- package/build-module/accordion-panel/edit.js.map +2 -2
- package/build-module/breadcrumbs/block.json +1 -2
- package/build-module/breadcrumbs/edit.js +2 -1
- package/build-module/breadcrumbs/edit.js.map +2 -2
- package/build-module/button/index.js +9 -1
- package/build-module/button/index.js.map +2 -2
- package/build-module/buttons/block.json +1 -0
- package/build-module/comment-author-name/block.json +1 -3
- package/build-module/comment-author-name/deprecated.js +57 -1
- package/build-module/comment-author-name/deprecated.js.map +2 -2
- package/build-module/comment-author-name/edit.js +10 -25
- package/build-module/comment-author-name/edit.js.map +2 -2
- package/build-module/freeform/edit.js +56 -176
- package/build-module/freeform/edit.js.map +2 -2
- package/build-module/freeform/modal.js +55 -78
- package/build-module/freeform/modal.js.map +2 -2
- package/build-module/index.js +2 -2
- package/build-module/index.js.map +2 -2
- package/build-module/list/block.json +2 -1
- package/build-module/query/edit/query-content.js +5 -5
- package/build-module/query/edit/query-content.js.map +2 -2
- package/build-module/query/edit/query-placeholder.js +4 -4
- package/build-module/query/edit/query-placeholder.js.map +2 -2
- package/build-module/query/edit/query-toolbar.js +22 -7
- package/build-module/query/edit/query-toolbar.js.map +2 -2
- package/build-module/social-links/block.json +2 -1
- package/build-style/audio/style-rtl.css +4 -0
- package/build-style/audio/style.css +4 -0
- package/build-style/audio/theme-rtl.css +4 -0
- package/build-style/audio/theme.css +4 -0
- package/build-style/columns/style-rtl.css +4 -0
- package/build-style/columns/style.css +4 -0
- package/build-style/common-rtl.css +4 -0
- package/build-style/common.css +4 -0
- package/build-style/editor-rtl.css +9 -324
- package/build-style/editor.css +9 -328
- package/build-style/embed/style-rtl.css +4 -0
- package/build-style/embed/style.css +4 -0
- package/build-style/embed/theme-rtl.css +4 -0
- package/build-style/embed/theme.css +4 -0
- package/build-style/freeform/editor-rtl.css +10 -330
- package/build-style/freeform/editor.css +10 -334
- package/build-style/gallery/editor-rtl.css +4 -0
- package/build-style/gallery/editor.css +4 -0
- package/build-style/gallery/style-rtl.css +4 -0
- package/build-style/gallery/style.css +4 -0
- package/build-style/gallery/theme-rtl.css +4 -0
- package/build-style/gallery/theme.css +4 -0
- package/build-style/html/editor-rtl.css +4 -0
- package/build-style/html/editor.css +4 -0
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/image/style-rtl.css +4 -0
- package/build-style/image/style.css +4 -0
- package/build-style/image/theme-rtl.css +4 -0
- package/build-style/image/theme.css +4 -0
- package/build-style/latest-posts/style-rtl.css +4 -0
- package/build-style/latest-posts/style.css +4 -0
- package/build-style/navigation/editor-rtl.css +4 -0
- package/build-style/navigation/editor.css +4 -0
- package/build-style/navigation/style-rtl.css +4 -0
- package/build-style/navigation/style.css +4 -0
- package/build-style/navigation-submenu/editor-rtl.css +4 -0
- package/build-style/navigation-submenu/editor.css +4 -0
- package/build-style/page-list/editor-rtl.css +4 -0
- package/build-style/page-list/editor.css +4 -0
- package/build-style/paragraph/editor-rtl.css +5 -0
- package/build-style/paragraph/editor.css +5 -0
- package/build-style/post-template/style-rtl.css +4 -0
- package/build-style/post-template/style.css +4 -0
- package/build-style/query/editor-rtl.css +4 -0
- package/build-style/query/editor.css +4 -0
- package/build-style/rss/style-rtl.css +4 -0
- package/build-style/rss/style.css +4 -0
- package/build-style/shortcode/editor-rtl.css +4 -0
- package/build-style/shortcode/editor.css +4 -0
- package/build-style/style-rtl.css +4 -0
- package/build-style/style.css +4 -0
- package/build-style/table/editor-rtl.css +4 -0
- package/build-style/table/editor.css +4 -0
- package/build-style/table/theme-rtl.css +4 -0
- package/build-style/table/theme.css +4 -0
- package/build-style/template-part/editor-rtl.css +4 -0
- package/build-style/template-part/editor.css +4 -0
- package/build-style/theme-rtl.css +4 -0
- package/build-style/theme.css +4 -0
- package/build-style/video/style-rtl.css +4 -0
- package/build-style/video/style.css +4 -0
- package/build-style/video/theme-rtl.css +4 -0
- package/build-style/video/theme.css +4 -0
- package/package.json +37 -37
- package/src/accordion-heading/deprecated.js +122 -1
- package/src/accordion-heading/edit.js +11 -1
- package/src/accordion-heading/save.js +1 -0
- package/src/accordion-item/block.json +3 -0
- package/src/accordion-item/edit.js +4 -38
- package/src/accordion-panel/block.json +1 -4
- package/src/accordion-panel/edit.js +3 -4
- package/src/breadcrumbs/block.json +1 -2
- package/src/breadcrumbs/edit.js +2 -1
- package/src/breadcrumbs/index.php +23 -1
- package/src/button/index.js +12 -0
- package/src/button/test/get-experimental-label.js +50 -0
- package/src/buttons/block.json +1 -0
- package/src/comment-author-name/block.json +1 -3
- package/src/comment-author-name/deprecated.js +61 -1
- package/src/comment-author-name/edit.js +10 -34
- package/src/freeform/edit.js +60 -245
- package/src/freeform/editor.scss +1 -382
- package/src/freeform/modal.js +47 -80
- package/src/index.js +1 -1
- package/src/list/block.json +2 -1
- package/src/paragraph/editor.scss +8 -0
- package/src/post-date/index.php +4 -7
- package/src/query/edit/query-content.js +3 -3
- package/src/query/edit/query-placeholder.js +3 -3
- package/src/query/edit/query-toolbar.js +47 -31
- package/src/social-links/block.json +2 -1
- package/src/term-template/index.php +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-heading/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tRichText,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n} from '@wordpress/block-editor';\n\nexport default function Edit( { attributes, setAttributes, context } ) {\n\tconst { title } = attributes;\n\tconst {\n\t\t'core/accordion-icon-position': iconPosition,\n\t\t'core/accordion-show-icon': showIcon,\n\t\t'core/accordion-heading-level': headingLevel,\n\t} = context;\n\tconst TagName = 'h' + headingLevel;\n\n\t// Set icon attributes.\n\tuseEffect( () => {\n\t\tif ( iconPosition !== undefined && showIcon !== undefined ) {\n\t\t\tsetAttributes( {\n\t\t\t\ticonPosition,\n\t\t\t\tshowIcon,\n\t\t\t} );\n\t\t}\n\t}, [
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA,4CAA4C;AAAA,EAC5C;AAAA,EACA,iCAAiC;AAAA,EACjC;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as useSpacingProps,\n\tRichText,\n\tgetTypographyClassesAndStyles as useTypographyProps,\n\tuseSettings,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch } from '@wordpress/data';\n\nexport default function Edit( { attributes, setAttributes, context } ) {\n\tconst { title } = attributes;\n\tconst {\n\t\t'core/accordion-icon-position': iconPosition,\n\t\t'core/accordion-show-icon': showIcon,\n\t\t'core/accordion-heading-level': headingLevel,\n\t} = context;\n\tconst TagName = 'h' + headingLevel;\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\t// Set icon attributes.\n\tuseEffect( () => {\n\t\tif ( iconPosition !== undefined && showIcon !== undefined ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( {\n\t\t\t\ticonPosition,\n\t\t\t\tshowIcon,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\ticonPosition,\n\t\tshowIcon,\n\t\tsetAttributes,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t] );\n\n\tconst [ fluidTypographySettings, layout ] = useSettings(\n\t\t'typography.fluid',\n\t\t'layout'\n\t);\n\tconst typographyProps = useTypographyProps( attributes, {\n\t\ttypography: {\n\t\t\tfluid: fluidTypographySettings,\n\t\t},\n\t\tlayout: {\n\t\t\twideSize: layout?.wideSize,\n\t\t},\n\t} );\n\n\tconst blockProps = useBlockProps();\n\tconst spacingProps = useSpacingProps( attributes );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<button\n\t\t\t\tclassName=\"wp-block-accordion-heading__toggle\"\n\t\t\t\tstyle={ spacingProps.style }\n\t\t\t\ttabIndex=\"-1\"\n\t\t\t>\n\t\t\t\t{ showIcon && iconPosition === 'left' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t+\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText\n\t\t\t\t\twithoutInteractiveFormatting\n\t\t\t\t\tdisableLineBreaks\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ ( newTitle ) =>\n\t\t\t\t\t\tsetAttributes( { title: newTitle } )\n\t\t\t\t\t}\n\t\t\t\t\tplaceholder={ __( 'Accordion title' ) }\n\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-title\"\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tletterSpacing: typographyProps.style.letterSpacing,\n\t\t\t\t\t\ttextDecoration: typographyProps.style.textDecoration,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showIcon && iconPosition === 'right' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\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AAAA,YACZ;AAAA;AAAA,QAED;AAAA,QAED;AAAA,UAAC;AAAA;AAAA,YACA,8BAA4B;AAAA,YAC5B,mBAAiB;AAAA,YACjB,SAAQ;AAAA,YACR,OAAQ;AAAA,YACR,UAAW,CAAE,aACZ,cAAe,EAAE,OAAO,SAAS,CAAE;AAAA,YAEpC,aAAc,GAAI,iBAAkB;AAAA,YACpC,WAAU;AAAA,YACV,OAAQ;AAAA,cACP,eAAe,gBAAgB,MAAM;AAAA,cACrC,gBAAgB,gBAAgB,MAAM;AAAA,YACvC;AAAA;AAAA,QACD;AAAA,QACE,YAAY,iBAAiB,WAC9B;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,eAAY;AAAA,YACZ;AAAA;AAAA,QAED;AAAA;AAAA;AAAA,EAEF,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-heading/save.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\tRichText,\n\tgetTypographyClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { level, title, iconPosition, showIcon } = attributes;\n\tconst TagName = 'h' + ( level || 3 );\n\tconst typographyProps = getTypographyClassesAndStyles( attributes );\n\n\tconst blockProps = useBlockProps.save();\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<button\n\t\t\t\tclassName=\"wp-block-accordion-heading__toggle\"\n\t\t\t\tstyle={ spacingProps.style }\n\t\t\t>\n\t\t\t\t{ showIcon && iconPosition === 'left' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t+\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText.Content\n\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-title\"\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tletterSpacing: typographyProps.style.letterSpacing,\n\t\t\t\t\t\ttextDecoration: typographyProps.style.textDecoration,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showIcon && iconPosition === 'right' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t+\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t</TagName>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,4CAA4C;AAAA,EAC5C;AAAA,EACA;AAAA,OACM;AAYJ,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\t__experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,\n\tRichText,\n\tgetTypographyClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\tconst { level, title, iconPosition, showIcon } = attributes;\n\tconst TagName = 'h' + ( level || 3 );\n\tconst typographyProps = getTypographyClassesAndStyles( attributes );\n\n\tconst blockProps = useBlockProps.save();\n\tconst spacingProps = getSpacingClassesAndStyles( attributes );\n\n\treturn (\n\t\t<TagName { ...blockProps }>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclassName=\"wp-block-accordion-heading__toggle\"\n\t\t\t\tstyle={ spacingProps.style }\n\t\t\t>\n\t\t\t\t{ showIcon && iconPosition === 'left' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t+\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t\t<RichText.Content\n\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-title\"\n\t\t\t\t\ttagName=\"span\"\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tletterSpacing: typographyProps.style.letterSpacing,\n\t\t\t\t\t\ttextDecoration: typographyProps.style.textDecoration,\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t{ showIcon && iconPosition === 'right' && (\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName=\"wp-block-accordion-heading__toggle-icon\"\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t>\n\t\t\t\t\t\t+\n\t\t\t\t\t</span>\n\t\t\t\t) }\n\t\t\t</button>\n\t\t</TagName>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,4CAA4C;AAAA,EAC5C;AAAA,EACA;AAAA,OACM;AAYJ,SAME,KANF;AAVY,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,QAAM,EAAE,OAAO,OAAO,cAAc,SAAS,IAAI;AACjD,QAAM,UAAU,OAAQ,SAAS;AACjC,QAAM,kBAAkB,8BAA+B,UAAW;AAElE,QAAM,aAAa,cAAc,KAAK;AACtC,QAAM,eAAe,2BAA4B,UAAW;AAE5D,SACC,oBAAC,WAAU,GAAG,YACb;AAAA,IAAC;AAAA;AAAA,MACA,MAAK;AAAA,MACL,WAAU;AAAA,MACV,OAAQ,aAAa;AAAA,MAEnB;AAAA,oBAAY,iBAAiB,UAC9B;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,eAAY;AAAA,YACZ;AAAA;AAAA,QAED;AAAA,QAED;AAAA,UAAC,SAAS;AAAA,UAAT;AAAA,YACA,WAAU;AAAA,YACV,SAAQ;AAAA,YACR,OAAQ;AAAA,YACR,OAAQ;AAAA,cACP,eAAe,gBAAgB,MAAM;AAAA,cACrC,gBAAgB,gBAAgB,MAAM;AAAA,YACvC;AAAA;AAAA,QACD;AAAA,QACE,YAAY,iBAAiB,WAC9B;AAAA,UAAC;AAAA;AAAA,YACA,WAAU;AAAA,YACV,eAAY;AAAA,YACZ;AAAA;AAAA,QAED;AAAA;AAAA;AAAA,EAEF,GACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -16,12 +16,8 @@ import {
|
|
|
16
16
|
import clsx from "clsx";
|
|
17
17
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.js";
|
|
18
18
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
clientId,
|
|
22
|
-
setAttributes,
|
|
23
|
-
context
|
|
24
|
-
}) {
|
|
19
|
+
var TEMPLATE = [["core/accordion-heading"], ["core/accordion-panel"]];
|
|
20
|
+
function Edit({ attributes, clientId, setAttributes }) {
|
|
25
21
|
const { openByDefault } = attributes;
|
|
26
22
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
27
23
|
const { isSelected, getBlockOrder } = useSelect(
|
|
@@ -58,20 +54,8 @@ function Edit({
|
|
|
58
54
|
"is-open": openByDefault || isSelected
|
|
59
55
|
})
|
|
60
56
|
});
|
|
61
|
-
const headingLevel = context && context["core/accordion-heading-level"];
|
|
62
57
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
63
|
-
template:
|
|
64
|
-
[
|
|
65
|
-
"core/accordion-heading",
|
|
66
|
-
headingLevel ? { level: headingLevel } : {}
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
"core/accordion-panel",
|
|
70
|
-
{
|
|
71
|
-
openByDefault
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
],
|
|
58
|
+
template: TEMPLATE,
|
|
75
59
|
templateLock: "all",
|
|
76
60
|
directInsert: true,
|
|
77
61
|
templateInsertUpdatesSelection: true
|
|
@@ -83,11 +67,6 @@ function Edit({
|
|
|
83
67
|
label: __("Settings"),
|
|
84
68
|
resetAll: () => {
|
|
85
69
|
setAttributes({ openByDefault: false });
|
|
86
|
-
if (contentBlockClientId) {
|
|
87
|
-
updateBlockAttributes(contentBlockClientId, {
|
|
88
|
-
openByDefault: false
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
70
|
},
|
|
92
71
|
dropdownMenuProps,
|
|
93
72
|
children: /* @__PURE__ */ jsx(
|
|
@@ -98,11 +77,6 @@ function Edit({
|
|
|
98
77
|
hasValue: () => !!openByDefault,
|
|
99
78
|
onDeselect: () => {
|
|
100
79
|
setAttributes({ openByDefault: false });
|
|
101
|
-
if (contentBlockClientId) {
|
|
102
|
-
updateBlockAttributes(contentBlockClientId, {
|
|
103
|
-
openByDefault: false
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
80
|
},
|
|
107
81
|
children: /* @__PURE__ */ jsx(
|
|
108
82
|
ToggleControl,
|
|
@@ -112,14 +86,6 @@ function Edit({
|
|
|
112
86
|
setAttributes({
|
|
113
87
|
openByDefault: value
|
|
114
88
|
});
|
|
115
|
-
if (contentBlockClientId) {
|
|
116
|
-
updateBlockAttributes(
|
|
117
|
-
contentBlockClientId,
|
|
118
|
-
{
|
|
119
|
-
openByDefault: value
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
89
|
},
|
|
124
90
|
checked: openByDefault,
|
|
125
91
|
help: __(
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-item/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nexport default function Edit( {
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AAIP,OAAO,UAAU;AAKjB,SAAS,sCAAsC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tInspectorControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst TEMPLATE = [ [ 'core/accordion-heading' ], [ 'core/accordion-panel' ] ];\n\nexport default function Edit( { attributes, clientId, setAttributes } ) {\n\tconst { openByDefault } = attributes;\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\tconst { isSelected, getBlockOrder } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tisBlockSelected,\n\t\t\t\thasSelectedInnerBlock,\n\t\t\t\tgetBlockOrder: getBlockOrderSelector,\n\t\t\t} = select( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tisSelected:\n\t\t\t\t\tisBlockSelected( clientId ) ||\n\t\t\t\t\thasSelectedInnerBlock( clientId, true ),\n\t\t\t\tgetBlockOrder: getBlockOrderSelector,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst contentBlockClientId = getBlockOrder( clientId )[ 1 ];\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tif ( contentBlockClientId ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateBlockAttributes( contentBlockClientId, {\n\t\t\t\tisSelected,\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tisSelected,\n\t\tcontentBlockClientId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateBlockAttributes,\n\t] );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx( {\n\t\t\t'is-open': openByDefault || isSelected,\n\t\t} ),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t\ttemplateLock: 'all',\n\t\tdirectInsert: true,\n\t\ttemplateInsertUpdatesSelection: true,\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls key=\"setting\">\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( { openByDefault: false } );\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\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => !! openByDefault }\n\t\t\t\t\t\tonDeselect={ () => {\n\t\t\t\t\t\t\tsetAttributes( { openByDefault: 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\tlabel={ __( 'Open by default' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\topenByDefault: value,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tchecked={ openByDefault }\n\t\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t\t'Accordion content will be displayed by default.'\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<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,OACH;AACP,SAAS,aAAa,iBAAiB;AACvC,SAAS,iBAAiB;AAC1B;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AAIP,OAAO,UAAU;AAKjB,SAAS,sCAAsC;AAyD7C,mBAiBI,KAjBJ;AAvDF,IAAM,WAAW,CAAE,CAAE,wBAAyB,GAAG,CAAE,sBAAuB,CAAE;AAE7D,SAAR,KAAuB,EAAE,YAAY,UAAU,cAAc,GAAI;AACvE,QAAM,EAAE,cAAc,IAAI;AAC1B,QAAM,oBAAoB,+BAA+B;AAEzD,QAAM,EAAE,YAAY,cAAc,IAAI;AAAA,IACrC,CAAE,WAAY;AACb,YAAM;AAAA,QACL;AAAA,QACA;AAAA,QACA,eAAe;AAAA,MAChB,IAAI,OAAQ,gBAAiB;AAC7B,aAAO;AAAA,QACN,YACC,gBAAiB,QAAS,KAC1B,sBAAuB,UAAU,IAAK;AAAA,QACvC,eAAe;AAAA,MAChB;AAAA,IACD;AAAA,IACA,CAAE,QAAS;AA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A,KAC9B;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
"category": "design",
|
|
7
7
|
"description": "Contains the hidden or revealed content beneath the heading.",
|
|
8
8
|
"parent": [ "core/accordion-item" ],
|
|
9
|
+
"usesContext": [ "core/accordion-open-by-default" ],
|
|
9
10
|
"supports": {
|
|
10
11
|
"html": false,
|
|
11
12
|
"color": {
|
|
@@ -61,10 +62,6 @@
|
|
|
61
62
|
"enum": [ "all", "insert", "contentOnly", false ],
|
|
62
63
|
"default": false
|
|
63
64
|
},
|
|
64
|
-
"openByDefault": {
|
|
65
|
-
"type": "boolean",
|
|
66
|
-
"default": false
|
|
67
|
-
},
|
|
68
65
|
"isSelected": {
|
|
69
66
|
"type": "boolean",
|
|
70
67
|
"default": false
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// packages/block-library/src/accordion-panel/edit.js
|
|
2
2
|
import { useBlockProps, useInnerBlocksProps } from "@wordpress/block-editor";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
function Edit({ attributes }) {
|
|
5
|
-
const { allowedBlocks, templateLock,
|
|
4
|
+
function Edit({ attributes, context }) {
|
|
5
|
+
const { allowedBlocks, templateLock, isSelected } = attributes;
|
|
6
|
+
const openByDefault = context["core/accordion-open-by-default"];
|
|
6
7
|
const blockProps = useBlockProps({
|
|
7
8
|
"aria-hidden": !isSelected && !openByDefault,
|
|
8
9
|
role: "region"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion-panel/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function Edit( { attributes } ) {\n\tconst { allowedBlocks, templateLock,
|
|
5
|
-
"mappings": ";AAGA,SAAS,eAAe,2BAA2B;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\n\nexport default function Edit( { attributes, context } ) {\n\tconst { allowedBlocks, templateLock, isSelected } = attributes;\n\tconst openByDefault = context[ 'core/accordion-open-by-default' ];\n\tconst blockProps = useBlockProps( {\n\t\t'aria-hidden': ! isSelected && ! openByDefault,\n\t\trole: 'region',\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tallowedBlocks,\n\t\ttemplate: [ [ 'core/paragraph', {} ] ],\n\t\ttemplateLock,\n\t} );\n\n\treturn <div { ...innerBlocksProps } />;\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,eAAe,2BAA2B;AAgB3C;AAdO,SAAR,KAAuB,EAAE,YAAY,QAAQ,GAAI;AACvD,QAAM,EAAE,eAAe,cAAc,WAAW,IAAI;AACpD,QAAM,gBAAgB,QAAS,gCAAiC;AAChE,QAAM,aAAa,cAAe;AAAA,IACjC,eAAe,CAAE,cAAc,CAAE;AAAA,IACjC,MAAM;AAAA,EACP,CAAE;AAEF,QAAM,mBAAmB,oBAAqB,YAAY;AAAA,IACzD;AAAA,IACA,UAAU,CAAE,CAAE,kBAAkB,CAAC,CAAE,CAAE;AAAA,IACrC;AAAA,EACD,CAAE;AAEF,SAAO,oBAAC,SAAM,GAAG,kBAAmB;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
"apiVersion": 3,
|
|
4
4
|
"name": "core/breadcrumbs",
|
|
5
5
|
"title": "Breadcrumbs",
|
|
6
|
-
"__experimental": true,
|
|
7
6
|
"category": "theme",
|
|
8
|
-
"description": "Display a breadcrumb trail
|
|
7
|
+
"description": "Display a breadcrumb trail showing the path to the current page.",
|
|
9
8
|
"textdomain": "default",
|
|
10
9
|
"attributes": {
|
|
11
10
|
"prefersTaxonomy": {
|
|
@@ -19,6 +19,7 @@ var separatorDefaultValue = "/";
|
|
|
19
19
|
function BreadcrumbEdit({
|
|
20
20
|
attributes,
|
|
21
21
|
setAttributes,
|
|
22
|
+
name,
|
|
22
23
|
context: { postId, postType, templateSlug }
|
|
23
24
|
}) {
|
|
24
25
|
const {
|
|
@@ -76,7 +77,7 @@ function BreadcrumbEdit({
|
|
|
76
77
|
const { content } = useServerSideRender({
|
|
77
78
|
attributes,
|
|
78
79
|
skipBlockSupportAttributes: true,
|
|
79
|
-
block:
|
|
80
|
+
block: name,
|
|
80
81
|
urlQueryArgs: { post_id: postId, invalidationKey }
|
|
81
82
|
});
|
|
82
83
|
if (isLoading) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/breadcrumbs/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState, RawHTML } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock:
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,mBAAmB,qBAAqB;AACjD;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,EAChC;AAAA,OACM;AACP,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,WAAW,UAAU,eAAe;AAC7C,SAAS,2BAA2B;AAKpC,SAAS,sCAAsC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport {\n\tToggleControl,\n\tTextControl,\n\tCheckboxControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\tSpinner,\n} from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useEffect, useState, RawHTML } from '@wordpress/element';\nimport { useServerSideRender } from '@wordpress/server-side-render';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst separatorDefaultValue = '/';\n\nexport default function BreadcrumbEdit( {\n\tattributes,\n\tsetAttributes,\n\tname,\n\tcontext: { postId, postType, templateSlug },\n} ) {\n\tconst {\n\t\tseparator,\n\t\tshowHomeItem,\n\t\tshowCurrentItem,\n\t\tprefersTaxonomy,\n\t\tshowOnHomePage,\n\t} = attributes;\n\tconst {\n\t\tpost,\n\t\tisPostTypeHierarchical,\n\t\tpostTypeHasTaxonomies,\n\t\thasTermsAssigned,\n\t\tisLoading,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! postType ) {\n\t\t\t\treturn {};\n\t\t\t}\n\t\t\tconst _post = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst postTypeObject = select( coreStore ).getPostType( postType );\n\t\t\tconst _postTypeHasTaxonomies =\n\t\t\t\tpostTypeObject && postTypeObject.taxonomies.length;\n\t\t\tlet taxonomies;\n\t\t\tif ( _postTypeHasTaxonomies ) {\n\t\t\t\ttaxonomies = select( coreStore ).getTaxonomies( {\n\t\t\t\t\ttype: postType,\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} );\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpost: _post,\n\t\t\t\tisPostTypeHierarchical: postTypeObject?.hierarchical,\n\t\t\t\tpostTypeHasTaxonomies: _postTypeHasTaxonomies,\n\t\t\t\thasTermsAssigned:\n\t\t\t\t\t_post &&\n\t\t\t\t\t( taxonomies || [] )\n\t\t\t\t\t\t.filter(\n\t\t\t\t\t\t\t( { visibility } ) => visibility?.publicly_queryable\n\t\t\t\t\t\t)\n\t\t\t\t\t\t.some( ( taxonomy ) => {\n\t\t\t\t\t\t\treturn !! _post[ taxonomy.rest_base ]?.length;\n\t\t\t\t\t\t} ),\n\t\t\t\tisLoading:\n\t\t\t\t\t( postId && ! _post ) ||\n\t\t\t\t\t! postTypeObject ||\n\t\t\t\t\t( _postTypeHasTaxonomies && ! taxonomies ),\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\t/**\n\t * Counter used to cache-bust `useServerSideRender`.\n\t *\n\t * This is a catch-all signal to re-render the block when a post's title,\n\t * parent ID, or terms change.\n\t *\n\t * This is fundamentally imperfect, because there are other entities which\n\t * could change in the meantime (the titles of ancestor posts, or the\n\t * labels of taxonomy terms), hence the choice to re-render systematically\n\t * upon saving.\n\t */\n\tconst [ invalidationKey, setInvalidationKey ] = useState( 0 );\n\tuseEffect( () => {\n\t\tsetInvalidationKey( ( c ) => c + 1 );\n\t}, [ post ] );\n\n\tconst blockProps = useBlockProps();\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst { content } = useServerSideRender( {\n\t\tattributes,\n\t\tskipBlockSupportAttributes: true,\n\t\tblock: name,\n\t\turlQueryArgs: { post_id: postId, invalidationKey },\n\t} );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Try to determine breadcrumb type for more accurate previews.\n\tlet _showTerms;\n\t// Some non-hierarchical post types (e.g., attachments) can have parents.\n\t// Use hierarchical breadcrumbs if a parent exists, otherwise use taxonomy breadcrumbs.\n\tif ( ! isPostTypeHierarchical && ! post?.parent ) {\n\t\t_showTerms = true;\n\t} else if ( ! postTypeHasTaxonomies ) {\n\t\t// Hierarchical post type without taxonomies can only use ancestors.\n\t\t_showTerms = false;\n\t} else {\n\t\t// For hierarchical post types with taxonomies, use the attribute.\n\t\t_showTerms = prefersTaxonomy;\n\t}\n\tlet placeholder = null;\n\t// This is fragile because this block is server side rendered and we'll have to\n\t// update the placeholder html if the server side rendering output changes.\n\tconst showPlaceholder =\n\t\t! postId ||\n\t\t! postType ||\n\t\t// When `templateSlug` is set only show placeholder if the post type is not.\n\t\t// This is needed because when we are showing the template in post editor we\n\t\t// want to show the real breadcrumbs if we have the post type.\n\t\t( templateSlug && ! postType ) ||\n\t\t( ! _showTerms && ! isPostTypeHierarchical ) ||\n\t\t( _showTerms && ! hasTermsAssigned );\n\tif ( showPlaceholder ) {\n\t\tconst placeholderItems = [];\n\t\tif ( showHomeItem ) {\n\t\t\tplaceholderItems.push( __( 'Home' ) );\n\t\t}\n\t\tif ( templateSlug && ! postId ) {\n\t\t\tplaceholderItems.push( __( 'Page' ) );\n\t\t} else if ( _showTerms ) {\n\t\t\tplaceholderItems.push( __( 'Category' ) );\n\t\t} else {\n\t\t\tplaceholderItems.push( __( 'Ancestor' ), __( 'Parent' ) );\n\t\t}\n\t\tplaceholder = (\n\t\t\t<nav\n\t\t\t\tstyle={ {\n\t\t\t\t\t'--separator': `'${ separator }'`,\n\t\t\t\t} }\n\t\t\t\tinert=\"true\"\n\t\t\t>\n\t\t\t\t<ol>\n\t\t\t\t\t{ placeholderItems.map( ( text, index ) => (\n\t\t\t\t\t\t<li key={ index }>\n\t\t\t\t\t\t\t<a href={ `#breadcrumbs-pseudo-link-${ index }` }>\n\t\t\t\t\t\t\t\t{ text }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) ) }\n\t\t\t\t\t{ showCurrentItem && (\n\t\t\t\t\t\t<li>\n\t\t\t\t\t\t\t<span aria-current=\"page\">{ __( 'Current' ) }</span>\n\t\t\t\t\t\t</li>\n\t\t\t\t\t) }\n\t\t\t\t</ol>\n\t\t\t</nav>\n\t\t);\n\t}\n\treturn (\n\t\t<>\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\tseparator: separatorDefaultValue,\n\t\t\t\t\t\t\tshowHomeItem: true,\n\t\t\t\t\t\t\tshowCurrentItem: true,\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\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showHomeItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowHomeItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show home breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showHomeItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showHomeItem }\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\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => ! showCurrentItem }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tshowCurrentItem: true,\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Show current breadcrumb' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { showCurrentItem: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ showCurrentItem }\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\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => separator !== separatorDefaultValue }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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\t<TextControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\tlabel={ __( 'Separator' ) }\n\t\t\t\t\t\t\tvalue={ separator }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { separator: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\t\tif ( ! separator ) {\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tseparator: separatorDefaultValue,\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</ToolsPanelItem>\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Show on homepage' ) }\n\t\t\t\t\tchecked={ showOnHomePage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { showOnHomePage: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'If this breadcrumbs block appears in a template or template part that\u2019s shown on the homepage, enable this option to display the breadcrumb trail. Otherwise, this setting has no effect.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t\t<CheckboxControl\n\t\t\t\t\tlabel={ __( 'Prefer taxonomy terms' ) }\n\t\t\t\t\tchecked={ prefersTaxonomy }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { prefersTaxonomy: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t'The exact type of breadcrumbs shown will vary automatically depending on the page in which this block is displayed. In the specific case of a hierarchical post type with taxonomies, the breadcrumbs can either reflect its post hierarchy (default) or the hierarchy of its assigned taxonomy terms.'\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ showPlaceholder ? (\n\t\t\t\t\tplaceholder\n\t\t\t\t) : (\n\t\t\t\t\t<RawHTML inert=\"true\">{ content }</RawHTML>\n\t\t\t\t) }\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|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
|
merge: (a, { text = "" }) => ({
|
|
25
25
|
...a,
|
|
26
26
|
text: (a.text || "") + text
|
|
27
|
-
})
|
|
27
|
+
}),
|
|
28
|
+
__experimentalLabel(attributes, { context }) {
|
|
29
|
+
const { text } = attributes;
|
|
30
|
+
const customName = attributes?.metadata?.name;
|
|
31
|
+
const hasContent = text?.trim().length > 0;
|
|
32
|
+
if (context === "list-view" && (customName || hasContent)) {
|
|
33
|
+
return customName || text;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
28
36
|
};
|
|
29
37
|
if (window.__experimentalContentOnlyInspectorFields) {
|
|
30
38
|
settings[fieldsKey] = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/button/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'text',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'text' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY;AAC/B,SAAS,eAAe,yBAAyB;AAKjD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AACvB,OAAO,UAAU;AACjB,OAAO,cAAc;AACrB,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB,IAAM,EAAE,WAAW,QAAQ,IAAI,OAAQ,iBAAkB;AAEzD,IAAM,EAAE,KAAK,IAAI;AAIV,IAAM,WAAW;AAAA,EACvB;AAAA,EACA,SAAS;AAAA,IACR,YAAY;AAAA,MACX,WAAW;AAAA,MACX,MAAM,GAAI,gBAAiB;AAAA,IAC5B;AAAA,EACD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO,CAAE,GAAG,EAAE,OAAO,GAAG,OAAS;AAAA,IAChC,GAAG;AAAA,IACH,OAAQ,EAAE,QAAQ,MAAO;AAAA,EAC1B;AACD;AAEA,IAAK,OAAO,0CAA2C;AACtD,WAAU,SAAU,IAAI;AAAA,IACvB;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,SAAU;AAAA,MACrB,MAAM;AAAA,IACP;AAAA,IACA;AAAA,MACC,IAAI;AAAA,MACJ,OAAO,GAAI,MAAO;AAAA,MAClB,MAAM;AAAA,MACN,SAAS;AAAA,QACR,KAAK;AAAA,QACL,KAAK;AAAA,QACL,YAAY;AAAA,MACb;AAAA,IACD;AAAA,EACD;AACA,WAAU,OAAQ,IAAI;AAAA,IACrB,QAAQ,CAAE,MAAO;AAAA,EAClB;AACD;AAEO,IAAM,OAAO,MAAM,UAAW,EAAE,MAAM,UAAU,SAAS,CAAE;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { button as icon } from '@wordpress/icons';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\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 { unlock } from '../lock-unlock';\n\nconst { fieldsKey, formKey } = unlock( blocksPrivateApis );\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tclassName: 'is-style-fill',\n\t\t\ttext: __( 'Call to action' ),\n\t\t},\n\t},\n\tedit,\n\tsave,\n\tdeprecated,\n\tmerge: ( a, { text = '' } ) => ( {\n\t\t...a,\n\t\ttext: ( a.text || '' ) + text,\n\t} ),\n\t__experimentalLabel( attributes, { context } ) {\n\t\tconst { text } = attributes;\n\n\t\tconst customName = attributes?.metadata?.name;\n\t\tconst hasContent = text?.trim().length > 0;\n\n\t\t// In the list view, use the block's text as the label.\n\t\t// If the text is empty, fall back to the default label.\n\t\tif ( context === 'list-view' && ( customName || hasContent ) ) {\n\t\t\treturn customName || text;\n\t\t}\n\t},\n};\n\nif ( window.__experimentalContentOnlyInspectorFields ) {\n\tsettings[ fieldsKey ] = [\n\t\t{\n\t\t\tid: 'text',\n\t\t\tlabel: __( 'Content' ),\n\t\t\ttype: 'richtext',\n\t\t},\n\t\t{\n\t\t\tid: 'link',\n\t\t\tlabel: __( 'Link' ),\n\t\t\ttype: 'link',\n\t\t\tmapping: {\n\t\t\t\turl: 'url',\n\t\t\t\trel: 'rel',\n\t\t\t\tlinkTarget: 'linkTarget',\n\t\t\t},\n\t\t},\n\t];\n\tsettings[ formKey ] = {\n\t\tfields: [ 'text' ],\n\t};\n}\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SA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
|
|
7
7
|
}
|
|
@@ -15,9 +15,6 @@
|
|
|
15
15
|
"linkTarget": {
|
|
16
16
|
"type": "string",
|
|
17
17
|
"default": "_self"
|
|
18
|
-
},
|
|
19
|
-
"textAlign": {
|
|
20
|
-
"type": "string"
|
|
21
18
|
}
|
|
22
19
|
},
|
|
23
20
|
"usesContext": [ "commentId" ],
|
|
@@ -39,6 +36,7 @@
|
|
|
39
36
|
"typography": {
|
|
40
37
|
"fontSize": true,
|
|
41
38
|
"lineHeight": true,
|
|
39
|
+
"textAlign": true,
|
|
42
40
|
"__experimentalFontFamily": true,
|
|
43
41
|
"__experimentalFontWeight": true,
|
|
44
42
|
"__experimentalFontStyle": true,
|
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
// packages/block-library/src/comment-author-name/deprecated.js
|
|
2
2
|
import migrateFontFamily from "../utils/migrate-font-family.js";
|
|
3
|
+
import migrateTextAlign from "../utils/migrate-text-align.js";
|
|
4
|
+
var v2 = {
|
|
5
|
+
attributes: {
|
|
6
|
+
isLink: {
|
|
7
|
+
type: "boolean",
|
|
8
|
+
default: true
|
|
9
|
+
},
|
|
10
|
+
linkTarget: {
|
|
11
|
+
type: "string",
|
|
12
|
+
default: "_self"
|
|
13
|
+
},
|
|
14
|
+
textAlign: {
|
|
15
|
+
type: "string"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
usesContext: ["commentId"],
|
|
19
|
+
supports: {
|
|
20
|
+
html: false,
|
|
21
|
+
spacing: {
|
|
22
|
+
margin: true,
|
|
23
|
+
padding: true
|
|
24
|
+
},
|
|
25
|
+
color: {
|
|
26
|
+
gradients: true,
|
|
27
|
+
link: true
|
|
28
|
+
},
|
|
29
|
+
typography: {
|
|
30
|
+
fontSize: true,
|
|
31
|
+
lineHeight: true,
|
|
32
|
+
__experimentalFontFamily: true,
|
|
33
|
+
__experimentalFontWeight: true,
|
|
34
|
+
__experimentalFontStyle: true,
|
|
35
|
+
__experimentalTextTransform: true,
|
|
36
|
+
__experimentalTextDecoration: true,
|
|
37
|
+
__experimentalLetterSpacing: true
|
|
38
|
+
},
|
|
39
|
+
interactivity: {
|
|
40
|
+
clientNavigation: true
|
|
41
|
+
},
|
|
42
|
+
__experimentalBorder: {
|
|
43
|
+
radius: true,
|
|
44
|
+
color: true,
|
|
45
|
+
width: true,
|
|
46
|
+
style: true
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
save() {
|
|
50
|
+
return null;
|
|
51
|
+
},
|
|
52
|
+
migrate: migrateTextAlign,
|
|
53
|
+
isEligible(attributes) {
|
|
54
|
+
return !!attributes.textAlign || !!attributes.className?.match(
|
|
55
|
+
/\bhas-text-align-(left|center|right)\b/
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
3
59
|
var v1 = {
|
|
4
60
|
attributes: {
|
|
5
61
|
isLink: {
|
|
@@ -35,7 +91,7 @@ var v1 = {
|
|
|
35
91
|
return style?.typography?.fontFamily;
|
|
36
92
|
}
|
|
37
93
|
};
|
|
38
|
-
var deprecated_default = [v1];
|
|
94
|
+
var deprecated_default = [v2, v1];
|
|
39
95
|
export {
|
|
40
96
|
deprecated_default as default
|
|
41
97
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-author-name/deprecated.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\n\nconst v1 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v1 ];\n"],
|
|
5
|
-
"mappings": ";AAGA,OAAO,uBAAuB;
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport migrateFontFamily from '../utils/migrate-font-family';\nimport migrateTextAlign from '../utils/migrate-text-align';\n\nconst v2 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: true,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t\ttextAlign: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tusesContext: [ 'commentId' ],\n\tsupports: {\n\t\thtml: false,\n\t\tspacing: {\n\t\t\tmargin: true,\n\t\t\tpadding: true,\n\t\t},\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalTextDecoration: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t\tinteractivity: {\n\t\t\tclientNavigation: true,\n\t\t},\n\t\t__experimentalBorder: {\n\t\t\tradius: true,\n\t\t\tcolor: true,\n\t\t\twidth: true,\n\t\t\tstyle: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateTextAlign,\n\tisEligible( attributes ) {\n\t\treturn (\n\t\t\t!! attributes.textAlign ||\n\t\t\t!! attributes.className?.match(\n\t\t\t\t/\\bhas-text-align-(left|center|right)\\b/\n\t\t\t)\n\t\t);\n\t},\n};\n\nconst v1 = {\n\tattributes: {\n\t\tisLink: {\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\tlinkTarget: {\n\t\t\ttype: 'string',\n\t\t\tdefault: '_self',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tcolor: {\n\t\t\tgradients: true,\n\t\t\tlink: true,\n\t\t},\n\t\ttypography: {\n\t\t\tfontSize: true,\n\t\t\tlineHeight: true,\n\t\t\t__experimentalFontFamily: true,\n\t\t\t__experimentalFontWeight: true,\n\t\t\t__experimentalFontStyle: true,\n\t\t\t__experimentalTextTransform: true,\n\t\t\t__experimentalLetterSpacing: true,\n\t\t},\n\t},\n\tsave() {\n\t\treturn null;\n\t},\n\tmigrate: migrateFontFamily,\n\tisEligible( { style } ) {\n\t\treturn style?.typography?.fontFamily;\n\t},\n};\n\n/**\n * New deprecations need to be placed first\n * for them to have higher priority.\n *\n * Old deprecations may need to be updated as well.\n *\n * See block-deprecation.md\n */\nexport default [ v2, v1 ];\n"],
|
|
5
|
+
"mappings": ";AAGA,OAAO,uBAAuB;AAC9B,OAAO,sBAAsB;AAE7B,IAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,QAAQ;AAAA,MACP,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,YAAY;AAAA,MACX,MAAM;AAAA,MACN,SAAS;AAAA,IACV;AAAA,IACA,WAAW;AAAA,MACV,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,aAAa,CAAE,WAAY;AAAA,EAC3B,UAAU;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,MACR,QAAQ;AAAA,MACR,SAAS;AAAA,IACV;AAAA,IACA,OAAO;AAAA,MACN,WAAW;AAAA,MACX,MAAM;AAAA,IACP;A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name/edit.js
|
|
2
|
-
import clsx from "clsx";
|
|
3
2
|
import { __, _x } from "@wordpress/i18n";
|
|
4
3
|
import { useSelect } from "@wordpress/data";
|
|
5
|
-
import {
|
|
6
|
-
AlignmentControl,
|
|
7
|
-
BlockControls,
|
|
8
|
-
InspectorControls,
|
|
9
|
-
useBlockProps
|
|
10
|
-
} from "@wordpress/block-editor";
|
|
4
|
+
import { InspectorControls, useBlockProps } from "@wordpress/block-editor";
|
|
11
5
|
import { store as coreStore } from "@wordpress/core-data";
|
|
12
6
|
import {
|
|
13
7
|
ToggleControl,
|
|
@@ -15,18 +9,17 @@ import {
|
|
|
15
9
|
__experimentalToolsPanelItem as ToolsPanelItem
|
|
16
10
|
} from "@wordpress/components";
|
|
17
11
|
import { useToolsPanelDropdownMenuProps } from "../utils/hooks.js";
|
|
12
|
+
import useDeprecatedTextAlign from "../utils/deprecated-text-align-attributes.js";
|
|
18
13
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
|
-
function Edit({
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
function Edit(props) {
|
|
15
|
+
const {
|
|
16
|
+
attributes: { isLink, linkTarget },
|
|
17
|
+
context: { commentId },
|
|
18
|
+
setAttributes
|
|
19
|
+
} = props;
|
|
20
|
+
useDeprecatedTextAlign(props);
|
|
24
21
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
25
|
-
const blockProps = useBlockProps(
|
|
26
|
-
className: clsx({
|
|
27
|
-
[`has-text-align-${textAlign}`]: textAlign
|
|
28
|
-
})
|
|
29
|
-
});
|
|
22
|
+
const blockProps = useBlockProps();
|
|
30
23
|
let displayName = useSelect(
|
|
31
24
|
(select) => {
|
|
32
25
|
const { getEntityRecord } = select(coreStore);
|
|
@@ -40,13 +33,6 @@ function Edit({
|
|
|
40
33
|
},
|
|
41
34
|
[commentId]
|
|
42
35
|
);
|
|
43
|
-
const blockControls = /* @__PURE__ */ jsx(BlockControls, { group: "block", children: /* @__PURE__ */ jsx(
|
|
44
|
-
AlignmentControl,
|
|
45
|
-
{
|
|
46
|
-
value: textAlign,
|
|
47
|
-
onChange: (newAlign) => setAttributes({ textAlign: newAlign })
|
|
48
|
-
}
|
|
49
|
-
) });
|
|
50
36
|
const inspectorControls = /* @__PURE__ */ jsx(InspectorControls, { children: /* @__PURE__ */ jsxs(
|
|
51
37
|
ToolsPanel,
|
|
52
38
|
{
|
|
@@ -115,7 +101,6 @@ function Edit({
|
|
|
115
101
|
) : displayName;
|
|
116
102
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
117
103
|
inspectorControls,
|
|
118
|
-
blockControls,
|
|
119
104
|
/* @__PURE__ */ jsx("div", { ...blockProps, children: displayAuthor })
|
|
120
105
|
] });
|
|
121
106
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/comment-author-name/edit.js"],
|
|
4
|
-
"sourcesContent": ["/**\n *
|
|
5
|
-
"mappings": ";AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { InspectorControls, useBlockProps } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tToggleControl,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\nimport useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';\n\n/**\n * Renders the `core/comment-author-name` block on the editor.\n *\n * @param {Object} props React props.\n * @param {Object} props.setAttributes Callback for updating block attributes.\n * @param {Object} props.attributes Block attributes.\n * @param {string} props.attributes.isLink Whether the author name should be linked.\n * @param {string} props.attributes.linkTarget Target of the link.\n * @param {Object} props.context Inherited context.\n * @param {string} props.context.commentId The comment ID.\n *\n * @return {JSX.Element} React element.\n */\nexport default function Edit( props ) {\n\tconst {\n\t\tattributes: { isLink, linkTarget },\n\t\tcontext: { commentId },\n\t\tsetAttributes,\n\t} = props;\n\tuseDeprecatedTextAlign( props );\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\tconst blockProps = useBlockProps();\n\tlet displayName = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\tconst comment = getEntityRecord( 'root', 'comment', commentId );\n\t\t\tconst authorName = comment?.author_name;\n\n\t\t\tif ( comment && ! authorName ) {\n\t\t\t\tconst user = getEntityRecord( 'root', 'user', comment.author );\n\t\t\t\treturn user?.name ?? __( 'Anonymous' );\n\t\t\t}\n\t\t\treturn authorName ?? '';\n\t\t},\n\t\t[ commentId ]\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\tisLink: true,\n\t\t\t\t\t\tlinkTarget: '_self',\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\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\tisShownByDefault\n\t\t\t\t\thasValue={ () => ! isLink }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tisLink: true,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Link to authors URL' ) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t\t{ isLink && (\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\thasValue={ () => linkTarget !== '_self' }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlinkTarget: '_self',\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\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Open in new tab' ) }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tlinkTarget: value ? '_blank' : '_self',\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchecked={ linkTarget === '_blank' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t) }\n\t\t\t</ToolsPanel>\n\t\t</InspectorControls>\n\t);\n\n\tif ( ! commentId || ! displayName ) {\n\t\tdisplayName = _x( 'Comment Author', 'block title' );\n\t}\n\n\tconst displayAuthor = isLink ? (\n\t\t<a\n\t\t\thref=\"#comment-author-pseudo-link\"\n\t\t\tonClick={ ( event ) => event.preventDefault() }\n\t\t>\n\t\t\t{ displayName }\n\t\t</a>\n\t) : (\n\t\tdisplayName\n\t);\n\treturn (\n\t\t<>\n\t\t\t{ inspectorControls }\n\t\t\t<div { ...blockProps }>{ displayAuthor }</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,IAAI,UAAU;AACvB,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB,qBAAqB;AACjD,SAAS,SAAS,iBAAiB;AACnC;AAAA,EACC;AAAA,EACA,4BAA4B;AAAA,EAC5B,gCAAgC;AAAA,OAC1B;AAKP,SAAS,sCAAsC;AAC/C,OAAO,4BAA4B;AA0ChC,SAmED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