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: blocks.js
[7500] Fix | Delete
[7501] Fix | Delete
[7502] Fix | Delete
/**
[7503] Fix | Delete
* WordPress dependencies
[7504] Fix | Delete
*/
[7505] Fix | Delete
[7506] Fix | Delete
[7507] Fix | Delete
[7508] Fix | Delete
[7509] Fix | Delete
[7510] Fix | Delete
/**
[7511] Fix | Delete
* Internal dependencies
[7512] Fix | Delete
*/
[7513] Fix | Delete
[7514] Fix | Delete
[7515] Fix | Delete
k([names, a11y]);
[7516] Fix | Delete
[7517] Fix | Delete
/**
[7518] Fix | Delete
* Array of icon colors containing a color to be used if the icon color
[7519] Fix | Delete
* was not explicitly set but the icon background color was.
[7520] Fix | Delete
*
[7521] Fix | Delete
* @type {Object}
[7522] Fix | Delete
*/
[7523] Fix | Delete
const ICON_COLORS = ['#191e23', '#f8f9f9'];
[7524] Fix | Delete
[7525] Fix | Delete
/**
[7526] Fix | Delete
* Determines whether the block's attributes are equal to the default attributes
[7527] Fix | Delete
* which means the block is unmodified.
[7528] Fix | Delete
*
[7529] Fix | Delete
* @param {WPBlock} block Block Object
[7530] Fix | Delete
*
[7531] Fix | Delete
* @return {boolean} Whether the block is an unmodified block.
[7532] Fix | Delete
*/
[7533] Fix | Delete
function isUnmodifiedBlock(block) {
[7534] Fix | Delete
var _getBlockType$attribu;
[7535] Fix | Delete
return Object.entries((_getBlockType$attribu = getBlockType(block.name)?.attributes) !== null && _getBlockType$attribu !== void 0 ? _getBlockType$attribu : {}).every(([key, definition]) => {
[7536] Fix | Delete
const value = block.attributes[key];
[7537] Fix | Delete
[7538] Fix | Delete
// Every attribute that has a default must match the default.
[7539] Fix | Delete
if (definition.hasOwnProperty('default')) {
[7540] Fix | Delete
return value === definition.default;
[7541] Fix | Delete
}
[7542] Fix | Delete
[7543] Fix | Delete
// The rich text type is a bit different from the rest because it
[7544] Fix | Delete
// has an implicit default value of an empty RichTextData instance,
[7545] Fix | Delete
// so check the length of the value.
[7546] Fix | Delete
if (definition.type === 'rich-text') {
[7547] Fix | Delete
return !value?.length;
[7548] Fix | Delete
}
[7549] Fix | Delete
[7550] Fix | Delete
// Every attribute that doesn't have a default should be undefined.
[7551] Fix | Delete
return value === undefined;
[7552] Fix | Delete
});
[7553] Fix | Delete
}
[7554] Fix | Delete
[7555] Fix | Delete
/**
[7556] Fix | Delete
* Determines whether the block is a default block and its attributes are equal
[7557] Fix | Delete
* to the default attributes which means the block is unmodified.
[7558] Fix | Delete
*
[7559] Fix | Delete
* @param {WPBlock} block Block Object
[7560] Fix | Delete
*
[7561] Fix | Delete
* @return {boolean} Whether the block is an unmodified default block.
[7562] Fix | Delete
*/
[7563] Fix | Delete
function isUnmodifiedDefaultBlock(block) {
[7564] Fix | Delete
return block.name === getDefaultBlockName() && isUnmodifiedBlock(block);
[7565] Fix | Delete
}
[7566] Fix | Delete
[7567] Fix | Delete
/**
[7568] Fix | Delete
* Function that checks if the parameter is a valid icon.
[7569] Fix | Delete
*
[7570] Fix | Delete
* @param {*} icon Parameter to be checked.
[7571] Fix | Delete
*
[7572] Fix | Delete
* @return {boolean} True if the parameter is a valid icon and false otherwise.
[7573] Fix | Delete
*/
[7574] Fix | Delete
[7575] Fix | Delete
function isValidIcon(icon) {
[7576] Fix | Delete
return !!icon && (typeof icon === 'string' || (0,external_wp_element_namespaceObject.isValidElement)(icon) || typeof icon === 'function' || icon instanceof external_wp_element_namespaceObject.Component);
[7577] Fix | Delete
}
[7578] Fix | Delete
[7579] Fix | Delete
/**
[7580] Fix | Delete
* Function that receives an icon as set by the blocks during the registration
[7581] Fix | Delete
* and returns a new icon object that is normalized so we can rely on just on possible icon structure
[7582] Fix | Delete
* in the codebase.
[7583] Fix | Delete
*
[7584] Fix | Delete
* @param {WPBlockTypeIconRender} icon Render behavior of a block type icon;
[7585] Fix | Delete
* one of a Dashicon slug, an element, or a
[7586] Fix | Delete
* component.
[7587] Fix | Delete
*
[7588] Fix | Delete
* @return {WPBlockTypeIconDescriptor} Object describing the icon.
[7589] Fix | Delete
*/
[7590] Fix | Delete
function normalizeIconObject(icon) {
[7591] Fix | Delete
icon = icon || BLOCK_ICON_DEFAULT;
[7592] Fix | Delete
if (isValidIcon(icon)) {
[7593] Fix | Delete
return {
[7594] Fix | Delete
src: icon
[7595] Fix | Delete
};
[7596] Fix | Delete
}
[7597] Fix | Delete
if ('background' in icon) {
[7598] Fix | Delete
const colordBgColor = w(icon.background);
[7599] Fix | Delete
const getColorContrast = iconColor => colordBgColor.contrast(iconColor);
[7600] Fix | Delete
const maxContrast = Math.max(...ICON_COLORS.map(getColorContrast));
[7601] Fix | Delete
return {
[7602] Fix | Delete
...icon,
[7603] Fix | Delete
foreground: icon.foreground ? icon.foreground : ICON_COLORS.find(iconColor => getColorContrast(iconColor) === maxContrast),
[7604] Fix | Delete
shadowColor: colordBgColor.alpha(0.3).toRgbString()
[7605] Fix | Delete
};
[7606] Fix | Delete
}
[7607] Fix | Delete
return icon;
[7608] Fix | Delete
}
[7609] Fix | Delete
[7610] Fix | Delete
/**
[7611] Fix | Delete
* Normalizes block type passed as param. When string is passed then
[7612] Fix | Delete
* it converts it to the matching block type object.
[7613] Fix | Delete
* It passes the original object otherwise.
[7614] Fix | Delete
*
[7615] Fix | Delete
* @param {string|Object} blockTypeOrName Block type or name.
[7616] Fix | Delete
*
[7617] Fix | Delete
* @return {?Object} Block type.
[7618] Fix | Delete
*/
[7619] Fix | Delete
function normalizeBlockType(blockTypeOrName) {
[7620] Fix | Delete
if (typeof blockTypeOrName === 'string') {
[7621] Fix | Delete
return getBlockType(blockTypeOrName);
[7622] Fix | Delete
}
[7623] Fix | Delete
return blockTypeOrName;
[7624] Fix | Delete
}
[7625] Fix | Delete
[7626] Fix | Delete
/**
[7627] Fix | Delete
* Get the label for the block, usually this is either the block title,
[7628] Fix | Delete
* or the value of the block's `label` function when that's specified.
[7629] Fix | Delete
*
[7630] Fix | Delete
* @param {Object} blockType The block type.
[7631] Fix | Delete
* @param {Object} attributes The values of the block's attributes.
[7632] Fix | Delete
* @param {Object} context The intended use for the label.
[7633] Fix | Delete
*
[7634] Fix | Delete
* @return {string} The block label.
[7635] Fix | Delete
*/
[7636] Fix | Delete
function getBlockLabel(blockType, attributes, context = 'visual') {
[7637] Fix | Delete
const {
[7638] Fix | Delete
__experimentalLabel: getLabel,
[7639] Fix | Delete
title
[7640] Fix | Delete
} = blockType;
[7641] Fix | Delete
const label = getLabel && getLabel(attributes, {
[7642] Fix | Delete
context
[7643] Fix | Delete
});
[7644] Fix | Delete
if (!label) {
[7645] Fix | Delete
return title;
[7646] Fix | Delete
}
[7647] Fix | Delete
if (label.toPlainText) {
[7648] Fix | Delete
return label.toPlainText();
[7649] Fix | Delete
}
[7650] Fix | Delete
[7651] Fix | Delete
// Strip any HTML (i.e. RichText formatting) before returning.
[7652] Fix | Delete
return (0,external_wp_dom_namespaceObject.__unstableStripHTML)(label);
[7653] Fix | Delete
}
[7654] Fix | Delete
[7655] Fix | Delete
/**
[7656] Fix | Delete
* Get a label for the block for use by screenreaders, this is more descriptive
[7657] Fix | Delete
* than the visual label and includes the block title and the value of the
[7658] Fix | Delete
* `getLabel` function if it's specified.
[7659] Fix | Delete
*
[7660] Fix | Delete
* @param {?Object} blockType The block type.
[7661] Fix | Delete
* @param {Object} attributes The values of the block's attributes.
[7662] Fix | Delete
* @param {?number} position The position of the block in the block list.
[7663] Fix | Delete
* @param {string} [direction='vertical'] The direction of the block layout.
[7664] Fix | Delete
*
[7665] Fix | Delete
* @return {string} The block label.
[7666] Fix | Delete
*/
[7667] Fix | Delete
function getAccessibleBlockLabel(blockType, attributes, position, direction = 'vertical') {
[7668] Fix | Delete
// `title` is already localized, `label` is a user-supplied value.
[7669] Fix | Delete
const title = blockType?.title;
[7670] Fix | Delete
const label = blockType ? getBlockLabel(blockType, attributes, 'accessibility') : '';
[7671] Fix | Delete
const hasPosition = position !== undefined;
[7672] Fix | Delete
[7673] Fix | Delete
// getBlockLabel returns the block title as a fallback when there's no label,
[7674] Fix | Delete
// if it did return the title, this function needs to avoid adding the
[7675] Fix | Delete
// title twice within the accessible label. Use this `hasLabel` boolean to
[7676] Fix | Delete
// handle that.
[7677] Fix | Delete
const hasLabel = label && label !== title;
[7678] Fix | Delete
if (hasPosition && direction === 'vertical') {
[7679] Fix | Delete
if (hasLabel) {
[7680] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. 3: The block label.. */
[7681] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d. %3$s'), title, position, label);
[7682] Fix | Delete
}
[7683] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block row number. */
[7684] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Row %2$d'), title, position);
[7685] Fix | Delete
} else if (hasPosition && direction === 'horizontal') {
[7686] Fix | Delete
if (hasLabel) {
[7687] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. 3: The block label.. */
[7688] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d. %3$s'), title, position, label);
[7689] Fix | Delete
}
[7690] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. 1: The block title. 2: The block column number. */
[7691] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. Column %2$d'), title, position);
[7692] Fix | Delete
}
[7693] Fix | Delete
if (hasLabel) {
[7694] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %1: The block title. %2: The block label. */
[7695] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%1$s Block. %2$s'), title, label);
[7696] Fix | Delete
}
[7697] Fix | Delete
return (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: accessibility text. %s: The block title. */
[7698] Fix | Delete
(0,external_wp_i18n_namespaceObject.__)('%s Block'), title);
[7699] Fix | Delete
}
[7700] Fix | Delete
function getDefault(attributeSchema) {
[7701] Fix | Delete
if (attributeSchema.default !== undefined) {
[7702] Fix | Delete
return attributeSchema.default;
[7703] Fix | Delete
}
[7704] Fix | Delete
if (attributeSchema.type === 'rich-text') {
[7705] Fix | Delete
return new external_wp_richText_namespaceObject.RichTextData();
[7706] Fix | Delete
}
[7707] Fix | Delete
}
[7708] Fix | Delete
[7709] Fix | Delete
/**
[7710] Fix | Delete
* Ensure attributes contains only values defined by block type, and merge
[7711] Fix | Delete
* default values for missing attributes.
[7712] Fix | Delete
*
[7713] Fix | Delete
* @param {string} name The block's name.
[7714] Fix | Delete
* @param {Object} attributes The block's attributes.
[7715] Fix | Delete
* @return {Object} The sanitized attributes.
[7716] Fix | Delete
*/
[7717] Fix | Delete
function __experimentalSanitizeBlockAttributes(name, attributes) {
[7718] Fix | Delete
// Get the type definition associated with a registered block.
[7719] Fix | Delete
const blockType = getBlockType(name);
[7720] Fix | Delete
if (undefined === blockType) {
[7721] Fix | Delete
throw new Error(`Block type '${name}' is not registered.`);
[7722] Fix | Delete
}
[7723] Fix | Delete
return Object.entries(blockType.attributes).reduce((accumulator, [key, schema]) => {
[7724] Fix | Delete
const value = attributes[key];
[7725] Fix | Delete
if (undefined !== value) {
[7726] Fix | Delete
if (schema.type === 'rich-text') {
[7727] Fix | Delete
if (value instanceof external_wp_richText_namespaceObject.RichTextData) {
[7728] Fix | Delete
accumulator[key] = value;
[7729] Fix | Delete
} else if (typeof value === 'string') {
[7730] Fix | Delete
accumulator[key] = external_wp_richText_namespaceObject.RichTextData.fromHTMLString(value);
[7731] Fix | Delete
}
[7732] Fix | Delete
} else if (schema.type === 'string' && value instanceof external_wp_richText_namespaceObject.RichTextData) {
[7733] Fix | Delete
accumulator[key] = value.toHTMLString();
[7734] Fix | Delete
} else {
[7735] Fix | Delete
accumulator[key] = value;
[7736] Fix | Delete
}
[7737] Fix | Delete
} else {
[7738] Fix | Delete
const _default = getDefault(schema);
[7739] Fix | Delete
if (undefined !== _default) {
[7740] Fix | Delete
accumulator[key] = _default;
[7741] Fix | Delete
}
[7742] Fix | Delete
}
[7743] Fix | Delete
if (['node', 'children'].indexOf(schema.source) !== -1) {
[7744] Fix | Delete
// Ensure value passed is always an array, which we're expecting in
[7745] Fix | Delete
// the RichText component to handle the deprecated value.
[7746] Fix | Delete
if (typeof accumulator[key] === 'string') {
[7747] Fix | Delete
accumulator[key] = [accumulator[key]];
[7748] Fix | Delete
} else if (!Array.isArray(accumulator[key])) {
[7749] Fix | Delete
accumulator[key] = [];
[7750] Fix | Delete
}
[7751] Fix | Delete
}
[7752] Fix | Delete
return accumulator;
[7753] Fix | Delete
}, {});
[7754] Fix | Delete
}
[7755] Fix | Delete
[7756] Fix | Delete
/**
[7757] Fix | Delete
* Filter block attributes by `role` and return their names.
[7758] Fix | Delete
*
[7759] Fix | Delete
* @param {string} name Block attribute's name.
[7760] Fix | Delete
* @param {string} role The role of a block attribute.
[7761] Fix | Delete
*
[7762] Fix | Delete
* @return {string[]} The attribute names that have the provided role.
[7763] Fix | Delete
*/
[7764] Fix | Delete
function __experimentalGetBlockAttributesNamesByRole(name, role) {
[7765] Fix | Delete
const attributes = getBlockType(name)?.attributes;
[7766] Fix | Delete
if (!attributes) {
[7767] Fix | Delete
return [];
[7768] Fix | Delete
}
[7769] Fix | Delete
const attributesNames = Object.keys(attributes);
[7770] Fix | Delete
if (!role) {
[7771] Fix | Delete
return attributesNames;
[7772] Fix | Delete
}
[7773] Fix | Delete
return attributesNames.filter(attributeName => attributes[attributeName]?.__experimentalRole === role);
[7774] Fix | Delete
}
[7775] Fix | Delete
[7776] Fix | Delete
/**
[7777] Fix | Delete
* Return a new object with the specified keys omitted.
[7778] Fix | Delete
*
[7779] Fix | Delete
* @param {Object} object Original object.
[7780] Fix | Delete
* @param {Array} keys Keys to be omitted.
[7781] Fix | Delete
*
[7782] Fix | Delete
* @return {Object} Object with omitted keys.
[7783] Fix | Delete
*/
[7784] Fix | Delete
function omit(object, keys) {
[7785] Fix | Delete
return Object.fromEntries(Object.entries(object).filter(([key]) => !keys.includes(key)));
[7786] Fix | Delete
}
[7787] Fix | Delete
[7788] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/blocks/build-module/store/reducer.js
[7789] Fix | Delete
/**
[7790] Fix | Delete
* External dependencies
[7791] Fix | Delete
*/
[7792] Fix | Delete
[7793] Fix | Delete
[7794] Fix | Delete
/**
[7795] Fix | Delete
* WordPress dependencies
[7796] Fix | Delete
*/
[7797] Fix | Delete
[7798] Fix | Delete
[7799] Fix | Delete
[7800] Fix | Delete
/**
[7801] Fix | Delete
* Internal dependencies
[7802] Fix | Delete
*/
[7803] Fix | Delete
[7804] Fix | Delete
[7805] Fix | Delete
/**
[7806] Fix | Delete
* @typedef {Object} WPBlockCategory
[7807] Fix | Delete
*
[7808] Fix | Delete
* @property {string} slug Unique category slug.
[7809] Fix | Delete
* @property {string} title Category label, for display in user interface.
[7810] Fix | Delete
*/
[7811] Fix | Delete
[7812] Fix | Delete
/**
[7813] Fix | Delete
* Default set of categories.
[7814] Fix | Delete
*
[7815] Fix | Delete
* @type {WPBlockCategory[]}
[7816] Fix | Delete
*/
[7817] Fix | Delete
const DEFAULT_CATEGORIES = [{
[7818] Fix | Delete
slug: 'text',
[7819] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Text')
[7820] Fix | Delete
}, {
[7821] Fix | Delete
slug: 'media',
[7822] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Media')
[7823] Fix | Delete
}, {
[7824] Fix | Delete
slug: 'design',
[7825] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Design')
[7826] Fix | Delete
}, {
[7827] Fix | Delete
slug: 'widgets',
[7828] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Widgets')
[7829] Fix | Delete
}, {
[7830] Fix | Delete
slug: 'theme',
[7831] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Theme')
[7832] Fix | Delete
}, {
[7833] Fix | Delete
slug: 'embed',
[7834] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Embeds')
[7835] Fix | Delete
}, {
[7836] Fix | Delete
slug: 'reusable',
[7837] Fix | Delete
title: (0,external_wp_i18n_namespaceObject.__)('Reusable blocks')
[7838] Fix | Delete
}];
[7839] Fix | Delete
[7840] Fix | Delete
// Key block types by their name.
[7841] Fix | Delete
function keyBlockTypesByName(types) {
[7842] Fix | Delete
return types.reduce((newBlockTypes, block) => ({
[7843] Fix | Delete
...newBlockTypes,
[7844] Fix | Delete
[block.name]: block
[7845] Fix | Delete
}), {});
[7846] Fix | Delete
}
[7847] Fix | Delete
[7848] Fix | Delete
// Filter items to ensure they're unique by their name.
[7849] Fix | Delete
function getUniqueItemsByName(items) {
[7850] Fix | Delete
return items.reduce((acc, currentItem) => {
[7851] Fix | Delete
if (!acc.some(item => item.name === currentItem.name)) {
[7852] Fix | Delete
acc.push(currentItem);
[7853] Fix | Delete
}
[7854] Fix | Delete
return acc;
[7855] Fix | Delete
}, []);
[7856] Fix | Delete
}
[7857] Fix | Delete
function bootstrappedBlockTypes(state = {}, action) {
[7858] Fix | Delete
switch (action.type) {
[7859] Fix | Delete
case 'ADD_BOOTSTRAPPED_BLOCK_TYPE':
[7860] Fix | Delete
const {
[7861] Fix | Delete
name,
[7862] Fix | Delete
blockType
[7863] Fix | Delete
} = action;
[7864] Fix | Delete
const serverDefinition = state[name];
[7865] Fix | Delete
let newDefinition;
[7866] Fix | Delete
// Don't overwrite if already set. It covers the case when metadata
[7867] Fix | Delete
// was initialized from the server.
[7868] Fix | Delete
if (serverDefinition) {
[7869] Fix | Delete
// The `blockHooks` prop is not yet included in the server provided
[7870] Fix | Delete
// definitions and needs to be polyfilled. This can be removed when the
[7871] Fix | Delete
// minimum supported WordPress is >= 6.4.
[7872] Fix | Delete
if (serverDefinition.blockHooks === undefined && blockType.blockHooks) {
[7873] Fix | Delete
newDefinition = {
[7874] Fix | Delete
...serverDefinition,
[7875] Fix | Delete
...newDefinition,
[7876] Fix | Delete
blockHooks: blockType.blockHooks
[7877] Fix | Delete
};
[7878] Fix | Delete
}
[7879] Fix | Delete
[7880] Fix | Delete
// The `allowedBlocks` prop is not yet included in the server provided
[7881] Fix | Delete
// definitions and needs to be polyfilled. This can be removed when the
[7882] Fix | Delete
// minimum supported WordPress is >= 6.5.
[7883] Fix | Delete
if (serverDefinition.allowedBlocks === undefined && blockType.allowedBlocks) {
[7884] Fix | Delete
newDefinition = {
[7885] Fix | Delete
...serverDefinition,
[7886] Fix | Delete
...newDefinition,
[7887] Fix | Delete
allowedBlocks: blockType.allowedBlocks
[7888] Fix | Delete
};
[7889] Fix | Delete
}
[7890] Fix | Delete
} else {
[7891] Fix | Delete
newDefinition = Object.fromEntries(Object.entries(blockType).filter(([, value]) => value !== null && value !== undefined).map(([key, value]) => [camelCase(key), value]));
[7892] Fix | Delete
newDefinition.name = name;
[7893] Fix | Delete
}
[7894] Fix | Delete
if (newDefinition) {
[7895] Fix | Delete
return {
[7896] Fix | Delete
...state,
[7897] Fix | Delete
[name]: newDefinition
[7898] Fix | Delete
};
[7899] Fix | Delete
}
[7900] Fix | Delete
return state;
[7901] Fix | Delete
case 'REMOVE_BLOCK_TYPES':
[7902] Fix | Delete
return omit(state, action.names);
[7903] Fix | Delete
}
[7904] Fix | Delete
return state;
[7905] Fix | Delete
}
[7906] Fix | Delete
[7907] Fix | Delete
/**
[7908] Fix | Delete
* Reducer managing the unprocessed block types in a form passed when registering the by block.
[7909] Fix | Delete
* It's for internal use only. It allows recomputing the processed block types on-demand after block type filters
[7910] Fix | Delete
* get added or removed.
[7911] Fix | Delete
*
[7912] Fix | Delete
* @param {Object} state Current state.
[7913] Fix | Delete
* @param {Object} action Dispatched action.
[7914] Fix | Delete
*
[7915] Fix | Delete
* @return {Object} Updated state.
[7916] Fix | Delete
*/
[7917] Fix | Delete
function unprocessedBlockTypes(state = {}, action) {
[7918] Fix | Delete
switch (action.type) {
[7919] Fix | Delete
case 'ADD_UNPROCESSED_BLOCK_TYPE':
[7920] Fix | Delete
return {
[7921] Fix | Delete
...state,
[7922] Fix | Delete
[action.name]: action.blockType
[7923] Fix | Delete
};
[7924] Fix | Delete
case 'REMOVE_BLOCK_TYPES':
[7925] Fix | Delete
return omit(state, action.names);
[7926] Fix | Delete
}
[7927] Fix | Delete
return state;
[7928] Fix | Delete
}
[7929] Fix | Delete
[7930] Fix | Delete
/**
[7931] Fix | Delete
* Reducer managing the processed block types with all filters applied.
[7932] Fix | Delete
* The state is derived from the `unprocessedBlockTypes` reducer.
[7933] Fix | Delete
*
[7934] Fix | Delete
* @param {Object} state Current state.
[7935] Fix | Delete
* @param {Object} action Dispatched action.
[7936] Fix | Delete
*
[7937] Fix | Delete
* @return {Object} Updated state.
[7938] Fix | Delete
*/
[7939] Fix | Delete
function blockTypes(state = {}, action) {
[7940] Fix | Delete
switch (action.type) {
[7941] Fix | Delete
case 'ADD_BLOCK_TYPES':
[7942] Fix | Delete
return {
[7943] Fix | Delete
...state,
[7944] Fix | Delete
...keyBlockTypesByName(action.blockTypes)
[7945] Fix | Delete
};
[7946] Fix | Delete
case 'REMOVE_BLOCK_TYPES':
[7947] Fix | Delete
return omit(state, action.names);
[7948] Fix | Delete
}
[7949] Fix | Delete
return state;
[7950] Fix | Delete
}
[7951] Fix | Delete
[7952] Fix | Delete
/**
[7953] Fix | Delete
* Reducer managing the block styles.
[7954] Fix | Delete
*
[7955] Fix | Delete
* @param {Object} state Current state.
[7956] Fix | Delete
* @param {Object} action Dispatched action.
[7957] Fix | Delete
*
[7958] Fix | Delete
* @return {Object} Updated state.
[7959] Fix | Delete
*/
[7960] Fix | Delete
function blockStyles(state = {}, action) {
[7961] Fix | Delete
var _state$action$blockNa;
[7962] Fix | Delete
switch (action.type) {
[7963] Fix | Delete
case 'ADD_BLOCK_TYPES':
[7964] Fix | Delete
return {
[7965] Fix | Delete
...state,
[7966] Fix | Delete
...Object.fromEntries(Object.entries(keyBlockTypesByName(action.blockTypes)).map(([name, blockType]) => {
[7967] Fix | Delete
var _blockType$styles, _state$blockType$name;
[7968] Fix | Delete
return [name, getUniqueItemsByName([...((_blockType$styles = blockType.styles) !== null && _blockType$styles !== void 0 ? _blockType$styles : []).map(style => ({
[7969] Fix | Delete
...style,
[7970] Fix | Delete
source: 'block'
[7971] Fix | Delete
})), ...((_state$blockType$name = state[blockType.name]) !== null && _state$blockType$name !== void 0 ? _state$blockType$name : []).filter(({
[7972] Fix | Delete
source
[7973] Fix | Delete
}) => 'block' !== source)])];
[7974] Fix | Delete
}))
[7975] Fix | Delete
};
[7976] Fix | Delete
case 'ADD_BLOCK_STYLES':
[7977] Fix | Delete
const updatedStyles = {};
[7978] Fix | Delete
action.blockNames.forEach(blockName => {
[7979] Fix | Delete
var _state$blockName;
[7980] Fix | Delete
updatedStyles[blockName] = getUniqueItemsByName([...((_state$blockName = state[blockName]) !== null && _state$blockName !== void 0 ? _state$blockName : []), ...action.styles]);
[7981] Fix | Delete
});
[7982] Fix | Delete
return {
[7983] Fix | Delete
...state,
[7984] Fix | Delete
...updatedStyles
[7985] Fix | Delete
};
[7986] Fix | Delete
case 'REMOVE_BLOCK_STYLES':
[7987] Fix | Delete
return {
[7988] Fix | Delete
...state,
[7989] Fix | Delete
[action.blockName]: ((_state$action$blockNa = state[action.blockName]) !== null && _state$action$blockNa !== void 0 ? _state$action$blockNa : []).filter(style => action.styleNames.indexOf(style.name) === -1)
[7990] Fix | Delete
};
[7991] Fix | Delete
}
[7992] Fix | Delete
return state;
[7993] Fix | Delete
}
[7994] Fix | Delete
[7995] Fix | Delete
/**
[7996] Fix | Delete
* Reducer managing the block variations.
[7997] Fix | Delete
*
[7998] Fix | Delete
* @param {Object} state Current state.
[7999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function