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

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: compose.js
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4000] Fix | Delete
focusOnMountRef.current = focusOnMount;
[4001] Fix | Delete
}, [focusOnMount]);
[4002] Fix | Delete
return useRefEffect(node => {
[4003] Fix | Delete
var _node$ownerDocument$a;
[4004] Fix | Delete
if (!node || focusOnMountRef.current === false) {
[4005] Fix | Delete
return;
[4006] Fix | Delete
}
[4007] Fix | Delete
if (node.contains((_node$ownerDocument$a = node.ownerDocument?.activeElement) !== null && _node$ownerDocument$a !== void 0 ? _node$ownerDocument$a : null)) {
[4008] Fix | Delete
return;
[4009] Fix | Delete
}
[4010] Fix | Delete
if (focusOnMountRef.current === 'firstElement') {
[4011] Fix | Delete
timerId.current = setTimeout(() => {
[4012] Fix | Delete
const firstTabbable = external_wp_dom_namespaceObject.focus.tabbable.find(node)[0];
[4013] Fix | Delete
if (firstTabbable) {
[4014] Fix | Delete
setFocus(firstTabbable);
[4015] Fix | Delete
}
[4016] Fix | Delete
}, 0);
[4017] Fix | Delete
return;
[4018] Fix | Delete
}
[4019] Fix | Delete
setFocus(node);
[4020] Fix | Delete
return () => {
[4021] Fix | Delete
if (timerId.current) {
[4022] Fix | Delete
clearTimeout(timerId.current);
[4023] Fix | Delete
}
[4024] Fix | Delete
};
[4025] Fix | Delete
}, []);
[4026] Fix | Delete
}
[4027] Fix | Delete
[4028] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-focus-return/index.js
[4029] Fix | Delete
/**
[4030] Fix | Delete
* WordPress dependencies
[4031] Fix | Delete
*/
[4032] Fix | Delete
[4033] Fix | Delete
[4034] Fix | Delete
/** @type {Element|null} */
[4035] Fix | Delete
let origin = null;
[4036] Fix | Delete
[4037] Fix | Delete
/**
[4038] Fix | Delete
* Adds the unmount behavior of returning focus to the element which had it
[4039] Fix | Delete
* previously as is expected for roles like menus or dialogs.
[4040] Fix | Delete
*
[4041] Fix | Delete
* @param {() => void} [onFocusReturn] Overrides the default return behavior.
[4042] Fix | Delete
* @return {import('react').RefCallback<HTMLElement>} Element Ref.
[4043] Fix | Delete
*
[4044] Fix | Delete
* @example
[4045] Fix | Delete
* ```js
[4046] Fix | Delete
* import { useFocusReturn } from '@wordpress/compose';
[4047] Fix | Delete
*
[4048] Fix | Delete
* const WithFocusReturn = () => {
[4049] Fix | Delete
* const ref = useFocusReturn()
[4050] Fix | Delete
* return (
[4051] Fix | Delete
* <div ref={ ref }>
[4052] Fix | Delete
* <Button />
[4053] Fix | Delete
* <Button />
[4054] Fix | Delete
* </div>
[4055] Fix | Delete
* );
[4056] Fix | Delete
* }
[4057] Fix | Delete
* ```
[4058] Fix | Delete
*/
[4059] Fix | Delete
function useFocusReturn(onFocusReturn) {
[4060] Fix | Delete
/** @type {import('react').MutableRefObject<null | HTMLElement>} */
[4061] Fix | Delete
const ref = (0,external_wp_element_namespaceObject.useRef)(null);
[4062] Fix | Delete
/** @type {import('react').MutableRefObject<null | Element>} */
[4063] Fix | Delete
const focusedBeforeMount = (0,external_wp_element_namespaceObject.useRef)(null);
[4064] Fix | Delete
const onFocusReturnRef = (0,external_wp_element_namespaceObject.useRef)(onFocusReturn);
[4065] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4066] Fix | Delete
onFocusReturnRef.current = onFocusReturn;
[4067] Fix | Delete
}, [onFocusReturn]);
[4068] Fix | Delete
return (0,external_wp_element_namespaceObject.useCallback)(node => {
[4069] Fix | Delete
if (node) {
[4070] Fix | Delete
// Set ref to be used when unmounting.
[4071] Fix | Delete
ref.current = node;
[4072] Fix | Delete
[4073] Fix | Delete
// Only set when the node mounts.
[4074] Fix | Delete
if (focusedBeforeMount.current) {
[4075] Fix | Delete
return;
[4076] Fix | Delete
}
[4077] Fix | Delete
focusedBeforeMount.current = node.ownerDocument.activeElement;
[4078] Fix | Delete
} else if (focusedBeforeMount.current) {
[4079] Fix | Delete
const isFocused = ref.current?.contains(ref.current?.ownerDocument.activeElement);
[4080] Fix | Delete
if (ref.current?.isConnected && !isFocused) {
[4081] Fix | Delete
var _origin;
[4082] Fix | Delete
(_origin = origin) !== null && _origin !== void 0 ? _origin : origin = focusedBeforeMount.current;
[4083] Fix | Delete
return;
[4084] Fix | Delete
}
[4085] Fix | Delete
[4086] Fix | Delete
// Defer to the component's own explicit focus return behavior, if
[4087] Fix | Delete
// specified. This allows for support that the `onFocusReturn`
[4088] Fix | Delete
// decides to allow the default behavior to occur under some
[4089] Fix | Delete
// conditions.
[4090] Fix | Delete
if (onFocusReturnRef.current) {
[4091] Fix | Delete
onFocusReturnRef.current();
[4092] Fix | Delete
} else {
[4093] Fix | Delete
/** @type {null|HTMLElement} */(!focusedBeforeMount.current.isConnected ? origin : focusedBeforeMount.current)?.focus();
[4094] Fix | Delete
}
[4095] Fix | Delete
origin = null;
[4096] Fix | Delete
}
[4097] Fix | Delete
}, []);
[4098] Fix | Delete
}
[4099] Fix | Delete
/* harmony default export */ const use_focus_return = (useFocusReturn);
[4100] Fix | Delete
[4101] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-focus-outside/index.js
[4102] Fix | Delete
/**
[4103] Fix | Delete
* WordPress dependencies
[4104] Fix | Delete
*/
[4105] Fix | Delete
[4106] Fix | Delete
[4107] Fix | Delete
/**
[4108] Fix | Delete
* Input types which are classified as button types, for use in considering
[4109] Fix | Delete
* whether element is a (focus-normalized) button.
[4110] Fix | Delete
*/
[4111] Fix | Delete
const INPUT_BUTTON_TYPES = ['button', 'submit'];
[4112] Fix | Delete
[4113] Fix | Delete
/**
[4114] Fix | Delete
* List of HTML button elements subject to focus normalization
[4115] Fix | Delete
*
[4116] Fix | Delete
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
[4117] Fix | Delete
*/
[4118] Fix | Delete
[4119] Fix | Delete
/**
[4120] Fix | Delete
* Returns true if the given element is a button element subject to focus
[4121] Fix | Delete
* normalization, or false otherwise.
[4122] Fix | Delete
*
[4123] Fix | Delete
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
[4124] Fix | Delete
*
[4125] Fix | Delete
* @param eventTarget The target from a mouse or touch event.
[4126] Fix | Delete
*
[4127] Fix | Delete
* @return Whether the element is a button element subject to focus normalization.
[4128] Fix | Delete
*/
[4129] Fix | Delete
function isFocusNormalizedButton(eventTarget) {
[4130] Fix | Delete
if (!(eventTarget instanceof window.HTMLElement)) {
[4131] Fix | Delete
return false;
[4132] Fix | Delete
}
[4133] Fix | Delete
switch (eventTarget.nodeName) {
[4134] Fix | Delete
case 'A':
[4135] Fix | Delete
case 'BUTTON':
[4136] Fix | Delete
return true;
[4137] Fix | Delete
case 'INPUT':
[4138] Fix | Delete
return INPUT_BUTTON_TYPES.includes(eventTarget.type);
[4139] Fix | Delete
}
[4140] Fix | Delete
return false;
[4141] Fix | Delete
}
[4142] Fix | Delete
/**
[4143] Fix | Delete
* A react hook that can be used to check whether focus has moved outside the
[4144] Fix | Delete
* element the event handlers are bound to.
[4145] Fix | Delete
*
[4146] Fix | Delete
* @param onFocusOutside A callback triggered when focus moves outside
[4147] Fix | Delete
* the element the event handlers are bound to.
[4148] Fix | Delete
*
[4149] Fix | Delete
* @return An object containing event handlers. Bind the event handlers to a
[4150] Fix | Delete
* wrapping element element to capture when focus moves outside that element.
[4151] Fix | Delete
*/
[4152] Fix | Delete
function useFocusOutside(onFocusOutside) {
[4153] Fix | Delete
const currentOnFocusOutside = (0,external_wp_element_namespaceObject.useRef)(onFocusOutside);
[4154] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4155] Fix | Delete
currentOnFocusOutside.current = onFocusOutside;
[4156] Fix | Delete
}, [onFocusOutside]);
[4157] Fix | Delete
const preventBlurCheck = (0,external_wp_element_namespaceObject.useRef)(false);
[4158] Fix | Delete
const blurCheckTimeoutId = (0,external_wp_element_namespaceObject.useRef)();
[4159] Fix | Delete
[4160] Fix | Delete
/**
[4161] Fix | Delete
* Cancel a blur check timeout.
[4162] Fix | Delete
*/
[4163] Fix | Delete
const cancelBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(() => {
[4164] Fix | Delete
clearTimeout(blurCheckTimeoutId.current);
[4165] Fix | Delete
}, []);
[4166] Fix | Delete
[4167] Fix | Delete
// Cancel blur checks on unmount.
[4168] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4169] Fix | Delete
return () => cancelBlurCheck();
[4170] Fix | Delete
}, []);
[4171] Fix | Delete
[4172] Fix | Delete
// Cancel a blur check if the callback or ref is no longer provided.
[4173] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4174] Fix | Delete
if (!onFocusOutside) {
[4175] Fix | Delete
cancelBlurCheck();
[4176] Fix | Delete
}
[4177] Fix | Delete
}, [onFocusOutside, cancelBlurCheck]);
[4178] Fix | Delete
[4179] Fix | Delete
/**
[4180] Fix | Delete
* Handles a mousedown or mouseup event to respectively assign and
[4181] Fix | Delete
* unassign a flag for preventing blur check on button elements. Some
[4182] Fix | Delete
* browsers, namely Firefox and Safari, do not emit a focus event on
[4183] Fix | Delete
* button elements when clicked, while others do. The logic here
[4184] Fix | Delete
* intends to normalize this as treating click on buttons as focus.
[4185] Fix | Delete
*
[4186] Fix | Delete
* @param event
[4187] Fix | Delete
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#Clicking_and_focus
[4188] Fix | Delete
*/
[4189] Fix | Delete
const normalizeButtonFocus = (0,external_wp_element_namespaceObject.useCallback)(event => {
[4190] Fix | Delete
const {
[4191] Fix | Delete
type,
[4192] Fix | Delete
target
[4193] Fix | Delete
} = event;
[4194] Fix | Delete
const isInteractionEnd = ['mouseup', 'touchend'].includes(type);
[4195] Fix | Delete
if (isInteractionEnd) {
[4196] Fix | Delete
preventBlurCheck.current = false;
[4197] Fix | Delete
} else if (isFocusNormalizedButton(target)) {
[4198] Fix | Delete
preventBlurCheck.current = true;
[4199] Fix | Delete
}
[4200] Fix | Delete
}, []);
[4201] Fix | Delete
[4202] Fix | Delete
/**
[4203] Fix | Delete
* A callback triggered when a blur event occurs on the element the handler
[4204] Fix | Delete
* is bound to.
[4205] Fix | Delete
*
[4206] Fix | Delete
* Calls the `onFocusOutside` callback in an immediate timeout if focus has
[4207] Fix | Delete
* move outside the bound element and is still within the document.
[4208] Fix | Delete
*/
[4209] Fix | Delete
const queueBlurCheck = (0,external_wp_element_namespaceObject.useCallback)(event => {
[4210] Fix | Delete
// React does not allow using an event reference asynchronously
[4211] Fix | Delete
// due to recycling behavior, except when explicitly persisted.
[4212] Fix | Delete
event.persist();
[4213] Fix | Delete
[4214] Fix | Delete
// Skip blur check if clicking button. See `normalizeButtonFocus`.
[4215] Fix | Delete
if (preventBlurCheck.current) {
[4216] Fix | Delete
return;
[4217] Fix | Delete
}
[4218] Fix | Delete
[4219] Fix | Delete
// The usage of this attribute should be avoided. The only use case
[4220] Fix | Delete
// would be when we load modals that are not React components and
[4221] Fix | Delete
// therefore don't exist in the React tree. An example is opening
[4222] Fix | Delete
// the Media Library modal from another dialog.
[4223] Fix | Delete
// This attribute should contain a selector of the related target
[4224] Fix | Delete
// we want to ignore, because we still need to trigger the blur event
[4225] Fix | Delete
// on all other cases.
[4226] Fix | Delete
const ignoreForRelatedTarget = event.target.getAttribute('data-unstable-ignore-focus-outside-for-relatedtarget');
[4227] Fix | Delete
if (ignoreForRelatedTarget && event.relatedTarget?.closest(ignoreForRelatedTarget)) {
[4228] Fix | Delete
return;
[4229] Fix | Delete
}
[4230] Fix | Delete
blurCheckTimeoutId.current = setTimeout(() => {
[4231] Fix | Delete
// If document is not focused then focus should remain
[4232] Fix | Delete
// inside the wrapped component and therefore we cancel
[4233] Fix | Delete
// this blur event thereby leaving focus in place.
[4234] Fix | Delete
// https://developer.mozilla.org/en-US/docs/Web/API/Document/hasFocus.
[4235] Fix | Delete
if (!document.hasFocus()) {
[4236] Fix | Delete
event.preventDefault();
[4237] Fix | Delete
return;
[4238] Fix | Delete
}
[4239] Fix | Delete
if ('function' === typeof currentOnFocusOutside.current) {
[4240] Fix | Delete
currentOnFocusOutside.current(event);
[4241] Fix | Delete
}
[4242] Fix | Delete
}, 0);
[4243] Fix | Delete
}, []);
[4244] Fix | Delete
return {
[4245] Fix | Delete
onFocus: cancelBlurCheck,
[4246] Fix | Delete
onMouseDown: normalizeButtonFocus,
[4247] Fix | Delete
onMouseUp: normalizeButtonFocus,
[4248] Fix | Delete
onTouchStart: normalizeButtonFocus,
[4249] Fix | Delete
onTouchEnd: normalizeButtonFocus,
[4250] Fix | Delete
onBlur: queueBlurCheck
[4251] Fix | Delete
};
[4252] Fix | Delete
}
[4253] Fix | Delete
[4254] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-merge-refs/index.js
[4255] Fix | Delete
/**
[4256] Fix | Delete
* WordPress dependencies
[4257] Fix | Delete
*/
[4258] Fix | Delete
[4259] Fix | Delete
[4260] Fix | Delete
/* eslint-disable jsdoc/valid-types */
[4261] Fix | Delete
/**
[4262] Fix | Delete
* @template T
[4263] Fix | Delete
* @typedef {T extends import('react').Ref<infer R> ? R : never} TypeFromRef
[4264] Fix | Delete
*/
[4265] Fix | Delete
/* eslint-enable jsdoc/valid-types */
[4266] Fix | Delete
[4267] Fix | Delete
/**
[4268] Fix | Delete
* @template T
[4269] Fix | Delete
* @param {import('react').Ref<T>} ref
[4270] Fix | Delete
* @param {T} value
[4271] Fix | Delete
*/
[4272] Fix | Delete
function assignRef(ref, value) {
[4273] Fix | Delete
if (typeof ref === 'function') {
[4274] Fix | Delete
ref(value);
[4275] Fix | Delete
} else if (ref && ref.hasOwnProperty('current')) {
[4276] Fix | Delete
/* eslint-disable jsdoc/no-undefined-types */
[4277] Fix | Delete
/** @type {import('react').MutableRefObject<T>} */ref.current = value;
[4278] Fix | Delete
/* eslint-enable jsdoc/no-undefined-types */
[4279] Fix | Delete
}
[4280] Fix | Delete
}
[4281] Fix | Delete
[4282] Fix | Delete
/**
[4283] Fix | Delete
* Merges refs into one ref callback.
[4284] Fix | Delete
*
[4285] Fix | Delete
* It also ensures that the merged ref callbacks are only called when they
[4286] Fix | Delete
* change (as a result of a `useCallback` dependency update) OR when the ref
[4287] Fix | Delete
* value changes, just as React does when passing a single ref callback to the
[4288] Fix | Delete
* component.
[4289] Fix | Delete
*
[4290] Fix | Delete
* As expected, if you pass a new function on every render, the ref callback
[4291] Fix | Delete
* will be called after every render.
[4292] Fix | Delete
*
[4293] Fix | Delete
* If you don't wish a ref callback to be called after every render, wrap it
[4294] Fix | Delete
* with `useCallback( callback, dependencies )`. When a dependency changes, the
[4295] Fix | Delete
* old ref callback will be called with `null` and the new ref callback will be
[4296] Fix | Delete
* called with the same value.
[4297] Fix | Delete
*
[4298] Fix | Delete
* To make ref callbacks easier to use, you can also pass the result of
[4299] Fix | Delete
* `useRefEffect`, which makes cleanup easier by allowing you to return a
[4300] Fix | Delete
* cleanup function instead of handling `null`.
[4301] Fix | Delete
*
[4302] Fix | Delete
* It's also possible to _disable_ a ref (and its behaviour) by simply not
[4303] Fix | Delete
* passing the ref.
[4304] Fix | Delete
*
[4305] Fix | Delete
* ```jsx
[4306] Fix | Delete
* const ref = useRefEffect( ( node ) => {
[4307] Fix | Delete
* node.addEventListener( ... );
[4308] Fix | Delete
* return () => {
[4309] Fix | Delete
* node.removeEventListener( ... );
[4310] Fix | Delete
* };
[4311] Fix | Delete
* }, [ ...dependencies ] );
[4312] Fix | Delete
* const otherRef = useRef();
[4313] Fix | Delete
* const mergedRefs useMergeRefs( [
[4314] Fix | Delete
* enabled && ref,
[4315] Fix | Delete
* otherRef,
[4316] Fix | Delete
* ] );
[4317] Fix | Delete
* return <div ref={ mergedRefs } />;
[4318] Fix | Delete
* ```
[4319] Fix | Delete
*
[4320] Fix | Delete
* @template {import('react').Ref<any>} TRef
[4321] Fix | Delete
* @param {Array<TRef>} refs The refs to be merged.
[4322] Fix | Delete
*
[4323] Fix | Delete
* @return {import('react').RefCallback<TypeFromRef<TRef>>} The merged ref callback.
[4324] Fix | Delete
*/
[4325] Fix | Delete
function useMergeRefs(refs) {
[4326] Fix | Delete
const element = (0,external_wp_element_namespaceObject.useRef)();
[4327] Fix | Delete
const isAttached = (0,external_wp_element_namespaceObject.useRef)(false);
[4328] Fix | Delete
const didElementChange = (0,external_wp_element_namespaceObject.useRef)(false);
[4329] Fix | Delete
/* eslint-disable jsdoc/no-undefined-types */
[4330] Fix | Delete
/** @type {import('react').MutableRefObject<TRef[]>} */
[4331] Fix | Delete
/* eslint-enable jsdoc/no-undefined-types */
[4332] Fix | Delete
const previousRefs = (0,external_wp_element_namespaceObject.useRef)([]);
[4333] Fix | Delete
const currentRefs = (0,external_wp_element_namespaceObject.useRef)(refs);
[4334] Fix | Delete
[4335] Fix | Delete
// Update on render before the ref callback is called, so the ref callback
[4336] Fix | Delete
// always has access to the current refs.
[4337] Fix | Delete
currentRefs.current = refs;
[4338] Fix | Delete
[4339] Fix | Delete
// If any of the refs change, call the previous ref with `null` and the new
[4340] Fix | Delete
// ref with the node, except when the element changes in the same cycle, in
[4341] Fix | Delete
// which case the ref callbacks will already have been called.
[4342] Fix | Delete
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
[4343] Fix | Delete
if (didElementChange.current === false && isAttached.current === true) {
[4344] Fix | Delete
refs.forEach((ref, index) => {
[4345] Fix | Delete
const previousRef = previousRefs.current[index];
[4346] Fix | Delete
if (ref !== previousRef) {
[4347] Fix | Delete
assignRef(previousRef, null);
[4348] Fix | Delete
assignRef(ref, element.current);
[4349] Fix | Delete
}
[4350] Fix | Delete
});
[4351] Fix | Delete
}
[4352] Fix | Delete
previousRefs.current = refs;
[4353] Fix | Delete
}, refs);
[4354] Fix | Delete
[4355] Fix | Delete
// No dependencies, must be reset after every render so ref callbacks are
[4356] Fix | Delete
// correctly called after a ref change.
[4357] Fix | Delete
(0,external_wp_element_namespaceObject.useLayoutEffect)(() => {
[4358] Fix | Delete
didElementChange.current = false;
[4359] Fix | Delete
});
[4360] Fix | Delete
[4361] Fix | Delete
// There should be no dependencies so that `callback` is only called when
[4362] Fix | Delete
// the node changes.
[4363] Fix | Delete
return (0,external_wp_element_namespaceObject.useCallback)(value => {
[4364] Fix | Delete
// Update the element so it can be used when calling ref callbacks on a
[4365] Fix | Delete
// dependency change.
[4366] Fix | Delete
assignRef(element, value);
[4367] Fix | Delete
didElementChange.current = true;
[4368] Fix | Delete
isAttached.current = value !== null;
[4369] Fix | Delete
[4370] Fix | Delete
// When an element changes, the current ref callback should be called
[4371] Fix | Delete
// with the new element and the previous one with `null`.
[4372] Fix | Delete
const refsToAssign = value ? currentRefs.current : previousRefs.current;
[4373] Fix | Delete
[4374] Fix | Delete
// Update the latest refs.
[4375] Fix | Delete
for (const ref of refsToAssign) {
[4376] Fix | Delete
assignRef(ref, value);
[4377] Fix | Delete
}
[4378] Fix | Delete
}, []);
[4379] Fix | Delete
}
[4380] Fix | Delete
[4381] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-dialog/index.js
[4382] Fix | Delete
/**
[4383] Fix | Delete
* External dependencies
[4384] Fix | Delete
*/
[4385] Fix | Delete
[4386] Fix | Delete
/**
[4387] Fix | Delete
* WordPress dependencies
[4388] Fix | Delete
*/
[4389] Fix | Delete
[4390] Fix | Delete
[4391] Fix | Delete
[4392] Fix | Delete
/**
[4393] Fix | Delete
* Internal dependencies
[4394] Fix | Delete
*/
[4395] Fix | Delete
[4396] Fix | Delete
[4397] Fix | Delete
[4398] Fix | Delete
[4399] Fix | Delete
[4400] Fix | Delete
/**
[4401] Fix | Delete
* Returns a ref and props to apply to a dialog wrapper to enable the following behaviors:
[4402] Fix | Delete
* - constrained tabbing.
[4403] Fix | Delete
* - focus on mount.
[4404] Fix | Delete
* - return focus on unmount.
[4405] Fix | Delete
* - focus outside.
[4406] Fix | Delete
*
[4407] Fix | Delete
* @param options Dialog Options.
[4408] Fix | Delete
*/
[4409] Fix | Delete
function useDialog(options) {
[4410] Fix | Delete
const currentOptions = (0,external_wp_element_namespaceObject.useRef)();
[4411] Fix | Delete
const {
[4412] Fix | Delete
constrainTabbing = options.focusOnMount !== false
[4413] Fix | Delete
} = options;
[4414] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[4415] Fix | Delete
currentOptions.current = options;
[4416] Fix | Delete
}, Object.values(options));
[4417] Fix | Delete
const constrainedTabbingRef = use_constrained_tabbing();
[4418] Fix | Delete
const focusOnMountRef = useFocusOnMount(options.focusOnMount);
[4419] Fix | Delete
const focusReturnRef = use_focus_return();
[4420] Fix | Delete
const focusOutsideProps = useFocusOutside(event => {
[4421] Fix | Delete
// This unstable prop is here only to manage backward compatibility
[4422] Fix | Delete
// for the Popover component otherwise, the onClose should be enough.
[4423] Fix | Delete
if (currentOptions.current?.__unstableOnClose) {
[4424] Fix | Delete
currentOptions.current.__unstableOnClose('focus-outside', event);
[4425] Fix | Delete
} else if (currentOptions.current?.onClose) {
[4426] Fix | Delete
currentOptions.current.onClose();
[4427] Fix | Delete
}
[4428] Fix | Delete
});
[4429] Fix | Delete
const closeOnEscapeRef = (0,external_wp_element_namespaceObject.useCallback)(node => {
[4430] Fix | Delete
if (!node) {
[4431] Fix | Delete
return;
[4432] Fix | Delete
}
[4433] Fix | Delete
node.addEventListener('keydown', event => {
[4434] Fix | Delete
// Close on escape.
[4435] Fix | Delete
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented && currentOptions.current?.onClose) {
[4436] Fix | Delete
event.preventDefault();
[4437] Fix | Delete
currentOptions.current.onClose();
[4438] Fix | Delete
}
[4439] Fix | Delete
});
[4440] Fix | Delete
}, []);
[4441] Fix | Delete
return [useMergeRefs([constrainTabbing ? constrainedTabbingRef : null, options.focusOnMount !== false ? focusReturnRef : null, options.focusOnMount !== false ? focusOnMountRef : null, closeOnEscapeRef]), {
[4442] Fix | Delete
...focusOutsideProps,
[4443] Fix | Delete
tabIndex: -1
[4444] Fix | Delete
}];
[4445] Fix | Delete
}
[4446] Fix | Delete
/* harmony default export */ const use_dialog = (useDialog);
[4447] Fix | Delete
[4448] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/compose/build-module/hooks/use-disabled/index.js
[4449] Fix | Delete
/**
[4450] Fix | Delete
* Internal dependencies
[4451] Fix | Delete
*/
[4452] Fix | Delete
[4453] Fix | Delete
[4454] Fix | Delete
[4455] Fix | Delete
/**
[4456] Fix | Delete
* In some circumstances, such as block previews, all focusable DOM elements
[4457] Fix | Delete
* (input fields, links, buttons, etc.) need to be disabled. This hook adds the
[4458] Fix | Delete
* behavior to disable nested DOM elements to the returned ref.
[4459] Fix | Delete
*
[4460] Fix | Delete
* If you can, prefer the use of the inert HTML attribute.
[4461] Fix | Delete
*
[4462] Fix | Delete
* @param {Object} config Configuration object.
[4463] Fix | Delete
* @param {boolean=} config.isDisabled Whether the element should be disabled.
[4464] Fix | Delete
* @return {import('react').RefCallback<HTMLElement>} Element Ref.
[4465] Fix | Delete
*
[4466] Fix | Delete
* @example
[4467] Fix | Delete
* ```js
[4468] Fix | Delete
* import { useDisabled } from '@wordpress/compose';
[4469] Fix | Delete
*
[4470] Fix | Delete
* const DisabledExample = () => {
[4471] Fix | Delete
* const disabledRef = useDisabled();
[4472] Fix | Delete
* return (
[4473] Fix | Delete
* <div ref={ disabledRef }>
[4474] Fix | Delete
* <a href="#">This link will have tabindex set to -1</a>
[4475] Fix | Delete
* <input placeholder="This input will have the disabled attribute added to it." type="text" />
[4476] Fix | Delete
* </div>
[4477] Fix | Delete
* );
[4478] Fix | Delete
* };
[4479] Fix | Delete
* ```
[4480] Fix | Delete
*/
[4481] Fix | Delete
function useDisabled({
[4482] Fix | Delete
isDisabled: isDisabledProp = false
[4483] Fix | Delete
} = {}) {
[4484] Fix | Delete
return useRefEffect(node => {
[4485] Fix | Delete
if (isDisabledProp) {
[4486] Fix | Delete
return;
[4487] Fix | Delete
}
[4488] Fix | Delete
const defaultView = node?.ownerDocument?.defaultView;
[4489] Fix | Delete
if (!defaultView) {
[4490] Fix | Delete
return;
[4491] Fix | Delete
}
[4492] Fix | Delete
[4493] Fix | Delete
/** A variable keeping track of the previous updates in order to restore them. */
[4494] Fix | Delete
const updates = [];
[4495] Fix | Delete
const disable = () => {
[4496] Fix | Delete
node.childNodes.forEach(child => {
[4497] Fix | Delete
if (!(child instanceof defaultView.HTMLElement)) {
[4498] Fix | Delete
return;
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function