Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
return Object(external_wp_element_["createElement"])(toolbar_item["a" /* default */], toggleProps, renderDropdownMenu);
[40500] Fix | Delete
}
[40501] Fix | Delete
[40502] Fix | Delete
return renderDropdownMenu(toggleProps);
[40503] Fix | Delete
}
[40504] Fix | Delete
[40505] Fix | Delete
/* harmony default export */ var toolbar_group_collapsed = (ToolbarGroupCollapsed);
[40506] Fix | Delete
[40507] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/index.js
[40508] Fix | Delete
[40509] Fix | Delete
[40510] Fix | Delete
[40511] Fix | Delete
[40512] Fix | Delete
/**
[40513] Fix | Delete
* External dependencies
[40514] Fix | Delete
*/
[40515] Fix | Delete
[40516] Fix | Delete
[40517] Fix | Delete
/**
[40518] Fix | Delete
* WordPress dependencies
[40519] Fix | Delete
*/
[40520] Fix | Delete
[40521] Fix | Delete
[40522] Fix | Delete
/**
[40523] Fix | Delete
* Internal dependencies
[40524] Fix | Delete
*/
[40525] Fix | Delete
[40526] Fix | Delete
[40527] Fix | Delete
[40528] Fix | Delete
[40529] Fix | Delete
[40530] Fix | Delete
/**
[40531] Fix | Delete
* Renders a collapsible group of controls
[40532] Fix | Delete
*
[40533] Fix | Delete
* The `controls` prop accepts an array of sets. A set is an array of controls.
[40534] Fix | Delete
* Controls have the following shape:
[40535] Fix | Delete
*
[40536] Fix | Delete
* ```
[40537] Fix | Delete
* {
[40538] Fix | Delete
* icon: string,
[40539] Fix | Delete
* title: string,
[40540] Fix | Delete
* subscript: string,
[40541] Fix | Delete
* onClick: Function,
[40542] Fix | Delete
* isActive: boolean,
[40543] Fix | Delete
* isDisabled: boolean
[40544] Fix | Delete
* }
[40545] Fix | Delete
* ```
[40546] Fix | Delete
*
[40547] Fix | Delete
* For convenience it is also possible to pass only an array of controls. It is
[40548] Fix | Delete
* then assumed this is the only set.
[40549] Fix | Delete
*
[40550] Fix | Delete
* Either `controls` or `children` is required, otherwise this components
[40551] Fix | Delete
* renders nothing.
[40552] Fix | Delete
*
[40553] Fix | Delete
* @param {Object} props Component props.
[40554] Fix | Delete
* @param {Array} [props.controls] The controls to render in this toolbar.
[40555] Fix | Delete
* @param {WPElement} [props.children] Any other things to render inside the toolbar besides the controls.
[40556] Fix | Delete
* @param {string} [props.className] Class to set on the container div.
[40557] Fix | Delete
* @param {boolean} [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.
[40558] Fix | Delete
* @param {string} [props.title] ARIA label for dropdown menu if is collapsed.
[40559] Fix | Delete
*/
[40560] Fix | Delete
[40561] Fix | Delete
function ToolbarGroup(_ref) {
[40562] Fix | Delete
var _ref$controls = _ref.controls,
[40563] Fix | Delete
controls = _ref$controls === void 0 ? [] : _ref$controls,
[40564] Fix | Delete
children = _ref.children,
[40565] Fix | Delete
className = _ref.className,
[40566] Fix | Delete
isCollapsed = _ref.isCollapsed,
[40567] Fix | Delete
title = _ref.title,
[40568] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["controls", "children", "className", "isCollapsed", "title"]);
[40569] Fix | Delete
[40570] Fix | Delete
// It'll contain state if `ToolbarGroup` is being used within
[40571] Fix | Delete
// `<Toolbar label="label" />`
[40572] Fix | Delete
var accessibleToolbarState = Object(external_wp_element_["useContext"])(toolbar_context["a" /* default */]);
[40573] Fix | Delete
[40574] Fix | Delete
if ((!controls || !controls.length) && !children) {
[40575] Fix | Delete
return null;
[40576] Fix | Delete
}
[40577] Fix | Delete
[40578] Fix | Delete
var finalClassName = classnames_default()( // Unfortunately, there's legacy code referencing to `.components-toolbar`
[40579] Fix | Delete
// So we can't get rid of it
[40580] Fix | Delete
accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className); // Normalize controls to nested array of objects (sets of controls)
[40581] Fix | Delete
[40582] Fix | Delete
var controlSets = controls;
[40583] Fix | Delete
[40584] Fix | Delete
if (!Array.isArray(controlSets[0])) {
[40585] Fix | Delete
controlSets = [controlSets];
[40586] Fix | Delete
}
[40587] Fix | Delete
[40588] Fix | Delete
if (isCollapsed) {
[40589] Fix | Delete
return Object(external_wp_element_["createElement"])(toolbar_group_collapsed, Object(esm_extends["a" /* default */])({
[40590] Fix | Delete
label: title,
[40591] Fix | Delete
controls: controlSets,
[40592] Fix | Delete
className: finalClassName,
[40593] Fix | Delete
children: children
[40594] Fix | Delete
}, props));
[40595] Fix | Delete
}
[40596] Fix | Delete
[40597] Fix | Delete
return Object(external_wp_element_["createElement"])(toolbar_group_container, Object(esm_extends["a" /* default */])({
[40598] Fix | Delete
className: finalClassName
[40599] Fix | Delete
}, props), Object(external_lodash_["flatMap"])(controlSets, function (controlSet, indexOfSet) {
[40600] Fix | Delete
return controlSet.map(function (control, indexOfControl) {
[40601] Fix | Delete
return Object(external_wp_element_["createElement"])(toolbar_button, Object(esm_extends["a" /* default */])({
[40602] Fix | Delete
key: [indexOfSet, indexOfControl].join(),
[40603] Fix | Delete
containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : null
[40604] Fix | Delete
}, control));
[40605] Fix | Delete
});
[40606] Fix | Delete
}), children);
[40607] Fix | Delete
}
[40608] Fix | Delete
[40609] Fix | Delete
/* harmony default export */ var toolbar_group = (ToolbarGroup);
[40610] Fix | Delete
[40611] Fix | Delete
// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarState.js
[40612] Fix | Delete
[40613] Fix | Delete
[40614] Fix | Delete
[40615] Fix | Delete
[40616] Fix | Delete
[40617] Fix | Delete
[40618] Fix | Delete
[40619] Fix | Delete
[40620] Fix | Delete
[40621] Fix | Delete
[40622] Fix | Delete
[40623] Fix | Delete
[40624] Fix | Delete
[40625] Fix | Delete
function useToolbarState(initialState) {
[40626] Fix | Delete
if (initialState === void 0) {
[40627] Fix | Delete
initialState = {};
[40628] Fix | Delete
}
[40629] Fix | Delete
[40630] Fix | Delete
var _useSealedState = useSealedState(initialState),
[40631] Fix | Delete
_useSealedState$orien = _useSealedState.orientation,
[40632] Fix | Delete
orientation = _useSealedState$orien === void 0 ? "horizontal" : _useSealedState$orien,
[40633] Fix | Delete
sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_useSealedState, ["orientation"]);
[40634] Fix | Delete
[40635] Fix | Delete
return useCompositeState(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
[40636] Fix | Delete
orientation: orientation
[40637] Fix | Delete
}, sealed));
[40638] Fix | Delete
}
[40639] Fix | Delete
[40640] Fix | Delete
[40641] Fix | Delete
[40642] Fix | Delete
// EXTERNAL MODULE: ./node_modules/reakit/es/__keys-ae468c11.js
[40643] Fix | Delete
var _keys_ae468c11 = __webpack_require__("mjVI");
[40644] Fix | Delete
[40645] Fix | Delete
// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/Toolbar.js
[40646] Fix | Delete
[40647] Fix | Delete
[40648] Fix | Delete
[40649] Fix | Delete
[40650] Fix | Delete
[40651] Fix | Delete
[40652] Fix | Delete
[40653] Fix | Delete
[40654] Fix | Delete
[40655] Fix | Delete
[40656] Fix | Delete
[40657] Fix | Delete
[40658] Fix | Delete
[40659] Fix | Delete
[40660] Fix | Delete
[40661] Fix | Delete
[40662] Fix | Delete
[40663] Fix | Delete
[40664] Fix | Delete
[40665] Fix | Delete
[40666] Fix | Delete
[40667] Fix | Delete
[40668] Fix | Delete
[40669] Fix | Delete
[40670] Fix | Delete
[40671] Fix | Delete
[40672] Fix | Delete
[40673] Fix | Delete
[40674] Fix | Delete
[40675] Fix | Delete
[40676] Fix | Delete
[40677] Fix | Delete
var useToolbar = Object(createHook["a" /* createHook */])({
[40678] Fix | Delete
name: "Toolbar",
[40679] Fix | Delete
compose: useComposite,
[40680] Fix | Delete
keys: _keys_ae468c11["a" /* T */],
[40681] Fix | Delete
useProps: function useProps(options, htmlProps) {
[40682] Fix | Delete
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
[40683] Fix | Delete
role: "toolbar",
[40684] Fix | Delete
"aria-orientation": options.orientation
[40685] Fix | Delete
}, htmlProps);
[40686] Fix | Delete
}
[40687] Fix | Delete
});
[40688] Fix | Delete
var Toolbar = Object(createComponent["a" /* createComponent */])({
[40689] Fix | Delete
as: "div",
[40690] Fix | Delete
useHook: useToolbar,
[40691] Fix | Delete
useCreateElement: function useCreateElement$1(type, props, children) {
[40692] Fix | Delete
false ? undefined : void 0;
[40693] Fix | Delete
return Object(useCreateElement["a" /* useCreateElement */])(type, props, children);
[40694] Fix | Delete
}
[40695] Fix | Delete
});
[40696] Fix | Delete
[40697] Fix | Delete
[40698] Fix | Delete
[40699] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-container.js
[40700] Fix | Delete
[40701] Fix | Delete
[40702] Fix | Delete
[40703] Fix | Delete
[40704] Fix | Delete
/**
[40705] Fix | Delete
* External dependencies
[40706] Fix | Delete
*/
[40707] Fix | Delete
[40708] Fix | Delete
/**
[40709] Fix | Delete
* WordPress dependencies
[40710] Fix | Delete
*/
[40711] Fix | Delete
[40712] Fix | Delete
[40713] Fix | Delete
[40714] Fix | Delete
/**
[40715] Fix | Delete
* Internal dependencies
[40716] Fix | Delete
*/
[40717] Fix | Delete
[40718] Fix | Delete
[40719] Fix | Delete
[40720] Fix | Delete
function ToolbarContainer(_ref, ref) {
[40721] Fix | Delete
var label = _ref.label,
[40722] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["label"]);
[40723] Fix | Delete
[40724] Fix | Delete
// https://reakit.io/docs/basic-concepts/#state-hooks
[40725] Fix | Delete
// Passing baseId for server side rendering (which includes snapshots)
[40726] Fix | Delete
// If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids
[40727] Fix | Delete
var toolbarState = useToolbarState({
[40728] Fix | Delete
loop: true,
[40729] Fix | Delete
baseId: props.id,
[40730] Fix | Delete
rtl: Object(external_wp_i18n_["isRTL"])()
[40731] Fix | Delete
});
[40732] Fix | Delete
return (// This will provide state for `ToolbarButton`'s
[40733] Fix | Delete
Object(external_wp_element_["createElement"])(toolbar_context["a" /* default */].Provider, {
[40734] Fix | Delete
value: toolbarState
[40735] Fix | Delete
}, Object(external_wp_element_["createElement"])(Toolbar, Object(esm_extends["a" /* default */])({
[40736] Fix | Delete
ref: ref,
[40737] Fix | Delete
"aria-label": label
[40738] Fix | Delete
}, toolbarState, props)))
[40739] Fix | Delete
);
[40740] Fix | Delete
}
[40741] Fix | Delete
[40742] Fix | Delete
/* harmony default export */ var toolbar_container = (Object(external_wp_element_["forwardRef"])(ToolbarContainer));
[40743] Fix | Delete
[40744] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/index.js
[40745] Fix | Delete
[40746] Fix | Delete
[40747] Fix | Delete
[40748] Fix | Delete
[40749] Fix | Delete
/**
[40750] Fix | Delete
* External dependencies
[40751] Fix | Delete
*/
[40752] Fix | Delete
[40753] Fix | Delete
/**
[40754] Fix | Delete
* WordPress dependencies
[40755] Fix | Delete
*/
[40756] Fix | Delete
[40757] Fix | Delete
[40758] Fix | Delete
[40759] Fix | Delete
/**
[40760] Fix | Delete
* Internal dependencies
[40761] Fix | Delete
*/
[40762] Fix | Delete
[40763] Fix | Delete
[40764] Fix | Delete
[40765] Fix | Delete
/**
[40766] Fix | Delete
* Renders a toolbar.
[40767] Fix | Delete
*
[40768] Fix | Delete
* To add controls, simply pass `ToolbarButton` components as children.
[40769] Fix | Delete
*
[40770] Fix | Delete
* @param {Object} props Component props.
[40771] Fix | Delete
* @param {string} [props.className] Class to set on the container div.
[40772] Fix | Delete
* @param {string} [props.label] ARIA label for toolbar container.
[40773] Fix | Delete
* @param {Object} ref React Element ref.
[40774] Fix | Delete
*/
[40775] Fix | Delete
[40776] Fix | Delete
function toolbar_Toolbar(_ref, ref) {
[40777] Fix | Delete
var className = _ref.className,
[40778] Fix | Delete
label = _ref.label,
[40779] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "label"]);
[40780] Fix | Delete
[40781] Fix | Delete
if (!label) {
[40782] Fix | Delete
external_wp_deprecated_default()('Using Toolbar without label prop', {
[40783] Fix | Delete
alternative: 'ToolbarGroup component',
[40784] Fix | Delete
link: 'https://developer.wordpress.org/block-editor/components/toolbar/'
[40785] Fix | Delete
});
[40786] Fix | Delete
return Object(external_wp_element_["createElement"])(toolbar_group, Object(esm_extends["a" /* default */])({}, props, {
[40787] Fix | Delete
className: className
[40788] Fix | Delete
}));
[40789] Fix | Delete
} // `ToolbarGroup` already uses components-toolbar for compatibility reasons
[40790] Fix | Delete
[40791] Fix | Delete
[40792] Fix | Delete
var finalClassName = classnames_default()('components-accessible-toolbar', className);
[40793] Fix | Delete
return Object(external_wp_element_["createElement"])(toolbar_container, Object(esm_extends["a" /* default */])({
[40794] Fix | Delete
className: finalClassName,
[40795] Fix | Delete
label: label,
[40796] Fix | Delete
ref: ref
[40797] Fix | Delete
}, props));
[40798] Fix | Delete
}
[40799] Fix | Delete
[40800] Fix | Delete
/* harmony default export */ var toolbar = (Object(external_wp_element_["forwardRef"])(toolbar_Toolbar));
[40801] Fix | Delete
[40802] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
[40803] Fix | Delete
/**
[40804] Fix | Delete
* WordPress dependencies
[40805] Fix | Delete
*/
[40806] Fix | Delete
[40807] Fix | Delete
var RovingTabIndexContext = Object(external_wp_element_["createContext"])();
[40808] Fix | Delete
var roving_tab_index_context_useRovingTabIndexContext = function useRovingTabIndexContext() {
[40809] Fix | Delete
return Object(external_wp_element_["useContext"])(RovingTabIndexContext);
[40810] Fix | Delete
};
[40811] Fix | Delete
var RovingTabIndexProvider = RovingTabIndexContext.Provider;
[40812] Fix | Delete
[40813] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
[40814] Fix | Delete
[40815] Fix | Delete
[40816] Fix | Delete
[40817] Fix | Delete
/**
[40818] Fix | Delete
* WordPress dependencies
[40819] Fix | Delete
*/
[40820] Fix | Delete
[40821] Fix | Delete
/**
[40822] Fix | Delete
* Internal dependencies
[40823] Fix | Delete
*/
[40824] Fix | Delete
[40825] Fix | Delete
[40826] Fix | Delete
/**
[40827] Fix | Delete
* Provider for adding roving tab index behaviors to tree grid structures.
[40828] Fix | Delete
*
[40829] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
[40830] Fix | Delete
*
[40831] Fix | Delete
* @param {Object} props Component props.
[40832] Fix | Delete
* @param {WPElement} props.children Children to be rendered
[40833] Fix | Delete
*/
[40834] Fix | Delete
[40835] Fix | Delete
function RovingTabIndex(_ref) {
[40836] Fix | Delete
var children = _ref.children;
[40837] Fix | Delete
[40838] Fix | Delete
var _useState = Object(external_wp_element_["useState"])(),
[40839] Fix | Delete
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
[40840] Fix | Delete
lastFocusedElement = _useState2[0],
[40841] Fix | Delete
setLastFocusedElement = _useState2[1]; // Use `useMemo` to avoid creation of a new object for the providerValue
[40842] Fix | Delete
// on every render. Only create a new object when the `lastFocusedElement`
[40843] Fix | Delete
// value changes.
[40844] Fix | Delete
[40845] Fix | Delete
[40846] Fix | Delete
var providerValue = Object(external_wp_element_["useMemo"])(function () {
[40847] Fix | Delete
return {
[40848] Fix | Delete
lastFocusedElement: lastFocusedElement,
[40849] Fix | Delete
setLastFocusedElement: setLastFocusedElement
[40850] Fix | Delete
};
[40851] Fix | Delete
}, [lastFocusedElement]);
[40852] Fix | Delete
return Object(external_wp_element_["createElement"])(RovingTabIndexProvider, {
[40853] Fix | Delete
value: providerValue
[40854] Fix | Delete
}, children);
[40855] Fix | Delete
}
[40856] Fix | Delete
[40857] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
[40858] Fix | Delete
[40859] Fix | Delete
[40860] Fix | Delete
[40861] Fix | Delete
[40862] Fix | Delete
/**
[40863] Fix | Delete
* External dependencies
[40864] Fix | Delete
*/
[40865] Fix | Delete
[40866] Fix | Delete
/**
[40867] Fix | Delete
* WordPress dependencies
[40868] Fix | Delete
*/
[40869] Fix | Delete
[40870] Fix | Delete
[40871] Fix | Delete
[40872] Fix | Delete
[40873] Fix | Delete
/**
[40874] Fix | Delete
* Internal dependencies
[40875] Fix | Delete
*/
[40876] Fix | Delete
[40877] Fix | Delete
[40878] Fix | Delete
/**
[40879] Fix | Delete
* Return focusables in a row element, excluding those from other branches
[40880] Fix | Delete
* nested within the row.
[40881] Fix | Delete
*
[40882] Fix | Delete
* @param {Element} rowElement The DOM element representing the row.
[40883] Fix | Delete
*
[40884] Fix | Delete
* @return {?Array} The array of focusables in the row.
[40885] Fix | Delete
*/
[40886] Fix | Delete
[40887] Fix | Delete
function getRowFocusables(rowElement) {
[40888] Fix | Delete
var focusablesInRow = external_wp_dom_["focus"].focusable.find(rowElement);
[40889] Fix | Delete
[40890] Fix | Delete
if (!focusablesInRow || !focusablesInRow.length) {
[40891] Fix | Delete
return;
[40892] Fix | Delete
}
[40893] Fix | Delete
[40894] Fix | Delete
return focusablesInRow.filter(function (focusable) {
[40895] Fix | Delete
return focusable.closest('[role="row"]') === rowElement;
[40896] Fix | Delete
});
[40897] Fix | Delete
}
[40898] Fix | Delete
/**
[40899] Fix | Delete
* Renders both a table and tbody element, used to create a tree hierarchy.
[40900] Fix | Delete
*
[40901] Fix | Delete
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
[40902] Fix | Delete
* @param {Object} props Component props.
[40903] Fix | Delete
* @param {WPElement} props.children Children to be rendered.
[40904] Fix | Delete
* @param {Object} ref A ref to the underlying DOM table element.
[40905] Fix | Delete
*/
[40906] Fix | Delete
[40907] Fix | Delete
[40908] Fix | Delete
function TreeGrid(_ref, ref) {
[40909] Fix | Delete
var children = _ref.children,
[40910] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children"]);
[40911] Fix | Delete
[40912] Fix | Delete
var onKeyDown = Object(external_wp_element_["useCallback"])(function (event) {
[40913] Fix | Delete
var keyCode = event.keyCode,
[40914] Fix | Delete
metaKey = event.metaKey,
[40915] Fix | Delete
ctrlKey = event.ctrlKey,
[40916] Fix | Delete
altKey = event.altKey,
[40917] Fix | Delete
shiftKey = event.shiftKey;
[40918] Fix | Delete
var hasModifierKeyPressed = metaKey || ctrlKey || altKey || shiftKey;
[40919] Fix | Delete
[40920] Fix | Delete
if (hasModifierKeyPressed || !Object(external_lodash_["includes"])([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]], keyCode)) {
[40921] Fix | Delete
return;
[40922] Fix | Delete
} // The event will be handled, stop propagation.
[40923] Fix | Delete
[40924] Fix | Delete
[40925] Fix | Delete
event.stopPropagation();
[40926] Fix | Delete
var _document = document,
[40927] Fix | Delete
activeElement = _document.activeElement;
[40928] Fix | Delete
var treeGridElement = event.currentTarget;
[40929] Fix | Delete
[40930] Fix | Delete
if (!treeGridElement.contains(activeElement)) {
[40931] Fix | Delete
return;
[40932] Fix | Delete
} // Calculate the columnIndex of the active element.
[40933] Fix | Delete
[40934] Fix | Delete
[40935] Fix | Delete
var activeRow = activeElement.closest('[role="row"]');
[40936] Fix | Delete
var focusablesInRow = getRowFocusables(activeRow);
[40937] Fix | Delete
var currentColumnIndex = focusablesInRow.indexOf(activeElement);
[40938] Fix | Delete
[40939] Fix | Delete
if (Object(external_lodash_["includes"])([external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]], keyCode)) {
[40940] Fix | Delete
// Calculate to the next element.
[40941] Fix | Delete
var nextIndex;
[40942] Fix | Delete
[40943] Fix | Delete
if (keyCode === external_wp_keycodes_["LEFT"]) {
[40944] Fix | Delete
nextIndex = Math.max(0, currentColumnIndex - 1);
[40945] Fix | Delete
} else {
[40946] Fix | Delete
nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
[40947] Fix | Delete
} // Focus is either at the left or right edge of the grid. Do nothing.
[40948] Fix | Delete
[40949] Fix | Delete
[40950] Fix | Delete
if (nextIndex === currentColumnIndex) {
[40951] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[40952] Fix | Delete
// will start reading text on continued use of left/right arrow
[40953] Fix | Delete
// keys.
[40954] Fix | Delete
event.preventDefault();
[40955] Fix | Delete
return;
[40956] Fix | Delete
} // Focus the next element.
[40957] Fix | Delete
[40958] Fix | Delete
[40959] Fix | Delete
focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
[40960] Fix | Delete
// doesn't try to handle key navigation.
[40961] Fix | Delete
[40962] Fix | Delete
event.preventDefault();
[40963] Fix | Delete
} else if (Object(external_lodash_["includes"])([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"]], keyCode)) {
[40964] Fix | Delete
// Calculate the rowIndex of the next row.
[40965] Fix | Delete
var rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
[40966] Fix | Delete
var currentRowIndex = rows.indexOf(activeRow);
[40967] Fix | Delete
var nextRowIndex;
[40968] Fix | Delete
[40969] Fix | Delete
if (keyCode === external_wp_keycodes_["UP"]) {
[40970] Fix | Delete
nextRowIndex = Math.max(0, currentRowIndex - 1);
[40971] Fix | Delete
} else {
[40972] Fix | Delete
nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
[40973] Fix | Delete
} // Focus is either at the top or bottom edge of the grid. Do nothing.
[40974] Fix | Delete
[40975] Fix | Delete
[40976] Fix | Delete
if (nextRowIndex === currentRowIndex) {
[40977] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[40978] Fix | Delete
// will start navigating horizontally when reaching the vertical
[40979] Fix | Delete
// bounds of a table.
[40980] Fix | Delete
event.preventDefault();
[40981] Fix | Delete
return;
[40982] Fix | Delete
} // Get the focusables in the next row.
[40983] Fix | Delete
[40984] Fix | Delete
[40985] Fix | Delete
var focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
[40986] Fix | Delete
[40987] Fix | Delete
if (!focusablesInNextRow || !focusablesInNextRow.length) {
[40988] Fix | Delete
// Prevent key use for anything else. For example, Voiceover
[40989] Fix | Delete
// will still focus text when using arrow keys, while this
[40990] Fix | Delete
// component should limit navigation to focusables.
[40991] Fix | Delete
event.preventDefault();
[40992] Fix | Delete
return;
[40993] Fix | Delete
} // Try to focus the element in the next row that's at a similar column to the activeElement.
[40994] Fix | Delete
[40995] Fix | Delete
[40996] Fix | Delete
var _nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
[40997] Fix | Delete
[40998] Fix | Delete
focusablesInNextRow[_nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
[40999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function