@wordpress/block-library 8.19.4 → 8.19.5
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/image/view.js +13 -4
- package/build/image/view.js.map +1 -1
- package/build/latest-posts/edit.js +2 -2
- package/build/latest-posts/edit.js.map +1 -1
- package/build/navigation/edit/index.js +0 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/view.js +7 -0
- package/build/navigation/view.js.map +1 -1
- package/build-module/image/view.js +13 -4
- package/build-module/image/view.js.map +1 -1
- package/build-module/latest-posts/edit.js +2 -2
- package/build-module/latest-posts/edit.js.map +1 -1
- package/build-module/navigation/edit/index.js +0 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/view.js +7 -0
- package/build-module/navigation/view.js.map +1 -1
- package/package.json +32 -32
- package/src/image/index.php +1 -0
- package/src/image/view.js +16 -5
- package/src/latest-posts/edit.js +4 -3
- package/src/latest-posts/index.php +2 -3
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation/index.php +19 -6
- package/src/navigation/view.js +7 -0
- package/src/query/index.php +2 -1
package/build/image/view.js
CHANGED
|
@@ -91,7 +91,7 @@ function handleScroll(context) {
|
|
|
91
91
|
context.core.image.lastFocusedElement = window.document.activeElement;
|
|
92
92
|
context.core.image.scrollDelta = 0;
|
|
93
93
|
context.core.image.lightboxEnabled = true;
|
|
94
|
-
setStyles(context, event);
|
|
94
|
+
setStyles(context, event.target.previousElementSibling);
|
|
95
95
|
context.core.image.scrollTopReset = window.pageYOffset || document.documentElement.scrollTop;
|
|
96
96
|
|
|
97
97
|
// In most cases, this value will be 0, but this is included
|
|
@@ -305,6 +305,15 @@ function handleScroll(context) {
|
|
|
305
305
|
context.core.image.imageButtonWidth = offsetWidth;
|
|
306
306
|
context.core.image.imageButtonHeight = offsetHeight;
|
|
307
307
|
}
|
|
308
|
+
},
|
|
309
|
+
setStylesOnResize: ({
|
|
310
|
+
state,
|
|
311
|
+
context,
|
|
312
|
+
ref
|
|
313
|
+
}) => {
|
|
314
|
+
if (context.core.image.lightboxEnabled && (state.core.image.windowWidth || state.core.image.windowHeight)) {
|
|
315
|
+
setStyles(context, ref);
|
|
316
|
+
}
|
|
308
317
|
}
|
|
309
318
|
}
|
|
310
319
|
}
|
|
@@ -327,7 +336,7 @@ function handleScroll(context) {
|
|
|
327
336
|
* @param {Object} context - An Interactivity API context
|
|
328
337
|
* @param {Object} event - A triggering event
|
|
329
338
|
*/
|
|
330
|
-
function setStyles(context,
|
|
339
|
+
function setStyles(context, ref) {
|
|
331
340
|
// The reference img element lies adjacent
|
|
332
341
|
// to the event target button in the DOM.
|
|
333
342
|
let {
|
|
@@ -335,11 +344,11 @@ function setStyles(context, event) {
|
|
|
335
344
|
naturalHeight,
|
|
336
345
|
offsetWidth: originalWidth,
|
|
337
346
|
offsetHeight: originalHeight
|
|
338
|
-
} =
|
|
347
|
+
} = ref;
|
|
339
348
|
let {
|
|
340
349
|
x: screenPosX,
|
|
341
350
|
y: screenPosY
|
|
342
|
-
} =
|
|
351
|
+
} = ref.getBoundingClientRect();
|
|
343
352
|
|
|
344
353
|
// Natural ratio of the image clicked to open the lightbox.
|
|
345
354
|
const naturalRatio = naturalWidth / naturalHeight;
|
package/build/image/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_interactivity","require","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","context","Date","now","window","scrollTo","core","image","scrollLeftReset","scrollTopReset","store","state","windowWidth","innerWidth","windowHeight","innerHeight","actions","showLightbox","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","lightboxEnabled","setStyles","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","selectors","roleAttribute","ariaModal","dialogLabel","lightboxObjectFit","enlargedImgSrc","imageUploadedSrc","setCurrentSrc","complete","initLightbox","figureRef","querySelector","imageRef","focusableElements","querySelectorAll","length","naturalWidth","naturalHeight","offsetWidth","offsetHeight","scaleAttr","naturalRatio","offsetRatio","imageButtonWidth","buttonHeight","imageButtonHeight","imageButtonTop","buttonWidth","imageButtonLeft","afterLoad","debounce","originalWidth","originalHeight","target","previousElementSibling","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/*\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/*\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/*\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/*\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} context Interactivity page context?\n */\nfunction handleScroll( context ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo(\n\t\t\tcontext.core.image.scrollLeftReset,\n\t\t\tcontext.core.image.scrollTopReset\n\t\t);\n\t}\n}\n\nstore(\n\t{\n\t\tstate: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\twindowWidth: window.innerWidth,\n\t\t\t\t\twindowHeight: window.innerHeight,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tshowLightbox: ( { context, event } ) => {\n\t\t\t\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\t\t\t\tif ( ! context.core.image.imageLoaded ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.core.image.initialized = true;\n\t\t\t\t\t\tcontext.core.image.lastFocusedElement =\n\t\t\t\t\t\t\twindow.document.activeElement;\n\t\t\t\t\t\tcontext.core.image.scrollDelta = 0;\n\n\t\t\t\t\t\tcontext.core.image.lightboxEnabled = true;\n\t\t\t\t\t\tsetStyles( context, event );\n\n\t\t\t\t\t\tcontext.core.image.scrollTopReset =\n\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\n\t\t\t\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\t\t\t\tcontext.core.image.scrollLeftReset =\n\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\n\t\t\t\t\t\t// We define and bind the scroll callback here so\n\t\t\t\t\t\t// that we can pass the context and as an argument.\n\t\t\t\t\t\t// We may be able to change this in the future if we\n\t\t\t\t\t\t// define the scroll callback in the store instead, but\n\t\t\t\t\t\t// this approach seems to tbe clearest for now.\n\t\t\t\t\t\tscrollCallback = handleScroll.bind( null, context );\n\n\t\t\t\t\t\t// We need to add a scroll event listener to the window\n\t\t\t\t\t\t// here because we are unable to otherwise access it via\n\t\t\t\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t\t\t\t// to access the window, we can remove this.\n\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\tscrollCallback,\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\thideLightbox: async ( { context } ) => {\n\t\t\t\t\t\tcontext.core.image.hideAnimationEnabled = true;\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\t\t\tscrollCallback\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}, 450 );\n\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled = false;\n\t\t\t\t\t\t\tcontext.core.image.lastFocusedElement.focus( {\n\t\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleKeydown: ( { context, actions, event } ) => {\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement.focus();\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.key === 'Escape' ||\n\t\t\t\t\t\t\t\tevent.keyCode === 27\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tactions.core.image.hideLightbox( {\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleLoad: ( { state, context, effects, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\teffects.core.image.setButtonStyles( {\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchStart: () => {\n\t\t\t\t\t\tisTouching = true;\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchMove: ( { context, event } ) => {\n\t\t\t\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchEnd: () => {\n\t\t\t\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t\t\t\t// on mobile devices when the lightbox is open.\n\t\t\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\t\t\tisTouching = false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tselectors: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\troleAttribute: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tariaModal: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'true'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tdialogLabel: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? context.core.image.dialogLabel\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tlightboxObjectFit: ( { context } ) => {\n\t\t\t\t\t\tif ( context.core.image.initialized ) {\n\t\t\t\t\t\t\treturn 'cover';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tenlargedImgSrc: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.initialized\n\t\t\t\t\t\t\t? context.core.image.imageUploadedSrc\n\t\t\t\t\t\t\t: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\teffects: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tsetCurrentSrc: ( { context, ref } ) => {\n\t\t\t\t\t\tif ( ref.complete ) {\n\t\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tinitLightbox: async ( { context, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.figureRef =\n\t\t\t\t\t\t\tref.querySelector( 'figure' );\n\t\t\t\t\t\tcontext.core.image.imageRef =\n\t\t\t\t\t\t\tref.querySelector( 'img' );\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[ 0 ];\n\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[\n\t\t\t\t\t\t\t\t\tfocusableElements.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tref.querySelector( '.close-button' ).focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetButtonStyles: ( { state, context, ref } ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tnaturalWidth,\n\t\t\t\t\t\t\tnaturalHeight,\n\t\t\t\t\t\t\toffsetWidth,\n\t\t\t\t\t\t\toffsetHeight,\n\t\t\t\t\t\t} = ref;\n\n\t\t\t\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t\t\t\t// calculate how big the button should be.\n\t\t\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Subscribe to the window dimensions so we can\n\t\t\t\t\t\t// recalculate the styles if the window is resized.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t( state.core.image.windowWidth ||\n\t\t\t\t\t\t\t\tstate.core.image.windowHeight ) &&\n\t\t\t\t\t\t\tcontext.core.image.scaleAttr === 'contain'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t\t\t\t\t// size of the img element can be larger than the image itself,\n\t\t\t\t\t\t\t// so we need to calculate the size of the button to match.\n\n\t\t\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\t\t\tif ( naturalRatio > offsetRatio ) {\n\t\t\t\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t\t\t\t// the width and recalculate the height.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\toffsetWidth;\n\t\t\t\t\t\t\t\tconst buttonHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\tbuttonHeight;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\t\t( offsetHeight - buttonHeight ) / 2;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t\t\t\t// the height and recalculate the width.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\toffsetHeight;\n\t\t\t\t\t\t\t\tconst buttonWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\tbuttonWidth;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonLeft =\n\t\t\t\t\t\t\t\t\t( offsetWidth - buttonWidth ) / 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// In all other cases, we can trust that the size of\n\t\t\t\t\t\t\t// the image is the right size for the button as well.\n\n\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth = offsetWidth;\n\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight = offsetHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tafterLoad: ( { state } ) => {\n\t\t\twindow.addEventListener(\n\t\t\t\t'resize',\n\t\t\t\tdebounce( () => {\n\t\t\t\t\tstate.core.image.windowWidth = window.innerWidth;\n\t\t\t\t\tstate.core.image.windowHeight = window.innerHeight;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t}\n);\n\n/*\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} context - An Interactivity API context\n * @param {Object} event - A triggering event\n */\nfunction setStyles( context, event ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = event.target.previousElementSibling;\n\tlet { x: screenPosX, y: screenPosY } =\n\t\tevent.target.previousElementSibling.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( context.core.image.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tcontext.core.image.targetWidth !== 'none'\n\t\t\t? context.core.image.targetWidth\n\t\t\t: naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tcontext.core.image.targetHeight !== 'none'\n\t\t\t? context.core.image.targetHeight\n\t\t\t: naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t}\n\t`;\n}\n\n/*\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,YAAY,EACZ,+DAA+D,EAC/D,2CAA2C,EAC3C,6CAA6C,EAC7C,2CAA2C,EAC3C,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,iCAAiC,CACjC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,cAAc;;AAElB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,UAAU,GAAG,KAAK;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,aAAa,GAAG,CAAC;;AAErB;AACA;AACA;AACA;AACA;AACA;A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AQ,GAAGpG,QAAQ,CAACqG,cAAc,CAAE,oBAAqB,CAAC;EAC9D,IAAK,CAAED,QAAQ,EAAG;IACjBA,QAAQ,GAAGpG,QAAQ,CAACsG,aAAa,CAAE,OAAQ,CAAC;IAC5CF,QAAQ,CAACG,EAAE,GAAG,oBAAoB;IAClCvG,QAAQ,CAACwG,IAAI,CAACC,WAAW,CAAEL,QAAS,CAAC;EACtC;;EAEA;EACA;EACA;EACA;EACA;EACAA,QAAQ,CAACM,SAAS,GAAI;AACvB;AACA,0CAA2ClC,UAAY;AACvD,2CAA4CF,UAAY;AACxD,qCAAsCe,cAAc,GAAG,CAAG;AAC1D,sCAAuCC,eAAe,GAAG,CAAG;AAC5D,iCAAkCY,gBAAkB;AACpD,kCAAmCC,iBAAmB;AACtD,2BAA4BF,cAAgB;AAC5C;AACA,EAAE;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASjC,QAAQA,CAAE2C,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAG/F,UAAU,CAAEgG,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
|
|
1
|
+
{"version":3,"names":["_interactivity","require","focusableSelectors","scrollCallback","isTouching","lastTouchTime","handleScroll","context","Date","now","window","scrollTo","core","image","scrollLeftReset","scrollTopReset","store","state","windowWidth","innerWidth","windowHeight","innerHeight","actions","showLightbox","event","imageLoaded","initialized","lastFocusedElement","document","activeElement","scrollDelta","lightboxEnabled","setStyles","target","previousElementSibling","pageYOffset","documentElement","scrollTop","pageXOffset","scrollLeft","bind","addEventListener","hideLightbox","hideAnimationEnabled","setTimeout","removeEventListener","focus","preventScroll","handleKeydown","key","keyCode","shiftKey","firstFocusableElement","preventDefault","lastFocusableElement","handleLoad","effects","ref","imageCurrentSrc","currentSrc","setButtonStyles","handleTouchStart","handleTouchMove","handleTouchEnd","selectors","roleAttribute","ariaModal","dialogLabel","lightboxObjectFit","enlargedImgSrc","imageUploadedSrc","setCurrentSrc","complete","initLightbox","figureRef","querySelector","imageRef","focusableElements","querySelectorAll","length","naturalWidth","naturalHeight","offsetWidth","offsetHeight","scaleAttr","naturalRatio","offsetRatio","imageButtonWidth","buttonHeight","imageButtonHeight","imageButtonTop","buttonWidth","imageButtonLeft","setStylesOnResize","afterLoad","debounce","originalWidth","originalHeight","x","screenPosX","y","screenPosY","getBoundingClientRect","originalRatio","heightWithoutSpace","widthWithoutSpace","imgMaxWidth","parseFloat","targetWidth","imgMaxHeight","targetHeight","imgRatio","containerMaxWidth","containerMaxHeight","containerWidth","containerHeight","toFixed","reducedHeight","reducedWidth","horizontalPadding","verticalPadding","targetMaxWidth","Math","min","targetMaxHeight","targetContainerRatio","containerScale","lightboxImgWidth","lightboxImgHeight","styleTag","getElementById","createElement","id","head","appendChild","innerHTML","func","wait","timeout","later","clearTimeout"],"sources":["@wordpress/block-library/src/image/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store } from '@wordpress/interactivity';\n\nconst focusableSelectors = [\n\t'a[href]',\n\t'area[href]',\n\t'input:not([disabled]):not([type=\"hidden\"]):not([aria-hidden])',\n\t'select:not([disabled]):not([aria-hidden])',\n\t'textarea:not([disabled]):not([aria-hidden])',\n\t'button:not([disabled]):not([aria-hidden])',\n\t'iframe',\n\t'object',\n\t'embed',\n\t'[contenteditable]',\n\t'[tabindex]:not([tabindex^=\"-\"])',\n];\n\n/*\n * Stores a context-bound scroll handler.\n *\n * This callback could be defined inline inside of the store\n * object but it's created externally to avoid confusion about\n * how its logic is called. This logic is not referenced directly\n * by the directives in the markup because the scroll event we\n * need to listen to is triggered on the window; so by defining it\n * outside of the store, we signal that the behavior here is different.\n * If we find a compelling reason to move it to the store, feel free.\n *\n * @type {Function}\n */\nlet scrollCallback;\n\n/*\n * Tracks whether user is touching screen; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {boolean}\n */\nlet isTouching = false;\n\n/*\n * Tracks the last time the screen was touched; used to\n * differentiate behavior for touch and mouse input.\n *\n * @type {number}\n */\nlet lastTouchTime = 0;\n\n/*\n * Lightbox page-scroll handler: prevents scrolling.\n *\n * This handler is added to prevent scrolling behaviors that\n * trigger content shift while the lightbox is open.\n *\n * It would be better to accomplish this through CSS alone, but\n * using overflow: hidden is currently the only way to do so, and\n * that causes the layout to shift and prevents the zoom animation\n * from working in some cases because we're unable to account for\n * the layout shift when doing the animation calculations. Instead,\n * here we use JavaScript to prevent and reset the scrolling\n * behavior. In the future, we may be able to use CSS or overflow: hidden\n * instead to not rely on JavaScript, but this seems to be the best approach\n * for now that provides the best visual experience.\n *\n * @param {Object} context Interactivity page context?\n */\nfunction handleScroll( context ) {\n\t// We can't override the scroll behavior on mobile devices\n\t// because doing so breaks the pinch to zoom functionality, and we\n\t// want to allow users to zoom in further on the high-res image.\n\tif ( ! isTouching && Date.now() - lastTouchTime > 450 ) {\n\t\t// We are unable to use event.preventDefault() to prevent scrolling\n\t\t// because the scroll event can't be canceled, so we reset the position instead.\n\t\twindow.scrollTo(\n\t\t\tcontext.core.image.scrollLeftReset,\n\t\t\tcontext.core.image.scrollTopReset\n\t\t);\n\t}\n}\n\nstore(\n\t{\n\t\tstate: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\twindowWidth: window.innerWidth,\n\t\t\t\t\twindowHeight: window.innerHeight,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tshowLightbox: ( { context, event } ) => {\n\t\t\t\t\t\t// We can't initialize the lightbox until the reference\n\t\t\t\t\t\t// image is loaded, otherwise the UX is broken.\n\t\t\t\t\t\tif ( ! context.core.image.imageLoaded ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontext.core.image.initialized = true;\n\t\t\t\t\t\tcontext.core.image.lastFocusedElement =\n\t\t\t\t\t\t\twindow.document.activeElement;\n\t\t\t\t\t\tcontext.core.image.scrollDelta = 0;\n\n\t\t\t\t\t\tcontext.core.image.lightboxEnabled = true;\n\t\t\t\t\t\tsetStyles(\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tevent.target.previousElementSibling\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tcontext.core.image.scrollTopReset =\n\t\t\t\t\t\t\twindow.pageYOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollTop;\n\n\t\t\t\t\t\t// In most cases, this value will be 0, but this is included\n\t\t\t\t\t\t// in case a user has created a page with horizontal scrolling.\n\t\t\t\t\t\tcontext.core.image.scrollLeftReset =\n\t\t\t\t\t\t\twindow.pageXOffset ||\n\t\t\t\t\t\t\tdocument.documentElement.scrollLeft;\n\n\t\t\t\t\t\t// We define and bind the scroll callback here so\n\t\t\t\t\t\t// that we can pass the context and as an argument.\n\t\t\t\t\t\t// We may be able to change this in the future if we\n\t\t\t\t\t\t// define the scroll callback in the store instead, but\n\t\t\t\t\t\t// this approach seems to tbe clearest for now.\n\t\t\t\t\t\tscrollCallback = handleScroll.bind( null, context );\n\n\t\t\t\t\t\t// We need to add a scroll event listener to the window\n\t\t\t\t\t\t// here because we are unable to otherwise access it via\n\t\t\t\t\t\t// the Interactivity API directives. If we add a native way\n\t\t\t\t\t\t// to access the window, we can remove this.\n\t\t\t\t\t\twindow.addEventListener(\n\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\tscrollCallback,\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\thideLightbox: async ( { context } ) => {\n\t\t\t\t\t\tcontext.core.image.hideAnimationEnabled = true;\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\t// We want to wait until the close animation is completed\n\t\t\t\t\t\t\t// before allowing a user to scroll again. The duration of this\n\t\t\t\t\t\t\t// animation is defined in the styles.scss and depends on if the\n\t\t\t\t\t\t\t// animation is 'zoom' or 'fade', but in any case we should wait\n\t\t\t\t\t\t\t// a few milliseconds longer than the duration, otherwise a user\n\t\t\t\t\t\t\t// may scroll too soon and cause the animation to look sloppy.\n\t\t\t\t\t\t\tsetTimeout( function () {\n\t\t\t\t\t\t\t\twindow.removeEventListener(\n\t\t\t\t\t\t\t\t\t'scroll',\n\t\t\t\t\t\t\t\t\tscrollCallback\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}, 450 );\n\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled = false;\n\t\t\t\t\t\t\tcontext.core.image.lastFocusedElement.focus( {\n\t\t\t\t\t\t\t\tpreventScroll: true,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleKeydown: ( { context, actions, event } ) => {\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tif ( event.key === 'Tab' || event.keyCode === 9 ) {\n\t\t\t\t\t\t\t\t// If shift + tab it change the direction\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tevent.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement.focus();\n\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t! event.shiftKey &&\n\t\t\t\t\t\t\t\t\twindow.document.activeElement ===\n\t\t\t\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement.focus();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tevent.key === 'Escape' ||\n\t\t\t\t\t\t\t\tevent.keyCode === 27\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tactions.core.image.hideLightbox( {\n\t\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleLoad: ( { state, context, effects, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\teffects.core.image.setButtonStyles( {\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tref,\n\t\t\t\t\t\t} );\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchStart: () => {\n\t\t\t\t\t\tisTouching = true;\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchMove: ( { context, event } ) => {\n\t\t\t\t\t\t// On mobile devices, we want to prevent triggering the\n\t\t\t\t\t\t// scroll event because otherwise the page jumps around as\n\t\t\t\t\t\t// we reset the scroll position. This also means that closing\n\t\t\t\t\t\t// the lightbox requires that a user perform a simple tap. This\n\t\t\t\t\t\t// may be changed in the future if we find a better alternative\n\t\t\t\t\t\t// to override or reset the scroll position during swipe actions.\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\thandleTouchEnd: () => {\n\t\t\t\t\t\t// We need to wait a few milliseconds before resetting\n\t\t\t\t\t\t// to ensure that pinch to zoom works consistently\n\t\t\t\t\t\t// on mobile devices when the lightbox is open.\n\t\t\t\t\t\tlastTouchTime = Date.now();\n\t\t\t\t\t\tisTouching = false;\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tselectors: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\troleAttribute: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'dialog'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tariaModal: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? 'true'\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tdialogLabel: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.lightboxEnabled\n\t\t\t\t\t\t\t? context.core.image.dialogLabel\n\t\t\t\t\t\t\t: null;\n\t\t\t\t\t},\n\t\t\t\t\tlightboxObjectFit: ( { context } ) => {\n\t\t\t\t\t\tif ( context.core.image.initialized ) {\n\t\t\t\t\t\t\treturn 'cover';\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tenlargedImgSrc: ( { context } ) => {\n\t\t\t\t\t\treturn context.core.image.initialized\n\t\t\t\t\t\t\t? context.core.image.imageUploadedSrc\n\t\t\t\t\t\t\t: 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\teffects: {\n\t\t\tcore: {\n\t\t\t\timage: {\n\t\t\t\t\tsetCurrentSrc: ( { context, ref } ) => {\n\t\t\t\t\t\tif ( ref.complete ) {\n\t\t\t\t\t\t\tcontext.core.image.imageLoaded = true;\n\t\t\t\t\t\t\tcontext.core.image.imageCurrentSrc = ref.currentSrc;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tinitLightbox: async ( { context, ref } ) => {\n\t\t\t\t\t\tcontext.core.image.figureRef =\n\t\t\t\t\t\t\tref.querySelector( 'figure' );\n\t\t\t\t\t\tcontext.core.image.imageRef =\n\t\t\t\t\t\t\tref.querySelector( 'img' );\n\t\t\t\t\t\tif ( context.core.image.lightboxEnabled ) {\n\t\t\t\t\t\t\tconst focusableElements =\n\t\t\t\t\t\t\t\tref.querySelectorAll( focusableSelectors );\n\t\t\t\t\t\t\tcontext.core.image.firstFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[ 0 ];\n\t\t\t\t\t\t\tcontext.core.image.lastFocusableElement =\n\t\t\t\t\t\t\t\tfocusableElements[\n\t\t\t\t\t\t\t\t\tfocusableElements.length - 1\n\t\t\t\t\t\t\t\t];\n\n\t\t\t\t\t\t\tref.querySelector( '.close-button' ).focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetButtonStyles: ( { state, context, ref } ) => {\n\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\tnaturalWidth,\n\t\t\t\t\t\t\tnaturalHeight,\n\t\t\t\t\t\t\toffsetWidth,\n\t\t\t\t\t\t\toffsetHeight,\n\t\t\t\t\t\t} = ref;\n\n\t\t\t\t\t\t// If the image isn't loaded yet, we can't\n\t\t\t\t\t\t// calculate how big the button should be.\n\t\t\t\t\t\tif ( naturalWidth === 0 || naturalHeight === 0 ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Subscribe to the window dimensions so we can\n\t\t\t\t\t\t// recalculate the styles if the window is resized.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t( state.core.image.windowWidth ||\n\t\t\t\t\t\t\t\tstate.core.image.windowHeight ) &&\n\t\t\t\t\t\t\tcontext.core.image.scaleAttr === 'contain'\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// In the case of an image with object-fit: contain, the\n\t\t\t\t\t\t\t// size of the img element can be larger than the image itself,\n\t\t\t\t\t\t\t// so we need to calculate the size of the button to match.\n\n\t\t\t\t\t\t\t// Natural ratio of the image.\n\t\t\t\t\t\t\tconst naturalRatio = naturalWidth / naturalHeight;\n\t\t\t\t\t\t\t// Offset ratio of the image.\n\t\t\t\t\t\t\tconst offsetRatio = offsetWidth / offsetHeight;\n\n\t\t\t\t\t\t\tif ( naturalRatio > offsetRatio ) {\n\t\t\t\t\t\t\t\t// If it reaches the width first, keep\n\t\t\t\t\t\t\t\t// the width and recalculate the height.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\toffsetWidth;\n\t\t\t\t\t\t\t\tconst buttonHeight = offsetWidth / naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\tbuttonHeight;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonTop =\n\t\t\t\t\t\t\t\t\t( offsetHeight - buttonHeight ) / 2;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If it reaches the height first, keep\n\t\t\t\t\t\t\t\t// the height and recalculate the width.\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight =\n\t\t\t\t\t\t\t\t\toffsetHeight;\n\t\t\t\t\t\t\t\tconst buttonWidth = offsetHeight * naturalRatio;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth =\n\t\t\t\t\t\t\t\t\tbuttonWidth;\n\t\t\t\t\t\t\t\tcontext.core.image.imageButtonLeft =\n\t\t\t\t\t\t\t\t\t( offsetWidth - buttonWidth ) / 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// In all other cases, we can trust that the size of\n\t\t\t\t\t\t\t// the image is the right size for the button as well.\n\n\t\t\t\t\t\t\tcontext.core.image.imageButtonWidth = offsetWidth;\n\t\t\t\t\t\t\tcontext.core.image.imageButtonHeight = offsetHeight;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tsetStylesOnResize: ( { state, context, ref } ) => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tcontext.core.image.lightboxEnabled &&\n\t\t\t\t\t\t\t( state.core.image.windowWidth ||\n\t\t\t\t\t\t\t\tstate.core.image.windowHeight )\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tsetStyles( context, ref );\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tafterLoad: ( { state } ) => {\n\t\t\twindow.addEventListener(\n\t\t\t\t'resize',\n\t\t\t\tdebounce( () => {\n\t\t\t\t\tstate.core.image.windowWidth = window.innerWidth;\n\t\t\t\t\tstate.core.image.windowHeight = window.innerHeight;\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t}\n);\n\n/*\n * Computes styles for the lightbox and adds them to the document.\n *\n * @function\n * @param {Object} context - An Interactivity API context\n * @param {Object} event - A triggering event\n */\nfunction setStyles( context, ref ) {\n\t// The reference img element lies adjacent\n\t// to the event target button in the DOM.\n\tlet {\n\t\tnaturalWidth,\n\t\tnaturalHeight,\n\t\toffsetWidth: originalWidth,\n\t\toffsetHeight: originalHeight,\n\t} = ref;\n\tlet { x: screenPosX, y: screenPosY } = ref.getBoundingClientRect();\n\n\t// Natural ratio of the image clicked to open the lightbox.\n\tconst naturalRatio = naturalWidth / naturalHeight;\n\t// Original ratio of the image clicked to open the lightbox.\n\tlet originalRatio = originalWidth / originalHeight;\n\n\t// If it has object-fit: contain, recalculate the original sizes\n\t// and the screen position without the blank spaces.\n\tif ( context.core.image.scaleAttr === 'contain' ) {\n\t\tif ( naturalRatio > originalRatio ) {\n\t\t\tconst heightWithoutSpace = originalWidth / naturalRatio;\n\t\t\t// Recalculate screen position without the top space.\n\t\t\tscreenPosY += ( originalHeight - heightWithoutSpace ) / 2;\n\t\t\toriginalHeight = heightWithoutSpace;\n\t\t} else {\n\t\t\tconst widthWithoutSpace = originalHeight * naturalRatio;\n\t\t\t// Recalculate screen position without the left space.\n\t\t\tscreenPosX += ( originalWidth - widthWithoutSpace ) / 2;\n\t\t\toriginalWidth = widthWithoutSpace;\n\t\t}\n\t}\n\toriginalRatio = originalWidth / originalHeight;\n\n\t// Typically, we use the image's full-sized dimensions. If those\n\t// dimensions have not been set (i.e. an external image with only one size),\n\t// the image's dimensions in the lightbox are the same\n\t// as those of the image in the content.\n\tlet imgMaxWidth = parseFloat(\n\t\tcontext.core.image.targetWidth !== 'none'\n\t\t\t? context.core.image.targetWidth\n\t\t\t: naturalWidth\n\t);\n\tlet imgMaxHeight = parseFloat(\n\t\tcontext.core.image.targetHeight !== 'none'\n\t\t\t? context.core.image.targetHeight\n\t\t\t: naturalHeight\n\t);\n\n\t// Ratio of the biggest image stored in the database.\n\tlet imgRatio = imgMaxWidth / imgMaxHeight;\n\tlet containerMaxWidth = imgMaxWidth;\n\tlet containerMaxHeight = imgMaxHeight;\n\tlet containerWidth = imgMaxWidth;\n\tlet containerHeight = imgMaxHeight;\n\t// Check if the target image has a different ratio than the original one (thumbnail).\n\t// Recalculate the width and height.\n\tif ( naturalRatio.toFixed( 2 ) !== imgRatio.toFixed( 2 ) ) {\n\t\tif ( naturalRatio > imgRatio ) {\n\t\t\t// If the width is reached before the height, we keep the maxWidth\n\t\t\t// and recalculate the height.\n\t\t\t// Unless the difference between the maxHeight and the reducedHeight\n\t\t\t// is higher than the maxWidth, where we keep the reducedHeight and\n\t\t\t// recalculate the width.\n\t\t\tconst reducedHeight = imgMaxWidth / naturalRatio;\n\t\t\tif ( imgMaxHeight - reducedHeight > imgMaxWidth ) {\n\t\t\t\timgMaxHeight = reducedHeight;\n\t\t\t\timgMaxWidth = reducedHeight * naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxHeight = imgMaxWidth / naturalRatio;\n\t\t\t}\n\t\t} else {\n\t\t\t// If the height is reached before the width, we keep the maxHeight\n\t\t\t// and recalculate the width.\n\t\t\t// Unless the difference between the maxWidth and the reducedWidth\n\t\t\t// is higher than the maxHeight, where we keep the reducedWidth and\n\t\t\t// recalculate the height.\n\t\t\tconst reducedWidth = imgMaxHeight * naturalRatio;\n\t\t\tif ( imgMaxWidth - reducedWidth > imgMaxHeight ) {\n\t\t\t\timgMaxWidth = reducedWidth;\n\t\t\t\timgMaxHeight = reducedWidth / naturalRatio;\n\t\t\t} else {\n\t\t\t\timgMaxWidth = imgMaxHeight * naturalRatio;\n\t\t\t}\n\t\t}\n\t\tcontainerWidth = imgMaxWidth;\n\t\tcontainerHeight = imgMaxHeight;\n\t\timgRatio = imgMaxWidth / imgMaxHeight;\n\n\t\t// Calculate the max size of the container.\n\t\tif ( originalRatio > imgRatio ) {\n\t\t\tcontainerMaxWidth = imgMaxWidth;\n\t\t\tcontainerMaxHeight = containerMaxWidth / originalRatio;\n\t\t} else {\n\t\t\tcontainerMaxHeight = imgMaxHeight;\n\t\t\tcontainerMaxWidth = containerMaxHeight * originalRatio;\n\t\t}\n\t}\n\n\t// If the image has been pixelated on purpose, keep that size.\n\tif ( originalWidth > containerWidth || originalHeight > containerHeight ) {\n\t\tcontainerWidth = originalWidth;\n\t\tcontainerHeight = originalHeight;\n\t}\n\n\t// Calculate the final lightbox image size and the\n\t// scale factor. MaxWidth is either the window container\n\t// (accounting for padding) or the image resolution.\n\tlet horizontalPadding = 0;\n\tif ( window.innerWidth > 480 ) {\n\t\thorizontalPadding = 80;\n\t} else if ( window.innerWidth > 1920 ) {\n\t\thorizontalPadding = 160;\n\t}\n\tconst verticalPadding = 80;\n\n\tconst targetMaxWidth = Math.min(\n\t\twindow.innerWidth - horizontalPadding,\n\t\tcontainerWidth\n\t);\n\tconst targetMaxHeight = Math.min(\n\t\twindow.innerHeight - verticalPadding,\n\t\tcontainerHeight\n\t);\n\tconst targetContainerRatio = targetMaxWidth / targetMaxHeight;\n\n\tif ( originalRatio > targetContainerRatio ) {\n\t\t// If targetMaxWidth is reached before targetMaxHeight\n\t\tcontainerWidth = targetMaxWidth;\n\t\tcontainerHeight = containerWidth / originalRatio;\n\t} else {\n\t\t// If targetMaxHeight is reached before targetMaxWidth\n\t\tcontainerHeight = targetMaxHeight;\n\t\tcontainerWidth = containerHeight * originalRatio;\n\t}\n\n\tconst containerScale = originalWidth / containerWidth;\n\tconst lightboxImgWidth =\n\t\timgMaxWidth * ( containerWidth / containerMaxWidth );\n\tconst lightboxImgHeight =\n\t\timgMaxHeight * ( containerHeight / containerMaxHeight );\n\n\t// Add the CSS variables needed.\n\tlet styleTag = document.getElementById( 'wp-lightbox-styles' );\n\tif ( ! styleTag ) {\n\t\tstyleTag = document.createElement( 'style' );\n\t\tstyleTag.id = 'wp-lightbox-styles';\n\t\tdocument.head.appendChild( styleTag );\n\t}\n\n\t// As of this writing, using the calculations above will render the lightbox\n\t// with a small, erroneous whitespace on the left side of the image in iOS Safari,\n\t// perhaps due to an inconsistency in how browsers handle absolute positioning and CSS\n\t// transformation. In any case, adding 1 pixel to the container width and height solves\n\t// the problem, though this can be removed if the issue is fixed in the future.\n\tstyleTag.innerHTML = `\n\t\t:root {\n\t\t\t--wp--lightbox-initial-top-position: ${ screenPosY }px;\n\t\t\t--wp--lightbox-initial-left-position: ${ screenPosX }px;\n\t\t\t--wp--lightbox-container-width: ${ containerWidth + 1 }px;\n\t\t\t--wp--lightbox-container-height: ${ containerHeight + 1 }px;\n\t\t\t--wp--lightbox-image-width: ${ lightboxImgWidth }px;\n\t\t\t--wp--lightbox-image-height: ${ lightboxImgHeight }px;\n\t\t\t--wp--lightbox-scale: ${ containerScale };\n\t\t}\n\t`;\n}\n\n/*\n * Debounces a function call.\n *\n * @function\n * @param {Function} func - A function to be called\n * @param {number} wait - The time to wait before calling the function\n */\nfunction debounce( func, wait = 50 ) {\n\tlet timeout;\n\treturn () => {\n\t\tconst later = () => {\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tclearTimeout( timeout );\n\t\ttimeout = setTimeout( later, wait );\n\t};\n}\n"],"mappings":";;AAGA,IAAAA,cAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,kBAAkB,GAAG,CAC1B,SAAS,EACT,YAAY,EACZ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SAAS/B,QAAQA,CAAEyC,IAAI,EAAEC,IAAI,GAAG,EAAE,EAAG;EACpC,IAAIC,OAAO;EACX,OAAO,MAAM;IACZ,MAAMC,KAAK,GAAGA,CAAA,KAAM;MACnBD,OAAO,GAAG,IAAI;MACdF,IAAI,CAAC,CAAC;IACP,CAAC;IACDI,YAAY,CAAEF,OAAQ,CAAC;IACvBA,OAAO,GAAG9F,UAAU,CAAE+F,KAAK,EAAEF,IAAK,CAAC;EACpC,CAAC;AACF"}
|
|
@@ -352,8 +352,8 @@ function LatestPostsEdit({
|
|
|
352
352
|
}
|
|
353
353
|
});
|
|
354
354
|
const needsReadMore = excerptLength < excerpt.trim().split(' ').length && post.excerpt.raw === '';
|
|
355
|
-
const postExcerpt = needsReadMore ? (0, _element.createElement)(_element.Fragment, null, excerpt.trim().split(' ', excerptLength).join(' '), (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1:
|
|
356
|
-
(0, _i18n.__)('… <a
|
|
355
|
+
const postExcerpt = needsReadMore ? (0, _element.createElement)(_element.Fragment, null, excerpt.trim().split(' ', excerptLength).join(' '), (0, _element.createInterpolateElement)((0, _i18n.sprintf)( /* translators: 1: Hidden accessibility text: Post title */
|
|
356
|
+
(0, _i18n.__)('… <a>Read more<span>: %1$s</span></a>'), titleTrimmed || (0, _i18n.__)('(no title)')), {
|
|
357
357
|
a:
|
|
358
358
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
359
359
|
(0, _element.createElement)("a", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_i18n","_date","_blockEditor","_data","_icons","_coreData","_notices","_compose","_constants","CATEGORIES_LIST_QUERY","per_page","context","USERS_LIST_QUERY","has_published_posts","getFeaturedImageDetails","post","size","_image$media_details$","image","_embedded","url","media_details","sizes","source_url","alt","alt_text","LatestPostsEdit","attributes","setAttributes","_categoriesList$reduc","instanceId","useInstanceId","postsToShow","order","orderBy","categories","selectedAuthor","displayFeaturedImage","displayPostContentRadio","displayPostContent","displayPostDate","displayAuthor","postLayout","columns","excerptLength","featuredImageAlign","featuredImageSizeSlug","featuredImageSizeWidth","featuredImageSizeHeight","addLinkToFeaturedImage","imageSizes","latestPosts","defaultImageWidth","defaultImageHeight","categoriesList","authorList","useSelect","select","_settings$imageDimens","_settings$imageDimens2","getEntityRecords","getUsers","coreStore","settings","blockEditorStore","getSettings","catIds","length","map","cat","id","latestPostsQuery","Object","fromEntries","entries","author","orderby","_embed","filter","value","imageDimensions","width","height","createWarningNotice","removeNotice","useDispatch","noticeStore","noticeId","showRedirectionPreventedNotice","event","preventDefault","__","type","imageSizeOptions","slug","name","label","categorySuggestions","reduce","accumulator","category","selectCategories","tokens","hasNoSuggestion","some","token","allCategories","includes","hasPosts","inspectorControls","createElement","InspectorControls","PanelBody","title","ToggleControl","checked","onChange","RadioControl","selected","options","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","min","MIN_EXCERPT_LENGTH","max","MAX_EXCERPT_LENGTH","Fragment","__experimentalImageSizeControl","newAttrs","hasOwnProperty","imageWidth","imageHeight","imageSizeHelp","onChangeImage","undefined","BaseControl","className","VisualLabel","BlockAlignmentToolbar","controls","isCollapsed","QueryControls","numberOfItems","onOrderChange","onOrderByChange","onNumberOfItemsChange","onCategoryChange","selectedCategories","onAuthorChange","Number","selectedAuthorId","MAX_POSTS_COLUMNS","Math","required","blockProps","useBlockProps","classnames","Placeholder","icon","pin","Array","isArray","Spinner","displayPosts","slice","layoutControls","list","onClick","isActive","grid","dateFormat","formats","date","BlockControls","ToolbarGroup","titleTrimmed","rendered","trim","excerpt","currentAuthor","find","excerptElement","document","innerHTML","textContent","innerText","imageSourceUrl","featuredImageAlt","imageClasses","renderFeaturedImage","featuredImage","src","style","maxWidth","maxHeight","needsReadMore","split","raw","postExcerpt","join","createInterpolateElement","sprintf","a","href","link","rel","span","key","dangerouslySetInnerHTML","__html","date_gmt","dateTime","format","dateI18n","content"],"sources":["@wordpress/block-library/src/latest-posts/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tPanelBody,\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockAlignmentToolbar,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pin, list, grid } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n} from './constants';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tlatestPosts,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'wp:featuredmedia',\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tfeaturedImageSizeSlug,\n\t\t\tpostsToShow,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tcategories,\n\t\t\tselectedAuthor,\n\t\t]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticeStore );\n\tlet noticeId;\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\t// Remove previous warning if any, to show one at a time per block.\n\t\tremoveNotice( noticeId );\n\t\tnoticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: noticeId,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Post content' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<RadioControl\n\t\t\t\t\t\tlabel={ __( 'Show:' ) }\n\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\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) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Post meta' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Featured image' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BaseControl className=\"editor-latest-posts-image-alignment-control\">\n\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t{ __( 'Image alignment' ) }\n\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t<BlockAlignmentToolbar\n\t\t\t\t\t\t\t\tvalue={ featuredImageAlign }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageAlign: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontrols={ [ 'left', 'center', 'right' ] }\n\t\t\t\t\t\t\t\tisCollapsed={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Sorting and filtering' ) }>\n\t\t\t\t<QueryControls\n\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t}\n\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t/>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t! hasPosts\n\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t: Math.min(\n\t\t\t\t\t\t\t\t\t\tMAX_POSTS_COLUMNS,\n\t\t\t\t\t\t\t\t\t\tlatestPosts.length\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<div>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = authorList?.find(\n\t\t\t\t\t\t( author ) => author.id === post.author\n\t\t\t\t\t);\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = classnames( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: The static string \"Read more\", 2: The post title only visible to screen readers. */\n\t\t\t\t\t\t\t\t\t__( '… <a>%1$s<span>: %2$s</span></a>' ),\n\t\t\t\t\t\t\t\t\t__( 'Read more' ),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-text\" />\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: current author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AA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ACC2B,SAAS,EAAC,0CAA0C;MACpDwE,uBAAuB,EAAG;QACzBC,MAAM,EAAEnM,IAAI,CAACwM,OAAO,CAACjB,GAAG,CAACpB,IAAI,CAAC;MAC/B;IAAG,CACH,CAEA,CAAC;EAEP,CAAE,CACC,CACA,CAAC;AAER"}
|
|
1
|
+
{"version":3,"names":["_element","require","_classnames","_interopRequireDefault","_components","_i18n","_date","_blockEditor","_data","_icons","_coreData","_notices","_compose","_constants","CATEGORIES_LIST_QUERY","per_page","context","USERS_LIST_QUERY","has_published_posts","getFeaturedImageDetails","post","size","_image$media_details$","image","_embedded","url","media_details","sizes","source_url","alt","alt_text","LatestPostsEdit","attributes","setAttributes","_categoriesList$reduc","instanceId","useInstanceId","postsToShow","order","orderBy","categories","selectedAuthor","displayFeaturedImage","displayPostContentRadio","displayPostContent","displayPostDate","displayAuthor","postLayout","columns","excerptLength","featuredImageAlign","featuredImageSizeSlug","featuredImageSizeWidth","featuredImageSizeHeight","addLinkToFeaturedImage","imageSizes","latestPosts","defaultImageWidth","defaultImageHeight","categoriesList","authorList","useSelect","select","_settings$imageDimens","_settings$imageDimens2","getEntityRecords","getUsers","coreStore","settings","blockEditorStore","getSettings","catIds","length","map","cat","id","latestPostsQuery","Object","fromEntries","entries","author","orderby","_embed","filter","value","imageDimensions","width","height","createWarningNotice","removeNotice","useDispatch","noticeStore","noticeId","showRedirectionPreventedNotice","event","preventDefault","__","type","imageSizeOptions","slug","name","label","categorySuggestions","reduce","accumulator","category","selectCategories","tokens","hasNoSuggestion","some","token","allCategories","includes","hasPosts","inspectorControls","createElement","InspectorControls","PanelBody","title","ToggleControl","checked","onChange","RadioControl","selected","options","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","min","MIN_EXCERPT_LENGTH","max","MAX_EXCERPT_LENGTH","Fragment","__experimentalImageSizeControl","newAttrs","hasOwnProperty","imageWidth","imageHeight","imageSizeHelp","onChangeImage","undefined","BaseControl","className","VisualLabel","BlockAlignmentToolbar","controls","isCollapsed","QueryControls","numberOfItems","onOrderChange","onOrderByChange","onNumberOfItemsChange","onCategoryChange","selectedCategories","onAuthorChange","Number","selectedAuthorId","MAX_POSTS_COLUMNS","Math","required","blockProps","useBlockProps","classnames","Placeholder","icon","pin","Array","isArray","Spinner","displayPosts","slice","layoutControls","list","onClick","isActive","grid","dateFormat","formats","date","BlockControls","ToolbarGroup","titleTrimmed","rendered","trim","excerpt","currentAuthor","find","excerptElement","document","innerHTML","textContent","innerText","imageSourceUrl","featuredImageAlt","imageClasses","renderFeaturedImage","featuredImage","src","style","maxWidth","maxHeight","needsReadMore","split","raw","postExcerpt","join","createInterpolateElement","sprintf","a","href","link","rel","span","key","dangerouslySetInnerHTML","__html","date_gmt","dateTime","format","dateI18n","content"],"sources":["@wordpress/block-library/src/latest-posts/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBaseControl,\n\tPanelBody,\n\tPlaceholder,\n\tQueryControls,\n\tRadioControl,\n\tRangeControl,\n\tSpinner,\n\tToggleControl,\n\tToolbarGroup,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { dateI18n, format, getSettings } from '@wordpress/date';\nimport {\n\tInspectorControls,\n\tBlockAlignmentToolbar,\n\tBlockControls,\n\t__experimentalImageSizeControl as ImageSizeControl,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { pin, list, grid } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticeStore } from '@wordpress/notices';\nimport { useInstanceId } from '@wordpress/compose';\nimport { createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tMIN_EXCERPT_LENGTH,\n\tMAX_EXCERPT_LENGTH,\n\tMAX_POSTS_COLUMNS,\n} from './constants';\n\n/**\n * Module Constants\n */\nconst CATEGORIES_LIST_QUERY = {\n\tper_page: -1,\n\tcontext: 'view',\n};\nconst USERS_LIST_QUERY = {\n\tper_page: -1,\n\thas_published_posts: [ 'post' ],\n\tcontext: 'view',\n};\n\nfunction getFeaturedImageDetails( post, size ) {\n\tconst image = post._embedded?.[ 'wp:featuredmedia' ]?.[ '0' ];\n\n\treturn {\n\t\turl:\n\t\t\timage?.media_details?.sizes?.[ size ]?.source_url ??\n\t\t\timage?.source_url,\n\t\talt: image?.alt_text,\n\t};\n}\n\nexport default function LatestPostsEdit( { attributes, setAttributes } ) {\n\tconst instanceId = useInstanceId( LatestPostsEdit );\n\tconst {\n\t\tpostsToShow,\n\t\torder,\n\t\torderBy,\n\t\tcategories,\n\t\tselectedAuthor,\n\t\tdisplayFeaturedImage,\n\t\tdisplayPostContentRadio,\n\t\tdisplayPostContent,\n\t\tdisplayPostDate,\n\t\tdisplayAuthor,\n\t\tpostLayout,\n\t\tcolumns,\n\t\texcerptLength,\n\t\tfeaturedImageAlign,\n\t\tfeaturedImageSizeSlug,\n\t\tfeaturedImageSizeWidth,\n\t\tfeaturedImageSizeHeight,\n\t\taddLinkToFeaturedImage,\n\t} = attributes;\n\tconst {\n\t\timageSizes,\n\t\tlatestPosts,\n\t\tdefaultImageWidth,\n\t\tdefaultImageHeight,\n\t\tcategoriesList,\n\t\tauthorList,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getUsers } = select( coreStore );\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tconst catIds =\n\t\t\t\tcategories && categories.length > 0\n\t\t\t\t\t? categories.map( ( cat ) => cat.id )\n\t\t\t\t\t: [];\n\t\t\tconst latestPostsQuery = Object.fromEntries(\n\t\t\t\tObject.entries( {\n\t\t\t\t\tcategories: catIds,\n\t\t\t\t\tauthor: selectedAuthor,\n\t\t\t\t\torder,\n\t\t\t\t\torderby: orderBy,\n\t\t\t\t\tper_page: postsToShow,\n\t\t\t\t\t_embed: 'wp:featuredmedia',\n\t\t\t\t} ).filter( ( [ , value ] ) => typeof value !== 'undefined' )\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tdefaultImageWidth:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.width ?? 0,\n\t\t\t\tdefaultImageHeight:\n\t\t\t\t\tsettings.imageDimensions?.[ featuredImageSizeSlug ]\n\t\t\t\t\t\t?.height ?? 0,\n\t\t\t\timageSizes: settings.imageSizes,\n\t\t\t\tlatestPosts: getEntityRecords(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'post',\n\t\t\t\t\tlatestPostsQuery\n\t\t\t\t),\n\t\t\t\tcategoriesList: getEntityRecords(\n\t\t\t\t\t'taxonomy',\n\t\t\t\t\t'category',\n\t\t\t\t\tCATEGORIES_LIST_QUERY\n\t\t\t\t),\n\t\t\t\tauthorList: getUsers( USERS_LIST_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[\n\t\t\tfeaturedImageSizeSlug,\n\t\t\tpostsToShow,\n\t\t\torder,\n\t\t\torderBy,\n\t\t\tcategories,\n\t\t\tselectedAuthor,\n\t\t]\n\t);\n\n\t// If a user clicks to a link prevent redirection and show a warning.\n\tconst { createWarningNotice, removeNotice } = useDispatch( noticeStore );\n\tlet noticeId;\n\tconst showRedirectionPreventedNotice = ( event ) => {\n\t\tevent.preventDefault();\n\t\t// Remove previous warning if any, to show one at a time per block.\n\t\tremoveNotice( noticeId );\n\t\tnoticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;\n\t\tcreateWarningNotice( __( 'Links are disabled in the editor.' ), {\n\t\t\tid: noticeId,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t};\n\n\tconst imageSizeOptions = imageSizes\n\t\t.filter( ( { slug } ) => slug !== 'full' )\n\t\t.map( ( { name, slug } ) => ( {\n\t\t\tvalue: slug,\n\t\t\tlabel: name,\n\t\t} ) );\n\tconst categorySuggestions =\n\t\tcategoriesList?.reduce(\n\t\t\t( accumulator, category ) => ( {\n\t\t\t\t...accumulator,\n\t\t\t\t[ category.name ]: category,\n\t\t\t} ),\n\t\t\t{}\n\t\t) ?? {};\n\tconst selectCategories = ( tokens ) => {\n\t\tconst hasNoSuggestion = tokens.some(\n\t\t\t( token ) =>\n\t\t\t\ttypeof token === 'string' && ! categorySuggestions[ token ]\n\t\t);\n\t\tif ( hasNoSuggestion ) {\n\t\t\treturn;\n\t\t}\n\t\t// Categories that are already will be objects, while new additions will be strings (the name).\n\t\t// allCategories nomalizes the array so that they are all objects.\n\t\tconst allCategories = tokens.map( ( token ) => {\n\t\t\treturn typeof token === 'string'\n\t\t\t\t? categorySuggestions[ token ]\n\t\t\t\t: token;\n\t\t} );\n\t\t// We do nothing if the category is not selected\n\t\t// from suggestions.\n\t\tif ( allCategories.includes( null ) ) {\n\t\t\treturn false;\n\t\t}\n\t\tsetAttributes( { categories: allCategories } );\n\t};\n\n\tconst hasPosts = !! latestPosts?.length;\n\tconst inspectorControls = (\n\t\t<InspectorControls>\n\t\t\t<PanelBody title={ __( 'Post content' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Post content' ) }\n\t\t\t\t\tchecked={ displayPostContent }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostContent: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayPostContent && (\n\t\t\t\t\t<RadioControl\n\t\t\t\t\t\tlabel={ __( 'Show:' ) }\n\t\t\t\t\t\tselected={ displayPostContentRadio }\n\t\t\t\t\t\toptions={ [\n\t\t\t\t\t\t\t{ label: __( 'Excerpt' ), value: 'excerpt' },\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Full post' ),\n\t\t\t\t\t\t\t\tvalue: 'full_post',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tdisplayPostContentRadio: value,\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) }\n\t\t\t\t{ displayPostContent &&\n\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tlabel={ __( 'Max number of words' ) }\n\t\t\t\t\t\t\tvalue={ excerptLength }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( { excerptLength: value } )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ MIN_EXCERPT_LENGTH }\n\t\t\t\t\t\t\tmax={ MAX_EXCERPT_LENGTH }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Post meta' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display author name' ) }\n\t\t\t\t\tchecked={ displayAuthor }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayAuthor: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display post date' ) }\n\t\t\t\t\tchecked={ displayPostDate }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayPostDate: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Featured image' ) }>\n\t\t\t\t<ToggleControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tlabel={ __( 'Display featured image' ) }\n\t\t\t\t\tchecked={ displayFeaturedImage }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { displayFeaturedImage: value } )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ displayFeaturedImage && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<ImageSizeControl\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\tconst newAttrs = {};\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'width' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeWidth =\n\t\t\t\t\t\t\t\t\t\tvalue.width;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( value.hasOwnProperty( 'height' ) ) {\n\t\t\t\t\t\t\t\t\tnewAttrs.featuredImageSizeHeight =\n\t\t\t\t\t\t\t\t\t\tvalue.height;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetAttributes( newAttrs );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tslug={ featuredImageSizeSlug }\n\t\t\t\t\t\t\twidth={ featuredImageSizeWidth }\n\t\t\t\t\t\t\theight={ featuredImageSizeHeight }\n\t\t\t\t\t\t\timageWidth={ defaultImageWidth }\n\t\t\t\t\t\t\timageHeight={ defaultImageHeight }\n\t\t\t\t\t\t\timageSizeOptions={ imageSizeOptions }\n\t\t\t\t\t\t\timageSizeHelp={ __(\n\t\t\t\t\t\t\t\t'Select the size of the source image.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tonChangeImage={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeSlug: value,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeWidth: undefined,\n\t\t\t\t\t\t\t\t\tfeaturedImageSizeHeight: undefined,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<BaseControl className=\"editor-latest-posts-image-alignment-control\">\n\t\t\t\t\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t\t\t\t\t{ __( 'Image alignment' ) }\n\t\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t\t<BlockAlignmentToolbar\n\t\t\t\t\t\t\t\tvalue={ featuredImageAlign }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfeaturedImageAlign: value,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcontrols={ [ 'left', 'center', 'right' ] }\n\t\t\t\t\t\t\t\tisCollapsed={ false }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BaseControl>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Add link to featured image' ) }\n\t\t\t\t\t\t\tchecked={ addLinkToFeaturedImage }\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\taddLinkToFeaturedImage: value,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\n\t\t\t<PanelBody title={ __( 'Sorting and filtering' ) }>\n\t\t\t\t<QueryControls\n\t\t\t\t\t{ ...{ order, orderBy } }\n\t\t\t\t\tnumberOfItems={ postsToShow }\n\t\t\t\t\tonOrderChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { order: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonOrderByChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { orderBy: value } )\n\t\t\t\t\t}\n\t\t\t\t\tonNumberOfItemsChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { postsToShow: value } )\n\t\t\t\t\t}\n\t\t\t\t\tcategorySuggestions={ categorySuggestions }\n\t\t\t\t\tonCategoryChange={ selectCategories }\n\t\t\t\t\tselectedCategories={ categories }\n\t\t\t\t\tonAuthorChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tselectedAuthor:\n\t\t\t\t\t\t\t\t'' !== value ? Number( value ) : undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tauthorList={ authorList ?? [] }\n\t\t\t\t\tselectedAuthorId={ selectedAuthor }\n\t\t\t\t/>\n\n\t\t\t\t{ postLayout === 'grid' && (\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ columns }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( { columns: value } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 2 }\n\t\t\t\t\t\tmax={\n\t\t\t\t\t\t\t! hasPosts\n\t\t\t\t\t\t\t\t? MAX_POSTS_COLUMNS\n\t\t\t\t\t\t\t\t: Math.min(\n\t\t\t\t\t\t\t\t\t\tMAX_POSTS_COLUMNS,\n\t\t\t\t\t\t\t\t\t\tlatestPosts.length\n\t\t\t\t\t\t\t\t )\n\t\t\t\t\t\t}\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</PanelBody>\n\t\t</InspectorControls>\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( {\n\t\t\t'wp-block-latest-posts__list': true,\n\t\t\t'is-grid': postLayout === 'grid',\n\t\t\t'has-dates': displayPostDate,\n\t\t\t'has-author': displayAuthor,\n\t\t\t[ `columns-${ columns }` ]: postLayout === 'grid',\n\t\t} ),\n\t} );\n\n\tif ( ! hasPosts ) {\n\t\treturn (\n\t\t\t<div { ...blockProps }>\n\t\t\t\t{ inspectorControls }\n\t\t\t\t<Placeholder icon={ pin } label={ __( 'Latest Posts' ) }>\n\t\t\t\t\t{ ! Array.isArray( latestPosts ) ? (\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t__( 'No posts found.' )\n\t\t\t\t\t) }\n\t\t\t\t</Placeholder>\n\t\t\t</div>\n\t\t);\n\t}\n\n\t// Removing posts from display should be instant.\n\tconst displayPosts =\n\t\tlatestPosts.length > postsToShow\n\t\t\t? latestPosts.slice( 0, postsToShow )\n\t\t\t: latestPosts;\n\n\tconst layoutControls = [\n\t\t{\n\t\t\ticon: list,\n\t\t\ttitle: __( 'List view' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'list' } ),\n\t\t\tisActive: postLayout === 'list',\n\t\t},\n\t\t{\n\t\t\ticon: grid,\n\t\t\ttitle: __( 'Grid view' ),\n\t\t\tonClick: () => setAttributes( { postLayout: 'grid' } ),\n\t\t\tisActive: postLayout === 'grid',\n\t\t},\n\t];\n\n\tconst dateFormat = getSettings().formats.date;\n\n\treturn (\n\t\t<div>\n\t\t\t{ inspectorControls }\n\t\t\t<BlockControls>\n\t\t\t\t<ToolbarGroup controls={ layoutControls } />\n\t\t\t</BlockControls>\n\t\t\t<ul { ...blockProps }>\n\t\t\t\t{ displayPosts.map( ( post ) => {\n\t\t\t\t\tconst titleTrimmed = post.title.rendered.trim();\n\t\t\t\t\tlet excerpt = post.excerpt.rendered;\n\t\t\t\t\tconst currentAuthor = authorList?.find(\n\t\t\t\t\t\t( author ) => author.id === post.author\n\t\t\t\t\t);\n\n\t\t\t\t\tconst excerptElement = document.createElement( 'div' );\n\t\t\t\t\texcerptElement.innerHTML = excerpt;\n\n\t\t\t\t\texcerpt =\n\t\t\t\t\t\texcerptElement.textContent ||\n\t\t\t\t\t\texcerptElement.innerText ||\n\t\t\t\t\t\t'';\n\n\t\t\t\t\tconst { url: imageSourceUrl, alt: featuredImageAlt } =\n\t\t\t\t\t\tgetFeaturedImageDetails( post, featuredImageSizeSlug );\n\t\t\t\t\tconst imageClasses = classnames( {\n\t\t\t\t\t\t'wp-block-latest-posts__featured-image': true,\n\t\t\t\t\t\t[ `align${ featuredImageAlign }` ]:\n\t\t\t\t\t\t\t!! featuredImageAlign,\n\t\t\t\t\t} );\n\t\t\t\t\tconst renderFeaturedImage =\n\t\t\t\t\t\tdisplayFeaturedImage && imageSourceUrl;\n\t\t\t\t\tconst featuredImage = renderFeaturedImage && (\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tsrc={ imageSourceUrl }\n\t\t\t\t\t\t\talt={ featuredImageAlt }\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tmaxWidth: featuredImageSizeWidth,\n\t\t\t\t\t\t\t\tmaxHeight: featuredImageSizeHeight,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\n\t\t\t\t\tconst needsReadMore =\n\t\t\t\t\t\texcerptLength < excerpt.trim().split( ' ' ).length &&\n\t\t\t\t\t\tpost.excerpt.raw === '';\n\n\t\t\t\t\tconst postExcerpt = needsReadMore ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t{ excerpt\n\t\t\t\t\t\t\t\t.trim()\n\t\t\t\t\t\t\t\t.split( ' ', excerptLength )\n\t\t\t\t\t\t\t\t.join( ' ' ) }\n\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t/* translators: 1: Hidden accessibility text: Post title */\n\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t'… <a>Read more<span>: %1$s</span></a>'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\ttitleTrimmed || __( '(no title)' )\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ta: (\n\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line jsx-a11y/anchor-has-content\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__read-more\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tspan: (\n\t\t\t\t\t\t\t\t\t\t<span className=\"screen-reader-text\" />\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\texcerpt\n\t\t\t\t\t);\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<li key={ post.id }>\n\t\t\t\t\t\t\t{ renderFeaturedImage && (\n\t\t\t\t\t\t\t\t<div className={ imageClasses }>\n\t\t\t\t\t\t\t\t\t{ addLinkToFeaturedImage ? (\n\t\t\t\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-title\"\n\t\t\t\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={\n\t\t\t\t\t\t\t\t\t\t\t\tshowRedirectionPreventedNotice\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ featuredImage }\n\t\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\tfeaturedImage\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t<a\n\t\t\t\t\t\t\t\thref={ post.link }\n\t\t\t\t\t\t\t\trel=\"noreferrer noopener\"\n\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={\n\t\t\t\t\t\t\t\t\t!! titleTrimmed\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\t__html: titleTrimmed,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonClick={ showRedirectionPreventedNotice }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ ! titleTrimmed ? __( '(no title)' ) : null }\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t{ displayAuthor && currentAuthor && (\n\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-author\">\n\t\t\t\t\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: byline. %s: current author. */\n\t\t\t\t\t\t\t\t\t\t__( 'by %s' ),\n\t\t\t\t\t\t\t\t\t\tcurrentAuthor.name\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostDate && post.date_gmt && (\n\t\t\t\t\t\t\t\t<time\n\t\t\t\t\t\t\t\t\tdateTime={ format( 'c', post.date_gmt ) }\n\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-date\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ dateI18n( dateFormat, post.date_gmt ) }\n\t\t\t\t\t\t\t\t</time>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'excerpt' && (\n\t\t\t\t\t\t\t\t\t<div className=\"wp-block-latest-posts__post-excerpt\">\n\t\t\t\t\t\t\t\t\t\t{ postExcerpt }\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ displayPostContent &&\n\t\t\t\t\t\t\t\tdisplayPostContentRadio === 'full_post' && (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tclassName=\"wp-block-latest-posts__post-full-content\"\n\t\t\t\t\t\t\t\t\t\tdangerouslySetInnerHTML={ {\n\t\t\t\t\t\t\t\t\t\t\t__html: post.content.raw.trim(),\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</li>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ul>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;;AAkCA,IAAAA,QAAA,GAAAC,OAAA;AA/BA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,WAAA,GAAAH,OAAA;AAWA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAQA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,QAAA,GAAAX,OAAA;AAMA,IAAAY,UAAA,GAAAZ,OAAA;AAvCA;AACA;AACA;;AAGA;AACA;AACA;;AA6BA;AACA;AACA;;AAOA;AACA;AACA;AACA,MAAMa,qBAAqB,GAAG;EAC7BC,QAAQ,EAAE,CAAC,CAAC;EACZC,OAAO,EAAE;AACV,CAAC;AACD,MAAMC,gBAAgB,GAAG;EACxBF,QAAQ,EAAE,CAAC,CAAC;EACZG,mBAAmB,EAAE,CAAE,MAAM,CAAE;EAC/BF,OAAO,EAAE;AACV,CAAC;AAED,SAASG,uBAAuBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EAAA,IAAAC,qBAAA;E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QAAQ,IACjC,IAAAxN,QAAA,CAAAmH,aAAA;MACCsG,QAAQ,EAAG,IAAAC,YAAM,EAAE,GAAG,EAAEtM,IAAI,CAACoM,QAAS,CAAG;MACzC1E,SAAS,EAAC;IAAkC,GAE1C,IAAA6E,cAAQ,EAAE3C,UAAU,EAAE5J,IAAI,CAACoM,QAAS,CACjC,CACN,EACC5K,kBAAkB,IACnBD,uBAAuB,KAAK,SAAS,IACpC,IAAA3C,QAAA,CAAAmH,aAAA;MAAK2B,SAAS,EAAC;IAAqC,GACjD8D,WACE,CACL,EACAhK,kBAAkB,IACnBD,uBAAuB,KAAK,WAAW,IACtC,IAAA3C,QAAA,CAAAmH,aAAA;MACC2B,SAAS,EAAC,0CAA0C;MACpDwE,uBAAuB,EAAG;QACzBC,MAAM,EAAEnM,IAAI,CAACwM,OAAO,CAACjB,GAAG,CAACpB,IAAI,CAAC;MAC/B;IAAG,CACH,CAEA,CAAC;EAEP,CAAE,CACC,CACA,CAAC;AAER"}
|
|
@@ -563,7 +563,6 @@ function Navigation({
|
|
|
563
563
|
}), (0, _element.createElement)(_responsiveWrapper.default, {
|
|
564
564
|
id: clientId,
|
|
565
565
|
onToggle: setResponsiveMenuVisibility,
|
|
566
|
-
label: (0, _i18n.__)('Menu'),
|
|
567
566
|
hasIcon: hasIcon,
|
|
568
567
|
icon: icon,
|
|
569
568
|
isOpen: isResponsiveMenuOpen,
|