@wordpress/block-library 9.20.0 → 9.21.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/categories/edit.js +3 -3
- package/build/categories/edit.js.map +1 -1
- package/build/embed/edit.js +4 -1
- package/build/embed/edit.js.map +1 -1
- package/build/image/edit.js +3 -2
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +13 -8
- package/build/image/image.js.map +1 -1
- package/build/navigation/edit/index.js +8 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation-link/edit.js +27 -8
- package/build/navigation-link/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +2 -1
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/query-total/index.js +3 -0
- package/build/query-total/index.js.map +1 -1
- package/build/rss/edit.js +21 -1
- package/build/rss/edit.js.map +1 -1
- package/build/rss/index.js +7 -0
- package/build/rss/index.js.map +1 -1
- package/build/site-title/edit.js +1 -1
- package/build/site-title/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +50 -8
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/hooks.js +7 -1
- package/build/table-of-contents/hooks.js.map +1 -1
- package/build/table-of-contents/index.js +3 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -3
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/embed/edit.js +4 -1
- package/build-module/embed/edit.js.map +1 -1
- package/build-module/image/edit.js +3 -2
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +14 -9
- package/build-module/image/image.js.map +1 -1
- package/build-module/navigation/edit/index.js +8 -4
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation-link/edit.js +28 -9
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +2 -1
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/query-total/index.js +3 -0
- package/build-module/query-total/index.js.map +1 -1
- package/build-module/rss/edit.js +22 -2
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/rss/index.js +7 -0
- package/build-module/rss/index.js.map +1 -1
- package/build-module/site-title/edit.js +1 -1
- package/build-module/site-title/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +52 -10
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/hooks.js +7 -1
- package/build-module/table-of-contents/hooks.js.map +1 -1
- package/build-module/table-of-contents/index.js +3 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-style/post-comments-form/style-rtl.css +3 -0
- package/build-style/post-comments-form/style.css +3 -0
- package/build-style/style-rtl.css +3 -0
- package/build-style/style.css +3 -0
- package/package.json +35 -35
- package/src/categories/edit.js +3 -3
- package/src/embed/edit.js +7 -1
- package/src/image/edit.js +3 -3
- package/src/image/image.js +9 -12
- package/src/navigation/edit/index.js +4 -0
- package/src/navigation-link/edit.js +45 -11
- package/src/post-comments-form/style.scss +5 -0
- package/src/post-featured-image/edit.js +2 -1
- package/src/query-total/block.json +3 -0
- package/src/query-total/index.php +1 -1
- package/src/rss/block.json +7 -0
- package/src/rss/edit.js +21 -0
- package/src/rss/index.php +27 -9
- package/src/site-title/edit.js +1 -1
- package/src/site-title/index.php +1 -1
- package/src/table-of-contents/block.json +3 -0
- package/src/table-of-contents/edit.js +45 -4
- package/src/table-of-contents/hooks.js +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fastDeepEqual","useRegistry","__unstableStripHTML","stripHTML","useEffect","addQueryArgs","removeQueryArgs","store","blockEditorStore","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","page","blockName","headingAttributes","canBeLinked","anchor","push","content","replace","level","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","useObserveHeadings","registry","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage } = getBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,mBAAmB,IA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AiB,CAACM,KAAK;UAC9BC,IAAI,EAAEN,WAAW,GACd,GAAIJ,eAAe,IAAMG,iBAAiB,CAACE,MAAM,EAAG,GACpD;QACJ,CAAE,CAAC;MACJ;IACD;EACD;EAEA,OAAOP,cAAc;AACtB;AAEA,SAASa,eAAeA,CAAElC,MAAM,EAAEmC,QAAQ,EAAElC,QAAQ,EAAG;EACtD,MAAM;IAAEG;EAAmB,CAAC,GAAGJ,MAAM,CAAEF,gBAAiB,CAAC;EACzD,MAAM;IAAEsC,qBAAqB;IAAEC;EAAwC,CAAC,GACvEF,QAAQ,CAAErC,gBAAiB,CAAC;;EAE7B;AACD;AACA;AACA;AACA;EACC,MAAMwC,UAAU,GAAGlC,kBAAkB,CAAEH,QAAS,CAAC;EACjD,IAAKqC,UAAU,KAAK,IAAI,EAAG;IAC1B;EACD;EAEA,MAAMC,QAAQ,GAAGxC,iBAAiB,CAAEC,MAAM,EAAEC,QAAS,CAAC;EACtD,IAAK,CAAEX,aAAa,CAAEiD,QAAQ,EAAED,UAAU,CAACC,QAAS,CAAC,EAAG;IACvDF,uCAAuC,CAAC,CAAC;IACzCD,qBAAqB,CAAEnC,QAAQ,EAAE;MAAEsC;IAAS,CAAE,CAAC;EAChD;AACD;AAEA,OAAO,SAASC,kBAAkBA,CAAEvC,QAAQ,EAAG;EAC9C,MAAMwC,QAAQ,GAAGlD,WAAW,CAAC,CAAC;EAC9BG,SAAS,CAAE,MAAM;IAChB;IACA;IACA,OAAO+C,QAAQ,CAACC,SAAS,CAAE,MAC1BR,eAAe,CAAEO,QAAQ,CAACzC,MAAM,EAAEyC,QAAQ,CAACN,QAAQ,EAAElC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAEwC,QAAQ,EAAExC,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["fastDeepEqual","useRegistry","__unstableStripHTML","stripHTML","useEffect","addQueryArgs","removeQueryArgs","store","blockEditorStore","getLatestHeadings","select","clientId","_select$getPermalink","_getBlockAttributes","getBlockAttributes","getBlockName","getBlocksByName","getClientIdsOfDescendants","permalink","getPermalink","isPaginated","length","onlyIncludeCurrentPage","maxLevel","postContentClientId","allBlockClientIds","tocPage","tocIndex","indexOf","blockIndex","blockClientId","entries","latestHeadings","headingPage","headingPageLink","page","blockName","headingAttributes","level","canBeLinked","anchor","push","content","replace","link","observeCallback","dispatch","updateBlockAttributes","__unstableMarkNextChangeAsNotPersistent","attributes","headings","useObserveHeadings","registry","subscribe"],"sources":["@wordpress/block-library/src/table-of-contents/hooks.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { useRegistry } from '@wordpress/data';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { useEffect } from '@wordpress/element';\nimport { addQueryArgs, removeQueryArgs } from '@wordpress/url';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction getLatestHeadings( select, clientId ) {\n\tconst {\n\t\tgetBlockAttributes,\n\t\tgetBlockName,\n\t\tgetBlocksByName,\n\t\tgetClientIdsOfDescendants,\n\t} = select( blockEditorStore );\n\n\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t// Blocks can be loaded into a *non-post* block editor, so to avoid\n\t// declaring @wordpress/editor as a dependency, we must access its\n\t// store by string. When the store is not available, editorSelectors\n\t// will be null, and the block's saved markup will lack permalinks.\n\t// eslint-disable-next-line @wordpress/data-no-store-string-literals\n\tconst permalink = select( 'core/editor' ).getPermalink() ?? null;\n\n\tconst isPaginated = getBlocksByName( 'core/nextpage' ).length !== 0;\n\tconst { onlyIncludeCurrentPage, maxLevel } =\n\t\tgetBlockAttributes( clientId ) ?? {};\n\n\t// Get post-content block client ID.\n\tconst [ postContentClientId = '' ] = getBlocksByName( 'core/post-content' );\n\n\t// Get the client ids of all blocks in the editor.\n\tconst allBlockClientIds = getClientIdsOfDescendants( postContentClientId );\n\n\t// If onlyIncludeCurrentPage is true, calculate the page (of a paginated post) this block is part of, so we know which headings to include; otherwise, skip the calculation.\n\tlet tocPage = 1;\n\n\tif ( isPaginated && onlyIncludeCurrentPage ) {\n\t\t// We can't use getBlockIndex because it only returns the index\n\t\t// relative to sibling blocks.\n\t\tconst tocIndex = allBlockClientIds.indexOf( clientId );\n\n\t\tfor ( const [\n\t\t\tblockIndex,\n\t\t\tblockClientId,\n\t\t] of allBlockClientIds.entries() ) {\n\t\t\t// If we've reached blocks after the Table of Contents, we've\n\t\t\t// finished calculating which page the block is on.\n\t\t\tif ( blockIndex >= tocIndex ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( getBlockName( blockClientId ) === 'core/nextpage' ) {\n\t\t\t\ttocPage++;\n\t\t\t}\n\t\t}\n\t}\n\n\tconst latestHeadings = [];\n\n\t/** The page (of a paginated post) a heading will be part of. */\n\tlet headingPage = 1;\n\tlet headingPageLink = null;\n\n\t// If the core/editor store is available, we can add permalinks to the\n\t// generated table of contents.\n\tif ( typeof permalink === 'string' ) {\n\t\theadingPageLink = isPaginated\n\t\t\t? addQueryArgs( permalink, { page: headingPage } )\n\t\t\t: permalink;\n\t}\n\n\tfor ( const blockClientId of allBlockClientIds ) {\n\t\tconst blockName = getBlockName( blockClientId );\n\t\tif ( blockName === 'core/nextpage' ) {\n\t\t\theadingPage++;\n\n\t\t\t// If we're only including headings from the current page (of\n\t\t\t// a paginated post), then exit the loop if we've reached the\n\t\t\t// pages after the one with the Table of Contents block.\n\t\t\tif ( onlyIncludeCurrentPage && headingPage > tocPage ) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( typeof permalink === 'string' ) {\n\t\t\t\theadingPageLink = addQueryArgs(\n\t\t\t\t\tremoveQueryArgs( permalink, [ 'page' ] ),\n\t\t\t\t\t{ page: headingPage }\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t\t// If we're including all headings or we've reached headings on\n\t\t// the same page as the Table of Contents block, add them to the\n\t\t// list.\n\t\telse if ( ! onlyIncludeCurrentPage || headingPage === tocPage ) {\n\t\t\tif ( blockName === 'core/heading' ) {\n\t\t\t\tconst headingAttributes = getBlockAttributes( blockClientId );\n\n\t\t\t\t// Skip headings that are deeper than maxLevel\n\t\t\t\tif ( maxLevel && headingAttributes.level > maxLevel ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tconst canBeLinked =\n\t\t\t\t\ttypeof headingPageLink === 'string' &&\n\t\t\t\t\ttypeof headingAttributes.anchor === 'string' &&\n\t\t\t\t\theadingAttributes.anchor !== '';\n\n\t\t\t\tlatestHeadings.push( {\n\t\t\t\t\t// Convert line breaks to spaces, and get rid of HTML tags in the headings.\n\t\t\t\t\tcontent: stripHTML(\n\t\t\t\t\t\theadingAttributes.content.replace(\n\t\t\t\t\t\t\t/(<br *\\/?>)+/g,\n\t\t\t\t\t\t\t' '\n\t\t\t\t\t\t)\n\t\t\t\t\t),\n\t\t\t\t\tlevel: headingAttributes.level,\n\t\t\t\t\tlink: canBeLinked\n\t\t\t\t\t\t? `${ headingPageLink }#${ headingAttributes.anchor }`\n\t\t\t\t\t\t: null,\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn latestHeadings;\n}\n\nfunction observeCallback( select, dispatch, clientId ) {\n\tconst { getBlockAttributes } = select( blockEditorStore );\n\tconst { updateBlockAttributes, __unstableMarkNextChangeAsNotPersistent } =\n\t\tdispatch( blockEditorStore );\n\n\t/**\n\t * If the block no longer exists in the store, skip the update.\n\t * The \"undo\" action recreates the block and provides a new `clientId`.\n\t * The hook still might be observing the changes while the old block unmounts.\n\t */\n\tconst attributes = getBlockAttributes( clientId );\n\tif ( attributes === null ) {\n\t\treturn;\n\t}\n\n\tconst headings = getLatestHeadings( select, clientId );\n\tif ( ! fastDeepEqual( headings, attributes.headings ) ) {\n\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\tupdateBlockAttributes( clientId, { headings } );\n\t}\n}\n\nexport function useObserveHeadings( clientId ) {\n\tconst registry = useRegistry();\n\tuseEffect( () => {\n\t\t// Todo: Limit subscription to block editor store when data no longer depends on `getPermalink`.\n\t\t// See: https://github.com/WordPress/gutenberg/pull/45513\n\t\treturn registry.subscribe( () =>\n\t\t\tobserveCallback( registry.select, registry.dispatch, clientId )\n\t\t);\n\t}, [ registry, clientId ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,aAAa,MAAM,qBAAqB;;AAE/C;AACA;AACA;AACA,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,mBAAmB,IAAIC,SAAS,QAAQ,gBAAgB;AACjE,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,YAAY,EAAEC,eAAe,QAAQ,gBAAgB;AAC9D,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAEnE,SAASC,iBAAiBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAAA,IAAAC,oBAAA,EAAAC,mBAAA;EAC9C,MAAM;IACLC,kBAAkB;IAClBC,YAAY;IACZC,eAAe;IACfC;EACD,CAAC,GAAGP,MAAM,CAAEF,gBAAiB,CAAC;;EAE9B;EACA;EACA;EACA;EACA;EACA;EACA,MAAMU,SAAS,IAAAN,oBAAA,GAAGF,MAAM,CAAE,aAAc,CAAC,CAACS,YAAY,CAAC,CAAC,cAAAP,oBAAA,cAAAA,oBAAA,GAAI,IAAI;EAEhE,MAAMQ,WAAW,GAAGJ,eAAe,CAAE,eAAgB,CAAC,CAACK,MAAM,KAAK,CAAC;EACnE,MAAM;IAAEC,sBAAsB;IAAEC;EAAS,CAAC,IAAAV,mBAAA,GACzCC,kBAAkB,CAAEH,QAAS,CAAC,cAAAE,mBAAA,cAAAA,mBAAA,GAAI,CAAC,CAAC;;EAErC;EACA,MAAM,CAAEW,mBAAmB,GAAG,EAAE,CAAE,GAAGR,eAAe,CAAE,mBAAoB,CAAC;;EAE3E;EACA,MAAMS,iBAAiB,GAAGR,yBAAyB,CAAE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EA,OAAO,SAASC,kBAAkBA,CAAExC,QAAQ,EAAG;EAC9C,MAAMyC,QAAQ,GAAGnD,WAAW,CAAC,CAAC;EAC9BG,SAAS,CAAE,MAAM;IAChB;IACA;IACA,OAAOgD,QAAQ,CAACC,SAAS,CAAE,MAC1BR,eAAe,CAAEO,QAAQ,CAAC1C,MAAM,EAAE0C,QAAQ,CAACN,QAAQ,EAAEnC,QAAS,CAC/D,CAAC;EACF,CAAC,EAAE,CAAEyC,QAAQ,EAAEzC,QAAQ,CAAG,CAAC;AAC5B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","tableOfContents","icon","initBlock","metadata","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","attributes","headings","type","items","onlyIncludeCurrentPage","supports","html","color","text","background","gradients","link","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","interactivity","clientNavigation","__experimentalBorder","radius","width","style","edit","save","settings","example","innerBlocks","level","content","init"],"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t\tlevel: 3,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t},\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,eAAe,IAAIC,IAAI,QAAQ,kBAAkB;;AAE1D;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,cAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,QAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,QAAA;MAAAC,IAAA;MAAAC,KAAA;QAAAD,IAAA;MAAA;MAAA;IAAA;IAAAE,sBAAA;MAAAF,IAAA;MAAA;IAAA;EAAA;
|
|
1
|
+
{"version":3,"names":["__","tableOfContents","icon","initBlock","metadata","$schema","apiVersion","__experimental","name","title","category","description","keywords","textdomain","attributes","headings","type","items","onlyIncludeCurrentPage","maxLevel","supports","html","color","text","background","gradients","link","spacing","margin","padding","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","__experimentalDefaultControls","interactivity","clientNavigation","__experimentalBorder","radius","width","style","edit","save","settings","example","innerBlocks","level","content","init"],"sources":["@wordpress/block-library/src/table-of-contents/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { tableOfContents as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\n\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\tedit,\n\tsave,\n\texample: {\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 2,\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'core/heading',\n\t\t\t\tattributes: {\n\t\t\t\t\tlevel: 3,\n\t\t\t\t\tcontent: __( 'Subheading' ),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tattributes: {\n\t\t\theadings: [\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Heading' ),\n\t\t\t\t\tlevel: 2,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcontent: __( 'Subheading' ),\n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;EAAEK,IAAI;EAAEJ,QAAQ;EAAE4C;AAAS,CAAE,CAAC","ignoreList":[]}
|
|
@@ -2930,6 +2930,9 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
2930
2930
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2931
2931
|
margin-right: 0.5em;
|
|
2932
2932
|
}
|
|
2933
|
+
.wp-block-post-comments-form input[type=submit] {
|
|
2934
|
+
width: auto;
|
|
2935
|
+
}
|
|
2933
2936
|
|
|
2934
2937
|
.wp-block-post-comments-count {
|
|
2935
2938
|
box-sizing: border-box;
|
package/build-style/style.css
CHANGED
|
@@ -2962,6 +2962,9 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
|
|
|
2962
2962
|
font-size: var(--wp--preset--font-size--medium, smaller);
|
|
2963
2963
|
margin-left: 0.5em;
|
|
2964
2964
|
}
|
|
2965
|
+
.wp-block-post-comments-form input[type=submit] {
|
|
2966
|
+
width: auto;
|
|
2967
|
+
}
|
|
2965
2968
|
|
|
2966
2969
|
.wp-block-post-comments-count {
|
|
2967
2970
|
box-sizing: border-box;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.21.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -41,39 +41,39 @@
|
|
|
41
41
|
],
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@babel/runtime": "7.25.7",
|
|
44
|
-
"@wordpress/a11y": "^4.
|
|
45
|
-
"@wordpress/api-fetch": "^7.
|
|
46
|
-
"@wordpress/autop": "^4.
|
|
47
|
-
"@wordpress/blob": "^4.
|
|
48
|
-
"@wordpress/block-editor": "^14.
|
|
49
|
-
"@wordpress/blocks": "^14.
|
|
50
|
-
"@wordpress/components": "^29.
|
|
51
|
-
"@wordpress/compose": "^7.
|
|
52
|
-
"@wordpress/core-data": "^7.
|
|
53
|
-
"@wordpress/data": "^10.
|
|
54
|
-
"@wordpress/date": "^5.
|
|
55
|
-
"@wordpress/deprecated": "^4.
|
|
56
|
-
"@wordpress/dom": "^4.
|
|
57
|
-
"@wordpress/element": "^6.
|
|
58
|
-
"@wordpress/escape-html": "^3.
|
|
59
|
-
"@wordpress/hooks": "^4.
|
|
60
|
-
"@wordpress/html-entities": "^4.
|
|
61
|
-
"@wordpress/i18n": "^5.
|
|
62
|
-
"@wordpress/icons": "^10.
|
|
63
|
-
"@wordpress/interactivity": "^6.
|
|
64
|
-
"@wordpress/interactivity-router": "^2.
|
|
65
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
66
|
-
"@wordpress/keycodes": "^4.
|
|
67
|
-
"@wordpress/notices": "^5.
|
|
68
|
-
"@wordpress/patterns": "^2.
|
|
69
|
-
"@wordpress/primitives": "^4.
|
|
70
|
-
"@wordpress/private-apis": "^1.
|
|
71
|
-
"@wordpress/reusable-blocks": "^5.
|
|
72
|
-
"@wordpress/rich-text": "^7.
|
|
73
|
-
"@wordpress/server-side-render": "^5.
|
|
74
|
-
"@wordpress/url": "^4.
|
|
75
|
-
"@wordpress/viewport": "^6.
|
|
76
|
-
"@wordpress/wordcount": "^4.
|
|
44
|
+
"@wordpress/a11y": "^4.21.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.21.0",
|
|
46
|
+
"@wordpress/autop": "^4.21.0",
|
|
47
|
+
"@wordpress/blob": "^4.21.0",
|
|
48
|
+
"@wordpress/block-editor": "^14.16.0",
|
|
49
|
+
"@wordpress/blocks": "^14.10.0",
|
|
50
|
+
"@wordpress/components": "^29.7.0",
|
|
51
|
+
"@wordpress/compose": "^7.21.0",
|
|
52
|
+
"@wordpress/core-data": "^7.21.0",
|
|
53
|
+
"@wordpress/data": "^10.21.0",
|
|
54
|
+
"@wordpress/date": "^5.21.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.21.0",
|
|
56
|
+
"@wordpress/dom": "^4.21.0",
|
|
57
|
+
"@wordpress/element": "^6.21.0",
|
|
58
|
+
"@wordpress/escape-html": "^3.21.0",
|
|
59
|
+
"@wordpress/hooks": "^4.21.0",
|
|
60
|
+
"@wordpress/html-entities": "^4.21.0",
|
|
61
|
+
"@wordpress/i18n": "^5.21.0",
|
|
62
|
+
"@wordpress/icons": "^10.21.0",
|
|
63
|
+
"@wordpress/interactivity": "^6.21.0",
|
|
64
|
+
"@wordpress/interactivity-router": "^2.21.0",
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.21.0",
|
|
66
|
+
"@wordpress/keycodes": "^4.21.0",
|
|
67
|
+
"@wordpress/notices": "^5.21.0",
|
|
68
|
+
"@wordpress/patterns": "^2.21.0",
|
|
69
|
+
"@wordpress/primitives": "^4.21.0",
|
|
70
|
+
"@wordpress/private-apis": "^1.21.0",
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.21.0",
|
|
72
|
+
"@wordpress/rich-text": "^7.21.0",
|
|
73
|
+
"@wordpress/server-side-render": "^5.21.0",
|
|
74
|
+
"@wordpress/url": "^4.21.0",
|
|
75
|
+
"@wordpress/viewport": "^6.21.0",
|
|
76
|
+
"@wordpress/wordcount": "^4.21.0",
|
|
77
77
|
"change-case": "^4.1.2",
|
|
78
78
|
"clsx": "^2.1.1",
|
|
79
79
|
"colord": "^2.7.0",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "104af00f9abcd7a4d36b87e648f148c72cc4ea5f"
|
|
95
95
|
}
|
package/src/categories/edit.js
CHANGED
|
@@ -125,7 +125,7 @@ export default function CategoriesEdit( {
|
|
|
125
125
|
<RichText
|
|
126
126
|
className="wp-block-categories__label"
|
|
127
127
|
aria-label={ __( 'Label text' ) }
|
|
128
|
-
placeholder={ taxonomy
|
|
128
|
+
placeholder={ taxonomy?.name }
|
|
129
129
|
withoutInteractiveFormatting
|
|
130
130
|
value={ label }
|
|
131
131
|
onChange={ ( html ) =>
|
|
@@ -134,7 +134,7 @@ export default function CategoriesEdit( {
|
|
|
134
134
|
/>
|
|
135
135
|
) : (
|
|
136
136
|
<VisuallyHidden as="label" htmlFor={ selectId }>
|
|
137
|
-
{ label ? label : taxonomy
|
|
137
|
+
{ label ? label : taxonomy?.name }
|
|
138
138
|
</VisuallyHidden>
|
|
139
139
|
) }
|
|
140
140
|
<select id={ selectId }>
|
|
@@ -142,7 +142,7 @@ export default function CategoriesEdit( {
|
|
|
142
142
|
{ sprintf(
|
|
143
143
|
/* translators: %s: taxonomy's singular name */
|
|
144
144
|
__( 'Select %s' ),
|
|
145
|
-
taxonomy
|
|
145
|
+
taxonomy?.labels?.singular_name
|
|
146
146
|
) }
|
|
147
147
|
</option>
|
|
148
148
|
{ categoriesList.map( ( category ) =>
|
package/src/embed/edit.js
CHANGED
|
@@ -172,7 +172,13 @@ const EmbedEdit = ( props ) => {
|
|
|
172
172
|
// When obtaining an incoming preview,
|
|
173
173
|
// we set the attributes derived from the preview data.
|
|
174
174
|
const mergedAttributes = getMergedAttributes();
|
|
175
|
-
|
|
175
|
+
const hasChanges = Object.keys( mergedAttributes ).some(
|
|
176
|
+
( key ) => mergedAttributes[ key ] !== attributes[ key ]
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
if ( hasChanges ) {
|
|
180
|
+
setAttributes( mergedAttributes );
|
|
181
|
+
}
|
|
176
182
|
|
|
177
183
|
if ( onReplace ) {
|
|
178
184
|
const upgradedBlock = createUpgradedEmbedBlock(
|
package/src/image/edit.js
CHANGED
|
@@ -116,9 +116,9 @@ export function ImageEdit( {
|
|
|
116
116
|
// Only observe the max width from the parent container when the parent layout is not flex nor grid.
|
|
117
117
|
// This won't work for them because the container width changes with the image.
|
|
118
118
|
// TODO: Find a way to observe the container width for flex and grid layouts.
|
|
119
|
+
const layoutType = parentLayout?.type || parentLayout?.default?.type;
|
|
119
120
|
const isMaxWidthContainerWidth =
|
|
120
|
-
!
|
|
121
|
-
( parentLayout.type !== 'flex' && parentLayout.type !== 'grid' );
|
|
121
|
+
! layoutType || ( layoutType !== 'flex' && layoutType !== 'grid' );
|
|
122
122
|
const [ maxWidthObserver, maxContentWidth ] = useMaxWidthObserver();
|
|
123
123
|
|
|
124
124
|
const [ placeholderResizeListener, { width: placeholderWidth } ] =
|
|
@@ -452,7 +452,7 @@ export function ImageEdit( {
|
|
|
452
452
|
context={ context }
|
|
453
453
|
clientId={ clientId }
|
|
454
454
|
blockEditingMode={ blockEditingMode }
|
|
455
|
-
parentLayoutType={
|
|
455
|
+
parentLayoutType={ layoutType }
|
|
456
456
|
maxContentWidth={ maxContentWidth }
|
|
457
457
|
/>
|
|
458
458
|
<MediaPlaceholder
|
package/src/image/image.js
CHANGED
|
@@ -44,7 +44,7 @@ import { getFilename } from '@wordpress/url';
|
|
|
44
44
|
import { getBlockBindingsSource, switchToBlockType } from '@wordpress/blocks';
|
|
45
45
|
import { crop, overlayText, upload, chevronDown } from '@wordpress/icons';
|
|
46
46
|
import { store as noticesStore } from '@wordpress/notices';
|
|
47
|
-
import { store as coreStore
|
|
47
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Internal dependencies
|
|
@@ -301,7 +301,6 @@ export default function Image( {
|
|
|
301
301
|
}, [ imageElement ] );
|
|
302
302
|
const setRefs = useMergeRefs( [ setImageElement, setResizeObserved ] );
|
|
303
303
|
const { allowResize = true } = context;
|
|
304
|
-
const { getBlock, getSettings } = useSelect( blockEditorStore );
|
|
305
304
|
|
|
306
305
|
const image = useSelect(
|
|
307
306
|
( select ) =>
|
|
@@ -313,7 +312,7 @@ export default function Image( {
|
|
|
313
312
|
|
|
314
313
|
const { canInsertCover, imageEditing, imageSizes, maxWidth } = useSelect(
|
|
315
314
|
( select ) => {
|
|
316
|
-
const { getBlockRootClientId, canInsertBlockType } =
|
|
315
|
+
const { getBlockRootClientId, canInsertBlockType, getSettings } =
|
|
317
316
|
select( blockEditorStore );
|
|
318
317
|
|
|
319
318
|
const rootClientId = getBlockRootClientId( clientId );
|
|
@@ -331,10 +330,13 @@ export default function Image( {
|
|
|
331
330
|
},
|
|
332
331
|
[ clientId ]
|
|
333
332
|
);
|
|
333
|
+
const { getBlock, getSettings } = useSelect( blockEditorStore );
|
|
334
334
|
|
|
335
335
|
const { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );
|
|
336
336
|
const { createErrorNotice, createSuccessNotice } =
|
|
337
337
|
useDispatch( noticesStore );
|
|
338
|
+
const { editEntityRecord } = useDispatch( coreStore );
|
|
339
|
+
|
|
338
340
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
339
341
|
const isWideAligned = [ 'wide', 'full' ].includes( align );
|
|
340
342
|
const [
|
|
@@ -381,7 +383,7 @@ export default function Image( {
|
|
|
381
383
|
.then( ( blob ) => setExternalBlob( blob ) )
|
|
382
384
|
// Do nothing, cannot upload.
|
|
383
385
|
.catch( () => {} );
|
|
384
|
-
}, [ id, url, isSingleSelected, externalBlob ] );
|
|
386
|
+
}, [ id, url, isSingleSelected, externalBlob, getSettings ] );
|
|
385
387
|
|
|
386
388
|
// Get naturalWidth and naturalHeight from image, and fall back to loaded natural
|
|
387
389
|
// width and height. This resolves an issue in Safari where the loaded natural
|
|
@@ -891,13 +893,6 @@ export default function Image( {
|
|
|
891
893
|
const { postType, postId, queryId } = context;
|
|
892
894
|
const isDescendentOfQueryLoop = Number.isFinite( queryId );
|
|
893
895
|
|
|
894
|
-
const [ , setFeaturedImage ] = useEntityProp(
|
|
895
|
-
'postType',
|
|
896
|
-
postType,
|
|
897
|
-
'featured_media',
|
|
898
|
-
postId
|
|
899
|
-
);
|
|
900
|
-
|
|
901
896
|
let img =
|
|
902
897
|
temporaryURL && hasImageErrored ? (
|
|
903
898
|
// Show a placeholder during upload when the blob URL can't be loaded. This can
|
|
@@ -1103,7 +1098,9 @@ export default function Image( {
|
|
|
1103
1098
|
* Set the post's featured image with the current image.
|
|
1104
1099
|
*/
|
|
1105
1100
|
const setPostFeatureImage = () => {
|
|
1106
|
-
|
|
1101
|
+
editEntityRecord( 'postType', postType, postId, {
|
|
1102
|
+
featured_media: id,
|
|
1103
|
+
} );
|
|
1107
1104
|
createSuccessNotice( __( 'Post featured image updated.' ), {
|
|
1108
1105
|
type: 'snackbar',
|
|
1109
1106
|
} );
|
|
@@ -143,6 +143,7 @@ function ColorTools( {
|
|
|
143
143
|
onColorChange: setTextColor,
|
|
144
144
|
resetAllFilter: () => setTextColor(),
|
|
145
145
|
clearable: true,
|
|
146
|
+
enableAlpha: true,
|
|
146
147
|
},
|
|
147
148
|
{
|
|
148
149
|
colorValue: backgroundColor.color,
|
|
@@ -150,6 +151,7 @@ function ColorTools( {
|
|
|
150
151
|
onColorChange: setBackgroundColor,
|
|
151
152
|
resetAllFilter: () => setBackgroundColor(),
|
|
152
153
|
clearable: true,
|
|
154
|
+
enableAlpha: true,
|
|
153
155
|
},
|
|
154
156
|
{
|
|
155
157
|
colorValue: overlayTextColor.color,
|
|
@@ -157,6 +159,7 @@ function ColorTools( {
|
|
|
157
159
|
onColorChange: setOverlayTextColor,
|
|
158
160
|
resetAllFilter: () => setOverlayTextColor(),
|
|
159
161
|
clearable: true,
|
|
162
|
+
enableAlpha: true,
|
|
160
163
|
},
|
|
161
164
|
{
|
|
162
165
|
colorValue: overlayBackgroundColor.color,
|
|
@@ -164,6 +167,7 @@ function ColorTools( {
|
|
|
164
167
|
onColorChange: setOverlayBackgroundColor,
|
|
165
168
|
resetAllFilter: () => setOverlayBackgroundColor(),
|
|
166
169
|
clearable: true,
|
|
170
|
+
enableAlpha: true,
|
|
167
171
|
},
|
|
168
172
|
] }
|
|
169
173
|
panelId={ clientId }
|
|
@@ -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
|
*/
|
|
@@ -34,7 +34,7 @@ function render_block_core_query_total( $attributes, $content, $block ) {
|
|
|
34
34
|
$posts_per_page = (int) $query_to_use->get( 'posts_per_page' );
|
|
35
35
|
|
|
36
36
|
// Calculate the range of posts being displayed.
|
|
37
|
-
$start = ( $current_page - 1 ) * $posts_per_page + 1;
|
|
37
|
+
$start = ( 0 === $max_rows ) ? 0 : ( ( $current_page - 1 ) * $posts_per_page + 1 );
|
|
38
38
|
$end = min( $start + $posts_per_page - 1, $max_rows );
|
|
39
39
|
|
|
40
40
|
// Prepare the display based on the `displayType` attribute.
|
package/src/rss/block.json
CHANGED
package/src/rss/edit.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
RangeControl,
|
|
15
15
|
ToggleControl,
|
|
16
16
|
ToolbarGroup,
|
|
17
|
+
TextControl,
|
|
17
18
|
__experimentalInputControl as InputControl,
|
|
18
19
|
} from '@wordpress/components';
|
|
19
20
|
import { useState } from '@wordpress/element';
|
|
@@ -37,6 +38,8 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
37
38
|
excerptLength,
|
|
38
39
|
feedURL,
|
|
39
40
|
itemsToShow,
|
|
41
|
+
openInNewTab,
|
|
42
|
+
rel,
|
|
40
43
|
} = attributes;
|
|
41
44
|
|
|
42
45
|
function toggleAttribute( propName ) {
|
|
@@ -197,8 +200,26 @@ export default function RSSEdit( { attributes, setAttributes } ) {
|
|
|
197
200
|
required
|
|
198
201
|
/>
|
|
199
202
|
) }
|
|
203
|
+
|
|
204
|
+
<ToggleControl
|
|
205
|
+
__nextHasNoMarginBottom
|
|
206
|
+
label={ __( 'Open links in new tab' ) }
|
|
207
|
+
checked={ openInNewTab }
|
|
208
|
+
onChange={ ( value ) =>
|
|
209
|
+
setAttributes( { openInNewTab: value } )
|
|
210
|
+
}
|
|
211
|
+
/>
|
|
200
212
|
</PanelBody>
|
|
201
213
|
</InspectorControls>
|
|
214
|
+
<InspectorControls group="advanced">
|
|
215
|
+
<TextControl
|
|
216
|
+
__next40pxDefaultSize
|
|
217
|
+
__nextHasNoMarginBottom
|
|
218
|
+
label={ __( 'Link rel' ) }
|
|
219
|
+
value={ rel || '' }
|
|
220
|
+
onChange={ ( value ) => setAttributes( { rel: value } ) }
|
|
221
|
+
/>
|
|
222
|
+
</InspectorControls>
|
|
202
223
|
<div { ...blockProps }>
|
|
203
224
|
<Disabled>
|
|
204
225
|
<ServerSideRender
|