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: block-editor.js
* When the component updates, and there is multi selection, we need to
[42000] Fix | Delete
* select the entire block contents.
[42001] Fix | Delete
*/
[42002] Fix | Delete
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
[42003] Fix | Delete
const {
[42004] Fix | Delete
ownerDocument
[42005] Fix | Delete
} = node;
[42006] Fix | Delete
const {
[42007] Fix | Delete
defaultView
[42008] Fix | Delete
} = ownerDocument;
[42009] Fix | Delete
[42010] Fix | Delete
// Allow initialPosition to bypass focus behavior. This is useful
[42011] Fix | Delete
// for the list view or other areas where we don't want to transfer
[42012] Fix | Delete
// focus to the editor canvas.
[42013] Fix | Delete
if (initialPosition === undefined || initialPosition === null) {
[42014] Fix | Delete
return;
[42015] Fix | Delete
}
[42016] Fix | Delete
if (!hasMultiSelection || isMultiSelecting) {
[42017] Fix | Delete
return;
[42018] Fix | Delete
}
[42019] Fix | Delete
const {
[42020] Fix | Delete
length
[42021] Fix | Delete
} = multiSelectedBlockClientIds;
[42022] Fix | Delete
if (length < 2) {
[42023] Fix | Delete
return;
[42024] Fix | Delete
}
[42025] Fix | Delete
if (!isFullSelection) {
[42026] Fix | Delete
return;
[42027] Fix | Delete
}
[42028] Fix | Delete
[42029] Fix | Delete
// Allow cross contentEditable selection by temporarily making
[42030] Fix | Delete
// all content editable. We can't rely on using the store and
[42031] Fix | Delete
// React because re-rending happens too slowly. We need to be
[42032] Fix | Delete
// able to select across instances immediately.
[42033] Fix | Delete
node.contentEditable = true;
[42034] Fix | Delete
[42035] Fix | Delete
// For some browsers, like Safari, it is important that focus
[42036] Fix | Delete
// happens BEFORE selection removal.
[42037] Fix | Delete
node.focus();
[42038] Fix | Delete
defaultView.getSelection().removeAllRanges();
[42039] Fix | Delete
}, [hasMultiSelection, isMultiSelecting, multiSelectedBlockClientIds, selectedBlockClientId, initialPosition, isFullSelection]);
[42040] Fix | Delete
}
[42041] Fix | Delete
[42042] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-tab-nav.js
[42043] Fix | Delete
/**
[42044] Fix | Delete
* WordPress dependencies
[42045] Fix | Delete
*/
[42046] Fix | Delete
[42047] Fix | Delete
[42048] Fix | Delete
[42049] Fix | Delete
[42050] Fix | Delete
[42051] Fix | Delete
[42052] Fix | Delete
/**
[42053] Fix | Delete
* Internal dependencies
[42054] Fix | Delete
*/
[42055] Fix | Delete
[42056] Fix | Delete
[42057] Fix | Delete
[42058] Fix | Delete
[42059] Fix | Delete
function useTabNav() {
[42060] Fix | Delete
const container = (0,external_wp_element_namespaceObject.useRef)();
[42061] Fix | Delete
const focusCaptureBeforeRef = (0,external_wp_element_namespaceObject.useRef)();
[42062] Fix | Delete
const focusCaptureAfterRef = (0,external_wp_element_namespaceObject.useRef)();
[42063] Fix | Delete
const {
[42064] Fix | Delete
hasMultiSelection,
[42065] Fix | Delete
getSelectedBlockClientId,
[42066] Fix | Delete
getBlockCount
[42067] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[42068] Fix | Delete
const {
[42069] Fix | Delete
setNavigationMode,
[42070] Fix | Delete
setLastFocus
[42071] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useDispatch)(store));
[42072] Fix | Delete
const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isNavigationMode(), []);
[42073] Fix | Delete
const {
[42074] Fix | Delete
getLastFocus
[42075] Fix | Delete
} = unlock((0,external_wp_data_namespaceObject.useSelect)(store));
[42076] Fix | Delete
[42077] Fix | Delete
// Don't allow tabbing to this element in Navigation mode.
[42078] Fix | Delete
const focusCaptureTabIndex = !isNavigationMode ? '0' : undefined;
[42079] Fix | Delete
[42080] Fix | Delete
// Reference that holds the a flag for enabling or disabling
[42081] Fix | Delete
// capturing on the focus capture elements.
[42082] Fix | Delete
const noCapture = (0,external_wp_element_namespaceObject.useRef)();
[42083] Fix | Delete
function onFocusCapture(event) {
[42084] Fix | Delete
// Do not capture incoming focus if set by us in WritingFlow.
[42085] Fix | Delete
if (noCapture.current) {
[42086] Fix | Delete
noCapture.current = null;
[42087] Fix | Delete
} else if (hasMultiSelection()) {
[42088] Fix | Delete
container.current.focus();
[42089] Fix | Delete
} else if (getSelectedBlockClientId()) {
[42090] Fix | Delete
if (getLastFocus()?.current) {
[42091] Fix | Delete
getLastFocus().current.focus();
[42092] Fix | Delete
} else {
[42093] Fix | Delete
// Handles when the last focus has not been set yet, or has been cleared by new blocks being added via the inserter.
[42094] Fix | Delete
container.current.querySelector(`[data-block="${getSelectedBlockClientId()}"]`).focus();
[42095] Fix | Delete
}
[42096] Fix | Delete
} else {
[42097] Fix | Delete
setNavigationMode(true);
[42098] Fix | Delete
const canvasElement = container.current.ownerDocument === event.target.ownerDocument ? container.current : container.current.ownerDocument.defaultView.frameElement;
[42099] Fix | Delete
const isBefore =
[42100] Fix | Delete
// eslint-disable-next-line no-bitwise
[42101] Fix | Delete
event.target.compareDocumentPosition(canvasElement) & event.target.DOCUMENT_POSITION_FOLLOWING;
[42102] Fix | Delete
const tabbables = external_wp_dom_namespaceObject.focus.tabbable.find(container.current);
[42103] Fix | Delete
if (tabbables.length) {
[42104] Fix | Delete
const next = isBefore ? tabbables[0] : tabbables[tabbables.length - 1];
[42105] Fix | Delete
next.focus();
[42106] Fix | Delete
}
[42107] Fix | Delete
}
[42108] Fix | Delete
}
[42109] Fix | Delete
const before = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[42110] Fix | Delete
ref: focusCaptureBeforeRef,
[42111] Fix | Delete
tabIndex: focusCaptureTabIndex,
[42112] Fix | Delete
onFocus: onFocusCapture
[42113] Fix | Delete
});
[42114] Fix | Delete
const after = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", {
[42115] Fix | Delete
ref: focusCaptureAfterRef,
[42116] Fix | Delete
tabIndex: focusCaptureTabIndex,
[42117] Fix | Delete
onFocus: onFocusCapture
[42118] Fix | Delete
});
[42119] Fix | Delete
const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
[42120] Fix | Delete
function onKeyDown(event) {
[42121] Fix | Delete
if (event.defaultPrevented) {
[42122] Fix | Delete
return;
[42123] Fix | Delete
}
[42124] Fix | Delete
if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !hasMultiSelection()) {
[42125] Fix | Delete
event.preventDefault();
[42126] Fix | Delete
setNavigationMode(true);
[42127] Fix | Delete
return;
[42128] Fix | Delete
}
[42129] Fix | Delete
[42130] Fix | Delete
// In Edit mode, Tab should focus the first tabbable element after
[42131] Fix | Delete
// the content, which is normally the sidebar (with block controls)
[42132] Fix | Delete
// and Shift+Tab should focus the first tabbable element before the
[42133] Fix | Delete
// content, which is normally the block toolbar.
[42134] Fix | Delete
// Arrow keys can be used, and Tab and arrow keys can be used in
[42135] Fix | Delete
// Navigation mode (press Esc), to navigate through blocks.
[42136] Fix | Delete
if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
[42137] Fix | Delete
return;
[42138] Fix | Delete
}
[42139] Fix | Delete
const isShift = event.shiftKey;
[42140] Fix | Delete
const direction = isShift ? 'findPrevious' : 'findNext';
[42141] Fix | Delete
if (!hasMultiSelection() && !getSelectedBlockClientId()) {
[42142] Fix | Delete
// Preserve the behaviour of entering navigation mode when
[42143] Fix | Delete
// tabbing into the content without a block selection.
[42144] Fix | Delete
// `onFocusCapture` already did this previously, but we need to
[42145] Fix | Delete
// do it again here because after clearing block selection,
[42146] Fix | Delete
// focus land on the writing flow container and pressing Tab
[42147] Fix | Delete
// will no longer send focus through the focus capture element.
[42148] Fix | Delete
if (event.target === node) {
[42149] Fix | Delete
setNavigationMode(true);
[42150] Fix | Delete
}
[42151] Fix | Delete
return;
[42152] Fix | Delete
}
[42153] Fix | Delete
const nextTabbable = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target);
[42154] Fix | Delete
[42155] Fix | Delete
// We want to constrain the tabbing to the block and its child blocks.
[42156] Fix | Delete
// If the preceding form element is within a different block,
[42157] Fix | Delete
// such as two sibling image blocks in the placeholder state,
[42158] Fix | Delete
// we want shift + tab from the first form element to move to the image
[42159] Fix | Delete
// block toolbar and not the previous image block's form element.
[42160] Fix | Delete
const currentBlock = event.target.closest('[data-block]');
[42161] Fix | Delete
const isElementPartOfSelectedBlock = currentBlock && nextTabbable && (isInSameBlock(currentBlock, nextTabbable) || isInsideRootBlock(currentBlock, nextTabbable));
[42162] Fix | Delete
[42163] Fix | Delete
// Allow tabbing from the block wrapper to a form element,
[42164] Fix | Delete
// and between form elements rendered in a block and its child blocks,
[42165] Fix | Delete
// such as inside a placeholder. Form elements are generally
[42166] Fix | Delete
// meant to be UI rather than part of the content. Ideally
[42167] Fix | Delete
// these are not rendered in the content and perhaps in the
[42168] Fix | Delete
// future they can be rendered in an iframe or shadow DOM.
[42169] Fix | Delete
if ((0,external_wp_dom_namespaceObject.isFormElement)(nextTabbable) && isElementPartOfSelectedBlock) {
[42170] Fix | Delete
return;
[42171] Fix | Delete
}
[42172] Fix | Delete
const next = isShift ? focusCaptureBeforeRef : focusCaptureAfterRef;
[42173] Fix | Delete
[42174] Fix | Delete
// Disable focus capturing on the focus capture element, so it
[42175] Fix | Delete
// doesn't refocus this block and so it allows default behaviour
[42176] Fix | Delete
// (moving focus to the next tabbable element).
[42177] Fix | Delete
noCapture.current = true;
[42178] Fix | Delete
[42179] Fix | Delete
// Focusing the focus capture element, which is located above and
[42180] Fix | Delete
// below the editor, should not scroll the page all the way up or
[42181] Fix | Delete
// down.
[42182] Fix | Delete
next.current.focus({
[42183] Fix | Delete
preventScroll: true
[42184] Fix | Delete
});
[42185] Fix | Delete
}
[42186] Fix | Delete
function onFocusOut(event) {
[42187] Fix | Delete
setLastFocus({
[42188] Fix | Delete
...getLastFocus(),
[42189] Fix | Delete
current: event.target
[42190] Fix | Delete
});
[42191] Fix | Delete
const {
[42192] Fix | Delete
ownerDocument
[42193] Fix | Delete
} = node;
[42194] Fix | Delete
[42195] Fix | Delete
// If focus disappears due to there being no blocks, move focus to
[42196] Fix | Delete
// the writing flow wrapper.
[42197] Fix | Delete
if (!event.relatedTarget && ownerDocument.activeElement === ownerDocument.body && getBlockCount() === 0) {
[42198] Fix | Delete
node.focus();
[42199] Fix | Delete
}
[42200] Fix | Delete
}
[42201] Fix | Delete
[42202] Fix | Delete
// When tabbing back to an element in block list, this event handler prevents scrolling if the
[42203] Fix | Delete
// focus capture divs (before/after) are outside of the viewport. (For example shift+tab back to a paragraph
[42204] Fix | Delete
// when focus is on a sidebar element. This prevents the scrollable writing area from jumping either to the
[42205] Fix | Delete
// top or bottom of the document.
[42206] Fix | Delete
//
[42207] Fix | Delete
// Note that it isn't possible to disable scrolling in the onFocus event. We need to intercept this
[42208] Fix | Delete
// earlier in the keypress handler, and call focus( { preventScroll: true } ) instead.
[42209] Fix | Delete
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLOrForeignElement/focus#parameters
[42210] Fix | Delete
function preventScrollOnTab(event) {
[42211] Fix | Delete
if (event.keyCode !== external_wp_keycodes_namespaceObject.TAB) {
[42212] Fix | Delete
return;
[42213] Fix | Delete
}
[42214] Fix | Delete
if (event.target?.getAttribute('role') === 'region') {
[42215] Fix | Delete
return;
[42216] Fix | Delete
}
[42217] Fix | Delete
if (container.current === event.target) {
[42218] Fix | Delete
return;
[42219] Fix | Delete
}
[42220] Fix | Delete
const isShift = event.shiftKey;
[42221] Fix | Delete
const direction = isShift ? 'findPrevious' : 'findNext';
[42222] Fix | Delete
const target = external_wp_dom_namespaceObject.focus.tabbable[direction](event.target);
[42223] Fix | Delete
// Only do something when the next tabbable is a focus capture div (before/after)
[42224] Fix | Delete
if (target === focusCaptureBeforeRef.current || target === focusCaptureAfterRef.current) {
[42225] Fix | Delete
event.preventDefault();
[42226] Fix | Delete
target.focus({
[42227] Fix | Delete
preventScroll: true
[42228] Fix | Delete
});
[42229] Fix | Delete
}
[42230] Fix | Delete
}
[42231] Fix | Delete
const {
[42232] Fix | Delete
ownerDocument
[42233] Fix | Delete
} = node;
[42234] Fix | Delete
const {
[42235] Fix | Delete
defaultView
[42236] Fix | Delete
} = ownerDocument;
[42237] Fix | Delete
defaultView.addEventListener('keydown', preventScrollOnTab);
[42238] Fix | Delete
node.addEventListener('keydown', onKeyDown);
[42239] Fix | Delete
node.addEventListener('focusout', onFocusOut);
[42240] Fix | Delete
return () => {
[42241] Fix | Delete
defaultView.removeEventListener('keydown', preventScrollOnTab);
[42242] Fix | Delete
node.removeEventListener('keydown', onKeyDown);
[42243] Fix | Delete
node.removeEventListener('focusout', onFocusOut);
[42244] Fix | Delete
};
[42245] Fix | Delete
}, []);
[42246] Fix | Delete
const mergedRefs = (0,external_wp_compose_namespaceObject.useMergeRefs)([container, ref]);
[42247] Fix | Delete
return [before, mergedRefs, after];
[42248] Fix | Delete
}
[42249] Fix | Delete
[42250] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-arrow-nav.js
[42251] Fix | Delete
/**
[42252] Fix | Delete
* WordPress dependencies
[42253] Fix | Delete
*/
[42254] Fix | Delete
[42255] Fix | Delete
[42256] Fix | Delete
[42257] Fix | Delete
[42258] Fix | Delete
[42259] Fix | Delete
/**
[42260] Fix | Delete
* Internal dependencies
[42261] Fix | Delete
*/
[42262] Fix | Delete
[42263] Fix | Delete
[42264] Fix | Delete
[42265] Fix | Delete
/**
[42266] Fix | Delete
* Returns true if the element should consider edge navigation upon a keyboard
[42267] Fix | Delete
* event of the given directional key code, or false otherwise.
[42268] Fix | Delete
*
[42269] Fix | Delete
* @param {Element} element HTML element to test.
[42270] Fix | Delete
* @param {number} keyCode KeyboardEvent keyCode to test.
[42271] Fix | Delete
* @param {boolean} hasModifier Whether a modifier is pressed.
[42272] Fix | Delete
*
[42273] Fix | Delete
* @return {boolean} Whether element should consider edge navigation.
[42274] Fix | Delete
*/
[42275] Fix | Delete
function isNavigationCandidate(element, keyCode, hasModifier) {
[42276] Fix | Delete
const isVertical = keyCode === external_wp_keycodes_namespaceObject.UP || keyCode === external_wp_keycodes_namespaceObject.DOWN;
[42277] Fix | Delete
const {
[42278] Fix | Delete
tagName
[42279] Fix | Delete
} = element;
[42280] Fix | Delete
const elementType = element.getAttribute('type');
[42281] Fix | Delete
[42282] Fix | Delete
// Native inputs should not navigate vertically, unless they are simple types that don't need up/down arrow keys.
[42283] Fix | Delete
if (isVertical && !hasModifier) {
[42284] Fix | Delete
if (tagName === 'INPUT') {
[42285] Fix | Delete
const verticalInputTypes = ['date', 'datetime-local', 'month', 'number', 'range', 'time', 'week'];
[42286] Fix | Delete
return !verticalInputTypes.includes(elementType);
[42287] Fix | Delete
}
[42288] Fix | Delete
return true;
[42289] Fix | Delete
}
[42290] Fix | Delete
[42291] Fix | Delete
// Native inputs should not navigate horizontally, unless they are simple types that don't need left/right arrow keys.
[42292] Fix | Delete
if (tagName === 'INPUT') {
[42293] Fix | Delete
const simpleInputTypes = ['button', 'checkbox', 'number', 'color', 'file', 'image', 'radio', 'reset', 'submit'];
[42294] Fix | Delete
return simpleInputTypes.includes(elementType);
[42295] Fix | Delete
}
[42296] Fix | Delete
[42297] Fix | Delete
// Native textareas should not navigate horizontally.
[42298] Fix | Delete
return tagName !== 'TEXTAREA';
[42299] Fix | Delete
}
[42300] Fix | Delete
[42301] Fix | Delete
/**
[42302] Fix | Delete
* Returns the optimal tab target from the given focused element in the desired
[42303] Fix | Delete
* direction. A preference is made toward text fields, falling back to the block
[42304] Fix | Delete
* focus stop if no other candidates exist for the block.
[42305] Fix | Delete
*
[42306] Fix | Delete
* @param {Element} target Currently focused text field.
[42307] Fix | Delete
* @param {boolean} isReverse True if considering as the first field.
[42308] Fix | Delete
* @param {Element} containerElement Element containing all blocks.
[42309] Fix | Delete
* @param {boolean} onlyVertical Whether to only consider tabbable elements
[42310] Fix | Delete
* that are visually above or under the
[42311] Fix | Delete
* target.
[42312] Fix | Delete
*
[42313] Fix | Delete
* @return {?Element} Optimal tab target, if one exists.
[42314] Fix | Delete
*/
[42315] Fix | Delete
function getClosestTabbable(target, isReverse, containerElement, onlyVertical) {
[42316] Fix | Delete
// Since the current focus target is not guaranteed to be a text field, find
[42317] Fix | Delete
// all focusables. Tabbability is considered later.
[42318] Fix | Delete
let focusableNodes = external_wp_dom_namespaceObject.focus.focusable.find(containerElement);
[42319] Fix | Delete
if (isReverse) {
[42320] Fix | Delete
focusableNodes.reverse();
[42321] Fix | Delete
}
[42322] Fix | Delete
[42323] Fix | Delete
// Consider as candidates those focusables after the current target. It's
[42324] Fix | Delete
// assumed this can only be reached if the target is focusable (on its
[42325] Fix | Delete
// keydown event), so no need to verify it exists in the set.
[42326] Fix | Delete
focusableNodes = focusableNodes.slice(focusableNodes.indexOf(target) + 1);
[42327] Fix | Delete
let targetRect;
[42328] Fix | Delete
if (onlyVertical) {
[42329] Fix | Delete
targetRect = target.getBoundingClientRect();
[42330] Fix | Delete
}
[42331] Fix | Delete
function isTabCandidate(node) {
[42332] Fix | Delete
if (node.closest('[inert]')) {
[42333] Fix | Delete
return;
[42334] Fix | Delete
}
[42335] Fix | Delete
[42336] Fix | Delete
// Skip if there's only one child that is content editable (and thus a
[42337] Fix | Delete
// better candidate).
[42338] Fix | Delete
if (node.children.length === 1 && isInSameBlock(node, node.firstElementChild) && node.firstElementChild.getAttribute('contenteditable') === 'true') {
[42339] Fix | Delete
return;
[42340] Fix | Delete
}
[42341] Fix | Delete
[42342] Fix | Delete
// Not a candidate if the node is not tabbable.
[42343] Fix | Delete
if (!external_wp_dom_namespaceObject.focus.tabbable.isTabbableIndex(node)) {
[42344] Fix | Delete
return false;
[42345] Fix | Delete
}
[42346] Fix | Delete
[42347] Fix | Delete
// Skip focusable elements such as links within content editable nodes.
[42348] Fix | Delete
if (node.isContentEditable && node.contentEditable !== 'true') {
[42349] Fix | Delete
return false;
[42350] Fix | Delete
}
[42351] Fix | Delete
if (onlyVertical) {
[42352] Fix | Delete
const nodeRect = node.getBoundingClientRect();
[42353] Fix | Delete
if (nodeRect.left >= targetRect.right || nodeRect.right <= targetRect.left) {
[42354] Fix | Delete
return false;
[42355] Fix | Delete
}
[42356] Fix | Delete
}
[42357] Fix | Delete
return true;
[42358] Fix | Delete
}
[42359] Fix | Delete
return focusableNodes.find(isTabCandidate);
[42360] Fix | Delete
}
[42361] Fix | Delete
function useArrowNav() {
[42362] Fix | Delete
const {
[42363] Fix | Delete
getMultiSelectedBlocksStartClientId,
[42364] Fix | Delete
getMultiSelectedBlocksEndClientId,
[42365] Fix | Delete
getSettings,
[42366] Fix | Delete
hasMultiSelection,
[42367] Fix | Delete
__unstableIsFullySelected
[42368] Fix | Delete
} = (0,external_wp_data_namespaceObject.useSelect)(store);
[42369] Fix | Delete
const {
[42370] Fix | Delete
selectBlock
[42371] Fix | Delete
} = (0,external_wp_data_namespaceObject.useDispatch)(store);
[42372] Fix | Delete
return (0,external_wp_compose_namespaceObject.useRefEffect)(node => {
[42373] Fix | Delete
// Here a DOMRect is stored while moving the caret vertically so
[42374] Fix | Delete
// vertical position of the start position can be restored. This is to
[42375] Fix | Delete
// recreate browser behaviour across blocks.
[42376] Fix | Delete
let verticalRect;
[42377] Fix | Delete
function onMouseDown() {
[42378] Fix | Delete
verticalRect = null;
[42379] Fix | Delete
}
[42380] Fix | Delete
function isClosestTabbableABlock(target, isReverse) {
[42381] Fix | Delete
const closestTabbable = getClosestTabbable(target, isReverse, node);
[42382] Fix | Delete
return closestTabbable && getBlockClientId(closestTabbable);
[42383] Fix | Delete
}
[42384] Fix | Delete
function onKeyDown(event) {
[42385] Fix | Delete
// Abort if navigation has already been handled (e.g. RichText
[42386] Fix | Delete
// inline boundaries).
[42387] Fix | Delete
if (event.defaultPrevented) {
[42388] Fix | Delete
return;
[42389] Fix | Delete
}
[42390] Fix | Delete
const {
[42391] Fix | Delete
keyCode,
[42392] Fix | Delete
target,
[42393] Fix | Delete
shiftKey,
[42394] Fix | Delete
ctrlKey,
[42395] Fix | Delete
altKey,
[42396] Fix | Delete
metaKey
[42397] Fix | Delete
} = event;
[42398] Fix | Delete
const isUp = keyCode === external_wp_keycodes_namespaceObject.UP;
[42399] Fix | Delete
const isDown = keyCode === external_wp_keycodes_namespaceObject.DOWN;
[42400] Fix | Delete
const isLeft = keyCode === external_wp_keycodes_namespaceObject.LEFT;
[42401] Fix | Delete
const isRight = keyCode === external_wp_keycodes_namespaceObject.RIGHT;
[42402] Fix | Delete
const isReverse = isUp || isLeft;
[42403] Fix | Delete
const isHorizontal = isLeft || isRight;
[42404] Fix | Delete
const isVertical = isUp || isDown;
[42405] Fix | Delete
const isNav = isHorizontal || isVertical;
[42406] Fix | Delete
const hasModifier = shiftKey || ctrlKey || altKey || metaKey;
[42407] Fix | Delete
const isNavEdge = isVertical ? external_wp_dom_namespaceObject.isVerticalEdge : external_wp_dom_namespaceObject.isHorizontalEdge;
[42408] Fix | Delete
const {
[42409] Fix | Delete
ownerDocument
[42410] Fix | Delete
} = node;
[42411] Fix | Delete
const {
[42412] Fix | Delete
defaultView
[42413] Fix | Delete
} = ownerDocument;
[42414] Fix | Delete
if (!isNav) {
[42415] Fix | Delete
return;
[42416] Fix | Delete
}
[42417] Fix | Delete
[42418] Fix | Delete
// If there is a multi-selection, the arrow keys should collapse the
[42419] Fix | Delete
// selection to the start or end of the selection.
[42420] Fix | Delete
if (hasMultiSelection()) {
[42421] Fix | Delete
if (shiftKey) {
[42422] Fix | Delete
return;
[42423] Fix | Delete
}
[42424] Fix | Delete
[42425] Fix | Delete
// Only handle if we have a full selection (not a native partial
[42426] Fix | Delete
// selection).
[42427] Fix | Delete
if (!__unstableIsFullySelected()) {
[42428] Fix | Delete
return;
[42429] Fix | Delete
}
[42430] Fix | Delete
event.preventDefault();
[42431] Fix | Delete
if (isReverse) {
[42432] Fix | Delete
selectBlock(getMultiSelectedBlocksStartClientId());
[42433] Fix | Delete
} else {
[42434] Fix | Delete
selectBlock(getMultiSelectedBlocksEndClientId(), -1);
[42435] Fix | Delete
}
[42436] Fix | Delete
return;
[42437] Fix | Delete
}
[42438] Fix | Delete
[42439] Fix | Delete
// Abort if our current target is not a candidate for navigation
[42440] Fix | Delete
// (e.g. preserve native input behaviors).
[42441] Fix | Delete
if (!isNavigationCandidate(target, keyCode, hasModifier)) {
[42442] Fix | Delete
return;
[42443] Fix | Delete
}
[42444] Fix | Delete
[42445] Fix | Delete
// When presing any key other than up or down, the initial vertical
[42446] Fix | Delete
// position must ALWAYS be reset. The vertical position is saved so
[42447] Fix | Delete
// it can be restored as well as possible on sebsequent vertical
[42448] Fix | Delete
// arrow key presses. It may not always be possible to restore the
[42449] Fix | Delete
// exact same position (such as at an empty line), so it wouldn't be
[42450] Fix | Delete
// good to compute the position right before any vertical arrow key
[42451] Fix | Delete
// press.
[42452] Fix | Delete
if (!isVertical) {
[42453] Fix | Delete
verticalRect = null;
[42454] Fix | Delete
} else if (!verticalRect) {
[42455] Fix | Delete
verticalRect = (0,external_wp_dom_namespaceObject.computeCaretRect)(defaultView);
[42456] Fix | Delete
}
[42457] Fix | Delete
[42458] Fix | Delete
// In the case of RTL scripts, right means previous and left means
[42459] Fix | Delete
// next, which is the exact reverse of LTR.
[42460] Fix | Delete
const isReverseDir = (0,external_wp_dom_namespaceObject.isRTL)(target) ? !isReverse : isReverse;
[42461] Fix | Delete
const {
[42462] Fix | Delete
keepCaretInsideBlock
[42463] Fix | Delete
} = getSettings();
[42464] Fix | Delete
if (shiftKey) {
[42465] Fix | Delete
if (isClosestTabbableABlock(target, isReverse) && isNavEdge(target, isReverse)) {
[42466] Fix | Delete
node.contentEditable = true;
[42467] Fix | Delete
// Firefox doesn't automatically move focus.
[42468] Fix | Delete
node.focus();
[42469] Fix | Delete
}
[42470] Fix | Delete
} else if (isVertical && (0,external_wp_dom_namespaceObject.isVerticalEdge)(target, isReverse) && (
[42471] Fix | Delete
// When Alt is pressed, only intercept if the caret is also at
[42472] Fix | Delete
// the horizontal edge.
[42473] Fix | Delete
altKey ? (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) : true) && !keepCaretInsideBlock) {
[42474] Fix | Delete
const closestTabbable = getClosestTabbable(target, isReverse, node, true);
[42475] Fix | Delete
if (closestTabbable) {
[42476] Fix | Delete
(0,external_wp_dom_namespaceObject.placeCaretAtVerticalEdge)(closestTabbable,
[42477] Fix | Delete
// When Alt is pressed, place the caret at the furthest
[42478] Fix | Delete
// horizontal edge and the furthest vertical edge.
[42479] Fix | Delete
altKey ? !isReverse : isReverse, altKey ? undefined : verticalRect);
[42480] Fix | Delete
event.preventDefault();
[42481] Fix | Delete
}
[42482] Fix | Delete
} else if (isHorizontal && defaultView.getSelection().isCollapsed && (0,external_wp_dom_namespaceObject.isHorizontalEdge)(target, isReverseDir) && !keepCaretInsideBlock) {
[42483] Fix | Delete
const closestTabbable = getClosestTabbable(target, isReverseDir, node);
[42484] Fix | Delete
(0,external_wp_dom_namespaceObject.placeCaretAtHorizontalEdge)(closestTabbable, isReverse);
[42485] Fix | Delete
event.preventDefault();
[42486] Fix | Delete
}
[42487] Fix | Delete
}
[42488] Fix | Delete
node.addEventListener('mousedown', onMouseDown);
[42489] Fix | Delete
node.addEventListener('keydown', onKeyDown);
[42490] Fix | Delete
return () => {
[42491] Fix | Delete
node.removeEventListener('mousedown', onMouseDown);
[42492] Fix | Delete
node.removeEventListener('keydown', onKeyDown);
[42493] Fix | Delete
};
[42494] Fix | Delete
}, []);
[42495] Fix | Delete
}
[42496] Fix | Delete
[42497] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/writing-flow/use-select-all.js
[42498] Fix | Delete
/**
[42499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function