@wordpress/block-library 8.23.0 → 8.24.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 +2 -0
- package/build/block/edit.js +8 -11
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +3 -4
- package/build/block/edit.native.js.map +1 -1
- package/build/button/edit.js +4 -7
- package/build/button/edit.js.map +1 -1
- package/build/column/edit.js +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/file/edit.js +8 -9
- package/build/file/edit.js.map +1 -1
- package/build/file/view.js +4 -6
- package/build/file/view.js.map +1 -1
- package/build/group/edit.js +3 -7
- package/build/group/edit.js.map +1 -1
- package/build/image/edit.js +17 -18
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +22 -15
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +35 -27
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +2 -3
- package/build/image/index.js.map +1 -1
- package/build/image/view.js +233 -268
- package/build/image/view.js.map +1 -1
- package/build/navigation/view.js +153 -176
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/index.js +2 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/pattern/edit.js +1 -3
- package/build/pattern/edit.js.map +1 -1
- package/build/post-template/edit.js +1 -1
- package/build/post-template/edit.js.map +1 -1
- package/build/query/view.js +52 -60
- package/build/query/view.js.map +1 -1
- package/build/search/view.js +66 -74
- package/build/search/view.js.map +1 -1
- package/build/utils/remove-anchor-tag.js +17 -0
- package/build/utils/remove-anchor-tag.js.map +1 -0
- package/build-module/block/edit.js +8 -11
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +3 -4
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/edit.js +4 -7
- package/build-module/button/edit.js.map +1 -1
- package/build-module/column/edit.js +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/file/edit.js +8 -9
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/view.js +5 -7
- package/build-module/file/view.js.map +1 -1
- package/build-module/group/edit.js +3 -7
- package/build-module/group/edit.js.map +1 -1
- package/build-module/image/edit.js +18 -19
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +23 -16
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +36 -28
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +2 -3
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/view.js +234 -269
- package/build-module/image/view.js.map +1 -1
- package/build-module/navigation/view.js +154 -177
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/index.js +2 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/pattern/edit.js +1 -3
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-template/edit.js +1 -1
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/view.js +53 -61
- package/build-module/query/view.js.map +1 -1
- package/build-module/search/view.js +67 -75
- package/build-module/search/view.js.map +1 -1
- package/build-module/utils/remove-anchor-tag.js +11 -0
- package/build-module/utils/remove-anchor-tag.js.map +1 -0
- package/build-style/cover/style-rtl.css +14 -14
- package/build-style/cover/style.css +14 -14
- package/build-style/editor-rtl.css +6 -9
- package/build-style/editor.css +6 -9
- package/build-style/gallery/style-rtl.css +28 -0
- package/build-style/gallery/style.css +28 -0
- package/build-style/image/editor-rtl.css +0 -3
- package/build-style/image/editor.css +0 -3
- package/build-style/style-rtl.css +42 -14
- package/build-style/style.css +42 -14
- package/package.json +32 -32
- package/src/block/edit.js +18 -19
- package/src/block/edit.native.js +5 -13
- package/src/button/edit.js +6 -6
- package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -6
- package/src/buttons/test/edit.native.js +0 -27
- package/src/column/edit.js +1 -1
- package/src/column/edit.native.js +1 -1
- package/src/cover/edit/index.js +1 -0
- package/src/cover/style.scss +1 -1
- package/src/cover/test/edit.js +1 -1
- package/src/editor.scss +6 -6
- package/src/file/edit.js +11 -10
- package/src/file/index.php +30 -11
- package/src/file/view.js +5 -7
- package/src/gallery/style.scss +1 -0
- package/src/group/edit.js +3 -11
- package/src/heading/test/__snapshots__/index.native.js.snap +6 -0
- package/src/heading/test/index.native.js +40 -0
- package/src/image/block.json +2 -3
- package/src/image/edit.js +16 -21
- package/src/image/edit.native.js +17 -18
- package/src/image/editor.scss +0 -7
- package/src/image/image.js +48 -51
- package/src/image/index.php +54 -45
- package/src/image/view.js +278 -334
- package/src/navigation/index.php +19 -10
- package/src/navigation/view.js +159 -192
- package/src/navigation-link/block.json +2 -1
- package/src/paragraph/test/edit.native.js +37 -1
- package/src/pattern/edit.js +5 -3
- package/src/post-template/edit.js +1 -1
- package/src/query/index.php +36 -22
- package/src/query/view.js +58 -65
- package/src/query-pagination-next/index.php +3 -3
- package/src/query-pagination-numbers/index.php +1 -1
- package/src/query-pagination-previous/index.php +3 -3
- package/src/search/index.php +40 -40
- package/src/search/view.js +58 -63
- package/src/utils/remove-anchor-tag.js +10 -0
- package/tsconfig.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_x","customLink","linkIcon","InnerBlocks","addFilter","initBlock","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","label","type","rel","id","opensInNewTab","url","kind","isTopLevelLink","usesContext","supports","reusable","html","__experimentalSlashInserter","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","editorStyle","style","edit","save","enhanceNavigationLinkVariations","transforms","settings","icon","__experimentalLabel","merge","leftAttributes","rightLabel","example","deprecated","isEligible","nofollow","default","migrate","rest","createElement","Content","init"],"sources":["@wordpress/block-library/src/navigation-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\nimport { InnerBlocks } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport { enhanceNavigationLinkVariations } from './hooks';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: linkIcon,\n\n\t__experimentalLabel: ( { label } ) => label,\n\n\tmerge( leftAttributes, { label: rightLabel = '' } ) {\n\t\treturn {\n\t\t\t...leftAttributes,\n\t\t\tlabel: leftAttributes.label + rightLabel,\n\t\t};\n\t},\n\n\tedit,\n\n\tsave,\n\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'Example Link', 'navigation link preview example' ),\n\t\t\turl: 'https://example.com',\n\t\t},\n\t},\n\n\tdeprecated: [\n\t\t{\n\t\t\tisEligible( attributes ) {\n\t\t\t\treturn attributes.nofollow;\n\t\t\t},\n\n\t\t\tattributes: {\n\t\t\t\tlabel: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tnofollow: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\topensInNewTab: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t},\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tmigrate( { nofollow, ...rest } ) {\n\t\t\t\treturn {\n\t\t\t\t\trel: nofollow ? 'nofollow' : '',\n\t\t\t\t\t...rest,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tsave() {\n\t\t\t\treturn <InnerBlocks.Content />;\n\t\t\t},\n\t\t},\n\t],\n\ttransforms,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/navigation-link',\n\t\tenhanceNavigationLinkVariations\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,IAAIC,QAAQ,QAAQ,kBAAkB;AACzD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAA,IAAA;MAAAA,IAAA;IAAA;IAAAJ,WAAA;MAAAI,IAAA;IAAA;IAAAC,GAAA;MAAAD,IAAA;IAAA;IAAAE,EAAA;MAAAF,IAAA;IAAA;IAAAG,aAAA;MAAAH,IAAA;MAAA;IAAA;IAAAI,GAAA;MAAAJ,IAAA;IAAA;IAAAP,KAAA;MAAAO,IAAA;IAAA;IAAAK,IAAA;MAAAL,IAAA;IAAA;IAAAM,cAAA;MAAAN,IAAA;IAAA;EAAA;EAAAO,WAAA;EAAAC,QAAA;IAAAC,QAAA;IAAAC,IAAA;IAAAC,2BAAA;IAAAC,UAAA;MAAAC,QAAA;MAAAC,UAAA;MAAAC,wBAAA;MAAAC,wBAAA;MAAAC,uBAAA;MAAAC,2BAAA;MAAAC,4BAAA;MAAAC,2BAAA;MAAAC,6BAAA;QAAAR,QAAA;MAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"names":["_x","customLink","linkIcon","InnerBlocks","addFilter","initBlock","metadata","$schema","apiVersion","name","title","category","parent","description","textdomain","attributes","label","type","rel","id","opensInNewTab","url","kind","isTopLevelLink","usesContext","supports","reusable","html","__experimentalSlashInserter","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","renaming","editorStyle","style","edit","save","enhanceNavigationLinkVariations","transforms","settings","icon","__experimentalLabel","merge","leftAttributes","rightLabel","example","deprecated","isEligible","nofollow","default","migrate","rest","createElement","Content","init"],"sources":["@wordpress/block-library/src/navigation-link/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\nimport { customLink as linkIcon } from '@wordpress/icons';\nimport { InnerBlocks } from '@wordpress/block-editor';\nimport { addFilter } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport { enhanceNavigationLinkVariations } from './hooks';\nimport transforms from './transforms';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon: linkIcon,\n\n\t__experimentalLabel: ( { label } ) => label,\n\n\tmerge( leftAttributes, { label: rightLabel = '' } ) {\n\t\treturn {\n\t\t\t...leftAttributes,\n\t\t\tlabel: leftAttributes.label + rightLabel,\n\t\t};\n\t},\n\n\tedit,\n\n\tsave,\n\n\texample: {\n\t\tattributes: {\n\t\t\tlabel: _x( 'Example Link', 'navigation link preview example' ),\n\t\t\turl: 'https://example.com',\n\t\t},\n\t},\n\n\tdeprecated: [\n\t\t{\n\t\t\tisEligible( attributes ) {\n\t\t\t\treturn attributes.nofollow;\n\t\t\t},\n\n\t\t\tattributes: {\n\t\t\t\tlabel: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\ttype: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tnofollow: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t},\n\t\t\t\tdescription: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\topensInNewTab: {\n\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\tdefault: false,\n\t\t\t\t},\n\t\t\t\turl: {\n\t\t\t\t\ttype: 'string',\n\t\t\t\t},\n\t\t\t},\n\n\t\t\tmigrate( { nofollow, ...rest } ) {\n\t\t\t\treturn {\n\t\t\t\t\trel: nofollow ? 'nofollow' : '',\n\t\t\t\t\t...rest,\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tsave() {\n\t\t\t\treturn <InnerBlocks.Content />;\n\t\t\t},\n\t\t},\n\t],\n\ttransforms,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/navigation-link',\n\t\tenhanceNavigationLinkVariations\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,UAAU,IAAIC,QAAQ,QAAQ,kBAAkB;AACzD,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,SAAS,QAAQ,kBAAkB;;AAE5C;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,MAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,KAAA;MAAAC,IAAA;IAAA;IAAAA,IAAA;MAAAA,IAAA;IAAA;IAAAJ,WAAA;MAAAI,IAAA;IAAA;IAAAC,GAAA;MAAAD,IAAA;IAAA;IAAAE,EAAA;MAAAF,IAAA;IAAA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,CAACwC,QAAQ;IAC3B,CAAC;IAEDxC,UAAU,EAAE;MACXC,KAAK,EAAE;QACNC,IAAI,EAAE;MACP,CAAC;MACDA,IAAI,EAAE;QACLA,IAAI,EAAE;MACP,CAAC;MACDsC,QAAQ,EAAE;QACTtC,IAAI,EAAE;MACP,CAAC;MACDJ,WAAW,EAAE;QACZI,IAAI,EAAE;MACP,CAAC;MACDE,EAAE,EAAE;QACHF,IAAI,EAAE;MACP,CAAC;MACDG,aAAa,EAAE;QACdH,IAAI,EAAE,SAAS;QACfuC,OAAO,EAAE;MACV,CAAC;MACDnC,GAAG,EAAE;QACJJ,IAAI,EAAE;MACP;IACD,CAAC;IAEDwC,OAAOA,CAAE;MAAEF,QAAQ;MAAE,GAAGG;IAAK,CAAC,EAAG;MAChC,OAAO;QACNxC,GAAG,EAAEqC,QAAQ,GAAG,UAAU,GAAG,EAAE;QAC/B,GAAGG;MACJ,CAAC;IACF,CAAC;IAEDf,IAAIA,CAAA,EAAG;MACN,OAAOgB,aAAA,CAACxD,WAAW,CAACyD,OAAO,MAAE,CAAC;IAC/B;EACD,CAAC,CACD;EACDf;AACD,CAAC;AAED,OAAO,MAAMgB,IAAI,GAAGA,CAAA,KAAM;EACzBzD,SAAS,CACR,0BAA0B,EAC1B,sBAAsB,EACtBwC,+BACD,CAAC;EAED,OAAOvC,SAAS,CAAE;IAAEI,IAAI;IAAEH,QAAQ;IAAEwC;EAAS,CAAE,CAAC;AACjD,CAAC"}
|
|
@@ -15,11 +15,9 @@ const PatternEdit = ({
|
|
|
15
15
|
const currentThemeStylesheet = useSelect(select => select(coreStore).getCurrentTheme()?.stylesheet, []);
|
|
16
16
|
const {
|
|
17
17
|
replaceBlocks,
|
|
18
|
+
setBlockEditingMode,
|
|
18
19
|
__unstableMarkNextChangeAsNotPersistent
|
|
19
20
|
} = useDispatch(blockEditorStore);
|
|
20
|
-
const {
|
|
21
|
-
setBlockEditingMode
|
|
22
|
-
} = useDispatch(blockEditorStore);
|
|
23
21
|
const {
|
|
24
22
|
getBlockRootClientId,
|
|
25
23
|
getBlockEditingMode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cloneBlock","useSelect","useDispatch","useEffect","store","blockEditorStore","useBlockProps","coreStore","PatternEdit","attributes","clientId","selectedPattern","select","__experimentalGetParsedPattern","slug","currentThemeStylesheet","getCurrentTheme","stylesheet","replaceBlocks","
|
|
1
|
+
{"version":3,"names":["cloneBlock","useSelect","useDispatch","useEffect","store","blockEditorStore","useBlockProps","coreStore","PatternEdit","attributes","clientId","selectedPattern","select","__experimentalGetParsedPattern","slug","currentThemeStylesheet","getCurrentTheme","stylesheet","replaceBlocks","setBlockEditingMode","__unstableMarkNextChangeAsNotPersistent","getBlockRootClientId","getBlockEditingMode","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","theme","undefined","blocks","window","queueMicrotask","rootClientId","clonedBlocks","rootEditingMode","props","createElement"],"sources":["@wordpress/block-library/src/pattern/edit.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { cloneBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\nimport {\n\tstore as blockEditorStore,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\nconst PatternEdit = ( { attributes, clientId } ) => {\n\tconst selectedPattern = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).__experimentalGetParsedPattern(\n\t\t\t\tattributes.slug\n\t\t\t),\n\t\t[ attributes.slug ]\n\t);\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\n\tconst {\n\t\treplaceBlocks,\n\t\tsetBlockEditingMode,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t} = useDispatch( blockEditorStore );\n\tconst { getBlockRootClientId, getBlockEditingMode } =\n\t\tuseSelect( blockEditorStore );\n\n\t// Duplicated in packages/edit-site/src/components/start-template-options/index.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\t// Run this effect when the component loads.\n\t// This adds the Pattern's contents to the post.\n\t// This change won't be saved.\n\t// It will continue to pull from the pattern file unless changes are made to its respective template part.\n\tuseEffect( () => {\n\t\tif ( selectedPattern?.blocks ) {\n\t\t\t// We batch updates to block list settings to avoid triggering cascading renders\n\t\t\t// for each container block included in a tree and optimize initial render.\n\t\t\t// Since the above uses microtasks, we need to use a microtask here as well,\n\t\t\t// because nested pattern blocks cannot be inserted if the parent block supports\n\t\t\t// inner blocks but doesn't have blockSettings in the state.\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\tconst rootClientId = getBlockRootClientId( clientId );\n\t\t\t\t// Clone blocks from the pattern before insertion to ensure they receive\n\t\t\t\t// distinct client ids. See https://github.com/WordPress/gutenberg/issues/50628.\n\t\t\t\tconst clonedBlocks = selectedPattern.blocks.map( ( block ) =>\n\t\t\t\t\tcloneBlock(\n\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t\tconst rootEditingMode = getBlockEditingMode( rootClientId );\n\t\t\t\t// Temporarily set the root block to default mode to allow replacing the pattern.\n\t\t\t\t// This could happen when the page is disabling edits of non-content blocks.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, 'default' );\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlocks( clientId, clonedBlocks );\n\t\t\t\t// Restore the root block's original mode.\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\tsetBlockEditingMode( rootClientId, rootEditingMode );\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tclientId,\n\t\tselectedPattern?.blocks,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\treplaceBlocks,\n\t\tgetBlockEditingMode,\n\t\tsetBlockEditingMode,\n\t\tgetBlockRootClientId,\n\t] );\n\n\tconst props = useBlockProps();\n\n\treturn <div { ...props } />;\n};\n\nexport default PatternEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,mBAAmB;AAC9C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SACCC,KAAK,IAAIC,gBAAgB,EACzBC,aAAa,QACP,yBAAyB;AAChC,SAASF,KAAK,IAAIG,SAAS,QAAQ,sBAAsB;AAEzD,MAAMC,WAAW,GAAGA,CAAE;EAAEC,UAAU;EAAEC;AAAS,CAAC,KAAM;EACnD,MAAMC,eAAe,GAAGV,SAAS,CAC9BW,MAAM,IACPA,MAAM,CAAEP,gBAAiB,CAAC,CAACQ,8BAA8B,CACxDJ,UAAU,CAACK,IACZ,CAAC,EACF,CAAEL,UAAU,CAACK,IAAI,CAClB,CAAC;EAED,MAAMC,sBAAsB,GAAGd,SAAS,CACrCW,MAAM,IAAMA,MAAM,CAAEL,SAAU,CAAC,CAACS,eAAe,CAAC,CAAC,EAAEC,UAAU,EAC/D,EACD,CAAC;EAED,MAAM;IACLC,aAAa;IACbC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B,CAAEgB,YAAY,EAAE,SAAU,CAAC;QAC9Cf,uCAAuC,CAAC,CAAC;QACzCF,aAAa,CAAER,QAAQ,EAAE0B,YAAa,CAAC;QACvC;QACAhB,uCAAuC,CAAC,CAAC;QACzCD,mBAAmB,CAAEgB,YAAY,EAAEE,eAAgB,CAAC;MACrD,CAAE,CAAC;IACJ;EACD,CAAC,EAAE,CACF3B,QAAQ,EACRC,eAAe,EAAEqB,MAAM,EACvBZ,uCAAuC,EACvCF,aAAa,EACbI,mBAAmB,EACnBH,mBAAmB,EACnBE,oBAAoB,CACnB,CAAC;EAEH,MAAMiB,KAAK,GAAGhC,aAAa,CAAC,CAAC;EAE7B,OAAOiC,aAAA;IAAA,GAAUD;EAAK,CAAI,CAAC;AAC5B,CAAC;AAED,eAAe9B,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","memo","useMemo","useState","useSelect","__","BlockControls","BlockContextProvider","__experimentalUseBlockPreview","useBlockPreview","useBlockProps","useInnerBlocksProps","store","blockEditorStore","Spinner","ToolbarGroup","coreStore","list","grid","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","className","template","__unstableDisableLayoutClassNames","createElement","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","posts","select","getEntityRecords","getTaxonomies","getBlocks","taxonomies","per_page","templateCategory","startsWith","_fields","slug","replace","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","map","post","postId","blockProps","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","title","isActive","Fragment","controls","blockContext","key","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wp-block-post' },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wp-block-post',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: perPage ? perPage + offset : 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 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AE,MAAM;MACZE;IACD,CAAE,CAAC;IACJ0C,QAAQ,EAAE3C,UAAU,KAAK;EAC1B,CAAC,CACD;;EAED;EACA;EACA;EACA;EACA,OACC1C,aAAA,CAAAsF,QAAA,QACCtF,aAAA,CAACnB,aAAa,QACbmB,aAAA,CAACV,YAAY;IAACiG,QAAQ,EAAGL;EAAuB,CAAE,CACpC,CAAC,EAEhBlF,aAAA;IAAA,GAAS+E;EAAU,GAChBJ,aAAa,IACdA,aAAa,CAACC,GAAG,CAAIY,YAAY,IAChCxF,aAAA,CAAClB,oBAAoB;IACpB2G,GAAG,EAAGD,YAAY,CAACV,MAAQ;IAC3BY,KAAK,EAAGF;EAAc,GAEpBA,YAAY,CAACV,MAAM,MACnBlC,oBAAoB,IACrB+B,aAAa,CAAE,CAAC,CAAE,EAAEG,MAAM,CAAE,GAC5B9E,aAAA,CAACL,uBAAuB,MAAE,CAAC,GACxB,IAAI,EACRK,aAAA,CAACgB,gCAAgC;IAChCd,MAAM,EAAGA,MAAQ;IACjBC,cAAc,EAAGqF,YAAY,CAACV,MAAQ;IACtCzE,uBAAuB,EACtBA,uBACA;IACDD,QAAQ,EACPoF,YAAY,CAACV,MAAM,MACjBlC,oBAAoB,IACrB+B,aAAa,CAAE,CAAC,CAAE,EAAEG,MAAM;EAC3B,CACD,CACoB,CACrB,CACA,CACH,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["classnames","memo","useMemo","useState","useSelect","__","BlockControls","BlockContextProvider","__experimentalUseBlockPreview","useBlockPreview","useBlockProps","useInnerBlocksProps","store","blockEditorStore","Spinner","ToolbarGroup","coreStore","list","grid","TEMPLATE","PostTemplateInnerBlocks","innerBlocksProps","className","template","__unstableDisableLayoutClassNames","createElement","PostTemplateBlockPreview","blocks","blockContextId","isHidden","setActiveBlockContextId","blockPreviewProps","props","handleOnClick","style","display","undefined","tabIndex","role","onClick","onKeyPress","MemoizedPostTemplateBlockPreview","PostTemplateEdit","setAttributes","clientId","context","query","perPage","offset","postType","order","orderBy","author","search","exclude","sticky","inherit","taxQuery","parents","pages","restQueryArgs","templateSlug","previewPostType","attributes","layout","__unstableLayoutClassNames","type","layoutType","columnCount","activeBlockContextId","posts","select","getEntityRecords","getTaxonomies","getBlocks","taxonomies","per_page","templateCategory","startsWith","_fields","slug","replace","orderby","builtTaxQuery","Object","entries","reduce","accumulator","taxonomySlug","terms","taxonomy","find","rest_base","keys","length","assign","parent","categories","id","usedPostType","blockContexts","map","post","postId","blockProps","setDisplayLayout","newDisplayLayout","displayLayoutControls","icon","title","isActive","Fragment","controls","blockContext","key","value"],"sources":["@wordpress/block-library/src/post-template/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { memo, useMemo, useState } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockControls,\n\tBlockContextProvider,\n\t__experimentalUseBlockPreview as useBlockPreview,\n\tuseBlockProps,\n\tuseInnerBlocksProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { Spinner, ToolbarGroup } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { list, grid } from '@wordpress/icons';\n\nconst TEMPLATE = [\n\t[ 'core/post-title' ],\n\t[ 'core/post-date' ],\n\t[ 'core/post-excerpt' ],\n];\n\nfunction PostTemplateInnerBlocks() {\n\tconst innerBlocksProps = useInnerBlocksProps(\n\t\t{ className: 'wp-block-post' },\n\t\t{ template: TEMPLATE, __unstableDisableLayoutClassNames: true }\n\t);\n\treturn <li { ...innerBlocksProps } />;\n}\n\nfunction PostTemplateBlockPreview( {\n\tblocks,\n\tblockContextId,\n\tisHidden,\n\tsetActiveBlockContextId,\n} ) {\n\tconst blockPreviewProps = useBlockPreview( {\n\t\tblocks,\n\t\tprops: {\n\t\t\tclassName: 'wp-block-post',\n\t\t},\n\t} );\n\n\tconst handleOnClick = () => {\n\t\tsetActiveBlockContextId( blockContextId );\n\t};\n\n\tconst style = {\n\t\tdisplay: isHidden ? 'none' : undefined,\n\t};\n\n\treturn (\n\t\t<li\n\t\t\t{ ...blockPreviewProps }\n\t\t\ttabIndex={ 0 }\n\t\t\t// eslint-disable-next-line jsx-a11y/no-noninteractive-element-to-interactive-role\n\t\t\trole=\"button\"\n\t\t\tonClick={ handleOnClick }\n\t\t\tonKeyPress={ handleOnClick }\n\t\t\tstyle={ style }\n\t\t/>\n\t);\n}\n\nconst MemoizedPostTemplateBlockPreview = memo( PostTemplateBlockPreview );\n\nexport default function PostTemplateEdit( {\n\tsetAttributes,\n\tclientId,\n\tcontext: {\n\t\tquery: {\n\t\t\tperPage,\n\t\t\toffset = 0,\n\t\t\tpostType,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\tpages,\n\t\t\t// We gather extra query args to pass to the REST API call.\n\t\t\t// This way extenders of Query Loop can add their own query args,\n\t\t\t// and have accurate previews in the editor.\n\t\t\t// Noting though that these args should either be supported by the\n\t\t\t// REST API or be handled by custom REST filters like `rest_{$this->post_type}_query`.\n\t\t\t...restQueryArgs\n\t\t} = {},\n\t\ttemplateSlug,\n\t\tpreviewPostType,\n\t},\n\tattributes: { layout },\n\t__unstableLayoutClassNames,\n} ) {\n\tconst { type: layoutType, columnCount = 3 } = layout || {};\n\tconst [ activeBlockContextId, setActiveBlockContextId ] = useState();\n\tconst { posts, blocks } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomies } = select( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\t\t\tconst taxonomies = getTaxonomies( {\n\t\t\t\ttype: postType,\n\t\t\t\tper_page: -1,\n\t\t\t\tcontext: 'view',\n\t\t\t} );\n\t\t\tconst templateCategory =\n\t\t\t\tinherit &&\n\t\t\t\ttemplateSlug?.startsWith( 'category-' ) &&\n\t\t\t\tgetEntityRecords( 'taxonomy', 'category', {\n\t\t\t\t\tcontext: 'view',\n\t\t\t\t\tper_page: 1,\n\t\t\t\t\t_fields: [ 'id' ],\n\t\t\t\t\tslug: templateSlug.replace( 'category-', '' ),\n\t\t\t\t} );\n\t\t\tconst query = {\n\t\t\t\toffset: offset || 0,\n\t\t\t\torder,\n\t\t\t\torderby: orderBy,\n\t\t\t};\n\t\t\t// There is no need to build the taxQuery if we inherit.\n\t\t\tif ( taxQuery && ! inherit ) {\n\t\t\t\t// We have to build the tax query for the REST API and use as\n\t\t\t\t// keys the taxonomies `rest_base` with the `term ids` as values.\n\t\t\t\tconst builtTaxQuery = Object.entries( taxQuery ).reduce(\n\t\t\t\t\t( accumulator, [ taxonomySlug, terms ] ) => {\n\t\t\t\t\t\tconst taxonomy = taxonomies?.find(\n\t\t\t\t\t\t\t( { slug } ) => slug === taxonomySlug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif ( taxonomy?.rest_base ) {\n\t\t\t\t\t\t\taccumulator[ taxonomy?.rest_base ] = terms;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn accumulator;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t);\n\t\t\t\tif ( !! Object.keys( builtTaxQuery ).length ) {\n\t\t\t\t\tObject.assign( query, builtTaxQuery );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( perPage ) {\n\t\t\t\tquery.per_page = perPage;\n\t\t\t}\n\t\t\tif ( author ) {\n\t\t\t\tquery.author = author;\n\t\t\t}\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\t\t\tif ( exclude?.length ) {\n\t\t\t\tquery.exclude = exclude;\n\t\t\t}\n\t\t\tif ( parents?.length ) {\n\t\t\t\tquery.parent = parents;\n\t\t\t}\n\t\t\t// If sticky is not set, it will return all posts in the results.\n\t\t\t// If sticky is set to `only`, it will limit the results to sticky posts only.\n\t\t\t// If it is anything else, it will exclude sticky posts from results. For the record the value stored is `exclude`.\n\t\t\tif ( sticky ) {\n\t\t\t\tquery.sticky = sticky === 'only';\n\t\t\t}\n\t\t\t// If `inherit` is truthy, adjust conditionally the query to create a better preview.\n\t\t\tif ( inherit ) {\n\t\t\t\t// Change the post-type if needed.\n\t\t\t\tif ( templateSlug?.startsWith( 'archive-' ) ) {\n\t\t\t\t\tquery.postType = templateSlug.replace( 'archive-', '' );\n\t\t\t\t\tpostType = query.postType;\n\t\t\t\t} else if ( templateCategory ) {\n\t\t\t\t\tquery.categories = templateCategory[ 0 ]?.id;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// When we preview Query Loop blocks we should prefer the current\n\t\t\t// block's postType, which is passed through block context.\n\t\t\tconst usedPostType = previewPostType || postType;\n\t\t\treturn {\n\t\t\t\tposts: getEntityRecords( 'postType', usedPostType, {\n\t\t\t\t\t...query,\n\t\t\t\t\t...restQueryArgs,\n\t\t\t\t} ),\n\t\t\t\tblocks: getBlocks( clientId ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tperPage,\n\t\t\toffset,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tclientId,\n\t\t\tauthor,\n\t\t\tsearch,\n\t\t\tpostType,\n\t\t\texclude,\n\t\t\tsticky,\n\t\t\tinherit,\n\t\t\ttemplateSlug,\n\t\t\ttaxQuery,\n\t\t\tparents,\n\t\t\trestQueryArgs,\n\t\t\tpreviewPostType,\n\t\t]\n\t);\n\tconst blockContexts = useMemo(\n\t\t() =>\n\t\t\tposts?.map( ( post ) => ( {\n\t\t\t\tpostType: post.type,\n\t\t\t\tpostId: post.id,\n\t\t\t} ) ),\n\t\t[ posts ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( __unstableLayoutClassNames, {\n\t\t\t[ `columns-${ columnCount }` ]:\n\t\t\t\tlayoutType === 'grid' && columnCount, // Ensure column count is flagged via classname for backwards compatibility.\n\t\t} ),\n\t} );\n\n\tif ( ! posts ) {\n\t\treturn (\n\t\t\t<p { ...blockProps }>\n\t\t\t\t<Spinner />\n\t\t\t</p>\n\t\t);\n\t}\n\n\tif ( ! posts.length ) {\n\t\treturn <p { ...blockProps }> { __( 'No results found.' ) }</p>;\n\t}\n\n\tconst setDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tlayout: { ...layout, ...newDisplayLayout },\n\t\t} );\n\n\tconst displayLayoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setDisplayLayout( { type: 'default' } ),\n\t\t\tisActive: layoutType === 'default' || layoutType === 'constrained',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () =>\n\t\t\t\tsetDisplayLayout( {\n\t\t\t\t\ttype: 'grid',\n\t\t\t\t\tcolumnCount,\n\t\t\t\t} ),\n\t\t\tisActive: layoutType === 'grid',\n\t\t},\n\t];\n\n\t// To avoid flicker when switching active block contexts, a preview is rendered\n\t// for each block context, but the preview for the active block context is hidden.\n\t// This ensures that when it is displayed again, the cached rendering of the\n\t// block preview is used, instead of having to re-render the preview from scratch.\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ displayLayoutControls } />\n\t\t\t</BlockControls>\n\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ blockContexts &&\n\t\t\t\t\tblockContexts.map( ( blockContext ) => (\n\t\t\t\t\t\t<BlockContextProvider\n\t\t\t\t\t\t\tkey={ blockContext.postId }\n\t\t\t\t\t\t\tvalue={ blockContext }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ blockContext.postId ===\n\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId ) ? (\n\t\t\t\t\t\t\t\t<PostTemplateInnerBlocks />\n\t\t\t\t\t\t\t) : null }\n\t\t\t\t\t\t\t<MemoizedPostTemplateBlockPreview\n\t\t\t\t\t\t\t\tblocks={ blocks }\n\t\t\t\t\t\t\t\tblockContextId={ blockContext.postId }\n\t\t\t\t\t\t\t\tsetActiveBlockContextId={\n\t\t\t\t\t\t\t\t\tsetActiveBlockContextId\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisHidden={\n\t\t\t\t\t\t\t\t\tblockContext.postId ===\n\t\t\t\t\t\t\t\t\t( activeBlockContextId ||\n\t\t\t\t\t\t\t\t\t\tblockContexts[ 0 ]?.postId )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t) ) }\n\t\t\t</ul>\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,IAAI,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AAC5D,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,aAAa,EACbC,oBAAoB,EACpBC,6BAA6B,IAAIC,eAAe,EAChDC,aAAa,EACbC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,OAAO,EAAEC,YAAY,QAAQ,uBAAuB;AAC7D,SAASH,KAAK,IAAII,SAAS,QAAQ,sBAAsB;AACzD,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAE7C,MAAMC,QAAQ,GAAG,CAChB,CAAE,iBAAiB,CAAE,EACrB,CAAE,gBAAgB,CAAE,EACpB,CAAE,mBAAmB,CAAE,CACvB;AAED,SAASC,uBAAuBA,CAAA,EAAG;EAClC,MAAMC,gBAAgB,GAAGV,mBAAmB,CAC3C;IAAEW,SAAS,EAAE;EAAgB,CAAC,EAC9B;IAAEC,QAAQ,EAAEJ,QAAQ;IAAEK,iCAAiC,EAAE;EAAK,CAC/D,CAAC;EAC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-
import { store, navigate, prefetch } from '@wordpress/interactivity';
|
|
4
|
+
import { store, getContext, getElement, navigate, prefetch } from '@wordpress/interactivity';
|
|
5
5
|
const isValidLink = ref => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === '_self') && ref.origin === window.location.origin;
|
|
6
6
|
const isValidEvent = event => event.button === 0 &&
|
|
7
7
|
// Left clicks only.
|
|
@@ -12,76 +12,68 @@ const isValidEvent = event => event.button === 0 &&
|
|
|
12
12
|
!event.altKey &&
|
|
13
13
|
// Download.
|
|
14
14
|
!event.shiftKey && !event.defaultPrevented;
|
|
15
|
-
store({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
finishAnimation: ({
|
|
23
|
-
context
|
|
24
|
-
}) => context.core.query.animation === 'finish'
|
|
25
|
-
}
|
|
15
|
+
store('core/query', {
|
|
16
|
+
state: {
|
|
17
|
+
get startAnimation() {
|
|
18
|
+
return getContext().animation === 'start';
|
|
19
|
+
},
|
|
20
|
+
get finishAnimation() {
|
|
21
|
+
return getContext().animation === 'finish';
|
|
26
22
|
}
|
|
27
23
|
},
|
|
28
24
|
actions: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
event.preventDefault();
|
|
39
|
-
const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
|
|
25
|
+
*navigate(event) {
|
|
26
|
+
const ctx = getContext();
|
|
27
|
+
const {
|
|
28
|
+
ref
|
|
29
|
+
} = getElement();
|
|
30
|
+
const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
|
|
31
|
+
if (isValidLink(ref) && isValidEvent(event) && !isDisabled) {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
// Don't announce the navigation immediately, wait 400 ms.
|
|
36
|
+
const timeout = setTimeout(() => {
|
|
37
|
+
ctx.message = ctx.loadingText;
|
|
38
|
+
ctx.animation = 'start';
|
|
39
|
+
}, 400);
|
|
40
|
+
yield navigate(ref.href);
|
|
47
41
|
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
// Dismiss loading message if it hasn't been added yet.
|
|
43
|
+
clearTimeout(timeout);
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
45
|
+
// Announce that the page has been loaded. If the message is the
|
|
46
|
+
// same, we use a no-break space similar to the @wordpress/a11y
|
|
47
|
+
// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26
|
|
48
|
+
ctx.message = ctx.loadedText + (ctx.message === ctx.loadedText ? '\u00A0' : '');
|
|
49
|
+
ctx.animation = 'finish';
|
|
50
|
+
ctx.url = ref.href;
|
|
57
51
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
52
|
+
// Focus the first anchor of the Query block.
|
|
53
|
+
const firstAnchor = `[data-wp-navigation-id=${id}] .wp-block-post-template a[href]`;
|
|
54
|
+
document.querySelector(firstAnchor)?.focus();
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
*prefetch() {
|
|
58
|
+
const {
|
|
59
|
+
ref
|
|
60
|
+
} = getElement();
|
|
61
|
+
const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
|
|
62
|
+
if (isValidLink(ref) && !isDisabled) {
|
|
63
|
+
yield prefetch(ref.href);
|
|
71
64
|
}
|
|
72
65
|
}
|
|
73
66
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
67
|
+
callbacks: {
|
|
68
|
+
*prefetch() {
|
|
69
|
+
const {
|
|
70
|
+
url
|
|
71
|
+
} = getContext();
|
|
72
|
+
const {
|
|
73
|
+
ref
|
|
74
|
+
} = getElement();
|
|
75
|
+
if (url && isValidLink(ref)) {
|
|
76
|
+
yield prefetch(ref.href);
|
|
85
77
|
}
|
|
86
78
|
}
|
|
87
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","navigate","prefetch","isValidLink","ref","window","HTMLAnchorElement","href","target","origin","location","isValidEvent","event","button","metaKey","ctrlKey","altKey","shiftKey","defaultPrevented","
|
|
1
|
+
{"version":3,"names":["store","getContext","getElement","navigate","prefetch","isValidLink","ref","window","HTMLAnchorElement","href","target","origin","location","isValidEvent","event","button","metaKey","ctrlKey","altKey","shiftKey","defaultPrevented","state","startAnimation","animation","finishAnimation","actions","ctx","isDisabled","closest","dataset","wpNavigationDisabled","preventDefault","id","wpNavigationId","timeout","setTimeout","message","loadingText","clearTimeout","loadedText","url","firstAnchor","document","querySelector","focus","callbacks"],"sources":["@wordpress/block-library/src/query/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tstore,\n\tgetContext,\n\tgetElement,\n\tnavigate,\n\tprefetch,\n} from '@wordpress/interactivity';\n\nconst isValidLink = ( ref ) =>\n\tref &&\n\tref instanceof window.HTMLAnchorElement &&\n\tref.href &&\n\t( ! ref.target || ref.target === '_self' ) &&\n\tref.origin === window.location.origin;\n\nconst isValidEvent = ( event ) =>\n\tevent.button === 0 && // Left clicks only.\n\t! event.metaKey && // Open in new tab (Mac).\n\t! event.ctrlKey && // Open in new tab (Windows).\n\t! event.altKey && // Download.\n\t! event.shiftKey &&\n\t! event.defaultPrevented;\n\nstore( 'core/query', {\n\tstate: {\n\t\tget startAnimation() {\n\t\t\treturn getContext().animation === 'start';\n\t\t},\n\t\tget finishAnimation() {\n\t\t\treturn getContext().animation === 'finish';\n\t\t},\n\t},\n\tactions: {\n\t\t*navigate( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )?.dataset\n\t\t\t\t.wpNavigationDisabled;\n\n\t\t\tif ( isValidLink( ref ) && isValidEvent( event ) && ! isDisabled ) {\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\tconst id = ref.closest( '[data-wp-navigation-id]' ).dataset\n\t\t\t\t\t.wpNavigationId;\n\n\t\t\t\t// Don't announce the navigation immediately, wait 400 ms.\n\t\t\t\tconst timeout = setTimeout( () => {\n\t\t\t\t\tctx.message = ctx.loadingText;\n\t\t\t\t\tctx.animation = 'start';\n\t\t\t\t}, 400 );\n\n\t\t\t\tyield navigate( ref.href );\n\n\t\t\t\t// Dismiss loading message if it hasn't been added yet.\n\t\t\t\tclearTimeout( timeout );\n\n\t\t\t\t// Announce that the page has been loaded. If the message is the\n\t\t\t\t// same, we use a no-break space similar to the @wordpress/a11y\n\t\t\t\t// package: https://github.com/WordPress/gutenberg/blob/c395242b8e6ee20f8b06c199e4fc2920d7018af1/packages/a11y/src/filter-message.js#L20-L26\n\t\t\t\tctx.message =\n\t\t\t\t\tctx.loadedText +\n\t\t\t\t\t( ctx.message === ctx.loadedText ? '\\u00A0' : '' );\n\n\t\t\t\tctx.animation = 'finish';\n\t\t\t\tctx.url = ref.href;\n\n\t\t\t\t// Focus the first anchor of the Query block.\n\t\t\t\tconst firstAnchor = `[data-wp-navigation-id=${ id }] .wp-block-post-template a[href]`;\n\t\t\t\tdocument.querySelector( firstAnchor )?.focus();\n\t\t\t}\n\t\t},\n\t\t*prefetch() {\n\t\t\tconst { ref } = getElement();\n\t\t\tconst isDisabled = ref.closest( '[data-wp-navigation-id]' )?.dataset\n\t\t\t\t.wpNavigationDisabled;\n\t\t\tif ( isValidLink( ref ) && ! isDisabled ) {\n\t\t\t\tyield prefetch( ref.href );\n\t\t\t}\n\t\t},\n\t},\n\tcallbacks: {\n\t\t*prefetch() {\n\t\t\tconst { url } = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( url && isValidLink( ref ) ) {\n\t\t\t\tyield prefetch( ref.href );\n\t\t\t}\n\t\t},\n\t},\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SACCA,KAAK,EACLC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACRC,QAAQ,QACF,0BAA0B;AAEjC,MAAMC,WAAW,GAAKC,GAAG,IACxBA,GAAG,IACHA,GAAG,YAAYC,MAAM,CAACC,iBAAiB,IACvCF,GAAG,CAACG,IAAI,KACN,CAAEH,GAAG,CAACI,MAAM,IAAIJ,GAAG,CAACI,MAAM,KAAK,OAAO,CAAE,IAC1CJ,GAAG,CAACK,MAAM,KAAKJ,MAAM,CAACK,QAAQ,CAACD,MAAM;AAEtC,MAAME,YAAY,GAAKC,KAAK,IAC3BA,KAAK,CAACC,MAAM,KAAK,CAAC;AAAI;AACtB,CAAED,KAAK,CAACE,OAAO;AAAI;AACnB,CAAEF,KAAK,CAACG,OAAO;AAAI;AACnB,CAAEH,KAAK,CAACI,MAAM;AAAI;AAClB,CAAEJ,KAAK,CAACK,QAAQ,IAChB,CAAEL,KAAK,CAACM,gBAAgB;AAEzBpB,KAAK,CAAE,YAAY,EAAE;EACpBqB,KAAK,EAAE;IACN,IAAIC,cAAcA,CAAA,EAAG;MACpB,OAAOrB,UAAU,CAAC,CAAC,CAACsB,SAAS,KAAK,OAAO;IAC1C,CAAC;IACD,IAAIC,eAAeA,CAAA,EAAG;MACrB,OAAOvB,UAAU,CAAC,CAAC,CAACsB,SAAS,KAAK,QAAQ;IAC3C;EACD,CAAC;EACDE,OA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B,UAAU,GAAGrB,GAAG,CAACsB,OAAO,CAAE,yBAA0B,CAAC,EAAEC,OAAO,CAClEC,oBAAoB;MACtB,IAAKzB,WAAW,CAAEC,GAAI,CAAC,IAAI,CAAEqB,UAAU,EAAG;QACzC,MAAMvB,QAAQ,CAAEE,GAAG,CAACG,IAAK,CAAC;MAC3B;IACD;EACD,CAAC;EACDoC,SAAS,EAAE;IACV,CAACzC,QAAQA,CAAA,EAAG;MACX,MAAM;QAAEoC;MAAI,CAAC,GAAGvC,UAAU,CAAC,CAAC;MAC5B,MAAM;QAAEK;MAAI,CAAC,GAAGJ,UAAU,CAAC,CAAC;MAC5B,IAAKsC,GAAG,IAAInC,WAAW,CAAEC,GAAI,CAAC,EAAG;QAChC,MAAMF,QAAQ,CAAEE,GAAG,CAACG,IAAK,CAAC;MAC3B;IACD;EACD;AACD,CAAE,CAAC"}
|
|
@@ -1,84 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
4
|
+
import { store, getContext, getElement } from '@wordpress/interactivity';
|
|
5
|
+
const {
|
|
6
|
+
actions
|
|
7
|
+
} = store('core/search', {
|
|
8
|
+
state: {
|
|
9
|
+
get ariaLabel() {
|
|
10
|
+
const {
|
|
11
|
+
isSearchInputVisible,
|
|
12
|
+
ariaLabelCollapsed,
|
|
13
|
+
ariaLabelExpanded
|
|
14
|
+
} = getContext();
|
|
15
|
+
return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed;
|
|
16
|
+
},
|
|
17
|
+
get ariaControls() {
|
|
18
|
+
const {
|
|
19
|
+
isSearchInputVisible,
|
|
20
|
+
inputId
|
|
21
|
+
} = getContext();
|
|
22
|
+
return isSearchInputVisible ? null : inputId;
|
|
23
|
+
},
|
|
24
|
+
get type() {
|
|
25
|
+
const {
|
|
26
|
+
isSearchInputVisible
|
|
27
|
+
} = getContext();
|
|
28
|
+
return isSearchInputVisible ? 'submit' : 'button';
|
|
29
|
+
},
|
|
30
|
+
get tabindex() {
|
|
31
|
+
const {
|
|
32
|
+
isSearchInputVisible
|
|
33
|
+
} = getContext();
|
|
34
|
+
return isSearchInputVisible ? '0' : '-1';
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
actions: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// If focus is outside search form, and in the document, close menu
|
|
74
|
-
// event.target === The element losing focus
|
|
75
|
-
// event.relatedTarget === The element receiving focus (if any)
|
|
76
|
-
// When focusout is outside the document,
|
|
77
|
-
// `window.document.activeElement` doesn't change.
|
|
78
|
-
if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
|
|
79
|
-
actions.core.search.closeSearchInput(store);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
38
|
+
openSearchInput(event) {
|
|
39
|
+
const ctx = getContext();
|
|
40
|
+
const {
|
|
41
|
+
ref
|
|
42
|
+
} = getElement();
|
|
43
|
+
if (!ctx.isSearchInputVisible) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
ctx.isSearchInputVisible = true;
|
|
46
|
+
ref.parentElement.querySelector('input').focus();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
closeSearchInput() {
|
|
50
|
+
const ctx = getContext();
|
|
51
|
+
ctx.isSearchInputVisible = false;
|
|
52
|
+
},
|
|
53
|
+
handleSearchKeydown(event) {
|
|
54
|
+
const {
|
|
55
|
+
ref
|
|
56
|
+
} = getElement();
|
|
57
|
+
// If Escape close the menu.
|
|
58
|
+
if (event?.key === 'Escape') {
|
|
59
|
+
actions.closeSearchInput();
|
|
60
|
+
ref.querySelector('button').focus();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
handleSearchFocusout(event) {
|
|
64
|
+
const {
|
|
65
|
+
ref
|
|
66
|
+
} = getElement();
|
|
67
|
+
// If focus is outside search form, and in the document, close menu
|
|
68
|
+
// event.target === The element losing focus
|
|
69
|
+
// event.relatedTarget === The element receiving focus (if any)
|
|
70
|
+
// When focusout is outside the document,
|
|
71
|
+
// `window.document.activeElement` doesn't change.
|
|
72
|
+
if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
|
|
73
|
+
actions.closeSearchInput();
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","
|
|
1
|
+
{"version":3,"names":["store","getContext","getElement","actions","state","ariaLabel","isSearchInputVisible","ariaLabelCollapsed","ariaLabelExpanded","ariaControls","inputId","type","tabindex","openSearchInput","event","ctx","ref","preventDefault","parentElement","querySelector","focus","closeSearchInput","handleSearchKeydown","key","handleSearchFocusout","contains","relatedTarget","target","window","document","activeElement"],"sources":["@wordpress/block-library/src/search/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst { actions } = store( 'core/search', {\n\tstate: {\n\t\tget ariaLabel() {\n\t\t\tconst {\n\t\t\t\tisSearchInputVisible,\n\t\t\t\tariaLabelCollapsed,\n\t\t\t\tariaLabelExpanded,\n\t\t\t} = getContext();\n\t\t\treturn isSearchInputVisible\n\t\t\t\t? ariaLabelExpanded\n\t\t\t\t: ariaLabelCollapsed;\n\t\t},\n\t\tget ariaControls() {\n\t\t\tconst { isSearchInputVisible, inputId } = getContext();\n\t\t\treturn isSearchInputVisible ? null : inputId;\n\t\t},\n\t\tget type() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? 'submit' : 'button';\n\t\t},\n\t\tget tabindex() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? '0' : '-1';\n\t\t},\n\t},\n\tactions: {\n\t\topenSearchInput( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( ! ctx.isSearchInputVisible ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tctx.isSearchInputVisible = true;\n\t\t\t\tref.parentElement.querySelector( 'input' ).focus();\n\t\t\t}\n\t\t},\n\t\tcloseSearchInput() {\n\t\t\tconst ctx = getContext();\n\t\t\tctx.isSearchInputVisible = false;\n\t\t},\n\t\thandleSearchKeydown( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If Escape close the menu.\n\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t}\n\t\t},\n\t\thandleSearchFocusout( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If focus is outside search form, and in the document, close menu\n\t\t\t// event.target === The element losing focus\n\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t// When focusout is outside the document,\n\t\t\t// `window.document.activeElement` doesn't change.\n\t\t\tif (\n\t\t\t\t! ref.contains( event.relatedTarget ) &&\n\t\t\t\tevent.target !== window.document.activeElement\n\t\t\t) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t}\n\t\t},\n\t},\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;AAExE,MAAM;EAAEC;AAAQ,CAAC,GAAGH,KAAK,CAAE,aAAa,EAAE;EACzCI,KAAK,EAAE;IACN,IAAIC,SAASA,CAAA,EAAG;MACf,MAAM;QACLC,oBAAoB;QACpBC,kBAAkB;QAClBC;MACD,CAAC,GAAGP,UAAU,CAAC,CAAC;MAChB,OAAOK,oBAAoB,GACxBE,iBAAiB,GACjBD,kBAAkB;IACtB,CAAC;IACD,IAAIE,YAAYA,CAAA,EAAG;MAClB,MAAM;QAAEH,oBAAoB;QAAEI;MAAQ,CAAC,GAAGT,UAAU,CAAC,CAAC;MACtD,OAAOK,oBAAoB,GAAG,IAAI,GAAGI,OAAO;IAC7C,CAAC;IACD,IAAIC,IAAIA,CAAA,EAAG;MACV,MAAM;QAAEL;MAAqB,CAAC,GAAGL,UAAU,CAAC,CAAC;MAC7C,OAAOK,oBAAoB,GAAG,QAAQ,GAAG,QAAQ;IAClD,CAAC;IACD,IAAIM,QAAQA,CAAA,EAAG;MACd,MAAM;QAAEN;MAAqB,CAAC,GAAGL,UAAU,CAAC,CAAC;MAC7C,OAAOK,oBAAoB,GAAG,GAAG,GAAG,IAAI;IACzC;EACD,CAAC;EACDH,OAAO,EAAE;IACRU,eAAeA,CAAEC,KAAK,EAAG;MACxB,MAAMC,GAAG,GAAGd,UAAU,CAAC,CAAC;MACxB,MAAM;QAAEe;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B,IAAK,CAAEa,GAAG,CAACT,oBAAoB,EAAG;QACjCQ,KAAK,CAACG,cAAc,CAAC,CAAC;QACtBF,GAAG,CAACT,oBAAoB,GAAG,IAAI;QAC/BU,GAAG,CAACE,aAAa,CAACC,aAAa,CAAE,OAAQ,CAAC,CAACC,KAAK,CAAC,CAAC;MACnD;IACD,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MAClB,MAAMN,GAAG,GAAGd,UAAU,CAAC,CAAC;MACxBc,GAAG,CAACT,oBAAoB,GAAG,KAAK;IACjC,CAAC;IACDgB,mBAAmBA,CAAER,KAAK,EAAG;MAC5B,MAAM;QAAEE;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B;MACA,IAAKY,KAAK,EAAES,GAAG,KAAK,QAAQ,EAAG;QAC9BpB,OAAO,CAACkB,gBAAgB,CAAC,CAAC;QAC1BL,GAAG,CAACG,aAAa,CAAE,QAAS,CAAC,CAACC,KAAK,CAAC,CAAC;MACtC;IACD,CAAC;IACDI,oBAAoBA,CAAEV,KAAK,EAAG;MAC7B,MAAM;QAAEE;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B;MACA;MACA;MACA;MACA;MACA,IACC,CAAEc,GAAG,CAACS,QAAQ,CAAEX,KAAK,CAACY,aAAc,CAAC,IACrCZ,KAAK,CAACa,MAAM,KAAKC,MAAM,CAACC,QAAQ,CAACC,aAAa,EAC7C;QACD3B,OAAO,CAACkB,gBAAgB,CAAC,CAAC;MAC3B;IACD;EACD;AACD,CAAE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes anchor tags from a string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} value The value to remove anchor tags from.
|
|
5
|
+
*
|
|
6
|
+
* @return {string} The value with anchor tags removed.
|
|
7
|
+
*/
|
|
8
|
+
export default function removeAnchorTag(value) {
|
|
9
|
+
return value.replace(/<\/?a[^>]*>/g, '');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=remove-anchor-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["removeAnchorTag","value","replace"],"sources":["@wordpress/block-library/src/utils/remove-anchor-tag.js"],"sourcesContent":["/**\n * Removes anchor tags from a string.\n *\n * @param {string} value The value to remove anchor tags from.\n *\n * @return {string} The value with anchor tags removed.\n */\nexport default function removeAnchorTag( value ) {\n\treturn value.replace( /<\\/?a[^>]*>/g, '' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,eAAeA,CAAEC,KAAK,EAAG;EAChD,OAAOA,KAAK,CAACC,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAC3C"}
|
|
@@ -315,20 +315,20 @@
|
|
|
315
315
|
z-index: 1;
|
|
316
316
|
color: inherit; direction: rtl;
|
|
317
317
|
}
|
|
318
|
-
.wp-block-cover-image p:not(.has-text-color),
|
|
319
|
-
.wp-block-cover-image h1:not(.has-text-color),
|
|
320
|
-
.wp-block-cover-image h2:not(.has-text-color),
|
|
321
|
-
.wp-block-cover-image h3:not(.has-text-color),
|
|
322
|
-
.wp-block-cover-image h4:not(.has-text-color),
|
|
323
|
-
.wp-block-cover-image h5:not(.has-text-color),
|
|
324
|
-
.wp-block-cover-image h6:not(.has-text-color),
|
|
325
|
-
.wp-block-cover p:not(.has-text-color),
|
|
326
|
-
.wp-block-cover h1:not(.has-text-color),
|
|
327
|
-
.wp-block-cover h2:not(.has-text-color),
|
|
328
|
-
.wp-block-cover h3:not(.has-text-color),
|
|
329
|
-
.wp-block-cover h4:not(.has-text-color),
|
|
330
|
-
.wp-block-cover h5:not(.has-text-color),
|
|
331
|
-
.wp-block-cover h6:not(.has-text-color) {
|
|
318
|
+
.wp-block-cover-image p:where(:not(.has-text-color)),
|
|
319
|
+
.wp-block-cover-image h1:where(:not(.has-text-color)),
|
|
320
|
+
.wp-block-cover-image h2:where(:not(.has-text-color)),
|
|
321
|
+
.wp-block-cover-image h3:where(:not(.has-text-color)),
|
|
322
|
+
.wp-block-cover-image h4:where(:not(.has-text-color)),
|
|
323
|
+
.wp-block-cover-image h5:where(:not(.has-text-color)),
|
|
324
|
+
.wp-block-cover-image h6:where(:not(.has-text-color)),
|
|
325
|
+
.wp-block-cover p:where(:not(.has-text-color)),
|
|
326
|
+
.wp-block-cover h1:where(:not(.has-text-color)),
|
|
327
|
+
.wp-block-cover h2:where(:not(.has-text-color)),
|
|
328
|
+
.wp-block-cover h3:where(:not(.has-text-color)),
|
|
329
|
+
.wp-block-cover h4:where(:not(.has-text-color)),
|
|
330
|
+
.wp-block-cover h5:where(:not(.has-text-color)),
|
|
331
|
+
.wp-block-cover h6:where(:not(.has-text-color)) {
|
|
332
332
|
color: inherit;
|
|
333
333
|
}
|
|
334
334
|
.wp-block-cover-image.is-position-top-left,
|