Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-inclu.../blocks/image
File: view.js
import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity";
[0] Fix | Delete
/******/ // The require scope
[1] Fix | Delete
/******/ var __webpack_require__ = {};
[2] Fix | Delete
/******/
[3] Fix | Delete
/************************************************************************/
[4] Fix | Delete
/******/ /* webpack/runtime/define property getters */
[5] Fix | Delete
/******/ (() => {
[6] Fix | Delete
/******/ // define getter functions for harmony exports
[7] Fix | Delete
/******/ __webpack_require__.d = (exports, definition) => {
[8] Fix | Delete
/******/ for(var key in definition) {
[9] Fix | Delete
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
[10] Fix | Delete
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
[11] Fix | Delete
/******/ }
[12] Fix | Delete
/******/ }
[13] Fix | Delete
/******/ };
[14] Fix | Delete
/******/ })();
[15] Fix | Delete
/******/
[16] Fix | Delete
/******/ /* webpack/runtime/hasOwnProperty shorthand */
[17] Fix | Delete
/******/ (() => {
[18] Fix | Delete
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
[19] Fix | Delete
/******/ })();
[20] Fix | Delete
/******/
[21] Fix | Delete
/************************************************************************/
[22] Fix | Delete
var __webpack_exports__ = {};
[23] Fix | Delete
[24] Fix | Delete
;// CONCATENATED MODULE: external "@wordpress/interactivity"
[25] Fix | Delete
var x = (y) => {
[26] Fix | Delete
var x = {}; __webpack_require__.d(x, y); return x
[27] Fix | Delete
}
[28] Fix | Delete
var y = (x) => (() => (x))
[29] Fix | Delete
const interactivity_namespaceObject = x({ ["getContext"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext), ["getElement"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement), ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) });
[30] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/image/view.js
[31] Fix | Delete
/**
[32] Fix | Delete
* WordPress dependencies
[33] Fix | Delete
*/
[34] Fix | Delete
[35] Fix | Delete
[36] Fix | Delete
/**
[37] Fix | Delete
* Tracks whether user is touching screen; used to differentiate behavior for
[38] Fix | Delete
* touch and mouse input.
[39] Fix | Delete
*
[40] Fix | Delete
* @type {boolean}
[41] Fix | Delete
*/
[42] Fix | Delete
let isTouching = false;
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Tracks the last time the screen was touched; used to differentiate behavior
[46] Fix | Delete
* for touch and mouse input.
[47] Fix | Delete
*
[48] Fix | Delete
* @type {number}
[49] Fix | Delete
*/
[50] Fix | Delete
let lastTouchTime = 0;
[51] Fix | Delete
[52] Fix | Delete
/**
[53] Fix | Delete
* Stores the image reference of the currently opened lightbox.
[54] Fix | Delete
*
[55] Fix | Delete
* @type {HTMLElement}
[56] Fix | Delete
*/
[57] Fix | Delete
let imageRef;
[58] Fix | Delete
[59] Fix | Delete
/**
[60] Fix | Delete
* Stores the button reference of the currently opened lightbox.
[61] Fix | Delete
*
[62] Fix | Delete
* @type {HTMLElement}
[63] Fix | Delete
*/
[64] Fix | Delete
let buttonRef;
[65] Fix | Delete
const {
[66] Fix | Delete
state,
[67] Fix | Delete
actions,
[68] Fix | Delete
callbacks
[69] Fix | Delete
} = (0,interactivity_namespaceObject.store)('core/image', {
[70] Fix | Delete
state: {
[71] Fix | Delete
currentImage: {},
[72] Fix | Delete
get overlayOpened() {
[73] Fix | Delete
return state.currentImage.currentSrc;
[74] Fix | Delete
},
[75] Fix | Delete
get roleAttribute() {
[76] Fix | Delete
return state.overlayOpened ? 'dialog' : null;
[77] Fix | Delete
},
[78] Fix | Delete
get ariaModal() {
[79] Fix | Delete
return state.overlayOpened ? 'true' : null;
[80] Fix | Delete
},
[81] Fix | Delete
get enlargedSrc() {
[82] Fix | Delete
return state.currentImage.uploadedSrc || 'data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=';
[83] Fix | Delete
},
[84] Fix | Delete
get imgStyles() {
[85] Fix | Delete
return state.overlayOpened && `${state.currentImage.imgStyles?.replace(/;$/, '')}; object-fit:cover;`;
[86] Fix | Delete
}
[87] Fix | Delete
},
[88] Fix | Delete
actions: {
[89] Fix | Delete
showLightbox() {
[90] Fix | Delete
const ctx = (0,interactivity_namespaceObject.getContext)();
[91] Fix | Delete
[92] Fix | Delete
// Bails out if the image has not loaded yet.
[93] Fix | Delete
if (!ctx.imageRef?.complete) {
[94] Fix | Delete
return;
[95] Fix | Delete
}
[96] Fix | Delete
[97] Fix | Delete
// Stores the positons of the scroll to fix it until the overlay is
[98] Fix | Delete
// closed.
[99] Fix | Delete
state.scrollTopReset = document.documentElement.scrollTop;
[100] Fix | Delete
state.scrollLeftReset = document.documentElement.scrollLeft;
[101] Fix | Delete
[102] Fix | Delete
// Moves the information of the expaned image to the state.
[103] Fix | Delete
ctx.currentSrc = ctx.imageRef.currentSrc;
[104] Fix | Delete
imageRef = ctx.imageRef;
[105] Fix | Delete
buttonRef = ctx.buttonRef;
[106] Fix | Delete
state.currentImage = ctx;
[107] Fix | Delete
state.overlayEnabled = true;
[108] Fix | Delete
[109] Fix | Delete
// Computes the styles of the overlay for the animation.
[110] Fix | Delete
callbacks.setOverlayStyles();
[111] Fix | Delete
},
[112] Fix | Delete
hideLightbox() {
[113] Fix | Delete
if (state.overlayEnabled) {
[114] Fix | Delete
// Waits until the close animation has completed before allowing a
[115] Fix | Delete
// user to scroll again. The duration of this animation is defined in
[116] Fix | Delete
// the `styles.scss` file, but in any case we should wait a few
[117] Fix | Delete
// milliseconds longer than the duration, otherwise a user may scroll
[118] Fix | Delete
// too soon and cause the animation to look sloppy.
[119] Fix | Delete
setTimeout(function () {
[120] Fix | Delete
// Delays before changing the focus. Otherwise the focus ring will
[121] Fix | Delete
// appear on Firefox before the image has finished animating, which
[122] Fix | Delete
// looks broken.
[123] Fix | Delete
buttonRef.focus({
[124] Fix | Delete
preventScroll: true
[125] Fix | Delete
});
[126] Fix | Delete
[127] Fix | Delete
// Resets the current image to mark the overlay as closed.
[128] Fix | Delete
state.currentImage = {};
[129] Fix | Delete
imageRef = null;
[130] Fix | Delete
buttonRef = null;
[131] Fix | Delete
}, 450);
[132] Fix | Delete
[133] Fix | Delete
// Starts the overlay closing animation. The showClosingAnimation
[134] Fix | Delete
// class is used to avoid showing it on page load.
[135] Fix | Delete
state.showClosingAnimation = true;
[136] Fix | Delete
state.overlayEnabled = false;
[137] Fix | Delete
}
[138] Fix | Delete
},
[139] Fix | Delete
handleKeydown(event) {
[140] Fix | Delete
if (state.overlayEnabled) {
[141] Fix | Delete
// Focuses the close button when the user presses the tab key.
[142] Fix | Delete
if (event.key === 'Tab') {
[143] Fix | Delete
event.preventDefault();
[144] Fix | Delete
const {
[145] Fix | Delete
ref
[146] Fix | Delete
} = (0,interactivity_namespaceObject.getElement)();
[147] Fix | Delete
ref.querySelector('button').focus();
[148] Fix | Delete
}
[149] Fix | Delete
// Closes the lightbox when the user presses the escape key.
[150] Fix | Delete
if (event.key === 'Escape') {
[151] Fix | Delete
actions.hideLightbox();
[152] Fix | Delete
}
[153] Fix | Delete
}
[154] Fix | Delete
},
[155] Fix | Delete
handleTouchMove(event) {
[156] Fix | Delete
// On mobile devices, prevents triggering the scroll event because
[157] Fix | Delete
// otherwise the page jumps around when it resets the scroll position.
[158] Fix | Delete
// This also means that closing the lightbox requires that a user
[159] Fix | Delete
// perform a simple tap. This may be changed in the future if there is a
[160] Fix | Delete
// better alternative to override or reset the scroll position during
[161] Fix | Delete
// swipe actions.
[162] Fix | Delete
if (state.overlayEnabled) {
[163] Fix | Delete
event.preventDefault();
[164] Fix | Delete
}
[165] Fix | Delete
},
[166] Fix | Delete
handleTouchStart() {
[167] Fix | Delete
isTouching = true;
[168] Fix | Delete
},
[169] Fix | Delete
handleTouchEnd() {
[170] Fix | Delete
// Waits a few milliseconds before resetting to ensure that pinch to
[171] Fix | Delete
// zoom works consistently on mobile devices when the lightbox is open.
[172] Fix | Delete
lastTouchTime = Date.now();
[173] Fix | Delete
isTouching = false;
[174] Fix | Delete
},
[175] Fix | Delete
handleScroll() {
[176] Fix | Delete
// Prevents scrolling behaviors that trigger content shift while the
[177] Fix | Delete
// lightbox is open. It would be better to accomplish through CSS alone,
[178] Fix | Delete
// but using overflow: hidden is currently the only way to do so and
[179] Fix | Delete
// that causes a layout to shift and prevents the zoom animation from
[180] Fix | Delete
// working in some cases because it's not possible to account for the
[181] Fix | Delete
// layout shift when doing the animation calculations. Instead, it uses
[182] Fix | Delete
// JavaScript to prevent and reset the scrolling behavior.
[183] Fix | Delete
if (state.overlayOpened) {
[184] Fix | Delete
// Avoids overriding the scroll behavior on mobile devices because
[185] Fix | Delete
// doing so breaks the pinch to zoom functionality, and users should
[186] Fix | Delete
// be able to zoom in further on the high-res image.
[187] Fix | Delete
if (!isTouching && Date.now() - lastTouchTime > 450) {
[188] Fix | Delete
// It doesn't rely on `event.preventDefault()` to prevent scrolling
[189] Fix | Delete
// because the scroll event can't be canceled, so it resets the
[190] Fix | Delete
// position instead.
[191] Fix | Delete
window.scrollTo(state.scrollLeftReset, state.scrollTopReset);
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
}
[195] Fix | Delete
},
[196] Fix | Delete
callbacks: {
[197] Fix | Delete
setOverlayStyles() {
[198] Fix | Delete
if (!imageRef) {
[199] Fix | Delete
return;
[200] Fix | Delete
}
[201] Fix | Delete
let {
[202] Fix | Delete
naturalWidth,
[203] Fix | Delete
naturalHeight,
[204] Fix | Delete
offsetWidth: originalWidth,
[205] Fix | Delete
offsetHeight: originalHeight
[206] Fix | Delete
} = imageRef;
[207] Fix | Delete
let {
[208] Fix | Delete
x: screenPosX,
[209] Fix | Delete
y: screenPosY
[210] Fix | Delete
} = imageRef.getBoundingClientRect();
[211] Fix | Delete
[212] Fix | Delete
// Natural ratio of the image clicked to open the lightbox.
[213] Fix | Delete
const naturalRatio = naturalWidth / naturalHeight;
[214] Fix | Delete
// Original ratio of the image clicked to open the lightbox.
[215] Fix | Delete
let originalRatio = originalWidth / originalHeight;
[216] Fix | Delete
[217] Fix | Delete
// If it has object-fit: contain, recalculates the original sizes
[218] Fix | Delete
// and the screen position without the blank spaces.
[219] Fix | Delete
if (state.currentImage.scaleAttr === 'contain') {
[220] Fix | Delete
if (naturalRatio > originalRatio) {
[221] Fix | Delete
const heightWithoutSpace = originalWidth / naturalRatio;
[222] Fix | Delete
// Recalculates screen position without the top space.
[223] Fix | Delete
screenPosY += (originalHeight - heightWithoutSpace) / 2;
[224] Fix | Delete
originalHeight = heightWithoutSpace;
[225] Fix | Delete
} else {
[226] Fix | Delete
const widthWithoutSpace = originalHeight * naturalRatio;
[227] Fix | Delete
// Recalculates screen position without the left space.
[228] Fix | Delete
screenPosX += (originalWidth - widthWithoutSpace) / 2;
[229] Fix | Delete
originalWidth = widthWithoutSpace;
[230] Fix | Delete
}
[231] Fix | Delete
}
[232] Fix | Delete
originalRatio = originalWidth / originalHeight;
[233] Fix | Delete
[234] Fix | Delete
// Typically, it uses the image's full-sized dimensions. If those
[235] Fix | Delete
// dimensions have not been set (i.e. an external image with only one
[236] Fix | Delete
// size), the image's dimensions in the lightbox are the same
[237] Fix | Delete
// as those of the image in the content.
[238] Fix | Delete
let imgMaxWidth = parseFloat(state.currentImage.targetWidth !== 'none' ? state.currentImage.targetWidth : naturalWidth);
[239] Fix | Delete
let imgMaxHeight = parseFloat(state.currentImage.targetHeight !== 'none' ? state.currentImage.targetHeight : naturalHeight);
[240] Fix | Delete
[241] Fix | Delete
// Ratio of the biggest image stored in the database.
[242] Fix | Delete
let imgRatio = imgMaxWidth / imgMaxHeight;
[243] Fix | Delete
let containerMaxWidth = imgMaxWidth;
[244] Fix | Delete
let containerMaxHeight = imgMaxHeight;
[245] Fix | Delete
let containerWidth = imgMaxWidth;
[246] Fix | Delete
let containerHeight = imgMaxHeight;
[247] Fix | Delete
// Checks if the target image has a different ratio than the original
[248] Fix | Delete
// one (thumbnail). Recalculates the width and height.
[249] Fix | Delete
if (naturalRatio.toFixed(2) !== imgRatio.toFixed(2)) {
[250] Fix | Delete
if (naturalRatio > imgRatio) {
[251] Fix | Delete
// If the width is reached before the height, it keeps the maxWidth
[252] Fix | Delete
// and recalculates the height unless the difference between the
[253] Fix | Delete
// maxHeight and the reducedHeight is higher than the maxWidth,
[254] Fix | Delete
// where it keeps the reducedHeight and recalculate the width.
[255] Fix | Delete
const reducedHeight = imgMaxWidth / naturalRatio;
[256] Fix | Delete
if (imgMaxHeight - reducedHeight > imgMaxWidth) {
[257] Fix | Delete
imgMaxHeight = reducedHeight;
[258] Fix | Delete
imgMaxWidth = reducedHeight * naturalRatio;
[259] Fix | Delete
} else {
[260] Fix | Delete
imgMaxHeight = imgMaxWidth / naturalRatio;
[261] Fix | Delete
}
[262] Fix | Delete
} else {
[263] Fix | Delete
// If the height is reached before the width, it keeps the maxHeight
[264] Fix | Delete
// and recalculate the width unlesss the difference between the
[265] Fix | Delete
// maxWidth and the reducedWidth is higher than the maxHeight, where
[266] Fix | Delete
// it keeps the reducedWidth and recalculate the height.
[267] Fix | Delete
const reducedWidth = imgMaxHeight * naturalRatio;
[268] Fix | Delete
if (imgMaxWidth - reducedWidth > imgMaxHeight) {
[269] Fix | Delete
imgMaxWidth = reducedWidth;
[270] Fix | Delete
imgMaxHeight = reducedWidth / naturalRatio;
[271] Fix | Delete
} else {
[272] Fix | Delete
imgMaxWidth = imgMaxHeight * naturalRatio;
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
containerWidth = imgMaxWidth;
[276] Fix | Delete
containerHeight = imgMaxHeight;
[277] Fix | Delete
imgRatio = imgMaxWidth / imgMaxHeight;
[278] Fix | Delete
[279] Fix | Delete
// Calculates the max size of the container.
[280] Fix | Delete
if (originalRatio > imgRatio) {
[281] Fix | Delete
containerMaxWidth = imgMaxWidth;
[282] Fix | Delete
containerMaxHeight = containerMaxWidth / originalRatio;
[283] Fix | Delete
} else {
[284] Fix | Delete
containerMaxHeight = imgMaxHeight;
[285] Fix | Delete
containerMaxWidth = containerMaxHeight * originalRatio;
[286] Fix | Delete
}
[287] Fix | Delete
}
[288] Fix | Delete
[289] Fix | Delete
// If the image has been pixelated on purpose, it keeps that size.
[290] Fix | Delete
if (originalWidth > containerWidth || originalHeight > containerHeight) {
[291] Fix | Delete
containerWidth = originalWidth;
[292] Fix | Delete
containerHeight = originalHeight;
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
// Calculates the final lightbox image size and the scale factor.
[296] Fix | Delete
// MaxWidth is either the window container (accounting for padding) or
[297] Fix | Delete
// the image resolution.
[298] Fix | Delete
let horizontalPadding = 0;
[299] Fix | Delete
if (window.innerWidth > 480) {
[300] Fix | Delete
horizontalPadding = 80;
[301] Fix | Delete
} else if (window.innerWidth > 1920) {
[302] Fix | Delete
horizontalPadding = 160;
[303] Fix | Delete
}
[304] Fix | Delete
const verticalPadding = 80;
[305] Fix | Delete
const targetMaxWidth = Math.min(window.innerWidth - horizontalPadding, containerWidth);
[306] Fix | Delete
const targetMaxHeight = Math.min(window.innerHeight - verticalPadding, containerHeight);
[307] Fix | Delete
const targetContainerRatio = targetMaxWidth / targetMaxHeight;
[308] Fix | Delete
if (originalRatio > targetContainerRatio) {
[309] Fix | Delete
// If targetMaxWidth is reached before targetMaxHeight.
[310] Fix | Delete
containerWidth = targetMaxWidth;
[311] Fix | Delete
containerHeight = containerWidth / originalRatio;
[312] Fix | Delete
} else {
[313] Fix | Delete
// If targetMaxHeight is reached before targetMaxWidth.
[314] Fix | Delete
containerHeight = targetMaxHeight;
[315] Fix | Delete
containerWidth = containerHeight * originalRatio;
[316] Fix | Delete
}
[317] Fix | Delete
const containerScale = originalWidth / containerWidth;
[318] Fix | Delete
const lightboxImgWidth = imgMaxWidth * (containerWidth / containerMaxWidth);
[319] Fix | Delete
const lightboxImgHeight = imgMaxHeight * (containerHeight / containerMaxHeight);
[320] Fix | Delete
[321] Fix | Delete
// As of this writing, using the calculations above will render the
[322] Fix | Delete
// lightbox with a small, erroneous whitespace on the left side of the
[323] Fix | Delete
// image in iOS Safari, perhaps due to an inconsistency in how browsers
[324] Fix | Delete
// handle absolute positioning and CSS transformation. In any case,
[325] Fix | Delete
// adding 1 pixel to the container width and height solves the problem,
[326] Fix | Delete
// though this can be removed if the issue is fixed in the future.
[327] Fix | Delete
state.overlayStyles = `
[328] Fix | Delete
:root {
[329] Fix | Delete
--wp--lightbox-initial-top-position: ${screenPosY}px;
[330] Fix | Delete
--wp--lightbox-initial-left-position: ${screenPosX}px;
[331] Fix | Delete
--wp--lightbox-container-width: ${containerWidth + 1}px;
[332] Fix | Delete
--wp--lightbox-container-height: ${containerHeight + 1}px;
[333] Fix | Delete
--wp--lightbox-image-width: ${lightboxImgWidth}px;
[334] Fix | Delete
--wp--lightbox-image-height: ${lightboxImgHeight}px;
[335] Fix | Delete
--wp--lightbox-scale: ${containerScale};
[336] Fix | Delete
--wp--lightbox-scrollbar-width: ${window.innerWidth - document.documentElement.clientWidth}px;
[337] Fix | Delete
}
[338] Fix | Delete
`;
[339] Fix | Delete
},
[340] Fix | Delete
setButtonStyles() {
[341] Fix | Delete
const ctx = (0,interactivity_namespaceObject.getContext)();
[342] Fix | Delete
const {
[343] Fix | Delete
ref
[344] Fix | Delete
} = (0,interactivity_namespaceObject.getElement)();
[345] Fix | Delete
ctx.imageRef = ref;
[346] Fix | Delete
const {
[347] Fix | Delete
naturalWidth,
[348] Fix | Delete
naturalHeight,
[349] Fix | Delete
offsetWidth,
[350] Fix | Delete
offsetHeight
[351] Fix | Delete
} = ref;
[352] Fix | Delete
[353] Fix | Delete
// If the image isn't loaded yet, it can't calculate where the button
[354] Fix | Delete
// should be.
[355] Fix | Delete
if (naturalWidth === 0 || naturalHeight === 0) {
[356] Fix | Delete
return;
[357] Fix | Delete
}
[358] Fix | Delete
const figure = ref.parentElement;
[359] Fix | Delete
const figureWidth = ref.parentElement.clientWidth;
[360] Fix | Delete
[361] Fix | Delete
// It needs special handling for the height because a caption will cause
[362] Fix | Delete
// the figure to be taller than the image, which means it needs to
[363] Fix | Delete
// account for that when calculating the placement of the button in the
[364] Fix | Delete
// top right corner of the image.
[365] Fix | Delete
let figureHeight = ref.parentElement.clientHeight;
[366] Fix | Delete
const caption = figure.querySelector('figcaption');
[367] Fix | Delete
if (caption) {
[368] Fix | Delete
const captionComputedStyle = window.getComputedStyle(caption);
[369] Fix | Delete
if (!['absolute', 'fixed'].includes(captionComputedStyle.position)) {
[370] Fix | Delete
figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
[371] Fix | Delete
}
[372] Fix | Delete
}
[373] Fix | Delete
const buttonOffsetTop = figureHeight - offsetHeight;
[374] Fix | Delete
const buttonOffsetRight = figureWidth - offsetWidth;
[375] Fix | Delete
[376] Fix | Delete
// In the case of an image with object-fit: contain, the size of the
[377] Fix | Delete
// <img> element can be larger than the image itself, so it needs to
[378] Fix | Delete
// calculate where to place the button.
[379] Fix | Delete
if (ctx.scaleAttr === 'contain') {
[380] Fix | Delete
// Natural ratio of the image.
[381] Fix | Delete
const naturalRatio = naturalWidth / naturalHeight;
[382] Fix | Delete
// Offset ratio of the image.
[383] Fix | Delete
const offsetRatio = offsetWidth / offsetHeight;
[384] Fix | Delete
if (naturalRatio >= offsetRatio) {
[385] Fix | Delete
// If it reaches the width first, it keeps the width and compute the
[386] Fix | Delete
// height.
[387] Fix | Delete
const referenceHeight = offsetWidth / naturalRatio;
[388] Fix | Delete
ctx.imageButtonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 16;
[389] Fix | Delete
ctx.imageButtonRight = buttonOffsetRight + 16;
[390] Fix | Delete
} else {
[391] Fix | Delete
// If it reaches the height first, it keeps the height and compute
[392] Fix | Delete
// the width.
[393] Fix | Delete
const referenceWidth = offsetHeight * naturalRatio;
[394] Fix | Delete
ctx.imageButtonTop = buttonOffsetTop + 16;
[395] Fix | Delete
ctx.imageButtonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 16;
[396] Fix | Delete
}
[397] Fix | Delete
} else {
[398] Fix | Delete
ctx.imageButtonTop = buttonOffsetTop + 16;
[399] Fix | Delete
ctx.imageButtonRight = buttonOffsetRight + 16;
[400] Fix | Delete
}
[401] Fix | Delete
},
[402] Fix | Delete
setOverlayFocus() {
[403] Fix | Delete
if (state.overlayEnabled) {
[404] Fix | Delete
// Moves the focus to the dialog when it opens.
[405] Fix | Delete
const {
[406] Fix | Delete
ref
[407] Fix | Delete
} = (0,interactivity_namespaceObject.getElement)();
[408] Fix | Delete
ref.focus();
[409] Fix | Delete
}
[410] Fix | Delete
},
[411] Fix | Delete
initTriggerButton() {
[412] Fix | Delete
const ctx = (0,interactivity_namespaceObject.getContext)();
[413] Fix | Delete
const {
[414] Fix | Delete
ref
[415] Fix | Delete
} = (0,interactivity_namespaceObject.getElement)();
[416] Fix | Delete
ctx.buttonRef = ref;
[417] Fix | Delete
}
[418] Fix | Delete
}
[419] Fix | Delete
}, {
[420] Fix | Delete
lock: true
[421] Fix | Delete
});
[422] Fix | Delete
[423] Fix | Delete
[424] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function