@wordpress/block-library 9.13.0 → 9.13.1-next.a9f418477.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/build/block/edit.js +2 -29
- package/build/block/edit.js.map +1 -1
- package/build/cover/edit/index.js +4 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +6 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/form/index.js +1 -2
- package/build/form/index.js.map +1 -1
- package/build/form/view.js +10 -5
- package/build/form/view.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +2 -2
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +9 -2
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation-link/edit.js +1 -2
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +3 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/recursion-detector.js +0 -1
- package/build/pattern/recursion-detector.js.map +1 -1
- package/build/query/edit/index.js +2 -2
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +0 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +0 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
- package/build/query/edit/pattern-selection.js.map +1 -0
- package/build/query/edit/query-content.js +5 -8
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +5 -11
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +31 -11
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/separator/deprecated.js +2 -1
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +29 -4
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +5 -0
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +3 -2
- package/build/separator/save.js.map +1 -1
- package/build/template-part/edit/import-controls.js +0 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build-module/block/edit.js +3 -30
- package/build-module/block/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +6 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/form/index.js +1 -2
- package/build-module/form/index.js.map +1 -1
- package/build-module/form/view.js +10 -5
- package/build-module/form/view.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +2 -2
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +3 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +0 -1
- package/build-module/pattern/recursion-detector.js.map +1 -1
- package/build-module/query/edit/index.js +1 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +0 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
- package/build-module/query/edit/pattern-selection.js.map +1 -0
- package/build-module/query/edit/query-content.js +5 -8
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +6 -12
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +31 -13
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/separator/deprecated.js +2 -1
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +32 -7
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +5 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +3 -2
- package/build-module/separator/save.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +0 -1
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-style/button/style-rtl.css +3 -3
- package/build-style/button/style.css +3 -3
- package/build-style/comments/editor-rtl.css +1 -1
- package/build-style/comments/editor.css +1 -1
- package/build-style/comments/style-rtl.css +1 -1
- package/build-style/comments/style.css +1 -1
- package/build-style/comments-pagination/editor-rtl.css +1 -0
- package/build-style/comments-pagination/editor.css +1 -0
- package/build-style/comments-pagination/style-rtl.css +1 -0
- package/build-style/comments-pagination/style.css +1 -0
- package/build-style/common-rtl.css +17 -17
- package/build-style/common.css +17 -17
- package/build-style/editor-rtl.css +72 -41
- package/build-style/editor.css +72 -41
- package/build-style/gallery/style-rtl.css +2 -2
- package/build-style/gallery/style.css +2 -2
- package/build-style/heading/style-rtl.css +11 -11
- package/build-style/heading/style.css +11 -11
- package/build-style/image/style-rtl.css +4 -3
- package/build-style/image/style.css +4 -3
- package/build-style/latest-comments/style-rtl.css +4 -4
- package/build-style/latest-comments/style.css +4 -4
- package/build-style/latest-posts/style-rtl.css +2 -1
- package/build-style/latest-posts/style.css +2 -1
- package/build-style/more/editor-rtl.css +1 -1
- package/build-style/more/editor.css +1 -1
- package/build-style/nextpage/editor-rtl.css +1 -1
- package/build-style/nextpage/editor.css +1 -1
- package/build-style/post-comments-form/style-rtl.css +2 -2
- package/build-style/post-comments-form/style.css +2 -2
- package/build-style/post-featured-image/editor-rtl.css +27 -27
- package/build-style/post-featured-image/editor.css +27 -27
- package/build-style/pullquote/style-rtl.css +1 -0
- package/build-style/pullquote/style.css +1 -0
- package/build-style/query/editor-rtl.css +30 -0
- package/build-style/query/editor.css +30 -0
- package/build-style/read-more/style-rtl.css +2 -2
- package/build-style/read-more/style.css +2 -2
- package/build-style/social-link/editor-rtl.css +2 -2
- package/build-style/social-link/editor.css +2 -2
- package/build-style/social-links/editor-rtl.css +2 -2
- package/build-style/social-links/editor.css +2 -2
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +55 -51
- package/build-style/style.css +55 -51
- package/build-style/text-columns/style-rtl.css +3 -3
- package/build-style/text-columns/style.css +3 -3
- package/build-types/lock-unlock.d.ts +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/package.json +35 -34
- package/src/block/edit.js +6 -51
- package/src/comments-pagination/editor.scss +1 -0
- package/src/comments-pagination/style.scss +1 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/edit/inspector-controls.js +10 -3
- package/src/cover/index.php +2 -2
- package/src/form/block.json +1 -2
- package/src/form/index.php +1 -20
- package/src/form/view.js +18 -5
- package/src/image/style.scss +4 -3
- package/src/latest-posts/style.scss +2 -1
- package/src/list-item/hooks/use-merge.js +2 -2
- package/src/missing/test/edit.native.js +0 -1
- package/src/navigation/README.md +1 -0
- package/src/navigation/edit/deleted-navigation-warning.js +11 -2
- package/src/navigation/index.php +9 -35
- package/src/navigation-link/edit.js +0 -6
- package/src/navigation-submenu/edit.js +5 -6
- package/src/navigation-submenu/index.php +17 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/edit/index.js +1 -1
- package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
- package/src/query/edit/query-content.js +4 -10
- package/src/query/edit/query-placeholder.js +5 -14
- package/src/query/edit/query-toolbar.js +38 -17
- package/src/query/editor.scss +30 -0
- package/src/search/index.php +3 -3
- package/src/separator/block.json +5 -0
- package/src/separator/deprecated.js +1 -0
- package/src/separator/edit.js +28 -3
- package/src/separator/save.js +2 -2
- package/src/separator/test/edit.js +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +0 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_patternSelection","_interopRequireWildcard","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","QueryToolbar","clientId","attributes","hasPatterns","useBlockPatterns","length","jsx","ToolbarGroup","className","children","__experimentalDropdownContentWrapper","Dropdown","contentClassName","focusOnMount","expandOnMobile","renderToggle","isOpen","onToggle","ToolbarButton","onClick","__","renderContent","showSearch","showTitlesAsTooltip"],"sources":["@wordpress/block-library/src/query/edit/query-toolbar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tToolbarGroup,\n\tToolbarButton,\n\tDropdown,\n\t__experimentalDropdownContentWrapper as DropdownContentWrapper,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport PatternSelection, { useBlockPatterns } from './pattern-selection';\n\nexport default function QueryToolbar( { clientId, attributes } ) {\n\tconst hasPatterns = useBlockPatterns( clientId, attributes ).length;\n\tif ( ! hasPatterns ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<ToolbarGroup className=\"wp-block-template-part__block-control-group\">\n\t\t\t<DropdownContentWrapper>\n\t\t\t\t<Dropdown\n\t\t\t\t\tcontentClassName=\"block-editor-block-settings-menu__popover\"\n\t\t\t\t\tfocusOnMount=\"firstElement\"\n\t\t\t\t\texpandOnMobile\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\taria-haspopup=\"true\"\n\t\t\t\t\t\t\taria-expanded={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Change design' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<PatternSelection\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\t\t\tshowSearch={ false }\n\t\t\t\t\t\t\tshowTitlesAsTooltip\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</DropdownContentWrapper>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAMA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,iBAAA,GAAAC,uBAAA,CAAAH,OAAA;AAAyE,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CA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AAW,QAAE,EAAE,eAAgB;QAAC,CACT,CACb;QACHC,aAAa,EAAGA,CAAA,kBACf,IAAA1C,WAAA,CAAA2B,GAAA,EAAC7B,iBAAA,CAAAS,OAAgB;UAChBe,QAAQ,EAAGA,QAAU;UACrBC,UAAU,EAAGA,UAAY;UACzBoB,UAAU,EAAG,KAAO;UACpBC,mBAAmB;QAAA,CACnB;MACC,CACH;IAAC,CACqB;EAAC,CACZ,CAAC;AAEjB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,IAAAE,WAAA,GAAAF,OAAA;AAR3E;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP,CAAC;IACDC,WAAW,EAAE;MACZD,IAAI,EAAE;IACP;EACD,CAAC;EACDE,IAAIA,CAAE;IAAEJ;EAAW,CAAC,EAAG;IACtB,MAAM;MAAEC,KAAK;MAAEE;IAAY,CAAC,GAAGH,UAAU;;IAEzC;IACA;IACA,MAAMK,eAAe,GAAG,IAAAC,8BAAiB,EAAE,kBAAkB,EAAEL,KAAM,CAAC;IACtE;IACA;IACA,MAAMM,UAAU,GAAG,IAAAD,8BAAiB,EAAE,OAAO,EAAEL,KAAM,CAAC;IAEtD,MAAMO,SAAS,GAAG,IAAAC,aAAI,EAAE;MACvB,+BAA+B,EAAER,KAAK,IAAIE,WAAW;MACrD,CAAEE,eAAe,GAAIA,eAAe;MACpC,CAAEE,UAAU,GAAIA;IACjB,CAAE,CAAC;IAEH,MAAMG,KAAK,GAAG;MACbC,eAAe,EAAEN,eAAe,GAAGO,SAAS,GAAGT,WAAW;MAC1DF,KAAK,EAAEM,UAAU,GAAGK,SAAS,GAAGT;IACjC,CAAC;IAED,oBAAO,IAAAL,WAAA,CAAAe,GAAA;MAAA,GAASC,0BAAa,CAACV,IAAI,CAAE;QAAEI,SAAS;QAAEE;MAAM,CAAE;IAAC,CAAI,CAAC;EAChE,CAAC;EACDK,OAAOA,CAAEf,UAAU,EAAG;IACrB,MAAM;MAAEC,KAAK;MAAEE,WAAW;MAAE,GAAGa;IAAe,CAAC,GAAGhB,UAAU;IAC5D,OAAO;MACN,GAAGgB,cAAc;MACjBL,eAAe,EAAEV,KAAK,GAAGA,KAAK,GAAGW,SAAS;MAC1CK,OAAO,EAAE,KAAK;MACdP,KAAK,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS;
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","v1","attributes","color","type","customColor","save","backgroundClass","getColorClassName","colorClass","className","clsx","style","backgroundColor","undefined","jsx","useBlockProps","migrate","restAttributes","opacity","background","tagName","_default","exports","default"],"sources":["@wordpress/block-library/src/separator/deprecated.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { getColorClassName, useBlockProps } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\tcolor: {\n\t\t\ttype: 'string',\n\t\t},\n\t\tcustomColor: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsave( { attributes } ) {\n\t\tconst { color, customColor } = attributes;\n\n\t\t// the hr support changing color using border-color, since border-color\n\t\t// is not yet supported in the color palette, we use background-color\n\t\tconst backgroundClass = getColorClassName( 'background-color', color );\n\t\t// the dots styles uses text for the dots, to change those dots color is\n\t\t// using color, not backgroundColor\n\t\tconst colorClass = getColorClassName( 'color', color );\n\n\t\tconst className = clsx( {\n\t\t\t'has-text-color has-background': color || customColor,\n\t\t\t[ backgroundClass ]: backgroundClass,\n\t\t\t[ colorClass ]: colorClass,\n\t\t} );\n\n\t\tconst style = {\n\t\t\tbackgroundColor: backgroundClass ? undefined : customColor,\n\t\t\tcolor: colorClass ? undefined : customColor,\n\t\t};\n\n\t\treturn <hr { ...useBlockProps.save( { className, style } ) } />;\n\t},\n\tmigrate( attributes ) {\n\t\tconst { color, customColor, ...restAttributes } = attributes;\n\t\treturn {\n\t\t\t...restAttributes,\n\t\t\tbackgroundColor: color ? color : undefined,\n\t\t\topacity: 'css',\n\t\t\tstyle: customColor\n\t\t\t\t? { color: { background: customColor } }\n\t\t\t\t: undefined,\n\t\t\ttagName: 'hr',\n\t\t};\n\t},\n};\n\nexport default [ v1 ];\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAA2E,IAAAE,WAAA,GAAAF,OAAA;AAR3E;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMG,EAAE,GAAG;EACVC,UAAU,EAAE;IACXC,KAAK,EAAE;MACNC,IAAI,EAAE;IACP,CAAC;IACDC,WAAW,EAAE;MACZD,IAAI,EAAE;IACP;EACD,CAAC;EACDE,IAAIA,CAAE;IAAEJ;EAAW,CAAC,EAAG;IACtB,MAAM;MAAEC,KAAK;MAAEE;IAAY,CAAC,GAAGH,UAAU;;IAEzC;IACA;IACA,MAAMK,eAAe,GAAG,IAAAC,8BAAiB,EAAE,kBAAkB,EAAEL,KAAM,CAAC;IACtE;IACA;IACA,MAAMM,UAAU,GAAG,IAAAD,8BAAiB,EAAE,OAAO,EAAEL,KAAM,CAAC;IAEtD,MAAMO,SAAS,GAAG,IAAAC,aAAI,EAAE;MACvB,+BAA+B,EAAER,KAAK,IAAIE,WAAW;MACrD,CAAEE,eAAe,GAAIA,eAAe;MACpC,CAAEE,UAAU,GAAIA;IACjB,CAAE,CAAC;IAEH,MAAMG,KAAK,GAAG;MACbC,eAAe,EAAEN,eAAe,GAAGO,SAAS,GAAGT,WAAW;MAC1DF,KAAK,EAAEM,UAAU,GAAGK,SAAS,GAAGT;IACjC,CAAC;IAED,oBAAO,IAAAL,WAAA,CAAAe,GAAA;MAAA,GAASC,0BAAa,CAACV,IAAI,CAAE;QAAEI,SAAS;QAAEE;MAAM,CAAE;IAAC,CAAI,CAAC;EAChE,CAAC;EACDK,OAAOA,CAAEf,UAAU,EAAG;IACrB,MAAM;MAAEC,KAAK;MAAEE,WAAW;MAAE,GAAGa;IAAe,CAAC,GAAGhB,UAAU;IAC5D,OAAO;MACN,GAAGgB,cAAc;MACjBL,eAAe,EAAEV,KAAK,GAAGA,KAAK,GAAGW,SAAS;MAC1CK,OAAO,EAAE,KAAK;MACdP,KAAK,EAAEP,WAAW,GACf;QAAEF,KAAK,EAAE;UAAEiB,UAAU,EAAEf;QAAY;MAAE,CAAC,GACtCS,SAAS;MACZO,OAAO,EAAE;IACV,CAAC;EACF;AACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa,CAAEvB,EAAE,CAAE","ignoreList":[]}
|
package/build/separator/edit.js
CHANGED
|
@@ -8,6 +8,7 @@ exports.default = SeparatorEdit;
|
|
|
8
8
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
9
9
|
var _components = require("@wordpress/components");
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
12
|
var _useDeprecatedOpacity = _interopRequireDefault(require("./use-deprecated-opacity"));
|
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
14
|
/**
|
|
@@ -22,6 +23,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
22
23
|
* Internal dependencies
|
|
23
24
|
*/
|
|
24
25
|
|
|
26
|
+
const htmlElementMessages = {
|
|
27
|
+
div: (0, _i18n.__)('The <div> element should only be used if the separator is a design element that should not be announced.')
|
|
28
|
+
};
|
|
25
29
|
function SeparatorEdit({
|
|
26
30
|
attributes,
|
|
27
31
|
setAttributes
|
|
@@ -29,7 +33,8 @@ function SeparatorEdit({
|
|
|
29
33
|
const {
|
|
30
34
|
backgroundColor,
|
|
31
35
|
opacity,
|
|
32
|
-
style
|
|
36
|
+
style,
|
|
37
|
+
tagName
|
|
33
38
|
} = attributes;
|
|
34
39
|
const colorProps = (0, _blockEditor.__experimentalUseColorProps)(attributes);
|
|
35
40
|
const currentColor = colorProps?.style?.backgroundColor;
|
|
@@ -49,13 +54,33 @@ function SeparatorEdit({
|
|
|
49
54
|
color: currentColor,
|
|
50
55
|
backgroundColor: currentColor
|
|
51
56
|
};
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
const Wrapper = tagName === 'hr' ? _components.HorizontalRule : tagName;
|
|
58
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InspectorControls, {
|
|
60
|
+
group: "advanced",
|
|
61
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.SelectControl, {
|
|
62
|
+
__nextHasNoMarginBottom: true,
|
|
63
|
+
__next40pxDefaultSize: true,
|
|
64
|
+
label: (0, _i18n.__)('HTML element'),
|
|
65
|
+
options: [{
|
|
66
|
+
label: (0, _i18n.__)('Default (<hr>)'),
|
|
67
|
+
value: 'hr'
|
|
68
|
+
}, {
|
|
69
|
+
label: '<div>',
|
|
70
|
+
value: 'div'
|
|
71
|
+
}],
|
|
72
|
+
value: tagName,
|
|
73
|
+
onChange: value => setAttributes({
|
|
74
|
+
tagName: value
|
|
75
|
+
}),
|
|
76
|
+
help: htmlElementMessages[tagName]
|
|
77
|
+
})
|
|
78
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(Wrapper, {
|
|
54
79
|
...(0, _blockEditor.useBlockProps)({
|
|
55
80
|
className,
|
|
56
81
|
style: hasCustomColor ? styles : undefined
|
|
57
82
|
})
|
|
58
|
-
})
|
|
83
|
+
})]
|
|
59
84
|
});
|
|
60
85
|
}
|
|
61
86
|
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_useDeprecatedOpacity","_jsxRuntime","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_blockEditor","_i18n","_useDeprecatedOpacity","_jsxRuntime","htmlElementMessages","div","__","SeparatorEdit","attributes","setAttributes","backgroundColor","opacity","style","tagName","colorProps","useColorProps","currentColor","hasCustomColor","color","background","useDeprecatedOpacity","colorClass","getColorClassName","className","clsx","styles","Wrapper","HorizontalRule","jsxs","Fragment","children","jsx","InspectorControls","group","SelectControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help","useBlockProps","undefined"],"sources":["@wordpress/block-library/src/separator/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { HorizontalRule, SelectControl } from '@wordpress/components';\nimport {\n\tuseBlockProps,\n\tgetColorClassName,\n\t__experimentalUseColorProps as useColorProps,\n\tInspectorControls,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport useDeprecatedOpacity from './use-deprecated-opacity';\n\nconst htmlElementMessages = {\n\tdiv: __(\n\t\t'The <div> element should only be used if the separator is a design element that should not be announced.'\n\t),\n};\n\nexport default function SeparatorEdit( { attributes, setAttributes } ) {\n\tconst { backgroundColor, opacity, style, tagName } = attributes;\n\tconst colorProps = useColorProps( attributes );\n\tconst currentColor = colorProps?.style?.backgroundColor;\n\tconst hasCustomColor = !! style?.color?.background;\n\n\tuseDeprecatedOpacity( opacity, currentColor, setAttributes );\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || currentColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tcolor: currentColor,\n\t\tbackgroundColor: currentColor,\n\t};\n\tconst Wrapper = tagName === 'hr' ? HorizontalRule : tagName;\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<hr>)' ), value: 'hr' },\n\t\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<Wrapper\n\t\t\t\t{ ...useBlockProps( {\n\t\t\t\t\tclassName,\n\t\t\t\t\tstyle: hasCustomColor ? styles : undefined,\n\t\t\t\t} ) }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,qBAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA4D,IAAAK,WAAA,GAAAL,OAAA;AApB5D;AACA;AACA;;AAGA;AACA;AACA;;AAUA;AACA;AACA;;AAGA,MAAMM,mBAAmB,GAAG;EAC3BC,GAAG,EAAE,IAAAC,QAAE,EACN,0GACD;AACD,CAAC;AAEc,SAASC,aAAaA,CAAE;EAAEC,UAAU;EAAEC;AAAc,CAAC,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C;UAAEiC,KAAK,EAAE;QAAK,CAAC,EAC9C;UAAEF,KAAK,EAAE,OAAO;UAAEE,KAAK,EAAE;QAAM,CAAC,CAC9B;QACHA,KAAK,EAAG1B,OAAS;QACjB2B,QAAQ,EAAKD,KAAK,IACjB9B,aAAa,CAAE;UAAEI,OAAO,EAAE0B;QAAM,CAAE,CAClC;QACDE,IAAI,EAAGrC,mBAAmB,CAAES,OAAO;MAAI,CACvC;IAAC,CACgB,CAAC,eACpB,IAAAV,WAAA,CAAA4B,GAAA,EAACL,OAAO;MAAA,GACF,IAAAgB,0BAAa,EAAE;QACnBnB,SAAS;QACTX,KAAK,EAAEK,cAAc,GAAGQ,MAAM,GAAGkB;MAClC,CAAE;IAAC,CACH,CAAC;EAAA,CACD,CAAC;AAEL","ignoreList":[]}
|
package/build/separator/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,KAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,WAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,WAAA,GAAAJ,sBAAA,CAAAF,OAAA;AAbA;AACA;AACA;AAGA;AACA;AACA;AAFA,MAAAO,QAAA,GAAAC,OAAA,CAAAD,QAAA;EAAAE,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,OAAA;MAAAC,IAAA;MAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"names":["_icons","require","_initBlock","_interopRequireDefault","_edit","_save","_transforms","_deprecated","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","opacity","type","tagName","supports","anchor","align","color","enableContrastChecker","__experimentalSkipSerialization","gradients","background","text","__experimentalDefaultControls","spacing","margin","interactivity","clientNavigation","styles","label","isDefault","editorStyle","style","settings","icon","example","customColor","className","transforms","edit","save","deprecated","init","initBlock"],"sources":["@wordpress/block-library/src/separator/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { separator as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport edit from './edit';\nimport metadata from './block.json';\nimport save from './save';\nimport transforms from './transforms';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tcustomColor: '#065174',\n\t\t\tclassName: 'is-style-wide',\n\t\t},\n\t},\n\ttransforms,\n\tedit,\n\tsave,\n\tdeprecated,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"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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;EAAEvC,IAAI;EAAEJ,QAAQ;EAAEiC;AAAS,CAAE,CAAC;AAAChC,OAAA,CAAAyC,IAAA,GAAAA,IAAA","ignoreList":[]}
|
package/build/separator/save.js
CHANGED
|
@@ -22,7 +22,8 @@ function separatorSave({
|
|
|
22
22
|
const {
|
|
23
23
|
backgroundColor,
|
|
24
24
|
style,
|
|
25
|
-
opacity
|
|
25
|
+
opacity,
|
|
26
|
+
tagName: Tag
|
|
26
27
|
} = attributes;
|
|
27
28
|
const customColor = style?.color?.background;
|
|
28
29
|
const colorProps = (0, _blockEditor.__experimentalGetColorClassesAndStyles)(attributes);
|
|
@@ -42,7 +43,7 @@ function separatorSave({
|
|
|
42
43
|
backgroundColor: colorProps?.style?.backgroundColor,
|
|
43
44
|
color: colorClass ? undefined : customColor
|
|
44
45
|
};
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Tag, {
|
|
46
47
|
..._blockEditor.useBlockProps.save({
|
|
47
48
|
className,
|
|
48
49
|
style: styles
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_jsxRuntime","separatorSave","attributes","backgroundColor","style","opacity","tagName","Tag","customColor","color","background","colorProps","getColorClassesAndStyles","colorClass","getColorClassName","className","clsx","styles","undefined","jsx","useBlockProps","save"],"sources":["@wordpress/block-library/src/separator/save.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tgetColorClassName,\n\tuseBlockProps,\n\t__experimentalGetColorClassesAndStyles as getColorClassesAndStyles,\n} from '@wordpress/block-editor';\n\nexport default function separatorSave( { attributes } ) {\n\tconst { backgroundColor, style, opacity, tagName: Tag } = attributes;\n\tconst customColor = style?.color?.background;\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\t// The hr support changing color using border-color, since border-color\n\t// is not yet supported in the color palette, we use background-color.\n\n\t// The dots styles uses text for the dots, to change those dots color is\n\t// using color, not backgroundColor.\n\tconst colorClass = getColorClassName( 'color', backgroundColor );\n\n\tconst className = clsx(\n\t\t{\n\t\t\t'has-text-color': backgroundColor || customColor,\n\t\t\t[ colorClass ]: colorClass,\n\t\t\t'has-css-opacity': opacity === 'css',\n\t\t\t'has-alpha-channel-opacity': opacity === 'alpha-channel',\n\t\t},\n\t\tcolorProps.className\n\t);\n\n\tconst styles = {\n\t\tbackgroundColor: colorProps?.style?.backgroundColor,\n\t\tcolor: colorClass ? undefined : customColor,\n\t};\n\treturn <Tag { ...useBlockProps.save( { className, style: styles } ) } />;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAIiC,IAAAE,WAAA,GAAAF,OAAA;AAZjC;AACA;AACA;;AAGA;AACA;AACA;;AAOe,SAASG,aAAaA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACvD,MAAM;IAAEC,eAAe;IAAEC,KAAK;IAAEC,OAAO;IAAEC,OAAO,EAAEC;EAAI,CAAC,GAAGL,UAAU;EACpE,MAAMM,WAAW,GAAGJ,KAAK,EAAEK,KAAK,EAAEC,UAAU;EAC5C,MAAMC,UAAU,GAAG,IAAAC,mDAAwB,EAAEV,UAAW,CAAC;EACzD;EACA;;EAEA;EACA;EACA,MAAMW,UAAU,GAAG,IAAAC,8BAAiB,EAAE,OAAO,EAAEX,eAAgB,CAAC;EAEhE,MAAMY,SAAS,GAAG,IAAAC,aAAI,EACrB;IACC,gBAAgB,EAAEb,eAAe,IAAIK,WAAW;IAChD,CAAEK,UAAU,GAAIA,UAAU;IAC1B,iBAAiB,EAAER,OAAO,KAAK,KAAK;IACpC,2BAA2B,EAAEA,OAAO,KAAK;EAC1C,CAAC,EACDM,UAAU,CAACI,SACZ,CAAC;EAED,MAAME,MAAM,GAAG;IACdd,eAAe,EAAEQ,UAAU,EAAEP,KAAK,EAAED,eAAe;IACnDM,KAAK,EAAEI,UAAU,GAAGK,SAAS,GAAGV;EACjC,CAAC;EACD,oBAAO,IAAAR,WAAA,CAAAmB,GAAA,EAACZ,GAAG;IAAA,GAAMa,0BAAa,CAACC,IAAI,CAAE;MAAEN,SAAS;MAAEX,KAAK,EAAEa;IAAO,CAAE;EAAC,CAAI,CAAC;AACzE","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy || ! selectedSidebar }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_i18n","require","_element","_data","_components","_coreData","_notices","_hooks","_transformers","_jsxRuntime","SIDEBARS_QUERY","per_page","_fields","TemplatePartImportControls","area","setAttributes","selectedSidebar","setSelectedSidebar","useState","isBusy","setIsBusy","registry","useRegistry","sidebars","hasResolved","useSelect","select","getSidebars","hasFinishedResolution","coreStore","createErrorNotice","useDispatch","noticesStore","createFromBlocks","useCreateTemplatePartFromBlocks","options","useMemo","sidebarOptions","filter","widgetArea","id","widgets","length","map","value","label","name","__","jsx","__experimentalSpacer","marginBottom","createFromWidgets","event","preventDefault","sidebar","find","getWidgets","resolveSelect","_embed","skippedWidgets","Set","blocks","flatMap","widget","block","transformWidgetToBlock","add","id_base","sprintf","size","Array","from","join","type","children","jsxs","__experimentalHStack","as","onSubmit","FlexBlock","SelectControl","onChange","disabled","__next40pxDefaultSize","__nextHasNoMarginBottom","FlexItem","style","marginTop","Button","variant","_x"],"sources":["@wordpress/block-library/src/template-part/edit/import-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { useMemo, useState } from '@wordpress/element';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tButton,\n\tFlexBlock,\n\tFlexItem,\n\tSelectControl,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { useCreateTemplatePartFromBlocks } from './utils/hooks';\nimport { transformWidgetToBlock } from './utils/transformers';\n\nconst SIDEBARS_QUERY = {\n\tper_page: -1,\n\t_fields: 'id,name,description,status,widgets',\n};\n\nexport function TemplatePartImportControls( { area, setAttributes } ) {\n\tconst [ selectedSidebar, setSelectedSidebar ] = useState( '' );\n\tconst [ isBusy, setIsBusy ] = useState( false );\n\n\tconst registry = useRegistry();\n\tconst { sidebars, hasResolved } = useSelect( ( select ) => {\n\t\tconst { getSidebars, hasFinishedResolution } = select( coreStore );\n\n\t\treturn {\n\t\t\tsidebars: getSidebars( SIDEBARS_QUERY ),\n\t\t\thasResolved: hasFinishedResolution( 'getSidebars', [\n\t\t\t\tSIDEBARS_QUERY,\n\t\t\t] ),\n\t\t};\n\t}, [] );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst createFromBlocks = useCreateTemplatePartFromBlocks(\n\t\tarea,\n\t\tsetAttributes\n\t);\n\n\tconst options = useMemo( () => {\n\t\tconst sidebarOptions = ( sidebars ?? [] )\n\t\t\t.filter(\n\t\t\t\t( widgetArea ) =>\n\t\t\t\t\twidgetArea.id !== 'wp_inactive_widgets' &&\n\t\t\t\t\twidgetArea.widgets.length > 0\n\t\t\t)\n\t\t\t.map( ( widgetArea ) => {\n\t\t\t\treturn {\n\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t};\n\t\t\t} );\n\n\t\tif ( ! sidebarOptions.length ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [\n\t\t\t{ value: '', label: __( 'Select widget area' ) },\n\t\t\t...sidebarOptions,\n\t\t];\n\t}, [ sidebars ] );\n\n\t// Render an empty node while data is loading to avoid SlotFill re-positioning bug.\n\t// See: https://github.com/WordPress/gutenberg/issues/15641.\n\tif ( ! hasResolved ) {\n\t\treturn <Spacer marginBottom=\"0\" />;\n\t}\n\n\tif ( hasResolved && ! options.length ) {\n\t\treturn null;\n\t}\n\n\tasync function createFromWidgets( event ) {\n\t\tevent.preventDefault();\n\n\t\tif ( isBusy || ! selectedSidebar ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsBusy( true );\n\n\t\tconst sidebar = options.find(\n\t\t\t( { value } ) => value === selectedSidebar\n\t\t);\n\t\tconst { getWidgets } = registry.resolveSelect( coreStore );\n\n\t\t// The widgets API always returns a successful response.\n\t\tconst widgets = await getWidgets( {\n\t\t\tsidebar: sidebar.value,\n\t\t\t_embed: 'about',\n\t\t} );\n\n\t\tconst skippedWidgets = new Set();\n\t\tconst blocks = widgets.flatMap( ( widget ) => {\n\t\t\tconst block = transformWidgetToBlock( widget );\n\n\t\t\t// Skip the block if we have no matching transformations.\n\t\t\tif ( ! block ) {\n\t\t\t\tskippedWidgets.add( widget.id_base );\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\treturn block;\n\t\t} );\n\n\t\tawait createFromBlocks(\n\t\t\tblocks,\n\t\t\t/* translators: %s: name of the widget area */\n\t\t\tsprintf( __( 'Widget area: %s' ), sidebar.label )\n\t\t);\n\n\t\tif ( skippedWidgets.size ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: the list of widgets */\n\t\t\t\t\t__( 'Unable to import the following widgets: %s.' ),\n\t\t\t\t\tArray.from( skippedWidgets ).join( ', ' )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\n\t\tsetIsBusy( false );\n\t}\n\n\treturn (\n\t\t<Spacer marginBottom=\"4\">\n\t\t\t<HStack as=\"form\" onSubmit={ createFromWidgets }>\n\t\t\t\t<FlexBlock>\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\tlabel={ __( 'Import widget area' ) }\n\t\t\t\t\t\tvalue={ selectedSidebar }\n\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\tonChange={ ( value ) => setSelectedSidebar( value ) }\n\t\t\t\t\t\tdisabled={ ! options.length }\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t/>\n\t\t\t\t</FlexBlock>\n\t\t\t\t<FlexItem\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\tmarginBottom: '8px',\n\t\t\t\t\t\tmarginTop: 'auto',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\taria-disabled={ isBusy || ! selectedSidebar }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ _x( 'Import', 'button label' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</Spacer>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AAQA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAKA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAA8D,IAAAQ,WAAA,GAAAR,OAAA;AArB9D;AACA;AACA;;AAeA;AACA;AACA;;AAIA,MAAMS,cAAc,GAAG;EACtBC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE;AACV,CAAC;AAEM,SAASC,0BAA0BA,CAAE;EAAEC,IAAI;EAAEC;AAAc,CAAC,EAAG;EACrE,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAAC,iBAAQ,EAAE,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Q;UACbtD,MAAM,EAAGA,MAAQ;UACjB,iBAAgBA,MAAM,IAAI,CAAEH,eAAiB;UAAA0D,QAAA,EAE3C,IAAAgB,QAAE,EAAE,QAAQ,EAAE,cAAe;QAAC,CACzB;MAAC,CACA,CAAC;IAAA,CACJ;EAAC,CACF,CAAC;AAEX","ignoreList":[]}
|
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import { useRef, useMemo
|
|
10
|
+
import { useRef, useMemo } from '@wordpress/element';
|
|
11
11
|
import { useEntityRecord, store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
|
|
12
12
|
import { Placeholder, Spinner, ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
13
13
|
import { __ } from '@wordpress/i18n';
|
|
@@ -18,14 +18,12 @@ import { getBlockBindingsSource } from '@wordpress/blocks';
|
|
|
18
18
|
/**
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
|
-
import { name as patternBlockName } from './index';
|
|
22
21
|
import { unlock } from '../lock-unlock';
|
|
23
22
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
23
|
const {
|
|
25
24
|
useLayoutClasses
|
|
26
25
|
} = unlock(blockEditorPrivateApis);
|
|
27
26
|
const {
|
|
28
|
-
isOverridableBlock,
|
|
29
27
|
hasOverridableBlocks
|
|
30
28
|
} = unlock(patternsPrivateApis);
|
|
31
29
|
const fullAlignments = ['full', 'wide', 'left', 'right'];
|
|
@@ -53,15 +51,6 @@ const useInferredLayout = (blocks, parentLayout) => {
|
|
|
53
51
|
};
|
|
54
52
|
}, [blocks, parentLayout]);
|
|
55
53
|
};
|
|
56
|
-
function setBlockEditMode(setEditMode, blocks, mode) {
|
|
57
|
-
blocks.forEach(block => {
|
|
58
|
-
const editMode = mode || (isOverridableBlock(block) ? 'contentOnly' : 'disabled');
|
|
59
|
-
setEditMode(block.clientId, editMode);
|
|
60
|
-
setBlockEditMode(setEditMode, block.innerBlocks,
|
|
61
|
-
// Disable editing for nested patterns.
|
|
62
|
-
block.name === patternBlockName ? 'disabled' : mode);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
54
|
function RecursionWarning() {
|
|
66
55
|
const blockProps = useBlockProps();
|
|
67
56
|
return /*#__PURE__*/_jsx("div", {
|
|
@@ -129,7 +118,6 @@ function ReusableBlockEdit({
|
|
|
129
118
|
content
|
|
130
119
|
},
|
|
131
120
|
__unstableParentLayout: parentLayout,
|
|
132
|
-
clientId: patternClientId,
|
|
133
121
|
setAttributes
|
|
134
122
|
}) {
|
|
135
123
|
const {
|
|
@@ -141,35 +129,21 @@ function ReusableBlockEdit({
|
|
|
141
129
|
});
|
|
142
130
|
const isMissing = hasResolved && !record;
|
|
143
131
|
const {
|
|
144
|
-
setBlockEditingMode,
|
|
145
132
|
__unstableMarkLastChangeAsPersistent
|
|
146
133
|
} = useDispatch(blockEditorStore);
|
|
147
134
|
const {
|
|
148
|
-
innerBlocks,
|
|
149
135
|
onNavigateToEntityRecord,
|
|
150
|
-
editingMode,
|
|
151
136
|
hasPatternOverridesSource
|
|
152
137
|
} = useSelect(select => {
|
|
153
138
|
const {
|
|
154
|
-
|
|
155
|
-
getSettings,
|
|
156
|
-
getBlockEditingMode
|
|
139
|
+
getSettings
|
|
157
140
|
} = select(blockEditorStore);
|
|
158
141
|
// For editing link to the site editor if the theme and user permissions support it.
|
|
159
142
|
return {
|
|
160
|
-
innerBlocks: getBlocks(patternClientId),
|
|
161
143
|
onNavigateToEntityRecord: getSettings().onNavigateToEntityRecord,
|
|
162
|
-
editingMode: getBlockEditingMode(patternClientId),
|
|
163
144
|
hasPatternOverridesSource: !!getBlockBindingsSource('core/pattern-overrides')
|
|
164
145
|
};
|
|
165
|
-
}, [
|
|
166
|
-
|
|
167
|
-
// Sync the editing mode of the pattern block with the inner blocks.
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
setBlockEditMode(setBlockEditingMode, innerBlocks,
|
|
170
|
-
// Disable editing if the pattern itself is disabled.
|
|
171
|
-
editingMode === 'disabled' || !hasPatternOverridesSource ? 'disabled' : undefined);
|
|
172
|
-
}, [editingMode, innerBlocks, setBlockEditingMode, hasPatternOverridesSource]);
|
|
146
|
+
}, []);
|
|
173
147
|
const canOverrideBlocks = useMemo(() => hasPatternOverridesSource && hasOverridableBlocks(blocks), [hasPatternOverridesSource, blocks]);
|
|
174
148
|
const {
|
|
175
149
|
alignment,
|
|
@@ -184,7 +158,6 @@ function ReusableBlockEdit({
|
|
|
184
158
|
})
|
|
185
159
|
});
|
|
186
160
|
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
187
|
-
templateLock: 'all',
|
|
188
161
|
layout,
|
|
189
162
|
value: blocks,
|
|
190
163
|
onInput: NOOP,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","useSelect","useDispatch","useRef","useMemo","useEffect","useEntityRecord","store","coreStore","useEntityBlockEditor","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","RecursionProvider","useHasRecursion","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","InnerBlocks","patternsPrivateApis","getBlockBindingsSource","name","patternBlockName","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLayoutClasses","isOverridableBlock","hasOverridableBlocks","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","setBlockEditMode","setEditMode","mode","forEach","editMode","clientId","innerBlocks","RecursionWarning","blockProps","children","NOOP","ReusableBlockEditRecursionWrapper","props","ref","hasAlreadyRendered","uniqueId","ReusableBlockEdit","ReusableBlockControl","recordId","canOverrideBlocks","hasContent","handleEditOriginal","resetContent","canUserEdit","select","canUser","kind","id","onClick","disabled","content","__unstableParentLayout","patternClientId","setAttributes","record","hasResolved","isMissing","setBlockEditingMode","__unstableMarkLastChangeAsPersistent","onNavigateToEntityRecord","editingMode","hasPatternOverridesSource","getBlocks","getSettings","getBlockEditingMode","layoutClasses","className","innerBlocksProps","templateLock","value","onInput","onChange","renderAppender","ButtonBlockAppender","postId","postType"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo, useEffect } from '@wordpress/element';\nimport {\n\tuseEntityRecord,\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n\tInnerBlocks,\n} from '@wordpress/block-editor';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { name as patternBlockName } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst { isOverridableBlock, hasOverridableBlocks } =\n\tunlock( patternsPrivateApis );\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction setBlockEditMode( setEditMode, blocks, mode ) {\n\tblocks.forEach( ( block ) => {\n\t\tconst editMode =\n\t\t\tmode ||\n\t\t\t( isOverridableBlock( block ) ? 'contentOnly' : 'disabled' );\n\t\tsetEditMode( block.clientId, editMode );\n\n\t\tsetBlockEditMode(\n\t\t\tsetEditMode,\n\t\t\tblock.innerBlocks,\n\t\t\t// Disable editing for nested patterns.\n\t\t\tblock.name === patternBlockName ? 'disabled' : mode\n\t\t);\n\t} );\n}\n\nfunction RecursionWarning() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nconst NOOP = () => {};\n\n// Wrap the main Edit function for the pattern block with a recursion wrapper\n// that allows short-circuiting rendering as early as possible, before any\n// of the other effects in the block edit have run.\nexport default function ReusableBlockEditRecursionWrapper( props ) {\n\tconst { ref } = props.attributes;\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn <RecursionWarning />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<ReusableBlockEdit { ...props } />\n\t\t</RecursionProvider>\n\t);\n}\n\nfunction ReusableBlockControl( {\n\trecordId,\n\tcanOverrideBlocks,\n\thasContent,\n\thandleEditOriginal,\n\tresetContent,\n} ) {\n\tconst canUserEdit = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_block',\n\t\t\t\tid: recordId,\n\t\t\t} ),\n\t\t[ recordId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ canUserEdit && !! handleEditOriginal && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton onClick={ handleEditOriginal }>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\n\t\t\t{ canOverrideBlocks && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ resetContent }\n\t\t\t\t\t\t\tdisabled={ ! hasContent }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, content },\n\t__unstableParentLayout: parentLayout,\n\tclientId: patternClientId,\n\tsetAttributes,\n} ) {\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', 'wp_block', {\n\t\tid: ref,\n\t} );\n\tconst isMissing = hasResolved && ! record;\n\n\tconst { setBlockEditingMode, __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst {\n\t\tinnerBlocks,\n\t\tonNavigateToEntityRecord,\n\t\teditingMode,\n\t\thasPatternOverridesSource,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlocks, getSettings, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( patternClientId ),\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\teditingMode: getBlockEditingMode( patternClientId ),\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ patternClientId ]\n\t);\n\n\t// Sync the editing mode of the pattern block with the inner blocks.\n\tuseEffect( () => {\n\t\tsetBlockEditMode(\n\t\t\tsetBlockEditingMode,\n\t\t\tinnerBlocks,\n\t\t\t// Disable editing if the pattern itself is disabled.\n\t\t\teditingMode === 'disabled' || ! hasPatternOverridesSource\n\t\t\t\t? 'disabled'\n\t\t\t\t: undefined\n\t\t);\n\t}, [\n\t\teditingMode,\n\t\tinnerBlocks,\n\t\tsetBlockEditingMode,\n\t\thasPatternOverridesSource,\n\t] );\n\n\tconst canOverrideBlocks = useMemo(\n\t\t() => hasPatternOverridesSource && hasOverridableBlocks( blocks ),\n\t\t[ hasPatternOverridesSource, blocks ]\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplateLock: 'all',\n\t\tlayout,\n\t\tvalue: blocks,\n\t\tonInput: NOOP,\n\t\tonChange: NOOP,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst handleEditOriginal = () => {\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: ref,\n\t\t\tpostType: 'wp_block',\n\t\t} );\n\t};\n\n\tconst resetContent = () => {\n\t\tif ( content ) {\n\t\t\t// Make sure any previous changes are persisted before resetting.\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tsetAttributes( { content: undefined } );\n\t\t}\n\t};\n\n\tlet children = null;\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasResolved && ! isMissing && (\n\t\t\t\t<ReusableBlockControl\n\t\t\t\t\trecordId={ ref }\n\t\t\t\t\tcanOverrideBlocks={ canOverrideBlocks }\n\t\t\t\t\thasContent={ !! content }\n\t\t\t\t\thandleEditOriginal={\n\t\t\t\t\t\tonNavigateToEntityRecord\n\t\t\t\t\t\t\t? handleEditOriginal\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tresetContent={ resetContent }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;;AAEvB;AACA;AACA;AACA,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,MAAM,EAAEC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;AAC/D,SACCC,eAAe,EACfC,KAAK,IAAIC,SAAS,EAClBC,oBAAoB,QACd,sBAAsB;AAC7B,SACCC,WAAW,EACXC,OAAO,EACPC,aAAa,EACbC,YAAY,QAC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,IAAK,CAAE8E,WAAW,EAAG;IACpB1B,QAAQ,gBACPnC,IAAA,CAACrB,WAAW;MAAAwD,QAAA,eACXnC,IAAA,CAACpB,OAAO,IAAE;IAAC,CACC,CACb;EACF;EAEA,oBACCwB,KAAA,CAAAF,SAAA;IAAAiC,QAAA,GACG0B,WAAW,IAAI,CAAEC,SAAS,iBAC3B9D,IAAA,CAAC2C,oBAAoB;MACpBC,QAAQ,EAAGL,GAAK;MAChBM,iBAAiB,EAAGA,iBAAmB;MACvCC,UAAU,EAAG,CAAC,CAAEU,OAAS;MACzBT,kBAAkB,EACjBkB,wBAAwB,GACrBlB,kBAAkB,GAClB/B,SACH;MACDgC,YAAY,EAAGA;IAAc,CAC7B,CACD,EAECb,QAAQ,KAAK,IAAI,gBAClBnC,IAAA;MAAA,GAAUyE;IAAgB,CAAI,CAAC,gBAE/BzE,IAAA;MAAA,GAAUkC,UAAU;MAAAC,QAAA,EAAKA;IAAQ,CAAO,CACxC;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["clsx","useSelect","useDispatch","useRef","useMemo","useEntityRecord","store","coreStore","useEntityBlockEditor","Placeholder","Spinner","ToolbarButton","ToolbarGroup","__","useInnerBlocksProps","RecursionProvider","useHasRecursion","useBlockProps","Warning","privateApis","blockEditorPrivateApis","blockEditorStore","BlockControls","InnerBlocks","patternsPrivateApis","getBlockBindingsSource","unlock","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLayoutClasses","hasOverridableBlocks","fullAlignments","useInferredLayout","blocks","parentLayout","initialInferredAlignmentRef","length","alignment","current","undefined","isConstrained","type","hasFullAlignment","some","block","includes","attributes","align","layout","RecursionWarning","blockProps","children","NOOP","ReusableBlockEditRecursionWrapper","props","ref","hasAlreadyRendered","uniqueId","ReusableBlockEdit","ReusableBlockControl","recordId","canOverrideBlocks","hasContent","handleEditOriginal","resetContent","canUserEdit","select","canUser","kind","name","id","onClick","disabled","content","__unstableParentLayout","setAttributes","record","hasResolved","isMissing","__unstableMarkLastChangeAsPersistent","onNavigateToEntityRecord","hasPatternOverridesSource","getSettings","layoutClasses","className","innerBlocksProps","value","onInput","onChange","renderAppender","ButtonBlockAppender","postId","postType"],"sources":["@wordpress/block-library/src/block/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useRef, useMemo } from '@wordpress/element';\nimport {\n\tuseEntityRecord,\n\tstore as coreStore,\n\tuseEntityBlockEditor,\n} from '@wordpress/core-data';\nimport {\n\tPlaceholder,\n\tSpinner,\n\tToolbarButton,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tuseInnerBlocksProps,\n\tRecursionProvider,\n\tuseHasRecursion,\n\tuseBlockProps,\n\tWarning,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockControls,\n\tInnerBlocks,\n} from '@wordpress/block-editor';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { getBlockBindingsSource } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\nconst { useLayoutClasses } = unlock( blockEditorPrivateApis );\nconst { hasOverridableBlocks } = unlock( patternsPrivateApis );\n\nconst fullAlignments = [ 'full', 'wide', 'left', 'right' ];\n\nconst useInferredLayout = ( blocks, parentLayout ) => {\n\tconst initialInferredAlignmentRef = useRef();\n\n\treturn useMemo( () => {\n\t\t// Exit early if the pattern's blocks haven't loaded yet.\n\t\tif ( ! blocks?.length ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tlet alignment = initialInferredAlignmentRef.current;\n\n\t\t// Only track the initial alignment so that temporarily removed\n\t\t// alignments can be reapplied.\n\t\tif ( alignment === undefined ) {\n\t\t\tconst isConstrained = parentLayout?.type === 'constrained';\n\t\t\tconst hasFullAlignment = blocks.some( ( block ) =>\n\t\t\t\tfullAlignments.includes( block.attributes.align )\n\t\t\t);\n\n\t\t\talignment = isConstrained && hasFullAlignment ? 'full' : null;\n\t\t\tinitialInferredAlignmentRef.current = alignment;\n\t\t}\n\n\t\tconst layout = alignment ? parentLayout : undefined;\n\n\t\treturn { alignment, layout };\n\t}, [ blocks, parentLayout ] );\n};\n\nfunction RecursionWarning() {\n\tconst blockProps = useBlockProps();\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t</Warning>\n\t\t</div>\n\t);\n}\n\nconst NOOP = () => {};\n\n// Wrap the main Edit function for the pattern block with a recursion wrapper\n// that allows short-circuiting rendering as early as possible, before any\n// of the other effects in the block edit have run.\nexport default function ReusableBlockEditRecursionWrapper( props ) {\n\tconst { ref } = props.attributes;\n\tconst hasAlreadyRendered = useHasRecursion( ref );\n\n\tif ( hasAlreadyRendered ) {\n\t\treturn <RecursionWarning />;\n\t}\n\n\treturn (\n\t\t<RecursionProvider uniqueId={ ref }>\n\t\t\t<ReusableBlockEdit { ...props } />\n\t\t</RecursionProvider>\n\t);\n}\n\nfunction ReusableBlockControl( {\n\trecordId,\n\tcanOverrideBlocks,\n\thasContent,\n\thandleEditOriginal,\n\tresetContent,\n} ) {\n\tconst canUserEdit = useSelect(\n\t\t( select ) =>\n\t\t\t!! select( coreStore ).canUser( 'update', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: 'wp_block',\n\t\t\t\tid: recordId,\n\t\t\t} ),\n\t\t[ recordId ]\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ canUserEdit && !! handleEditOriginal && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton onClick={ handleEditOriginal }>\n\t\t\t\t\t\t\t{ __( 'Edit original' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\n\t\t\t{ canOverrideBlocks && (\n\t\t\t\t<BlockControls>\n\t\t\t\t\t<ToolbarGroup>\n\t\t\t\t\t\t<ToolbarButton\n\t\t\t\t\t\t\tonClick={ resetContent }\n\t\t\t\t\t\t\tdisabled={ ! hasContent }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset' ) }\n\t\t\t\t\t\t</ToolbarButton>\n\t\t\t\t\t</ToolbarGroup>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction ReusableBlockEdit( {\n\tname,\n\tattributes: { ref, content },\n\t__unstableParentLayout: parentLayout,\n\tsetAttributes,\n} ) {\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'wp_block',\n\t\tref\n\t);\n\tconst [ blocks ] = useEntityBlockEditor( 'postType', 'wp_block', {\n\t\tid: ref,\n\t} );\n\tconst isMissing = hasResolved && ! record;\n\n\tconst { __unstableMarkLastChangeAsPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { onNavigateToEntityRecord, hasPatternOverridesSource } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getSettings } = select( blockEditorStore );\n\t\t\t// For editing link to the site editor if the theme and user permissions support it.\n\t\t\treturn {\n\t\t\t\tonNavigateToEntityRecord:\n\t\t\t\t\tgetSettings().onNavigateToEntityRecord,\n\t\t\t\thasPatternOverridesSource: !! getBlockBindingsSource(\n\t\t\t\t\t'core/pattern-overrides'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst canOverrideBlocks = useMemo(\n\t\t() => hasPatternOverridesSource && hasOverridableBlocks( blocks ),\n\t\t[ hasPatternOverridesSource, blocks ]\n\t);\n\n\tconst { alignment, layout } = useInferredLayout( blocks, parentLayout );\n\tconst layoutClasses = useLayoutClasses( { layout }, name );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: clsx(\n\t\t\t'block-library-block__reusable-block-container',\n\t\t\tlayout && layoutClasses,\n\t\t\t{ [ `align${ alignment }` ]: alignment }\n\t\t),\n\t} );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tlayout,\n\t\tvalue: blocks,\n\t\tonInput: NOOP,\n\t\tonChange: NOOP,\n\t\trenderAppender: blocks?.length\n\t\t\t? undefined\n\t\t\t: InnerBlocks.ButtonBlockAppender,\n\t} );\n\n\tconst handleEditOriginal = () => {\n\t\tonNavigateToEntityRecord( {\n\t\t\tpostId: ref,\n\t\t\tpostType: 'wp_block',\n\t\t} );\n\t};\n\n\tconst resetContent = () => {\n\t\tif ( content ) {\n\t\t\t// Make sure any previous changes are persisted before resetting.\n\t\t\t__unstableMarkLastChangeAsPersistent();\n\t\t\tsetAttributes( { content: undefined } );\n\t\t}\n\t};\n\n\tlet children = null;\n\n\tif ( isMissing ) {\n\t\tchildren = (\n\t\t\t<Warning>\n\t\t\t\t{ __( 'Block has been deleted or is unavailable.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n\n\tif ( ! hasResolved ) {\n\t\tchildren = (\n\t\t\t<Placeholder>\n\t\t\t\t<Spinner />\n\t\t\t</Placeholder>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ hasResolved && ! isMissing && (\n\t\t\t\t<ReusableBlockControl\n\t\t\t\t\trecordId={ ref }\n\t\t\t\t\tcanOverrideBlocks={ canOverrideBlocks }\n\t\t\t\t\thasContent={ !! content }\n\t\t\t\t\thandleEditOriginal={\n\t\t\t\t\t\tonNavigateToEntityRecord\n\t\t\t\t\t\t\t? handleEditOriginal\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t\tresetContent={ resetContent }\n\t\t\t\t/>\n\t\t\t) }\n\n\t\t\t{ children === null ? (\n\t\t\t\t<div { ...innerBlocksProps } />\n\t\t\t) : (\n\t\t\t\t<div { ...blockProps }>{ children }</div>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AAC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
|
|
61
|
+
var _media$media_details$;
|
|
61
62
|
const {
|
|
62
63
|
contentPosition,
|
|
63
64
|
id,
|
|
@@ -88,7 +89,7 @@ function CoverEdit({
|
|
|
88
89
|
const media = useSelect(select => featuredImage && select(coreStore).getMedia(featuredImage, {
|
|
89
90
|
context: 'view'
|
|
90
91
|
}), [featuredImage]);
|
|
91
|
-
const mediaUrl = media?.source_url;
|
|
92
|
+
const mediaUrl = (_media$media_details$ = media?.media_details?.sizes?.[sizeSlug]?.source_url) !== null && _media$media_details$ !== void 0 ? _media$media_details$ : media?.source_url;
|
|
92
93
|
|
|
93
94
|
// User can change the featured image outside of the block, but we still
|
|
94
95
|
// need to update the block when that happens. This effect should only
|
|
@@ -325,7 +326,8 @@ function CoverEdit({
|
|
|
325
326
|
currentSettings: currentSettings,
|
|
326
327
|
toggleUseFeaturedImage: toggleUseFeaturedImage,
|
|
327
328
|
updateDimRatio: onUpdateDimRatio,
|
|
328
|
-
onClearMedia: onClearMedia
|
|
329
|
+
onClearMedia: onClearMedia,
|
|
330
|
+
featuredImage: media
|
|
329
331
|
});
|
|
330
332
|
const resizableCoverProps = {
|
|
331
333
|
className: 'block-library-cover__resize-container',
|