Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
var instanceId = Object(external_wp_compose_["useInstanceId"])(font_size_picker_FontSizePicker);
[33000] Fix | Delete
var options = Object(external_wp_element_["useMemo"])(function () {
[33001] Fix | Delete
return getSelectOptions(fontSizes, disableCustomFontSizes);
[33002] Fix | Delete
}, [fontSizes, disableCustomFontSizes]);
[33003] Fix | Delete
[33004] Fix | Delete
if (!options) {
[33005] Fix | Delete
return null;
[33006] Fix | Delete
}
[33007] Fix | Delete
[33008] Fix | Delete
var selectedFontSizeSlug = getSelectValueFromFontSize(fontSizes, value);
[33009] Fix | Delete
var fontSizePickerNumberId = "components-font-size-picker__number#".concat(instanceId);
[33010] Fix | Delete
return Object(external_wp_element_["createElement"])("fieldset", Object(esm_extends["a" /* default */])({
[33011] Fix | Delete
className: "components-font-size-picker"
[33012] Fix | Delete
}, ref ? {} : {
[33013] Fix | Delete
ref: ref
[33014] Fix | Delete
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
[33015] Fix | Delete
as: "legend"
[33016] Fix | Delete
}, Object(external_wp_i18n_["__"])('Font size')), Object(external_wp_element_["createElement"])("div", {
[33017] Fix | Delete
className: "components-font-size-picker__controls"
[33018] Fix | Delete
}, fontSizes.length > 0 && Object(external_wp_element_["createElement"])(CustomSelectControl, {
[33019] Fix | Delete
className: 'components-font-size-picker__select',
[33020] Fix | Delete
label: Object(external_wp_i18n_["__"])('Font size'),
[33021] Fix | Delete
options: options,
[33022] Fix | Delete
value: options.find(function (option) {
[33023] Fix | Delete
return option.key === selectedFontSizeSlug;
[33024] Fix | Delete
}),
[33025] Fix | Delete
onChange: function onChange(_ref2) {
[33026] Fix | Delete
var selectedItem = _ref2.selectedItem;
[33027] Fix | Delete
[33028] Fix | Delete
if (hasUnits) {
[33029] Fix | Delete
_onChange(selectedItem.size);
[33030] Fix | Delete
} else {
[33031] Fix | Delete
_onChange(Number(selectedItem.size));
[33032] Fix | Delete
}
[33033] Fix | Delete
}
[33034] Fix | Delete
}), !withSlider && !disableCustomFontSizes && Object(external_wp_element_["createElement"])("div", {
[33035] Fix | Delete
className: "components-font-size-picker__number-container"
[33036] Fix | Delete
}, Object(external_wp_element_["createElement"])("label", {
[33037] Fix | Delete
htmlFor: fontSizePickerNumberId
[33038] Fix | Delete
}, Object(external_wp_i18n_["__"])('Custom')), Object(external_wp_element_["createElement"])("input", {
[33039] Fix | Delete
id: fontSizePickerNumberId,
[33040] Fix | Delete
className: "components-font-size-picker__number",
[33041] Fix | Delete
type: "number",
[33042] Fix | Delete
min: 1,
[33043] Fix | Delete
onChange: function onChange(event) {
[33044] Fix | Delete
if (!event.target.value && event.target.value !== 0) {
[33045] Fix | Delete
_onChange(undefined);
[33046] Fix | Delete
[33047] Fix | Delete
return;
[33048] Fix | Delete
}
[33049] Fix | Delete
[33050] Fix | Delete
if (hasUnits) {
[33051] Fix | Delete
_onChange(event.target.value + 'px');
[33052] Fix | Delete
} else {
[33053] Fix | Delete
_onChange(Number(event.target.value));
[33054] Fix | Delete
}
[33055] Fix | Delete
},
[33056] Fix | Delete
"aria-label": Object(external_wp_i18n_["__"])('Custom'),
[33057] Fix | Delete
value: isPixelValue && noUnitsValue || ''
[33058] Fix | Delete
})), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
[33059] Fix | Delete
className: "components-color-palette__clear",
[33060] Fix | Delete
disabled: value === undefined,
[33061] Fix | Delete
onClick: function onClick() {
[33062] Fix | Delete
_onChange(undefined);
[33063] Fix | Delete
},
[33064] Fix | Delete
isSmall: true,
[33065] Fix | Delete
isSecondary: true
[33066] Fix | Delete
}, Object(external_wp_i18n_["__"])('Reset'))), withSlider && Object(external_wp_element_["createElement"])(range_control, {
[33067] Fix | Delete
className: "components-font-size-picker__custom-input",
[33068] Fix | Delete
label: Object(external_wp_i18n_["__"])('Custom Size'),
[33069] Fix | Delete
value: isPixelValue && noUnitsValue || '',
[33070] Fix | Delete
initialPosition: fallbackFontSize,
[33071] Fix | Delete
onChange: function onChange(newValue) {
[33072] Fix | Delete
_onChange(hasUnits ? newValue + 'px' : newValue);
[33073] Fix | Delete
},
[33074] Fix | Delete
min: 12,
[33075] Fix | Delete
max: 100,
[33076] Fix | Delete
beforeIcon: text_color["a" /* default */],
[33077] Fix | Delete
afterIcon: text_color["a" /* default */]
[33078] Fix | Delete
}));
[33079] Fix | Delete
}
[33080] Fix | Delete
[33081] Fix | Delete
/* harmony default export */ var font_size_picker = (next_withNextComponent(font_size_picker_FontSizePicker));
[33082] Fix | Delete
[33083] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-file-upload/index.js
[33084] Fix | Delete
[33085] Fix | Delete
[33086] Fix | Delete
[33087] Fix | Delete
[33088] Fix | Delete
/**
[33089] Fix | Delete
* WordPress dependencies
[33090] Fix | Delete
*/
[33091] Fix | Delete
[33092] Fix | Delete
/**
[33093] Fix | Delete
* Internal dependencies
[33094] Fix | Delete
*/
[33095] Fix | Delete
[33096] Fix | Delete
[33097] Fix | Delete
[33098] Fix | Delete
function FormFileUpload(_ref) {
[33099] Fix | Delete
var accept = _ref.accept,
[33100] Fix | Delete
children = _ref.children,
[33101] Fix | Delete
_ref$multiple = _ref.multiple,
[33102] Fix | Delete
multiple = _ref$multiple === void 0 ? false : _ref$multiple,
[33103] Fix | Delete
onChange = _ref.onChange,
[33104] Fix | Delete
render = _ref.render,
[33105] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["accept", "children", "multiple", "onChange", "render"]);
[33106] Fix | Delete
[33107] Fix | Delete
var ref = Object(external_wp_element_["useRef"])();
[33108] Fix | Delete
[33109] Fix | Delete
var openFileDialog = function openFileDialog() {
[33110] Fix | Delete
ref.current.click();
[33111] Fix | Delete
};
[33112] Fix | Delete
[33113] Fix | Delete
var ui = render ? render({
[33114] Fix | Delete
openFileDialog: openFileDialog
[33115] Fix | Delete
}) : Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
[33116] Fix | Delete
onClick: openFileDialog
[33117] Fix | Delete
}, props), children);
[33118] Fix | Delete
return Object(external_wp_element_["createElement"])("div", {
[33119] Fix | Delete
className: "components-form-file-upload"
[33120] Fix | Delete
}, ui, Object(external_wp_element_["createElement"])("input", {
[33121] Fix | Delete
type: "file",
[33122] Fix | Delete
ref: ref,
[33123] Fix | Delete
multiple: multiple,
[33124] Fix | Delete
style: {
[33125] Fix | Delete
display: 'none'
[33126] Fix | Delete
},
[33127] Fix | Delete
accept: accept,
[33128] Fix | Delete
onChange: onChange
[33129] Fix | Delete
}));
[33130] Fix | Delete
}
[33131] Fix | Delete
[33132] Fix | Delete
/* harmony default export */ var form_file_upload = (FormFileUpload);
[33133] Fix | Delete
[33134] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-toggle/index.js
[33135] Fix | Delete
[33136] Fix | Delete
[33137] Fix | Delete
[33138] Fix | Delete
[33139] Fix | Delete
/**
[33140] Fix | Delete
* External dependencies
[33141] Fix | Delete
*/
[33142] Fix | Delete
[33143] Fix | Delete
[33144] Fix | Delete
[33145] Fix | Delete
function FormToggle(_ref) {
[33146] Fix | Delete
var className = _ref.className,
[33147] Fix | Delete
checked = _ref.checked,
[33148] Fix | Delete
id = _ref.id,
[33149] Fix | Delete
disabled = _ref.disabled,
[33150] Fix | Delete
_ref$onChange = _ref.onChange,
[33151] Fix | Delete
onChange = _ref$onChange === void 0 ? external_lodash_["noop"] : _ref$onChange,
[33152] Fix | Delete
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "checked", "id", "disabled", "onChange"]);
[33153] Fix | Delete
[33154] Fix | Delete
var wrapperClasses = classnames_default()('components-form-toggle', className, {
[33155] Fix | Delete
'is-checked': checked,
[33156] Fix | Delete
'is-disabled': disabled
[33157] Fix | Delete
});
[33158] Fix | Delete
return Object(external_wp_element_["createElement"])("span", {
[33159] Fix | Delete
className: wrapperClasses
[33160] Fix | Delete
}, Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
[33161] Fix | Delete
className: "components-form-toggle__input",
[33162] Fix | Delete
id: id,
[33163] Fix | Delete
type: "checkbox",
[33164] Fix | Delete
checked: checked,
[33165] Fix | Delete
onChange: onChange,
[33166] Fix | Delete
disabled: disabled
[33167] Fix | Delete
}, props)), Object(external_wp_element_["createElement"])("span", {
[33168] Fix | Delete
className: "components-form-toggle__track"
[33169] Fix | Delete
}), Object(external_wp_element_["createElement"])("span", {
[33170] Fix | Delete
className: "components-form-toggle__thumb"
[33171] Fix | Delete
}));
[33172] Fix | Delete
}
[33173] Fix | Delete
[33174] Fix | Delete
/* harmony default export */ var form_toggle = (FormToggle);
[33175] Fix | Delete
[33176] Fix | Delete
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/typeof.js
[33177] Fix | Delete
var esm_typeof = __webpack_require__("U8pU");
[33178] Fix | Delete
[33179] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token.js
[33180] Fix | Delete
[33181] Fix | Delete
[33182] Fix | Delete
/**
[33183] Fix | Delete
* External dependencies
[33184] Fix | Delete
*/
[33185] Fix | Delete
[33186] Fix | Delete
[33187] Fix | Delete
/**
[33188] Fix | Delete
* WordPress dependencies
[33189] Fix | Delete
*/
[33190] Fix | Delete
[33191] Fix | Delete
[33192] Fix | Delete
[33193] Fix | Delete
[33194] Fix | Delete
/**
[33195] Fix | Delete
* Internal dependencies
[33196] Fix | Delete
*/
[33197] Fix | Delete
[33198] Fix | Delete
[33199] Fix | Delete
[33200] Fix | Delete
function Token(_ref) {
[33201] Fix | Delete
var value = _ref.value,
[33202] Fix | Delete
status = _ref.status,
[33203] Fix | Delete
title = _ref.title,
[33204] Fix | Delete
displayTransform = _ref.displayTransform,
[33205] Fix | Delete
_ref$isBorderless = _ref.isBorderless,
[33206] Fix | Delete
isBorderless = _ref$isBorderless === void 0 ? false : _ref$isBorderless,
[33207] Fix | Delete
_ref$disabled = _ref.disabled,
[33208] Fix | Delete
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
[33209] Fix | Delete
_ref$onClickRemove = _ref.onClickRemove,
[33210] Fix | Delete
onClickRemove = _ref$onClickRemove === void 0 ? external_lodash_["noop"] : _ref$onClickRemove,
[33211] Fix | Delete
onMouseEnter = _ref.onMouseEnter,
[33212] Fix | Delete
onMouseLeave = _ref.onMouseLeave,
[33213] Fix | Delete
messages = _ref.messages,
[33214] Fix | Delete
termPosition = _ref.termPosition,
[33215] Fix | Delete
termsCount = _ref.termsCount;
[33216] Fix | Delete
var instanceId = Object(external_wp_compose_["useInstanceId"])(Token);
[33217] Fix | Delete
var tokenClasses = classnames_default()('components-form-token-field__token', {
[33218] Fix | Delete
'is-error': 'error' === status,
[33219] Fix | Delete
'is-success': 'success' === status,
[33220] Fix | Delete
'is-validating': 'validating' === status,
[33221] Fix | Delete
'is-borderless': isBorderless,
[33222] Fix | Delete
'is-disabled': disabled
[33223] Fix | Delete
});
[33224] Fix | Delete
[33225] Fix | Delete
var onClick = function onClick() {
[33226] Fix | Delete
return onClickRemove({
[33227] Fix | Delete
value: value
[33228] Fix | Delete
});
[33229] Fix | Delete
};
[33230] Fix | Delete
[33231] Fix | Delete
var transformedValue = displayTransform(value);
[33232] Fix | Delete
var termPositionAndCount = Object(external_wp_i18n_["sprintf"])(
[33233] Fix | Delete
/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
[33234] Fix | Delete
Object(external_wp_i18n_["__"])('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount);
[33235] Fix | Delete
return Object(external_wp_element_["createElement"])("span", {
[33236] Fix | Delete
className: tokenClasses,
[33237] Fix | Delete
onMouseEnter: onMouseEnter,
[33238] Fix | Delete
onMouseLeave: onMouseLeave,
[33239] Fix | Delete
title: title
[33240] Fix | Delete
}, Object(external_wp_element_["createElement"])("span", {
[33241] Fix | Delete
className: "components-form-token-field__token-text",
[33242] Fix | Delete
id: "components-form-token-field__token-text-".concat(instanceId)
[33243] Fix | Delete
}, Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
[33244] Fix | Delete
as: "span"
[33245] Fix | Delete
}, termPositionAndCount), Object(external_wp_element_["createElement"])("span", {
[33246] Fix | Delete
"aria-hidden": "true"
[33247] Fix | Delete
}, transformedValue)), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
[33248] Fix | Delete
className: "components-form-token-field__remove-token",
[33249] Fix | Delete
icon: close_small["a" /* default */],
[33250] Fix | Delete
onClick: !disabled && onClick,
[33251] Fix | Delete
label: messages.remove,
[33252] Fix | Delete
"aria-describedby": "components-form-token-field__token-text-".concat(instanceId)
[33253] Fix | Delete
}));
[33254] Fix | Delete
}
[33255] Fix | Delete
[33256] Fix | Delete
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/index.js
[33257] Fix | Delete
[33258] Fix | Delete
[33259] Fix | Delete
[33260] Fix | Delete
[33261] Fix | Delete
[33262] Fix | Delete
[33263] Fix | Delete
[33264] Fix | Delete
[33265] Fix | Delete
[33266] Fix | Delete
[33267] Fix | Delete
function form_token_field_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
[33268] Fix | Delete
[33269] Fix | Delete
function form_token_field_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { form_token_field_ownKeys(Object(source), true).forEach(function (key) { Object(esm_defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { form_token_field_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
[33270] Fix | Delete
[33271] Fix | Delete
function form_token_field_createSuper(Derived) { var hasNativeReflectConstruct = form_token_field_isNativeReflectConstruct(); return function _createSuperInternal() { var Super = Object(getPrototypeOf["a" /* default */])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = Object(getPrototypeOf["a" /* default */])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return Object(possibleConstructorReturn["a" /* default */])(this, result); }; }
[33272] Fix | Delete
[33273] Fix | Delete
function form_token_field_isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
[33274] Fix | Delete
[33275] Fix | Delete
/**
[33276] Fix | Delete
* External dependencies
[33277] Fix | Delete
*/
[33278] Fix | Delete
[33279] Fix | Delete
[33280] Fix | Delete
/**
[33281] Fix | Delete
* WordPress dependencies
[33282] Fix | Delete
*/
[33283] Fix | Delete
[33284] Fix | Delete
[33285] Fix | Delete
[33286] Fix | Delete
[33287] Fix | Delete
[33288] Fix | Delete
[33289] Fix | Delete
/**
[33290] Fix | Delete
* Internal dependencies
[33291] Fix | Delete
*/
[33292] Fix | Delete
[33293] Fix | Delete
[33294] Fix | Delete
[33295] Fix | Delete
[33296] Fix | Delete
[33297] Fix | Delete
var form_token_field_initialState = {
[33298] Fix | Delete
incompleteTokenValue: '',
[33299] Fix | Delete
inputOffsetFromEnd: 0,
[33300] Fix | Delete
isActive: false,
[33301] Fix | Delete
isExpanded: false,
[33302] Fix | Delete
selectedSuggestionIndex: -1,
[33303] Fix | Delete
selectedSuggestionScroll: false
[33304] Fix | Delete
};
[33305] Fix | Delete
[33306] Fix | Delete
var form_token_field_FormTokenField = /*#__PURE__*/function (_Component) {
[33307] Fix | Delete
Object(inherits["a" /* default */])(FormTokenField, _Component);
[33308] Fix | Delete
[33309] Fix | Delete
var _super = form_token_field_createSuper(FormTokenField);
[33310] Fix | Delete
[33311] Fix | Delete
function FormTokenField() {
[33312] Fix | Delete
var _this;
[33313] Fix | Delete
[33314] Fix | Delete
Object(classCallCheck["a" /* default */])(this, FormTokenField);
[33315] Fix | Delete
[33316] Fix | Delete
_this = _super.apply(this, arguments);
[33317] Fix | Delete
_this.state = form_token_field_initialState;
[33318] Fix | Delete
_this.onKeyDown = _this.onKeyDown.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33319] Fix | Delete
_this.onKeyPress = _this.onKeyPress.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33320] Fix | Delete
_this.onFocus = _this.onFocus.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33321] Fix | Delete
_this.onBlur = _this.onBlur.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33322] Fix | Delete
_this.deleteTokenBeforeInput = _this.deleteTokenBeforeInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33323] Fix | Delete
_this.deleteTokenAfterInput = _this.deleteTokenAfterInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33324] Fix | Delete
_this.addCurrentToken = _this.addCurrentToken.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33325] Fix | Delete
_this.onContainerTouched = _this.onContainerTouched.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33326] Fix | Delete
_this.renderToken = _this.renderToken.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33327] Fix | Delete
_this.onTokenClickRemove = _this.onTokenClickRemove.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33328] Fix | Delete
_this.onSuggestionHovered = _this.onSuggestionHovered.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33329] Fix | Delete
_this.onSuggestionSelected = _this.onSuggestionSelected.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33330] Fix | Delete
_this.onInputChange = _this.onInputChange.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33331] Fix | Delete
_this.bindInput = _this.bindInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33332] Fix | Delete
_this.bindTokensAndInput = _this.bindTokensAndInput.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33333] Fix | Delete
_this.updateSuggestions = _this.updateSuggestions.bind(Object(assertThisInitialized["a" /* default */])(_this));
[33334] Fix | Delete
return _this;
[33335] Fix | Delete
}
[33336] Fix | Delete
[33337] Fix | Delete
Object(createClass["a" /* default */])(FormTokenField, [{
[33338] Fix | Delete
key: "componentDidUpdate",
[33339] Fix | Delete
value: function componentDidUpdate(prevProps) {
[33340] Fix | Delete
// Make sure to focus the input when the isActive state is true.
[33341] Fix | Delete
if (this.state.isActive && !this.input.hasFocus()) {
[33342] Fix | Delete
this.input.focus();
[33343] Fix | Delete
}
[33344] Fix | Delete
[33345] Fix | Delete
var _this$props = this.props,
[33346] Fix | Delete
suggestions = _this$props.suggestions,
[33347] Fix | Delete
value = _this$props.value;
[33348] Fix | Delete
var suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevProps.suggestions);
[33349] Fix | Delete
[33350] Fix | Delete
if (suggestionsDidUpdate || value !== prevProps.value) {
[33351] Fix | Delete
this.updateSuggestions(suggestionsDidUpdate);
[33352] Fix | Delete
}
[33353] Fix | Delete
}
[33354] Fix | Delete
}, {
[33355] Fix | Delete
key: "bindInput",
[33356] Fix | Delete
value: function bindInput(ref) {
[33357] Fix | Delete
this.input = ref;
[33358] Fix | Delete
}
[33359] Fix | Delete
}, {
[33360] Fix | Delete
key: "bindTokensAndInput",
[33361] Fix | Delete
value: function bindTokensAndInput(ref) {
[33362] Fix | Delete
this.tokensAndInput = ref;
[33363] Fix | Delete
}
[33364] Fix | Delete
}, {
[33365] Fix | Delete
key: "onFocus",
[33366] Fix | Delete
value: function onFocus(event) {
[33367] Fix | Delete
// If focus is on the input or on the container, set the isActive state to true.
[33368] Fix | Delete
if (this.input.hasFocus() || event.target === this.tokensAndInput) {
[33369] Fix | Delete
this.setState({
[33370] Fix | Delete
isActive: true
[33371] Fix | Delete
});
[33372] Fix | Delete
} else {
[33373] Fix | Delete
/*
[33374] Fix | Delete
* Otherwise, focus is on one of the token "remove" buttons and we
[33375] Fix | Delete
* set the isActive state to false to prevent the input to be
[33376] Fix | Delete
* re-focused, see componentDidUpdate().
[33377] Fix | Delete
*/
[33378] Fix | Delete
this.setState({
[33379] Fix | Delete
isActive: false
[33380] Fix | Delete
});
[33381] Fix | Delete
}
[33382] Fix | Delete
[33383] Fix | Delete
if ('function' === typeof this.props.onFocus) {
[33384] Fix | Delete
this.props.onFocus(event);
[33385] Fix | Delete
}
[33386] Fix | Delete
}
[33387] Fix | Delete
}, {
[33388] Fix | Delete
key: "onBlur",
[33389] Fix | Delete
value: function onBlur() {
[33390] Fix | Delete
if (this.inputHasValidValue()) {
[33391] Fix | Delete
this.setState({
[33392] Fix | Delete
isActive: false
[33393] Fix | Delete
});
[33394] Fix | Delete
} else {
[33395] Fix | Delete
this.setState(form_token_field_initialState);
[33396] Fix | Delete
}
[33397] Fix | Delete
}
[33398] Fix | Delete
}, {
[33399] Fix | Delete
key: "onKeyDown",
[33400] Fix | Delete
value: function onKeyDown(event) {
[33401] Fix | Delete
var preventDefault = false;
[33402] Fix | Delete
[33403] Fix | Delete
switch (event.keyCode) {
[33404] Fix | Delete
case external_wp_keycodes_["BACKSPACE"]:
[33405] Fix | Delete
preventDefault = this.handleDeleteKey(this.deleteTokenBeforeInput);
[33406] Fix | Delete
break;
[33407] Fix | Delete
[33408] Fix | Delete
case external_wp_keycodes_["ENTER"]:
[33409] Fix | Delete
preventDefault = this.addCurrentToken();
[33410] Fix | Delete
break;
[33411] Fix | Delete
[33412] Fix | Delete
case external_wp_keycodes_["LEFT"]:
[33413] Fix | Delete
preventDefault = this.handleLeftArrowKey();
[33414] Fix | Delete
break;
[33415] Fix | Delete
[33416] Fix | Delete
case external_wp_keycodes_["UP"]:
[33417] Fix | Delete
preventDefault = this.handleUpArrowKey();
[33418] Fix | Delete
break;
[33419] Fix | Delete
[33420] Fix | Delete
case external_wp_keycodes_["RIGHT"]:
[33421] Fix | Delete
preventDefault = this.handleRightArrowKey();
[33422] Fix | Delete
break;
[33423] Fix | Delete
[33424] Fix | Delete
case external_wp_keycodes_["DOWN"]:
[33425] Fix | Delete
preventDefault = this.handleDownArrowKey();
[33426] Fix | Delete
break;
[33427] Fix | Delete
[33428] Fix | Delete
case external_wp_keycodes_["DELETE"]:
[33429] Fix | Delete
preventDefault = this.handleDeleteKey(this.deleteTokenAfterInput);
[33430] Fix | Delete
break;
[33431] Fix | Delete
[33432] Fix | Delete
case external_wp_keycodes_["SPACE"]:
[33433] Fix | Delete
if (this.props.tokenizeOnSpace) {
[33434] Fix | Delete
preventDefault = this.addCurrentToken();
[33435] Fix | Delete
}
[33436] Fix | Delete
[33437] Fix | Delete
break;
[33438] Fix | Delete
[33439] Fix | Delete
case external_wp_keycodes_["ESCAPE"]:
[33440] Fix | Delete
preventDefault = this.handleEscapeKey(event);
[33441] Fix | Delete
event.stopPropagation();
[33442] Fix | Delete
break;
[33443] Fix | Delete
[33444] Fix | Delete
default:
[33445] Fix | Delete
break;
[33446] Fix | Delete
}
[33447] Fix | Delete
[33448] Fix | Delete
if (preventDefault) {
[33449] Fix | Delete
event.preventDefault();
[33450] Fix | Delete
}
[33451] Fix | Delete
}
[33452] Fix | Delete
}, {
[33453] Fix | Delete
key: "onKeyPress",
[33454] Fix | Delete
value: function onKeyPress(event) {
[33455] Fix | Delete
var preventDefault = false;
[33456] Fix | Delete
[33457] Fix | Delete
switch (event.charCode) {
[33458] Fix | Delete
case 44:
[33459] Fix | Delete
// comma
[33460] Fix | Delete
preventDefault = this.handleCommaKey();
[33461] Fix | Delete
break;
[33462] Fix | Delete
[33463] Fix | Delete
default:
[33464] Fix | Delete
break;
[33465] Fix | Delete
}
[33466] Fix | Delete
[33467] Fix | Delete
if (preventDefault) {
[33468] Fix | Delete
event.preventDefault();
[33469] Fix | Delete
}
[33470] Fix | Delete
}
[33471] Fix | Delete
}, {
[33472] Fix | Delete
key: "onContainerTouched",
[33473] Fix | Delete
value: function onContainerTouched(event) {
[33474] Fix | Delete
// Prevent clicking/touching the tokensAndInput container from blurring
[33475] Fix | Delete
// the input and adding the current token.
[33476] Fix | Delete
if (event.target === this.tokensAndInput && this.state.isActive) {
[33477] Fix | Delete
event.preventDefault();
[33478] Fix | Delete
}
[33479] Fix | Delete
}
[33480] Fix | Delete
}, {
[33481] Fix | Delete
key: "onTokenClickRemove",
[33482] Fix | Delete
value: function onTokenClickRemove(event) {
[33483] Fix | Delete
this.deleteToken(event.value);
[33484] Fix | Delete
this.input.focus();
[33485] Fix | Delete
}
[33486] Fix | Delete
}, {
[33487] Fix | Delete
key: "onSuggestionHovered",
[33488] Fix | Delete
value: function onSuggestionHovered(suggestion) {
[33489] Fix | Delete
var index = this.getMatchingSuggestions().indexOf(suggestion);
[33490] Fix | Delete
[33491] Fix | Delete
if (index >= 0) {
[33492] Fix | Delete
this.setState({
[33493] Fix | Delete
selectedSuggestionIndex: index,
[33494] Fix | Delete
selectedSuggestionScroll: false
[33495] Fix | Delete
});
[33496] Fix | Delete
}
[33497] Fix | Delete
}
[33498] Fix | Delete
}, {
[33499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function