@wordpress/block-library 9.19.4 → 9.19.6
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/details/edit.js +28 -8
- package/build/details/edit.js.map +1 -1
- package/build/embed/variations.js +0 -10
- package/build/embed/variations.js.map +1 -1
- package/build/image/edit.js +0 -6
- package/build/image/edit.js.map +1 -1
- package/build/navigation-link/edit.js +27 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-template/edit.js +5 -3
- package/build/post-template/edit.js.map +1 -1
- package/build/query/edit/inspector-controls/index.js +30 -19
- package/build/query/edit/inspector-controls/index.js.map +1 -1
- package/build/query/edit/query-content.js +1 -6
- package/build/query/edit/query-content.js.map +1 -1
- package/build-module/details/edit.js +30 -10
- package/build-module/details/edit.js.map +1 -1
- package/build-module/embed/variations.js +0 -10
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/image/edit.js +0 -6
- package/build-module/image/edit.js.map +1 -1
- package/build-module/navigation-link/edit.js +28 -9
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-template/edit.js +5 -3
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/query/edit/inspector-controls/index.js +31 -20
- package/build-module/query/edit/inspector-controls/index.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -6
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-style/button/style-rtl.css +0 -1
- package/build-style/button/style.css +0 -1
- package/build-style/buttons/style-rtl.css +3 -0
- package/build-style/buttons/style.css +3 -0
- package/build-style/post-comments-form/style-rtl.css +0 -3
- package/build-style/post-comments-form/style.css +0 -3
- package/build-style/style-rtl.css +3 -4
- package/build-style/style.css +3 -4
- package/package.json +18 -18
- package/src/button/style.scss +0 -1
- package/src/buttons/style.scss +5 -0
- package/src/details/edit.js +38 -8
- package/src/embed/variations.js +0 -8
- package/src/image/edit.js +0 -4
- package/src/navigation-link/edit.js +45 -11
- package/src/post-author/index.php +1 -1
- package/src/post-author-name/index.php +1 -1
- package/src/post-comments-form/style.scss +0 -5
- package/src/post-template/edit.js +4 -3
- package/src/query/edit/inspector-controls/index.js +50 -34
- package/src/query/edit/query-content.js +2 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","useCallback","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","EnhancedPaginationControl","QueryInspectorControls","EnhancedPaginationModal","getQueryContextFromTemplate","QueryToolbar","htmlElementMessages","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","postsPerPage","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","newQuery","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\t\t// We need to reset the `inherit` value if in a singular template, as queries\n\t\t// are not inherited when in singular content (e.g. post, page, 404, blank).\n\t\tif ( isSingular && query.inherit ) {\n\t\t\tnewQuery.inherit = false;\n\t\t}\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tquery.inherit,\n\t\tpostsPerPage,\n\t\tinherit,\n\t\tisSingular,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\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 (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\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\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SA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AGA,aAAe;QAC/BC,QAAQ,EAAGA,QAAU;QACrBW,UAAU,EAAGA;MAAY,CACzB;IAAC,CACgB,CAAC,eACpBrB,IAAA,CAAChB,aAAa;MAAA+D,QAAA,eACb/C,IAAA,CAACH,YAAY;QAACW,UAAU,EAAGA,UAAY;QAACE,QAAQ,EAAGA;MAAU,CAAE;IAAC,CAClD,CAAC,eAChBR,KAAA,CAACjB,iBAAiB;MAACiE,KAAK,EAAC,UAAU;MAAAH,QAAA,gBAClC/C,IAAA,CAACV,aAAa;QACb6D,uBAAuB;QACvBC,qBAAqB;QACrBC,KAAK,EAAG9D,EAAE,CAAE,cAAe,CAAG;QAC9B+D,OAAO,EAAG,CACT;UAAED,KAAK,EAAE9D,EAAE,CAAE,iBAAkB,CAAC;UAAEgE,KAAK,EAAE;QAAM,CAAC,EAChD;UAAEF,KAAK,EAAE,QAAQ;UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGrC,OAAS;QACjBsC,QAAQ,EAAKD,KAAK,IACjB9C,aAAa,CAAE;UAAEQ,OAAO,EAAEsC;QAAM,CAAE,CAClC;QACDE,IAAI,EAAG3D,mBAAmB,CAAEoB,OAAO;MAAI,CACvC,CAAC,eACFlB,IAAA,CAACP,yBAAyB;QACzBuB,kBAAkB,EAAGA,kBAAoB;QACzCP,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpBV,IAAA,CAACkB,OAAO;MAAA,GAAMO;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","useInstanceId","useEffect","useCallback","BlockControls","InspectorControls","useBlockProps","store","blockEditorStore","useInnerBlocksProps","SelectControl","__","coreStore","EnhancedPaginationControl","QueryInspectorControls","EnhancedPaginationModal","getQueryContextFromTemplate","QueryToolbar","htmlElementMessages","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","DEFAULTS_POSTS_PER_PAGE","TEMPLATE","QueryContent","attributes","setAttributes","clientId","context","name","queryId","query","displayLayout","enhancedPagination","tagName","TagName","inherit","templateSlug","isSingular","__unstableMarkNextChangeAsNotPersistent","instanceId","blockProps","innerBlocksProps","template","postsPerPage","select","getSettings","getEntityRecord","getEntityRecordEdits","canUser","settingPerPage","kind","posts_per_page","editedSettingPerPage","updateQuery","newQuery","perPage","Object","keys","length","Number","isFinite","updateDisplayLayout","newDisplayLayout","children","setQuery","setDisplayLayout","group","__nextHasNoMarginBottom","__next40pxDefaultSize","label","options","value","onChange","help"],"sources":["@wordpress/block-library/src/query/edit/query-content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport {\n\tBlockControls,\n\tInspectorControls,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n\tuseInnerBlocksProps,\n} from '@wordpress/block-editor';\nimport { SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control';\nimport QueryInspectorControls from './inspector-controls';\nimport EnhancedPaginationModal from './enhanced-pagination-modal';\nimport { getQueryContextFromTemplate } from '../utils';\nimport QueryToolbar from './query-toolbar';\nimport { htmlElementMessages } from '../../utils/messages';\n\nconst DEFAULTS_POSTS_PER_PAGE = 3;\n\nconst TEMPLATE = [ [ 'core/post-template' ] ];\nexport default function QueryContent( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tcontext,\n\tname,\n} ) {\n\tconst {\n\t\tqueryId,\n\t\tquery,\n\t\tdisplayLayout,\n\t\tenhancedPagination,\n\t\ttagName: TagName = 'div',\n\t\tquery: { inherit } = {},\n\t} = attributes;\n\tconst { templateSlug } = context;\n\tconst { isSingular } = getQueryContextFromTemplate( templateSlug );\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst instanceId = useInstanceId( QueryContent );\n\tconst blockProps = useBlockProps();\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\ttemplate: TEMPLATE,\n\t} );\n\tconst { postsPerPage } = useSelect( ( select ) => {\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\tconst { getEntityRecord, getEntityRecordEdits, canUser } =\n\t\t\tselect( coreStore );\n\t\tconst settingPerPage = canUser( 'read', {\n\t\t\tkind: 'root',\n\t\t\tname: 'site',\n\t\t} )\n\t\t\t? +getEntityRecord( 'root', 'site' )?.posts_per_page\n\t\t\t: +getSettings().postsPerPage;\n\n\t\t// Gets changes made via the template area posts per page setting. These won't be saved\n\t\t// until the page is saved, but we should reflect this setting within the query loops\n\t\t// that inherit it.\n\t\tconst editedSettingPerPage = +getEntityRecordEdits( 'root', 'site' )\n\t\t\t?.posts_per_page;\n\n\t\treturn {\n\t\t\tpostsPerPage:\n\t\t\t\teditedSettingPerPage ||\n\t\t\t\tsettingPerPage ||\n\t\t\t\tDEFAULTS_POSTS_PER_PAGE,\n\t\t};\n\t}, [] );\n\t// There are some effects running where some initialization logic is\n\t// happening and setting some values to some attributes (ex. queryId).\n\t// These updates can cause an `undo trap` where undoing will result in\n\t// resetting again, so we need to mark these changes as not persistent\n\t// with `__unstableMarkNextChangeAsNotPersistent`.\n\n\t// Changes in query property (which is an object) need to be in the same callback,\n\t// because updates are batched after the render and changes in different query properties\n\t// would cause to override previous wanted changes.\n\tconst updateQuery = useCallback(\n\t\t( newQuery ) => setAttributes( { query: { ...query, ...newQuery } } ),\n\t\t[ query, setAttributes ]\n\t);\n\tuseEffect( () => {\n\t\tconst newQuery = {};\n\t\t// When we inherit from global query always need to set the `perPage`\n\t\t// based on the reading settings.\n\t\tif ( inherit && query.perPage !== postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t} else if ( ! query.perPage && postsPerPage ) {\n\t\t\tnewQuery.perPage = postsPerPage;\n\t\t}\n\n\t\tif ( !! Object.keys( newQuery ).length ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tupdateQuery( newQuery );\n\t\t}\n\t}, [\n\t\tquery.perPage,\n\t\tinherit,\n\t\tpostsPerPage,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tupdateQuery,\n\t] );\n\t// We need this for multi-query block pagination.\n\t// Query parameters for each block are scoped to their ID.\n\tuseEffect( () => {\n\t\tif ( ! Number.isFinite( queryId ) ) {\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( { queryId: instanceId } );\n\t\t}\n\t}, [\n\t\tqueryId,\n\t\tinstanceId,\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tsetAttributes,\n\t] );\n\tconst updateDisplayLayout = ( newDisplayLayout ) =>\n\t\tsetAttributes( {\n\t\t\tdisplayLayout: { ...displayLayout, ...newDisplayLayout },\n\t\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<EnhancedPaginationModal\n\t\t\t\tattributes={ attributes }\n\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\tclientId={ clientId }\n\t\t\t/>\n\t\t\t<InspectorControls>\n\t\t\t\t<QueryInspectorControls\n\t\t\t\t\tname={ name }\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetQuery={ updateQuery }\n\t\t\t\t\tsetDisplayLayout={ updateDisplayLayout }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tisSingular={ isSingular }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<BlockControls>\n\t\t\t\t<QueryToolbar attributes={ attributes } clientId={ clientId } />\n\t\t\t</BlockControls>\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 (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\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\t<EnhancedPaginationControl\n\t\t\t\t\tenhancedPagination={ enhancedPagination }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<TagName { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAC3D,SACCC,aAAa,EACbC,iBAAiB,EACjBC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,EACzBC,mBAAmB,QACb,yBAAyB;AAChC,SAASC,aAAa,QAAQ,uBAAuB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASJ,KAAK,IAAIK,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,OAAOC,yBAAyB,MAAM,kDAAkD;AACxF,OAAOC,sBAAsB,MAAM,sBAAsB;AACzD,OAAOC,uBAAuB,MAAM,6BAA6B;AACjE,SAASC,2BAA2B,QAAQ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UAAEE,KAAK,EAAE;QAAO,CAAC,EAClC;UAAEF,KAAK,EAAE,WAAW;UAAEE,KAAK,EAAE;QAAU,CAAC,EACxC;UAAEF,KAAK,EAAE,SAAS;UAAEE,KAAK,EAAE;QAAQ,CAAC,CAClC;QACHA,KAAK,EAAGrC,OAAS;QACjBsC,QAAQ,EAAKD,KAAK,IACjB9C,aAAa,CAAE;UAAEQ,OAAO,EAAEsC;QAAM,CAAE,CAClC;QACDE,IAAI,EAAG3D,mBAAmB,CAAEoB,OAAO;MAAI,CACvC,CAAC,eACFlB,IAAA,CAACP,yBAAyB;QACzBuB,kBAAkB,EAAGA,kBAAoB;QACzCP,aAAa,EAAGA,aAAe;QAC/BC,QAAQ,EAAGA;MAAU,CACrB,CAAC;IAAA,CACgB,CAAC,eACpBV,IAAA,CAACkB,OAAO;MAAA,GAAMO;IAAgB,CAAI,CAAC;EAAA,CAClC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
word-break: break-word;
|
|
138
138
|
box-sizing: border-box;
|
|
139
139
|
height: 100%;
|
|
140
|
-
width: 100%;
|
|
141
140
|
align-content: center;
|
|
142
141
|
}
|
|
143
142
|
.wp-block-button__link.aligncenter {
|
|
@@ -270,6 +269,9 @@
|
|
|
270
269
|
.wp-block-buttons.has-custom-font-size .wp-block-button__link {
|
|
271
270
|
font-size: inherit;
|
|
272
271
|
}
|
|
272
|
+
.wp-block-buttons .wp-block-button__link {
|
|
273
|
+
width: 100%;
|
|
274
|
+
}
|
|
273
275
|
|
|
274
276
|
.wp-block-button.aligncenter {
|
|
275
277
|
text-align: center;
|
|
@@ -2930,9 +2932,6 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
2930
2932
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2931
2933
|
margin-right: 0.5em;
|
|
2932
2934
|
}
|
|
2933
|
-
.wp-block-post-comments-form input[type=submit] {
|
|
2934
|
-
width: auto;
|
|
2935
|
-
}
|
|
2936
2935
|
|
|
2937
2936
|
.wp-block-post-comments-count {
|
|
2938
2937
|
box-sizing: border-box;
|
package/build-style/style.css
CHANGED
|
@@ -137,7 +137,6 @@
|
|
|
137
137
|
word-break: break-word;
|
|
138
138
|
box-sizing: border-box;
|
|
139
139
|
height: 100%;
|
|
140
|
-
width: 100%;
|
|
141
140
|
align-content: center;
|
|
142
141
|
}
|
|
143
142
|
.wp-block-button__link.aligncenter {
|
|
@@ -271,6 +270,9 @@
|
|
|
271
270
|
.wp-block-buttons.has-custom-font-size .wp-block-button__link {
|
|
272
271
|
font-size: inherit;
|
|
273
272
|
}
|
|
273
|
+
.wp-block-buttons .wp-block-button__link {
|
|
274
|
+
width: 100%;
|
|
275
|
+
}
|
|
274
276
|
|
|
275
277
|
.wp-block-button.aligncenter {
|
|
276
278
|
text-align: center;
|
|
@@ -2962,9 +2964,6 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
2962
2964
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2963
2965
|
margin-left: 0.5em;
|
|
2964
2966
|
}
|
|
2965
|
-
.wp-block-post-comments-form input[type=submit] {
|
|
2966
|
-
width: auto;
|
|
2967
|
-
}
|
|
2968
2967
|
|
|
2969
2968
|
.wp-block-post-comments-count {
|
|
2970
2969
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.19.
|
|
3
|
+
"version": "9.19.6",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,18 +42,18 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "7.25.7",
|
|
44
44
|
"@wordpress/a11y": "^4.19.1",
|
|
45
|
-
"@wordpress/api-fetch": "^7.19.
|
|
45
|
+
"@wordpress/api-fetch": "^7.19.2",
|
|
46
46
|
"@wordpress/autop": "^4.19.1",
|
|
47
47
|
"@wordpress/blob": "^4.19.1",
|
|
48
|
-
"@wordpress/block-editor": "^14.14.
|
|
49
|
-
"@wordpress/blocks": "^14.8.
|
|
50
|
-
"@wordpress/components": "^29.5.
|
|
51
|
-
"@wordpress/compose": "^7.19.
|
|
52
|
-
"@wordpress/core-data": "^7.19.
|
|
53
|
-
"@wordpress/data": "^10.19.
|
|
48
|
+
"@wordpress/block-editor": "^14.14.6",
|
|
49
|
+
"@wordpress/blocks": "^14.8.2",
|
|
50
|
+
"@wordpress/components": "^29.5.4",
|
|
51
|
+
"@wordpress/compose": "^7.19.2",
|
|
52
|
+
"@wordpress/core-data": "^7.19.6",
|
|
53
|
+
"@wordpress/data": "^10.19.2",
|
|
54
54
|
"@wordpress/date": "^5.19.1",
|
|
55
55
|
"@wordpress/deprecated": "^4.19.1",
|
|
56
|
-
"@wordpress/dom": "^4.19.
|
|
56
|
+
"@wordpress/dom": "^4.19.2",
|
|
57
57
|
"@wordpress/element": "^6.19.1",
|
|
58
58
|
"@wordpress/escape-html": "^3.19.1",
|
|
59
59
|
"@wordpress/hooks": "^4.19.1",
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
"@wordpress/icons": "^10.19.1",
|
|
63
63
|
"@wordpress/interactivity": "^6.19.1",
|
|
64
64
|
"@wordpress/interactivity-router": "^2.19.1",
|
|
65
|
-
"@wordpress/keyboard-shortcuts": "^5.19.
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.19.2",
|
|
66
66
|
"@wordpress/keycodes": "^4.19.1",
|
|
67
|
-
"@wordpress/notices": "^5.19.
|
|
68
|
-
"@wordpress/patterns": "^2.19.
|
|
67
|
+
"@wordpress/notices": "^5.19.2",
|
|
68
|
+
"@wordpress/patterns": "^2.19.6",
|
|
69
69
|
"@wordpress/primitives": "^4.19.1",
|
|
70
70
|
"@wordpress/private-apis": "^1.19.1",
|
|
71
|
-
"@wordpress/reusable-blocks": "^5.19.
|
|
72
|
-
"@wordpress/rich-text": "^7.19.
|
|
73
|
-
"@wordpress/server-side-render": "^5.19.
|
|
74
|
-
"@wordpress/url": "^4.19.
|
|
75
|
-
"@wordpress/viewport": "^6.19.
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.19.6",
|
|
72
|
+
"@wordpress/rich-text": "^7.19.2",
|
|
73
|
+
"@wordpress/server-side-render": "^5.19.4",
|
|
74
|
+
"@wordpress/url": "^4.19.2",
|
|
75
|
+
"@wordpress/viewport": "^6.19.2",
|
|
76
76
|
"@wordpress/wordcount": "^4.19.1",
|
|
77
77
|
"change-case": "^4.1.2",
|
|
78
78
|
"clsx": "^2.1.1",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "018f5b628fb5006dd45a1b7cd63463c73bd9d641"
|
|
95
95
|
}
|
package/src/button/style.scss
CHANGED
package/src/buttons/style.scss
CHANGED
|
@@ -82,6 +82,11 @@ $blocks-block__margin: 0.5em;
|
|
|
82
82
|
font-size: inherit;
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
+
|
|
86
|
+
// Needed to make the buttons stretch correctly in a vertical layout.
|
|
87
|
+
.wp-block-button__link {
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
// Legacy buttons that did not come in a wrapping container.
|
package/src/details/edit.js
CHANGED
|
@@ -6,20 +6,26 @@ import {
|
|
|
6
6
|
useBlockProps,
|
|
7
7
|
useInnerBlocksProps,
|
|
8
8
|
InspectorControls,
|
|
9
|
+
store as blockEditorStore,
|
|
9
10
|
} from '@wordpress/block-editor';
|
|
10
11
|
import {
|
|
11
12
|
TextControl,
|
|
12
13
|
ToggleControl,
|
|
13
14
|
__experimentalToolsPanel as ToolsPanel,
|
|
14
15
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
16
|
+
privateApis as componentsPrivateApis,
|
|
15
17
|
} from '@wordpress/components';
|
|
16
18
|
import { __ } from '@wordpress/i18n';
|
|
17
19
|
import { useState } from '@wordpress/element';
|
|
20
|
+
import { useSelect } from '@wordpress/data';
|
|
18
21
|
|
|
19
22
|
/**
|
|
20
23
|
* Internal dependencies
|
|
21
24
|
*/
|
|
22
25
|
import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
|
|
26
|
+
import { unlock } from '../lock-unlock';
|
|
27
|
+
|
|
28
|
+
const { withIgnoreIMEEvents } = unlock( componentsPrivateApis );
|
|
23
29
|
|
|
24
30
|
const TEMPLATE = [
|
|
25
31
|
[
|
|
@@ -30,7 +36,7 @@ const TEMPLATE = [
|
|
|
30
36
|
],
|
|
31
37
|
];
|
|
32
38
|
|
|
33
|
-
function DetailsEdit( { attributes, setAttributes } ) {
|
|
39
|
+
function DetailsEdit( { attributes, setAttributes, clientId } ) {
|
|
34
40
|
const { name, showContent, summary, allowedBlocks, placeholder } =
|
|
35
41
|
attributes;
|
|
36
42
|
const blockProps = useBlockProps();
|
|
@@ -42,6 +48,27 @@ function DetailsEdit( { attributes, setAttributes } ) {
|
|
|
42
48
|
const [ isOpen, setIsOpen ] = useState( showContent );
|
|
43
49
|
const dropdownMenuProps = useToolsPanelDropdownMenuProps();
|
|
44
50
|
|
|
51
|
+
// Check if the inner blocks are selected.
|
|
52
|
+
const hasSelectedInnerBlock = useSelect(
|
|
53
|
+
( select ) =>
|
|
54
|
+
select( blockEditorStore ).hasSelectedInnerBlock( clientId, true ),
|
|
55
|
+
[ clientId ]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const handleSummaryKeyDown = ( event ) => {
|
|
59
|
+
if ( event.key === 'Enter' && ! event.shiftKey ) {
|
|
60
|
+
setIsOpen( ( prevIsOpen ) => ! prevIsOpen );
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Prevent spacebar from toggling <details> while typing.
|
|
66
|
+
const handleSummaryKeyUp = ( event ) => {
|
|
67
|
+
if ( event.key === ' ' ) {
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
45
72
|
return (
|
|
46
73
|
<>
|
|
47
74
|
<InspectorControls>
|
|
@@ -91,18 +118,21 @@ function DetailsEdit( { attributes, setAttributes } ) {
|
|
|
91
118
|
) }
|
|
92
119
|
/>
|
|
93
120
|
</InspectorControls>
|
|
94
|
-
<details
|
|
121
|
+
<details
|
|
122
|
+
{ ...innerBlocksProps }
|
|
123
|
+
open={ isOpen || hasSelectedInnerBlock }
|
|
124
|
+
onToggle={ ( event ) => setIsOpen( event.target.open ) }
|
|
125
|
+
>
|
|
95
126
|
<summary
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
setIsOpen( ! isOpen );
|
|
99
|
-
} }
|
|
127
|
+
onKeyDown={ withIgnoreIMEEvents( handleSummaryKeyDown ) }
|
|
128
|
+
onKeyUp={ handleSummaryKeyUp }
|
|
100
129
|
>
|
|
101
130
|
<RichText
|
|
102
131
|
identifier="summary"
|
|
103
|
-
aria-label={ __(
|
|
132
|
+
aria-label={ __(
|
|
133
|
+
'Write summary. Press Enter to expand or collapse the details.'
|
|
134
|
+
) }
|
|
104
135
|
placeholder={ placeholder || __( 'Write summary…' ) }
|
|
105
|
-
allowedFormats={ [] }
|
|
106
136
|
withoutInteractiveFormatting
|
|
107
137
|
value={ summary }
|
|
108
138
|
onChange={ ( newSummary ) =>
|
package/src/embed/variations.js
CHANGED
|
@@ -251,14 +251,6 @@ const variations = [
|
|
|
251
251
|
patterns: [ /^https?:\/\/(www\.)?reverbnation\.com\/.+/i ],
|
|
252
252
|
attributes: { providerNameSlug: 'reverbnation', responsive: true },
|
|
253
253
|
},
|
|
254
|
-
{
|
|
255
|
-
name: 'screencast',
|
|
256
|
-
title: getTitle( 'Screencast' ),
|
|
257
|
-
icon: embedVideoIcon,
|
|
258
|
-
description: __( 'Embed Screencast content.' ),
|
|
259
|
-
patterns: [ /^https?:\/\/(www\.)?screencast\.com\/.+/i ],
|
|
260
|
-
attributes: { providerNameSlug: 'screencast', responsive: true },
|
|
261
|
-
},
|
|
262
254
|
{
|
|
263
255
|
name: 'scribd',
|
|
264
256
|
title: getTitle( 'Scribd' ),
|
package/src/image/edit.js
CHANGED
|
@@ -262,10 +262,6 @@ export function ImageEdit( {
|
|
|
262
262
|
additionalAttributes = {
|
|
263
263
|
sizeSlug: newSize,
|
|
264
264
|
};
|
|
265
|
-
} else {
|
|
266
|
-
// Keep the same url when selecting the same file, so "Resolution"
|
|
267
|
-
// option is not changed.
|
|
268
|
-
additionalAttributes = { url };
|
|
269
265
|
}
|
|
270
266
|
|
|
271
267
|
// Check if default link setting should be used.
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
store as blockEditorStore,
|
|
27
27
|
getColorClassName,
|
|
28
28
|
useInnerBlocksProps,
|
|
29
|
+
useBlockEditingMode,
|
|
29
30
|
} from '@wordpress/block-editor';
|
|
30
31
|
import { isURL, prependHTTP, safeDecodeURI } from '@wordpress/url';
|
|
31
32
|
import { useState, useEffect, useRef } from '@wordpress/element';
|
|
@@ -43,6 +44,10 @@ import { updateAttributes } from './update-attributes';
|
|
|
43
44
|
import { getColors } from '../navigation/edit/utils';
|
|
44
45
|
|
|
45
46
|
const DEFAULT_BLOCK = { name: 'core/navigation-link' };
|
|
47
|
+
const NESTING_BLOCK_NAMES = [
|
|
48
|
+
'core/navigation-link',
|
|
49
|
+
'core/navigation-submenu',
|
|
50
|
+
];
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
53
|
* A React hook to determine if it's dragging within the target element.
|
|
@@ -95,19 +100,29 @@ const useIsDraggingWithin = ( elementRef ) => {
|
|
|
95
100
|
return isDraggingWithin;
|
|
96
101
|
};
|
|
97
102
|
|
|
98
|
-
const useIsInvalidLink = ( kind, type, id ) => {
|
|
103
|
+
const useIsInvalidLink = ( kind, type, id, enabled ) => {
|
|
99
104
|
const isPostType =
|
|
100
105
|
kind === 'post-type' || type === 'post' || type === 'page';
|
|
101
106
|
const hasId = Number.isInteger( id );
|
|
107
|
+
const blockEditingMode = useBlockEditingMode();
|
|
108
|
+
|
|
102
109
|
const postStatus = useSelect(
|
|
103
110
|
( select ) => {
|
|
104
111
|
if ( ! isPostType ) {
|
|
105
112
|
return null;
|
|
106
113
|
}
|
|
114
|
+
|
|
115
|
+
// Fetching the posts status is an "expensive" operation. Especially for sites with large navigations.
|
|
116
|
+
// When the block is rendered in a template or other disabled contexts we can skip this check in order
|
|
117
|
+
// to avoid all these additional requests that don't really add any value in that mode.
|
|
118
|
+
if ( blockEditingMode === 'disabled' || ! enabled ) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
107
122
|
const { getEntityRecord } = select( coreStore );
|
|
108
123
|
return getEntityRecord( 'postType', type, id )?.status;
|
|
109
124
|
},
|
|
110
|
-
[ isPostType, type, id ]
|
|
125
|
+
[ isPostType, blockEditingMode, enabled, type, id ]
|
|
111
126
|
);
|
|
112
127
|
|
|
113
128
|
// Check Navigation Link validity if:
|
|
@@ -280,8 +295,6 @@ export default function NavigationLinkEdit( {
|
|
|
280
295
|
clientId,
|
|
281
296
|
} ) {
|
|
282
297
|
const { id, label, type, url, description, kind } = attributes;
|
|
283
|
-
|
|
284
|
-
const [ isInvalid, isDraft ] = useIsInvalidLink( kind, type, id );
|
|
285
298
|
const { maxNestingLevel } = context;
|
|
286
299
|
|
|
287
300
|
const {
|
|
@@ -313,6 +326,7 @@ export default function NavigationLinkEdit( {
|
|
|
313
326
|
isTopLevelLink,
|
|
314
327
|
isParentOfSelectedBlock,
|
|
315
328
|
hasChildren,
|
|
329
|
+
validateLinkStatus,
|
|
316
330
|
} = useSelect(
|
|
317
331
|
( select ) => {
|
|
318
332
|
const {
|
|
@@ -321,28 +335,48 @@ export default function NavigationLinkEdit( {
|
|
|
321
335
|
getBlockRootClientId,
|
|
322
336
|
hasSelectedInnerBlock,
|
|
323
337
|
getBlockParentsByBlockName,
|
|
338
|
+
getSelectedBlockClientId,
|
|
324
339
|
} = select( blockEditorStore );
|
|
340
|
+
const rootClientId = getBlockRootClientId( clientId );
|
|
341
|
+
const isTopLevel =
|
|
342
|
+
getBlockName( rootClientId ) === 'core/navigation';
|
|
343
|
+
const selectedBlockClientId = getSelectedBlockClientId();
|
|
344
|
+
const rootNavigationClientId = isTopLevel
|
|
345
|
+
? rootClientId
|
|
346
|
+
: getBlockParentsByBlockName(
|
|
347
|
+
clientId,
|
|
348
|
+
'core/navigation'
|
|
349
|
+
)[ 0 ];
|
|
350
|
+
|
|
351
|
+
// Enable when the root Navigation block is selected or any of its inner blocks.
|
|
352
|
+
const enableLinkStatusValidation =
|
|
353
|
+
selectedBlockClientId === rootNavigationClientId ||
|
|
354
|
+
hasSelectedInnerBlock( rootNavigationClientId, true );
|
|
325
355
|
|
|
326
356
|
return {
|
|
327
357
|
isAtMaxNesting:
|
|
328
|
-
getBlockParentsByBlockName( clientId,
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
] ).length >= maxNestingLevel,
|
|
332
|
-
isTopLevelLink:
|
|
333
|
-
getBlockName( getBlockRootClientId( clientId ) ) ===
|
|
334
|
-
'core/navigation',
|
|
358
|
+
getBlockParentsByBlockName( clientId, NESTING_BLOCK_NAMES )
|
|
359
|
+
.length >= maxNestingLevel,
|
|
360
|
+
isTopLevelLink: isTopLevel,
|
|
335
361
|
isParentOfSelectedBlock: hasSelectedInnerBlock(
|
|
336
362
|
clientId,
|
|
337
363
|
true
|
|
338
364
|
),
|
|
339
365
|
hasChildren: !! getBlockCount( clientId ),
|
|
366
|
+
validateLinkStatus: enableLinkStatusValidation,
|
|
340
367
|
};
|
|
341
368
|
},
|
|
342
369
|
[ clientId, maxNestingLevel ]
|
|
343
370
|
);
|
|
344
371
|
const { getBlocks } = useSelect( blockEditorStore );
|
|
345
372
|
|
|
373
|
+
const [ isInvalid, isDraft ] = useIsInvalidLink(
|
|
374
|
+
kind,
|
|
375
|
+
type,
|
|
376
|
+
id,
|
|
377
|
+
validateLinkStatus
|
|
378
|
+
);
|
|
379
|
+
|
|
346
380
|
/**
|
|
347
381
|
* Transform to submenu block.
|
|
348
382
|
*/
|
|
@@ -26,7 +26,7 @@ function render_block_core_post_author( $attributes, $content, $block ) {
|
|
|
26
26
|
return '';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if ( ! post_type_supports( $block->context['postType'], 'author' ) ) {
|
|
29
|
+
if ( isset( $block->context['postType'] ) && ! post_type_supports( $block->context['postType'], 'author' ) ) {
|
|
30
30
|
return '';
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -26,7 +26,7 @@ function render_block_core_post_author_name( $attributes, $content, $block ) {
|
|
|
26
26
|
return '';
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if ( ! post_type_supports( $block->context['postType'], 'author' ) ) {
|
|
29
|
+
if ( isset( $block->context['postType'] ) && ! post_type_supports( $block->context['postType'], 'author' ) ) {
|
|
30
30
|
return '';
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -181,14 +181,15 @@ export default function PostTemplateEdit( {
|
|
|
181
181
|
* Handle cases where sticky is set to `exclude` or `only`.
|
|
182
182
|
* Which works as a `post__in/post__not_in` query for sticky posts.
|
|
183
183
|
*/
|
|
184
|
-
if (
|
|
184
|
+
if ( [ 'exclude', 'only' ].includes( sticky ) ) {
|
|
185
185
|
query.sticky = sticky === 'only';
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
// Empty string represents the default behavior of including sticky posts.
|
|
189
|
+
if ( [ '', 'ignore' ].includes( sticky ) ) {
|
|
189
190
|
// Remove any leftover sticky query parameter.
|
|
190
191
|
delete query.sticky;
|
|
191
|
-
query.ignore_sticky =
|
|
192
|
+
query.ignore_sticky = sticky === 'ignore';
|
|
192
193
|
}
|
|
193
194
|
|
|
194
195
|
// If `inherit` is truthy, adjust conditionally the query to create a better preview.
|