Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
break;
[18500] Fix | Delete
}
[18501] Fix | Delete
[18502] Fix | Delete
var distance = directionBaseValue * modifier * directionModifier;
[18503] Fix | Delete
[18504] Fix | Delete
var _nextValue;
[18505] Fix | Delete
[18506] Fix | Delete
if (distance !== 0) {
[18507] Fix | Delete
_nextValue = roundClamp(add(currentValue, distance), min, max, modifier);
[18508] Fix | Delete
state.value = _nextValue;
[18509] Fix | Delete
}
[18510] Fix | Delete
}
[18511] Fix | Delete
/**
[18512] Fix | Delete
* Handles commit (ENTER key press or on blur if isPressEnterToChange)
[18513] Fix | Delete
*/
[18514] Fix | Delete
[18515] Fix | Delete
[18516] Fix | Delete
if (type === inputControlActionTypes.PRESS_ENTER || type === inputControlActionTypes.COMMIT) {
[18517] Fix | Delete
state.value = roundClamp(currentValue, min, max);
[18518] Fix | Delete
}
[18519] Fix | Delete
[18520] Fix | Delete
return state;
[18521] Fix | Delete
};
[18522] Fix | Delete
[18523] Fix | Delete
return Object(external_wp_element_["createElement"])(number_control_styles_Input, Object(esm_extends["a" /* default */])({
[18524] Fix | Delete
autoComplete: autoComplete,
[18525] Fix | Delete
inputMode: "numeric"
[18526] Fix | Delete
}, props, {
[18527] Fix | Delete
className: classes,
[18528] Fix | Delete
dragDirection: dragDirection,
[18529] Fix | Delete
hideHTMLArrows: hideHTMLArrows,
[18530] Fix | Delete
isDragEnabled: isDragEnabled,
[18531] Fix | Delete
label: label,
[18532] Fix | Delete
max: max,
[18533] Fix | Delete
min: min,
[18534] Fix | Delete
ref: ref,
[18535] Fix | Delete
step: jumpStep,
[18536] Fix | Delete
type: typeProp,
[18537] Fix | Delete
value: valueProp,
[18538] Fix | Delete
__unstableStateReducer: state_composeStateReducers(numberControlStateReducer, stateReducer)
[18539] Fix | Delete
}));
[18540] Fix | Delete
}
[18541] Fix | Delete
/* harmony default export */ var number_control = (Object(external_wp_element_["forwardRef"])(NumberControl));
[18542] Fix | Delete
[18543] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
[18544] Fix | Delete
[18545] Fix | Delete
[18546] Fix | Delete
function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
[18547] Fix | Delete
[18548] Fix | Delete
/**
[18549] Fix | Delete
* Internal dependencies
[18550] Fix | Delete
*/
[18551] Fix | Delete
[18552] Fix | Delete
[18553] Fix | Delete
var CIRCLE_SIZE = 30;
[18554] Fix | Delete
var angle_picker_control_styles_Root = /*#__PURE__*/styled_base_browser_esm(flex_Flex, {
[18555] Fix | Delete
target: "e65ony40",
[18556] Fix | Delete
label: "Root"
[18557] Fix | Delete
})( true ? {
[18558] Fix | Delete
name: "tn9ygg",
[18559] Fix | Delete
styles: "max-width:200px;"
[18560] Fix | Delete
} : undefined);
[18561] Fix | Delete
var CircleRoot = styled_base_browser_esm("div", {
[18562] Fix | Delete
target: "e65ony41",
[18563] Fix | Delete
label: "CircleRoot"
[18564] Fix | Delete
})("border-radius:50%;border:1px solid ", colors_color('ui.borderLight'), ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;" + ( true ? "" : undefined));
[18565] Fix | Delete
var CircleIndicatorWrapper = styled_base_browser_esm("div", {
[18566] Fix | Delete
target: "e65ony42",
[18567] Fix | Delete
label: "CircleIndicatorWrapper"
[18568] Fix | Delete
})( true ? {
[18569] Fix | Delete
name: "11t5m37",
[18570] Fix | Delete
styles: "box-sizing:border-box;position:relative;width:100%;height:100%;"
[18571] Fix | Delete
} : undefined);
[18572] Fix | Delete
var CircleIndicator = styled_base_browser_esm("div", {
[18573] Fix | Delete
target: "e65ony43",
[18574] Fix | Delete
label: "CircleIndicator"
[18575] Fix | Delete
})("background:", colors_color('ui.border'), ";border-radius:50%;border:3px solid ", colors_color('ui.border'), ";bottom:0;box-sizing:border-box;display:block;height:1px;left:0;margin:auto;position:absolute;right:0;top:-", CIRCLE_SIZE / 2, "px;width:1px;" + ( true ? "" : undefined));
[18576] Fix | Delete
[18577] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
[18578] Fix | Delete
[18579] Fix | Delete
[18580] Fix | Delete
[18581] Fix | Delete
[18582] Fix | Delete
/**
[18583] Fix | Delete
* WordPress dependencies
[18584] Fix | Delete
*/
[18585] Fix | Delete
[18586] Fix | Delete
[18587] Fix | Delete
/**
[18588] Fix | Delete
* Internal dependencies
[18589] Fix | Delete
*/
[18590] Fix | Delete
[18591] Fix | Delete
[18592] Fix | Delete
[18593] Fix | Delete
function AngleCircle(_ref) {
[18594] Fix | Delete
var value = _ref.value,
[18595] Fix | Delete
onChange = _ref.onChange,
[18596] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["value", "onChange"]);
[18597] Fix | Delete
[18598] Fix | Delete
var angleCircleRef = Object(external_wp_element_["useRef"])();
[18599] Fix | Delete
var angleCircleCenter = Object(external_wp_element_["useRef"])();
[18600] Fix | Delete
var previousCursorValue = Object(external_wp_element_["useRef"])();
[18601] Fix | Delete
[18602] Fix | Delete
var setAngleCircleCenter = function setAngleCircleCenter() {
[18603] Fix | Delete
var rect = angleCircleRef.current.getBoundingClientRect();
[18604] Fix | Delete
angleCircleCenter.current = {
[18605] Fix | Delete
x: rect.x + rect.width / 2,
[18606] Fix | Delete
y: rect.y + rect.height / 2
[18607] Fix | Delete
};
[18608] Fix | Delete
};
[18609] Fix | Delete
[18610] Fix | Delete
var changeAngleToPosition = function changeAngleToPosition(event) {
[18611] Fix | Delete
var _angleCircleCenter$cu = angleCircleCenter.current,
[18612] Fix | Delete
centerX = _angleCircleCenter$cu.x,
[18613] Fix | Delete
centerY = _angleCircleCenter$cu.y;
[18614] Fix | Delete
var ownerDocument = angleCircleRef.current.ownerDocument; // Prevent (drag) mouse events from selecting and accidentally
[18615] Fix | Delete
// triggering actions from other elements.
[18616] Fix | Delete
[18617] Fix | Delete
event.preventDefault(); // Ensure the input isn't focused as preventDefault would leave it
[18618] Fix | Delete
[18619] Fix | Delete
ownerDocument.activeElement.blur();
[18620] Fix | Delete
onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
[18621] Fix | Delete
};
[18622] Fix | Delete
[18623] Fix | Delete
var _useDragging = Object(external_wp_compose_["__experimentalUseDragging"])({
[18624] Fix | Delete
onDragStart: function onDragStart(event) {
[18625] Fix | Delete
setAngleCircleCenter();
[18626] Fix | Delete
changeAngleToPosition(event);
[18627] Fix | Delete
},
[18628] Fix | Delete
onDragMove: changeAngleToPosition,
[18629] Fix | Delete
onDragEnd: changeAngleToPosition
[18630] Fix | Delete
}),
[18631] Fix | Delete
startDrag = _useDragging.startDrag,
[18632] Fix | Delete
isDragging = _useDragging.isDragging;
[18633] Fix | Delete
[18634] Fix | Delete
Object(external_wp_element_["useEffect"])(function () {
[18635] Fix | Delete
if (isDragging) {
[18636] Fix | Delete
if (previousCursorValue.current === undefined) {
[18637] Fix | Delete
previousCursorValue.current = document.body.style.cursor;
[18638] Fix | Delete
}
[18639] Fix | Delete
[18640] Fix | Delete
document.body.style.cursor = 'grabbing';
[18641] Fix | Delete
} else {
[18642] Fix | Delete
document.body.style.cursor = previousCursorValue.current || null;
[18643] Fix | Delete
previousCursorValue.current = undefined;
[18644] Fix | Delete
}
[18645] Fix | Delete
}, [isDragging]);
[18646] Fix | Delete
return (
[18647] Fix | Delete
/* eslint-disable jsx-a11y/no-static-element-interactions */
[18648] Fix | Delete
Object(external_wp_element_["createElement"])(CircleRoot, Object(esm_extends["a" /* default */])({
[18649] Fix | Delete
ref: angleCircleRef,
[18650] Fix | Delete
onMouseDown: startDrag,
[18651] Fix | Delete
className: "components-angle-picker-control__angle-circle",
[18652] Fix | Delete
style: isDragging ? {
[18653] Fix | Delete
cursor: 'grabbing'
[18654] Fix | Delete
} : undefined
[18655] Fix | Delete
}, props), Object(external_wp_element_["createElement"])(CircleIndicatorWrapper, {
[18656] Fix | Delete
style: value ? {
[18657] Fix | Delete
transform: "rotate(".concat(value, "deg)")
[18658] Fix | Delete
} : undefined,
[18659] Fix | Delete
className: "components-angle-picker-control__angle-circle-indicator-wrapper"
[18660] Fix | Delete
}, Object(external_wp_element_["createElement"])(CircleIndicator, {
[18661] Fix | Delete
className: "components-angle-picker-control__angle-circle-indicator"
[18662] Fix | Delete
})))
[18663] Fix | Delete
/* eslint-enable jsx-a11y/no-static-element-interactions */
[18664] Fix | Delete
[18665] Fix | Delete
);
[18666] Fix | Delete
}
[18667] Fix | Delete
[18668] Fix | Delete
function getAngle(centerX, centerY, pointX, pointY) {
[18669] Fix | Delete
var y = pointY - centerY;
[18670] Fix | Delete
var x = pointX - centerX;
[18671] Fix | Delete
var angleInRadians = Math.atan2(y, x);
[18672] Fix | Delete
var angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
[18673] Fix | Delete
[18674] Fix | Delete
if (angleInDeg < 0) {
[18675] Fix | Delete
return 360 + angleInDeg;
[18676] Fix | Delete
}
[18677] Fix | Delete
[18678] Fix | Delete
return angleInDeg;
[18679] Fix | Delete
}
[18680] Fix | Delete
[18681] Fix | Delete
/* harmony default export */ var angle_circle = (AngleCircle);
[18682] Fix | Delete
[18683] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
[18684] Fix | Delete
[18685] Fix | Delete
[18686] Fix | Delete
[18687] Fix | Delete
[18688] Fix | Delete
/**
[18689] Fix | Delete
* External dependencies
[18690] Fix | Delete
*/
[18691] Fix | Delete
[18692] Fix | Delete
/**
[18693] Fix | Delete
* WordPress dependencies
[18694] Fix | Delete
*/
[18695] Fix | Delete
[18696] Fix | Delete
[18697] Fix | Delete
[18698] Fix | Delete
/**
[18699] Fix | Delete
* Internal dependencies
[18700] Fix | Delete
*/
[18701] Fix | Delete
[18702] Fix | Delete
[18703] Fix | Delete
[18704] Fix | Delete
[18705] Fix | Delete
[18706] Fix | Delete
[18707] Fix | Delete
function AnglePickerControl(_ref) {
[18708] Fix | Delete
var className = _ref.className,
[18709] Fix | Delete
hideLabelFromVision = _ref.hideLabelFromVision,
[18710] Fix | Delete
idProp = _ref.id,
[18711] Fix | Delete
_ref$label = _ref.label,
[18712] Fix | Delete
label = _ref$label === void 0 ? Object(external_wp_i18n_["__"])('Angle') : _ref$label,
[18713] Fix | Delete
onChange = _ref.onChange,
[18714] Fix | Delete
value = _ref.value,
[18715] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "hideLabelFromVision", "id", "label", "onChange", "value"]);
[18716] Fix | Delete
[18717] Fix | Delete
var instanceId = Object(external_wp_compose_["useInstanceId"])(AnglePickerControl, 'components-angle-picker-control__input');
[18718] Fix | Delete
var id = idProp || instanceId;
[18719] Fix | Delete
[18720] Fix | Delete
var handleOnNumberChange = function handleOnNumberChange(unprocessedValue) {
[18721] Fix | Delete
var inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
[18722] Fix | Delete
onChange(inputValue);
[18723] Fix | Delete
};
[18724] Fix | Delete
[18725] Fix | Delete
var classes = classnames_default()('components-angle-picker-control', className);
[18726] Fix | Delete
return Object(external_wp_element_["createElement"])(base_control, Object(esm_extends["a" /* default */])({
[18727] Fix | Delete
className: classes,
[18728] Fix | Delete
hideLabelFromVision: hideLabelFromVision,
[18729] Fix | Delete
id: id,
[18730] Fix | Delete
label: label
[18731] Fix | Delete
}, props), Object(external_wp_element_["createElement"])(angle_picker_control_styles_Root, null, Object(external_wp_element_["createElement"])(block, null, Object(external_wp_element_["createElement"])(number_control, {
[18732] Fix | Delete
className: "components-angle-picker-control__input-field",
[18733] Fix | Delete
id: id,
[18734] Fix | Delete
max: 360,
[18735] Fix | Delete
min: 0,
[18736] Fix | Delete
onChange: handleOnNumberChange,
[18737] Fix | Delete
step: "1",
[18738] Fix | Delete
value: value
[18739] Fix | Delete
})), Object(external_wp_element_["createElement"])(flex_item, null, Object(external_wp_element_["createElement"])(angle_circle, {
[18740] Fix | Delete
"aria-hidden": "true",
[18741] Fix | Delete
value: value,
[18742] Fix | Delete
onChange: onChange
[18743] Fix | Delete
}))));
[18744] Fix | Delete
}
[18745] Fix | Delete
[18746] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js + 2 modules
[18747] Fix | Delete
var toConsumableArray = __webpack_require__("KQm4");
[18748] Fix | Delete
[18749] Fix | Delete
// EXTERNAL MODULE: external ["wp","richText"]
[18750] Fix | Delete
var external_wp_richText_ = __webpack_require__("qRz9");
[18751] Fix | Delete
[18752] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
[18753] Fix | Delete
var build_module_button = __webpack_require__("kA6J");
[18754] Fix | Delete
[18755] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js + 1 modules
[18756] Fix | Delete
var popover = __webpack_require__("oXO/");
[18757] Fix | Delete
[18758] Fix | Delete
// EXTERNAL MODULE: external ["wp","a11y"]
[18759] Fix | Delete
var external_wp_a11y_ = __webpack_require__("gdqT");
[18760] Fix | Delete
[18761] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js
[18762] Fix | Delete
[18763] Fix | Delete
[18764] Fix | Delete
[18765] Fix | Delete
/**
[18766] Fix | Delete
* WordPress dependencies
[18767] Fix | Delete
*/
[18768] Fix | Delete
[18769] Fix | Delete
[18770] Fix | Delete
/**
[18771] Fix | Delete
* A Higher Order Component used to be provide speak and debounced speak
[18772] Fix | Delete
* functions.
[18773] Fix | Delete
*
[18774] Fix | Delete
* @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
[18775] Fix | Delete
*
[18776] Fix | Delete
* @param {WPComponent} Component The component to be wrapped.
[18777] Fix | Delete
*
[18778] Fix | Delete
* @return {WPComponent} The wrapped component.
[18779] Fix | Delete
*/
[18780] Fix | Delete
[18781] Fix | Delete
/* harmony default export */ var with_spoken_messages = (Object(external_wp_compose_["createHigherOrderComponent"])(function (Component) {
[18782] Fix | Delete
return function (props) {
[18783] Fix | Delete
return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, {
[18784] Fix | Delete
speak: external_wp_a11y_["speak"],
[18785] Fix | Delete
debouncedSpeak: Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500)
[18786] Fix | Delete
}));
[18787] Fix | Delete
};
[18788] Fix | Delete
}, 'withSpokenMessages'));
[18789] Fix | Delete
[18790] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
[18791] Fix | Delete
[18792] Fix | Delete
[18793] Fix | Delete
[18794] Fix | Delete
[18795] Fix | Delete
/**
[18796] Fix | Delete
* External dependencies
[18797] Fix | Delete
*/
[18798] Fix | Delete
[18799] Fix | Delete
[18800] Fix | Delete
/**
[18801] Fix | Delete
* WordPress dependencies
[18802] Fix | Delete
*/
[18803] Fix | Delete
[18804] Fix | Delete
[18805] Fix | Delete
[18806] Fix | Delete
[18807] Fix | Delete
[18808] Fix | Delete
[18809] Fix | Delete
/**
[18810] Fix | Delete
* Internal dependencies
[18811] Fix | Delete
*/
[18812] Fix | Delete
[18813] Fix | Delete
[18814] Fix | Delete
[18815] Fix | Delete
[18816] Fix | Delete
/**
[18817] Fix | Delete
* A raw completer option.
[18818] Fix | Delete
*
[18819] Fix | Delete
* @typedef {*} CompleterOption
[18820] Fix | Delete
*/
[18821] Fix | Delete
[18822] Fix | Delete
/**
[18823] Fix | Delete
* @callback FnGetOptions
[18824] Fix | Delete
*
[18825] Fix | Delete
* @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.
[18826] Fix | Delete
*/
[18827] Fix | Delete
[18828] Fix | Delete
/**
[18829] Fix | Delete
* @callback FnGetOptionKeywords
[18830] Fix | Delete
* @param {CompleterOption} option a completer option.
[18831] Fix | Delete
*
[18832] Fix | Delete
* @return {string[]} list of key words to search.
[18833] Fix | Delete
*/
[18834] Fix | Delete
[18835] Fix | Delete
/**
[18836] Fix | Delete
* @callback FnIsOptionDisabled
[18837] Fix | Delete
* @param {CompleterOption} option a completer option.
[18838] Fix | Delete
*
[18839] Fix | Delete
* @return {string[]} whether or not the given option is disabled.
[18840] Fix | Delete
*/
[18841] Fix | Delete
[18842] Fix | Delete
/**
[18843] Fix | Delete
* @callback FnGetOptionLabel
[18844] Fix | Delete
* @param {CompleterOption} option a completer option.
[18845] Fix | Delete
*
[18846] Fix | Delete
* @return {(string|Array.<(string|WPElement)>)} list of react components to render.
[18847] Fix | Delete
*/
[18848] Fix | Delete
[18849] Fix | Delete
/**
[18850] Fix | Delete
* @callback FnAllowContext
[18851] Fix | Delete
* @param {string} before the string before the auto complete trigger and query.
[18852] Fix | Delete
* @param {string} after the string after the autocomplete trigger and query.
[18853] Fix | Delete
*
[18854] Fix | Delete
* @return {boolean} true if the completer can handle.
[18855] Fix | Delete
*/
[18856] Fix | Delete
[18857] Fix | Delete
/**
[18858] Fix | Delete
* @typedef {Object} OptionCompletion
[18859] Fix | Delete
* @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
[18860] Fix | Delete
* @property {OptionCompletionValue} value the completion value.
[18861] Fix | Delete
*/
[18862] Fix | Delete
[18863] Fix | Delete
/**
[18864] Fix | Delete
* A completion value.
[18865] Fix | Delete
*
[18866] Fix | Delete
* @typedef {(string|WPElement|Object)} OptionCompletionValue
[18867] Fix | Delete
*/
[18868] Fix | Delete
[18869] Fix | Delete
/**
[18870] Fix | Delete
* @callback FnGetOptionCompletion
[18871] Fix | Delete
* @param {CompleterOption} value the value of the completer option.
[18872] Fix | Delete
* @param {string} query the text value of the autocomplete query.
[18873] Fix | Delete
*
[18874] Fix | Delete
* @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
[18875] Fix | Delete
* OptionCompletionValue is returned, the
[18876] Fix | Delete
* completion action defaults to `insert-at-caret`.
[18877] Fix | Delete
*/
[18878] Fix | Delete
[18879] Fix | Delete
/**
[18880] Fix | Delete
* @typedef {Object} WPCompleter
[18881] Fix | Delete
* @property {string} name a way to identify a completer, useful for selective overriding.
[18882] Fix | Delete
* @property {?string} className A class to apply to the popup menu.
[18883] Fix | Delete
* @property {string} triggerPrefix the prefix that will display the menu.
[18884] Fix | Delete
* @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
[18885] Fix | Delete
* @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
[18886] Fix | Delete
* @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
[18887] Fix | Delete
* @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
[18888] Fix | Delete
* @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
[18889] Fix | Delete
* @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
[18890] Fix | Delete
*/
[18891] Fix | Delete
[18892] Fix | Delete
function filterOptions(search) {
[18893] Fix | Delete
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
[18894] Fix | Delete
var maxResults = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 10;
[18895] Fix | Delete
var filtered = [];
[18896] Fix | Delete
[18897] Fix | Delete
for (var i = 0; i < options.length; i++) {
[18898] Fix | Delete
var option = options[i]; // Merge label into keywords
[18899] Fix | Delete
[18900] Fix | Delete
var _option$keywords = option.keywords,
[18901] Fix | Delete
keywords = _option$keywords === void 0 ? [] : _option$keywords;
[18902] Fix | Delete
[18903] Fix | Delete
if ('string' === typeof option.label) {
[18904] Fix | Delete
keywords = [].concat(Object(toConsumableArray["a" /* default */])(keywords), [option.label]);
[18905] Fix | Delete
}
[18906] Fix | Delete
[18907] Fix | Delete
var isMatch = keywords.some(function (keyword) {
[18908] Fix | Delete
return search.test(Object(external_lodash_["deburr"])(keyword));
[18909] Fix | Delete
});
[18910] Fix | Delete
[18911] Fix | Delete
if (!isMatch) {
[18912] Fix | Delete
continue;
[18913] Fix | Delete
}
[18914] Fix | Delete
[18915] Fix | Delete
filtered.push(option); // Abort early if max reached
[18916] Fix | Delete
[18917] Fix | Delete
if (filtered.length === maxResults) {
[18918] Fix | Delete
break;
[18919] Fix | Delete
}
[18920] Fix | Delete
}
[18921] Fix | Delete
[18922] Fix | Delete
return filtered;
[18923] Fix | Delete
}
[18924] Fix | Delete
[18925] Fix | Delete
var autocomplete_getAutoCompleterUI = function getAutoCompleterUI(autocompleter) {
[18926] Fix | Delete
var useItems = autocompleter.useItems ? autocompleter.useItems : function (filterValue) {
[18927] Fix | Delete
var _useState = Object(external_wp_element_["useState"])([]),
[18928] Fix | Delete
_useState2 = Object(slicedToArray["a" /* default */])(_useState, 2),
[18929] Fix | Delete
items = _useState2[0],
[18930] Fix | Delete
setItems = _useState2[1];
[18931] Fix | Delete
/*
[18932] Fix | Delete
* We support both synchronous and asynchronous retrieval of completer options
[18933] Fix | Delete
* but internally treat all as async so we maintain a single, consistent code path.
[18934] Fix | Delete
*
[18935] Fix | Delete
* Because networks can be slow, and the internet is wonderfully unpredictable,
[18936] Fix | Delete
* we don't want two promises updating the state at once. This ensures that only
[18937] Fix | Delete
* the most recent promise will act on `optionsData`. This doesn't use the state
[18938] Fix | Delete
* because `setState` is batched, and so there's no guarantee that setting
[18939] Fix | Delete
* `activePromise` in the state would result in it actually being in `this.state`
[18940] Fix | Delete
* before the promise resolves and we check to see if this is the active promise or not.
[18941] Fix | Delete
*/
[18942] Fix | Delete
[18943] Fix | Delete
[18944] Fix | Delete
Object(external_wp_element_["useLayoutEffect"])(function () {
[18945] Fix | Delete
var options = autocompleter.options,
[18946] Fix | Delete
isDebounced = autocompleter.isDebounced;
[18947] Fix | Delete
var loadOptions = Object(external_lodash_["debounce"])(function () {
[18948] Fix | Delete
var promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(function (optionsData) {
[18949] Fix | Delete
if (promise.canceled) {
[18950] Fix | Delete
return;
[18951] Fix | Delete
}
[18952] Fix | Delete
[18953] Fix | Delete
var keyedOptions = optionsData.map(function (optionData, optionIndex) {
[18954] Fix | Delete
return {
[18955] Fix | Delete
key: "".concat(autocompleter.name, "-").concat(optionIndex),
[18956] Fix | Delete
value: optionData,
[18957] Fix | Delete
label: autocompleter.getOptionLabel(optionData),
[18958] Fix | Delete
keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
[18959] Fix | Delete
isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
[18960] Fix | Delete
};
[18961] Fix | Delete
}); // create a regular expression to filter the options
[18962] Fix | Delete
[18963] Fix | Delete
var search = new RegExp('(?:\\b|\\s|^)' + Object(external_lodash_["escapeRegExp"])(filterValue), 'i');
[18964] Fix | Delete
setItems(filterOptions(search, keyedOptions));
[18965] Fix | Delete
});
[18966] Fix | Delete
return promise;
[18967] Fix | Delete
}, isDebounced ? 250 : 0);
[18968] Fix | Delete
var promise = loadOptions();
[18969] Fix | Delete
return function () {
[18970] Fix | Delete
loadOptions.cancel();
[18971] Fix | Delete
[18972] Fix | Delete
if (promise) {
[18973] Fix | Delete
promise.canceled = true;
[18974] Fix | Delete
}
[18975] Fix | Delete
};
[18976] Fix | Delete
}, [filterValue]);
[18977] Fix | Delete
return [items];
[18978] Fix | Delete
};
[18979] Fix | Delete
[18980] Fix | Delete
function AutocompleterUI(_ref) {
[18981] Fix | Delete
var filterValue = _ref.filterValue,
[18982] Fix | Delete
instanceId = _ref.instanceId,
[18983] Fix | Delete
listBoxId = _ref.listBoxId,
[18984] Fix | Delete
className = _ref.className,
[18985] Fix | Delete
selectedIndex = _ref.selectedIndex,
[18986] Fix | Delete
onChangeOptions = _ref.onChangeOptions,
[18987] Fix | Delete
onSelect = _ref.onSelect,
[18988] Fix | Delete
onReset = _ref.onReset,
[18989] Fix | Delete
value = _ref.value,
[18990] Fix | Delete
contentRef = _ref.contentRef;
[18991] Fix | Delete
[18992] Fix | Delete
var _useItems = useItems(filterValue),
[18993] Fix | Delete
_useItems2 = Object(slicedToArray["a" /* default */])(_useItems, 1),
[18994] Fix | Delete
items = _useItems2[0];
[18995] Fix | Delete
[18996] Fix | Delete
var anchorRef = Object(external_wp_richText_["useAnchorRef"])({
[18997] Fix | Delete
ref: contentRef,
[18998] Fix | Delete
value: value
[18999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function