Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../js/dist
File: block-editor.js
// Safari does not always update the duotone filter when the duotone colors
[33000] Fix | Delete
// are changed. This browser check is later used to force a re-render of the block
[33001] Fix | Delete
// element to ensure the duotone filter is updated. The check is included at the
[33002] Fix | Delete
// root of this file as it only needs to be run once per page load.
[33003] Fix | Delete
const isSafari = window?.navigator.userAgent && window.navigator.userAgent.includes('Safari') && !window.navigator.userAgent.includes('Chrome') && !window.navigator.userAgent.includes('Chromium');
[33004] Fix | Delete
k([names]);
[33005] Fix | Delete
function useMultiOriginPresets({
[33006] Fix | Delete
presetSetting,
[33007] Fix | Delete
defaultSetting
[33008] Fix | Delete
}) {
[33009] Fix | Delete
const [enableDefault, userPresets, themePresets, defaultPresets] = use_settings_useSettings(defaultSetting, `${presetSetting}.custom`, `${presetSetting}.theme`, `${presetSetting}.default`);
[33010] Fix | Delete
return (0,external_wp_element_namespaceObject.useMemo)(() => [...(userPresets || duotone_EMPTY_ARRAY), ...(themePresets || duotone_EMPTY_ARRAY), ...(enableDefault && defaultPresets || duotone_EMPTY_ARRAY)], [enableDefault, userPresets, themePresets, defaultPresets]);
[33011] Fix | Delete
}
[33012] Fix | Delete
function getColorsFromDuotonePreset(duotone, duotonePalette) {
[33013] Fix | Delete
if (!duotone) {
[33014] Fix | Delete
return;
[33015] Fix | Delete
}
[33016] Fix | Delete
const preset = duotonePalette?.find(({
[33017] Fix | Delete
slug
[33018] Fix | Delete
}) => {
[33019] Fix | Delete
return duotone === `var:preset|duotone|${slug}`;
[33020] Fix | Delete
});
[33021] Fix | Delete
return preset ? preset.colors : undefined;
[33022] Fix | Delete
}
[33023] Fix | Delete
function getDuotonePresetFromColors(colors, duotonePalette) {
[33024] Fix | Delete
if (!colors || !Array.isArray(colors)) {
[33025] Fix | Delete
return;
[33026] Fix | Delete
}
[33027] Fix | Delete
const preset = duotonePalette?.find(duotonePreset => {
[33028] Fix | Delete
return duotonePreset?.colors?.every((val, index) => val === colors[index]);
[33029] Fix | Delete
});
[33030] Fix | Delete
return preset ? `var:preset|duotone|${preset.slug}` : undefined;
[33031] Fix | Delete
}
[33032] Fix | Delete
function DuotonePanelPure({
[33033] Fix | Delete
style,
[33034] Fix | Delete
setAttributes,
[33035] Fix | Delete
name
[33036] Fix | Delete
}) {
[33037] Fix | Delete
const duotoneStyle = style?.color?.duotone;
[33038] Fix | Delete
const settings = useBlockSettings(name);
[33039] Fix | Delete
const blockEditingMode = useBlockEditingMode();
[33040] Fix | Delete
const duotonePalette = useMultiOriginPresets({
[33041] Fix | Delete
presetSetting: 'color.duotone',
[33042] Fix | Delete
defaultSetting: 'color.defaultDuotone'
[33043] Fix | Delete
});
[33044] Fix | Delete
const colorPalette = useMultiOriginPresets({
[33045] Fix | Delete
presetSetting: 'color.palette',
[33046] Fix | Delete
defaultSetting: 'color.defaultPalette'
[33047] Fix | Delete
});
[33048] Fix | Delete
const [enableCustomColors, enableCustomDuotone] = use_settings_useSettings('color.custom', 'color.customDuotone');
[33049] Fix | Delete
const disableCustomColors = !enableCustomColors;
[33050] Fix | Delete
const disableCustomDuotone = !enableCustomDuotone || colorPalette?.length === 0 && disableCustomColors;
[33051] Fix | Delete
if (duotonePalette?.length === 0 && disableCustomDuotone) {
[33052] Fix | Delete
return null;
[33053] Fix | Delete
}
[33054] Fix | Delete
if (blockEditingMode !== 'default') {
[33055] Fix | Delete
return null;
[33056] Fix | Delete
}
[33057] Fix | Delete
const duotonePresetOrColors = !Array.isArray(duotoneStyle) ? getColorsFromDuotonePreset(duotoneStyle, duotonePalette) : duotoneStyle;
[33058] Fix | Delete
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, {
[33059] Fix | Delete
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(inspector_controls, {
[33060] Fix | Delete
group: "filter",
[33061] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FiltersPanel, {
[33062] Fix | Delete
value: {
[33063] Fix | Delete
filter: {
[33064] Fix | Delete
duotone: duotonePresetOrColors
[33065] Fix | Delete
}
[33066] Fix | Delete
},
[33067] Fix | Delete
onChange: newDuotone => {
[33068] Fix | Delete
const newStyle = {
[33069] Fix | Delete
...style,
[33070] Fix | Delete
color: {
[33071] Fix | Delete
...newDuotone?.filter
[33072] Fix | Delete
}
[33073] Fix | Delete
};
[33074] Fix | Delete
setAttributes({
[33075] Fix | Delete
style: newStyle
[33076] Fix | Delete
});
[33077] Fix | Delete
},
[33078] Fix | Delete
settings: settings
[33079] Fix | Delete
})
[33080] Fix | Delete
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(block_controls, {
[33081] Fix | Delete
group: "block",
[33082] Fix | Delete
__experimentalShareWithChildBlocks: true,
[33083] Fix | Delete
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(duotone_control, {
[33084] Fix | Delete
duotonePalette: duotonePalette,
[33085] Fix | Delete
colorPalette: colorPalette,
[33086] Fix | Delete
disableCustomDuotone: disableCustomDuotone,
[33087] Fix | Delete
disableCustomColors: disableCustomColors,
[33088] Fix | Delete
value: duotonePresetOrColors,
[33089] Fix | Delete
onChange: newDuotone => {
[33090] Fix | Delete
const maybePreset = getDuotonePresetFromColors(newDuotone, duotonePalette);
[33091] Fix | Delete
const newStyle = {
[33092] Fix | Delete
...style,
[33093] Fix | Delete
color: {
[33094] Fix | Delete
...style?.color,
[33095] Fix | Delete
duotone: maybePreset !== null && maybePreset !== void 0 ? maybePreset : newDuotone // use preset or fallback to custom colors.
[33096] Fix | Delete
}
[33097] Fix | Delete
};
[33098] Fix | Delete
setAttributes({
[33099] Fix | Delete
style: newStyle
[33100] Fix | Delete
});
[33101] Fix | Delete
},
[33102] Fix | Delete
settings: settings
[33103] Fix | Delete
})
[33104] Fix | Delete
})]
[33105] Fix | Delete
});
[33106] Fix | Delete
}
[33107] Fix | Delete
/* harmony default export */ const duotone = ({
[33108] Fix | Delete
shareWithChildBlocks: true,
[33109] Fix | Delete
edit: DuotonePanelPure,
[33110] Fix | Delete
useBlockProps: duotone_useBlockProps,
[33111] Fix | Delete
attributeKeys: ['style'],
[33112] Fix | Delete
hasSupport(name) {
[33113] Fix | Delete
return (0,external_wp_blocks_namespaceObject.hasBlockSupport)(name, 'filter.duotone');
[33114] Fix | Delete
}
[33115] Fix | Delete
});
[33116] Fix | Delete
[33117] Fix | Delete
/**
[33118] Fix | Delete
* Filters registered block settings, extending attributes to include
[33119] Fix | Delete
* the `duotone` attribute.
[33120] Fix | Delete
*
[33121] Fix | Delete
* @param {Object} settings Original block settings.
[33122] Fix | Delete
*
[33123] Fix | Delete
* @return {Object} Filtered block settings.
[33124] Fix | Delete
*/
[33125] Fix | Delete
function addDuotoneAttributes(settings) {
[33126] Fix | Delete
// Previous `color.__experimentalDuotone` support flag is migrated via
[33127] Fix | Delete
// block_type_metadata_settings filter in `lib/block-supports/duotone.php`.
[33128] Fix | Delete
if (!(0,external_wp_blocks_namespaceObject.hasBlockSupport)(settings, 'filter.duotone')) {
[33129] Fix | Delete
return settings;
[33130] Fix | Delete
}
[33131] Fix | Delete
[33132] Fix | Delete
// Allow blocks to specify their own attribute definition with default
[33133] Fix | Delete
// values if needed.
[33134] Fix | Delete
if (!settings.attributes.style) {
[33135] Fix | Delete
Object.assign(settings.attributes, {
[33136] Fix | Delete
style: {
[33137] Fix | Delete
type: 'object'
[33138] Fix | Delete
}
[33139] Fix | Delete
});
[33140] Fix | Delete
}
[33141] Fix | Delete
return settings;
[33142] Fix | Delete
}
[33143] Fix | Delete
function useDuotoneStyles({
[33144] Fix | Delete
clientId,
[33145] Fix | Delete
id: filterId,
[33146] Fix | Delete
selector: duotoneSelector,
[33147] Fix | Delete
attribute: duotoneAttr
[33148] Fix | Delete
}) {
[33149] Fix | Delete
const duotonePalette = useMultiOriginPresets({
[33150] Fix | Delete
presetSetting: 'color.duotone',
[33151] Fix | Delete
defaultSetting: 'color.defaultDuotone'
[33152] Fix | Delete
});
[33153] Fix | Delete
[33154] Fix | Delete
// Possible values for duotone attribute:
[33155] Fix | Delete
// 1. Array of colors - e.g. ['#000000', '#ffffff'].
[33156] Fix | Delete
// 2. Variable for an existing Duotone preset - e.g. 'var:preset|duotone|green-blue' or 'var(--wp--preset--duotone--green-blue)''
[33157] Fix | Delete
// 3. A CSS string - e.g. 'unset' to remove globally applied duotone.
[33158] Fix | Delete
const isCustom = Array.isArray(duotoneAttr);
[33159] Fix | Delete
const duotonePreset = isCustom ? undefined : getColorsFromDuotonePreset(duotoneAttr, duotonePalette);
[33160] Fix | Delete
const isPreset = typeof duotoneAttr === 'string' && duotonePreset;
[33161] Fix | Delete
const isCSS = typeof duotoneAttr === 'string' && !isPreset;
[33162] Fix | Delete
[33163] Fix | Delete
// Match the structure of WP_Duotone_Gutenberg::render_duotone_support() in PHP.
[33164] Fix | Delete
let colors = null;
[33165] Fix | Delete
if (isPreset) {
[33166] Fix | Delete
// Array of colors.
[33167] Fix | Delete
colors = duotonePreset;
[33168] Fix | Delete
} else if (isCSS) {
[33169] Fix | Delete
// CSS filter property string (e.g. 'unset').
[33170] Fix | Delete
colors = duotoneAttr;
[33171] Fix | Delete
} else if (isCustom) {
[33172] Fix | Delete
// Array of colors.
[33173] Fix | Delete
colors = duotoneAttr;
[33174] Fix | Delete
}
[33175] Fix | Delete
[33176] Fix | Delete
// Build the CSS selectors to which the filter will be applied.
[33177] Fix | Delete
const selectors = duotoneSelector.split(',');
[33178] Fix | Delete
const selectorsScoped = selectors.map(selectorPart => {
[33179] Fix | Delete
// Extra .editor-styles-wrapper specificity is needed in the editor
[33180] Fix | Delete
// since we're not using inline styles to apply the filter. We need to
[33181] Fix | Delete
// override duotone applied by global styles and theme.json.
[33182] Fix | Delete
[33183] Fix | Delete
// Assuming the selector part is a subclass selector (not a tag name)
[33184] Fix | Delete
// so we can prepend the filter id class. If we want to support elements
[33185] Fix | Delete
// such as `img` or namespaces, we'll need to add a case for that here.
[33186] Fix | Delete
return `.${filterId}${selectorPart.trim()}`;
[33187] Fix | Delete
});
[33188] Fix | Delete
const selector = selectorsScoped.join(', ');
[33189] Fix | Delete
const isValidFilter = Array.isArray(colors) || colors === 'unset';
[33190] Fix | Delete
useStyleOverride(isValidFilter ? {
[33191] Fix | Delete
css: colors !== 'unset' ? getDuotoneStylesheet(selector, filterId) : getDuotoneUnsetStylesheet(selector),
[33192] Fix | Delete
__unstableType: 'presets'
[33193] Fix | Delete
} : undefined);
[33194] Fix | Delete
useStyleOverride(isValidFilter ? {
[33195] Fix | Delete
assets: colors !== 'unset' ? getDuotoneFilter(filterId, colors) : '',
[33196] Fix | Delete
__unstableType: 'svgs'
[33197] Fix | Delete
} : undefined);
[33198] Fix | Delete
const blockElement = useBlockElement(clientId);
[33199] Fix | Delete
(0,external_wp_element_namespaceObject.useEffect)(() => {
[33200] Fix | Delete
if (!isValidFilter) {
[33201] Fix | Delete
return;
[33202] Fix | Delete
}
[33203] Fix | Delete
[33204] Fix | Delete
// Safari does not always update the duotone filter when the duotone
[33205] Fix | Delete
// colors are changed. When using Safari, force the block element to be
[33206] Fix | Delete
// repainted by the browser to ensure any changes are reflected
[33207] Fix | Delete
// visually. This logic matches that used on the site frontend in
[33208] Fix | Delete
// `block-supports/duotone.php`.
[33209] Fix | Delete
if (blockElement && isSafari) {
[33210] Fix | Delete
const display = blockElement.style.display;
[33211] Fix | Delete
// Switch to `inline-block` to force a repaint. In the editor,
[33212] Fix | Delete
// `inline-block` is used instead of `none` to ensure that scroll
[33213] Fix | Delete
// position is not affected, as `none` results in the editor
[33214] Fix | Delete
// scrolling to the top of the block.
[33215] Fix | Delete
blockElement.style.display = 'inline-block';
[33216] Fix | Delete
// Simply accessing el.offsetHeight flushes layout and style changes
[33217] Fix | Delete
// in WebKit without having to wait for setTimeout.
[33218] Fix | Delete
// eslint-disable-next-line no-unused-expressions
[33219] Fix | Delete
blockElement.offsetHeight;
[33220] Fix | Delete
blockElement.style.display = display;
[33221] Fix | Delete
}
[33222] Fix | Delete
// `colors` must be a dependency so this effect runs when the colors
[33223] Fix | Delete
// change in Safari.
[33224] Fix | Delete
}, [isValidFilter, blockElement, colors]);
[33225] Fix | Delete
}
[33226] Fix | Delete
function duotone_useBlockProps({
[33227] Fix | Delete
clientId,
[33228] Fix | Delete
name,
[33229] Fix | Delete
style
[33230] Fix | Delete
}) {
[33231] Fix | Delete
const id = (0,external_wp_compose_namespaceObject.useInstanceId)(duotone_useBlockProps);
[33232] Fix | Delete
const selector = (0,external_wp_element_namespaceObject.useMemo)(() => {
[33233] Fix | Delete
const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(name);
[33234] Fix | Delete
if (blockType) {
[33235] Fix | Delete
// Backwards compatibility for `supports.color.__experimentalDuotone`
[33236] Fix | Delete
// is provided via the `block_type_metadata_settings` filter. If
[33237] Fix | Delete
// `supports.filter.duotone` has not been set and the
[33238] Fix | Delete
// experimental property has been, the experimental property
[33239] Fix | Delete
// value is copied into `supports.filter.duotone`.
[33240] Fix | Delete
const duotoneSupport = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'filter.duotone', false);
[33241] Fix | Delete
if (!duotoneSupport) {
[33242] Fix | Delete
return null;
[33243] Fix | Delete
}
[33244] Fix | Delete
[33245] Fix | Delete
// If the experimental duotone support was set, that value is
[33246] Fix | Delete
// to be treated as a selector and requires scoping.
[33247] Fix | Delete
const experimentalDuotone = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, 'color.__experimentalDuotone', false);
[33248] Fix | Delete
if (experimentalDuotone) {
[33249] Fix | Delete
const rootSelector = getBlockCSSSelector(blockType);
[33250] Fix | Delete
return typeof experimentalDuotone === 'string' ? scopeSelector(rootSelector, experimentalDuotone) : rootSelector;
[33251] Fix | Delete
}
[33252] Fix | Delete
[33253] Fix | Delete
// Regular filter.duotone support uses filter.duotone selectors with fallbacks.
[33254] Fix | Delete
return getBlockCSSSelector(blockType, 'filter.duotone', {
[33255] Fix | Delete
fallback: true
[33256] Fix | Delete
});
[33257] Fix | Delete
}
[33258] Fix | Delete
}, [name]);
[33259] Fix | Delete
const attribute = style?.color?.duotone;
[33260] Fix | Delete
const filterClass = `wp-duotone-${id}`;
[33261] Fix | Delete
const shouldRender = selector && attribute;
[33262] Fix | Delete
useDuotoneStyles({
[33263] Fix | Delete
clientId,
[33264] Fix | Delete
id: filterClass,
[33265] Fix | Delete
selector,
[33266] Fix | Delete
attribute
[33267] Fix | Delete
});
[33268] Fix | Delete
return {
[33269] Fix | Delete
className: shouldRender ? filterClass : ''
[33270] Fix | Delete
};
[33271] Fix | Delete
}
[33272] Fix | Delete
(0,external_wp_hooks_namespaceObject.addFilter)('blocks.registerBlockType', 'core/editor/duotone/add-attributes', addDuotoneAttributes);
[33273] Fix | Delete
[33274] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/components/use-block-display-information/index.js
[33275] Fix | Delete
/**
[33276] Fix | Delete
* WordPress dependencies
[33277] Fix | Delete
*/
[33278] Fix | Delete
[33279] Fix | Delete
[33280] Fix | Delete
[33281] Fix | Delete
[33282] Fix | Delete
/**
[33283] Fix | Delete
* Internal dependencies
[33284] Fix | Delete
*/
[33285] Fix | Delete
[33286] Fix | Delete
[33287] Fix | Delete
/** @typedef {import('@wordpress/blocks').WPIcon} WPIcon */
[33288] Fix | Delete
[33289] Fix | Delete
/**
[33290] Fix | Delete
* Contains basic block's information for display reasons.
[33291] Fix | Delete
*
[33292] Fix | Delete
* @typedef {Object} WPBlockDisplayInformation
[33293] Fix | Delete
*
[33294] Fix | Delete
* @property {boolean} isSynced True if is a reusable block or template part
[33295] Fix | Delete
* @property {string} title Human-readable block type label.
[33296] Fix | Delete
* @property {WPIcon} icon Block type icon.
[33297] Fix | Delete
* @property {string} description A detailed block type description.
[33298] Fix | Delete
* @property {string} anchor HTML anchor.
[33299] Fix | Delete
* @property {name} name A custom, human readable name for the block.
[33300] Fix | Delete
*/
[33301] Fix | Delete
[33302] Fix | Delete
/**
[33303] Fix | Delete
* Get the display label for a block's position type.
[33304] Fix | Delete
*
[33305] Fix | Delete
* @param {Object} attributes Block attributes.
[33306] Fix | Delete
* @return {string} The position type label.
[33307] Fix | Delete
*/
[33308] Fix | Delete
function getPositionTypeLabel(attributes) {
[33309] Fix | Delete
const positionType = attributes?.style?.position?.type;
[33310] Fix | Delete
if (positionType === 'sticky') {
[33311] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Sticky');
[33312] Fix | Delete
}
[33313] Fix | Delete
if (positionType === 'fixed') {
[33314] Fix | Delete
return (0,external_wp_i18n_namespaceObject.__)('Fixed');
[33315] Fix | Delete
}
[33316] Fix | Delete
return null;
[33317] Fix | Delete
}
[33318] Fix | Delete
[33319] Fix | Delete
/**
[33320] Fix | Delete
* Hook used to try to find a matching block variation and return
[33321] Fix | Delete
* the appropriate information for display reasons. In order to
[33322] Fix | Delete
* to try to find a match we need to things:
[33323] Fix | Delete
* 1. Block's client id to extract it's current attributes.
[33324] Fix | Delete
* 2. A block variation should have set `isActive` prop to a proper function.
[33325] Fix | Delete
*
[33326] Fix | Delete
* If for any reason a block variation match cannot be found,
[33327] Fix | Delete
* the returned information come from the Block Type.
[33328] Fix | Delete
* If no blockType is found with the provided clientId, returns null.
[33329] Fix | Delete
*
[33330] Fix | Delete
* @param {string} clientId Block's client id.
[33331] Fix | Delete
* @return {?WPBlockDisplayInformation} Block's display information, or `null` when the block or its type not found.
[33332] Fix | Delete
*/
[33333] Fix | Delete
[33334] Fix | Delete
function useBlockDisplayInformation(clientId) {
[33335] Fix | Delete
return (0,external_wp_data_namespaceObject.useSelect)(select => {
[33336] Fix | Delete
if (!clientId) {
[33337] Fix | Delete
return null;
[33338] Fix | Delete
}
[33339] Fix | Delete
const {
[33340] Fix | Delete
getBlockName,
[33341] Fix | Delete
getBlockAttributes
[33342] Fix | Delete
} = select(store);
[33343] Fix | Delete
const {
[33344] Fix | Delete
getBlockType,
[33345] Fix | Delete
getActiveBlockVariation
[33346] Fix | Delete
} = select(external_wp_blocks_namespaceObject.store);
[33347] Fix | Delete
const blockName = getBlockName(clientId);
[33348] Fix | Delete
const blockType = getBlockType(blockName);
[33349] Fix | Delete
if (!blockType) {
[33350] Fix | Delete
return null;
[33351] Fix | Delete
}
[33352] Fix | Delete
const attributes = getBlockAttributes(clientId);
[33353] Fix | Delete
const match = getActiveBlockVariation(blockName, attributes);
[33354] Fix | Delete
const isSynced = (0,external_wp_blocks_namespaceObject.isReusableBlock)(blockType) || (0,external_wp_blocks_namespaceObject.isTemplatePart)(blockType);
[33355] Fix | Delete
const syncedTitle = isSynced ? (0,external_wp_blocks_namespaceObject.__experimentalGetBlockLabel)(blockType, attributes) : undefined;
[33356] Fix | Delete
const title = syncedTitle || blockType.title;
[33357] Fix | Delete
const positionLabel = getPositionTypeLabel(attributes);
[33358] Fix | Delete
const blockTypeInfo = {
[33359] Fix | Delete
isSynced,
[33360] Fix | Delete
title,
[33361] Fix | Delete
icon: blockType.icon,
[33362] Fix | Delete
description: blockType.description,
[33363] Fix | Delete
anchor: attributes?.anchor,
[33364] Fix | Delete
positionLabel,
[33365] Fix | Delete
positionType: attributes?.style?.position?.type,
[33366] Fix | Delete
name: attributes?.metadata?.name
[33367] Fix | Delete
};
[33368] Fix | Delete
if (!match) {
[33369] Fix | Delete
return blockTypeInfo;
[33370] Fix | Delete
}
[33371] Fix | Delete
return {
[33372] Fix | Delete
isSynced,
[33373] Fix | Delete
title: match.title || blockType.title,
[33374] Fix | Delete
icon: match.icon || blockType.icon,
[33375] Fix | Delete
description: match.description || blockType.description,
[33376] Fix | Delete
anchor: attributes?.anchor,
[33377] Fix | Delete
positionLabel,
[33378] Fix | Delete
positionType: attributes?.style?.position?.type,
[33379] Fix | Delete
name: attributes?.metadata?.name
[33380] Fix | Delete
};
[33381] Fix | Delete
}, [clientId]);
[33382] Fix | Delete
}
[33383] Fix | Delete
[33384] Fix | Delete
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-editor/build-module/hooks/position.js
[33385] Fix | Delete
/**
[33386] Fix | Delete
* External dependencies
[33387] Fix | Delete
*/
[33388] Fix | Delete
[33389] Fix | Delete
[33390] Fix | Delete
/**
[33391] Fix | Delete
* WordPress dependencies
[33392] Fix | Delete
*/
[33393] Fix | Delete
[33394] Fix | Delete
[33395] Fix | Delete
[33396] Fix | Delete
[33397] Fix | Delete
[33398] Fix | Delete
[33399] Fix | Delete
[33400] Fix | Delete
/**
[33401] Fix | Delete
* Internal dependencies
[33402] Fix | Delete
*/
[33403] Fix | Delete
[33404] Fix | Delete
[33405] Fix | Delete
[33406] Fix | Delete
[33407] Fix | Delete
[33408] Fix | Delete
[33409] Fix | Delete
[33410] Fix | Delete
const {
[33411] Fix | Delete
CustomSelectControl
[33412] Fix | Delete
} = unlock(external_wp_components_namespaceObject.privateApis);
[33413] Fix | Delete
const POSITION_SUPPORT_KEY = 'position';
[33414] Fix | Delete
const OPTION_CLASSNAME = 'block-editor-hooks__position-selection__select-control__option';
[33415] Fix | Delete
const DEFAULT_OPTION = {
[33416] Fix | Delete
key: 'default',
[33417] Fix | Delete
value: '',
[33418] Fix | Delete
name: (0,external_wp_i18n_namespaceObject.__)('Default'),
[33419] Fix | Delete
className: OPTION_CLASSNAME
[33420] Fix | Delete
};
[33421] Fix | Delete
const STICKY_OPTION = {
[33422] Fix | Delete
key: 'sticky',
[33423] Fix | Delete
value: 'sticky',
[33424] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Sticky', 'Name for the value of the CSS position property'),
[33425] Fix | Delete
className: OPTION_CLASSNAME,
[33426] Fix | Delete
__experimentalHint: (0,external_wp_i18n_namespaceObject.__)('The block will stick to the top of the window instead of scrolling.')
[33427] Fix | Delete
};
[33428] Fix | Delete
const FIXED_OPTION = {
[33429] Fix | Delete
key: 'fixed',
[33430] Fix | Delete
value: 'fixed',
[33431] Fix | Delete
name: (0,external_wp_i18n_namespaceObject._x)('Fixed', 'Name for the value of the CSS position property'),
[33432] Fix | Delete
className: OPTION_CLASSNAME,
[33433] Fix | Delete
__experimentalHint: (0,external_wp_i18n_namespaceObject.__)('The block will not move when the page is scrolled.')
[33434] Fix | Delete
};
[33435] Fix | Delete
const POSITION_SIDES = ['top', 'right', 'bottom', 'left'];
[33436] Fix | Delete
const VALID_POSITION_TYPES = ['sticky', 'fixed'];
[33437] Fix | Delete
[33438] Fix | Delete
/**
[33439] Fix | Delete
* Get calculated position CSS.
[33440] Fix | Delete
*
[33441] Fix | Delete
* @param {Object} props Component props.
[33442] Fix | Delete
* @param {string} props.selector Selector to use.
[33443] Fix | Delete
* @param {Object} props.style Style object.
[33444] Fix | Delete
* @return {string} The generated CSS rules.
[33445] Fix | Delete
*/
[33446] Fix | Delete
function getPositionCSS({
[33447] Fix | Delete
selector,
[33448] Fix | Delete
style
[33449] Fix | Delete
}) {
[33450] Fix | Delete
let output = '';
[33451] Fix | Delete
const {
[33452] Fix | Delete
type: positionType
[33453] Fix | Delete
} = style?.position || {};
[33454] Fix | Delete
if (!VALID_POSITION_TYPES.includes(positionType)) {
[33455] Fix | Delete
return output;
[33456] Fix | Delete
}
[33457] Fix | Delete
output += `${selector} {`;
[33458] Fix | Delete
output += `position: ${positionType};`;
[33459] Fix | Delete
POSITION_SIDES.forEach(side => {
[33460] Fix | Delete
if (style?.position?.[side] !== undefined) {
[33461] Fix | Delete
output += `${side}: ${style.position[side]};`;
[33462] Fix | Delete
}
[33463] Fix | Delete
});
[33464] Fix | Delete
if (positionType === 'sticky' || positionType === 'fixed') {
[33465] Fix | Delete
// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.
[33466] Fix | Delete
output += `z-index: 10`;
[33467] Fix | Delete
}
[33468] Fix | Delete
output += `}`;
[33469] Fix | Delete
return output;
[33470] Fix | Delete
}
[33471] Fix | Delete
[33472] Fix | Delete
/**
[33473] Fix | Delete
* Determines if there is sticky position support.
[33474] Fix | Delete
*
[33475] Fix | Delete
* @param {string|Object} blockType Block name or Block Type object.
[33476] Fix | Delete
*
[33477] Fix | Delete
* @return {boolean} Whether there is support.
[33478] Fix | Delete
*/
[33479] Fix | Delete
function hasStickyPositionSupport(blockType) {
[33480] Fix | Delete
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
[33481] Fix | Delete
return !!(true === support || support?.sticky);
[33482] Fix | Delete
}
[33483] Fix | Delete
[33484] Fix | Delete
/**
[33485] Fix | Delete
* Determines if there is fixed position support.
[33486] Fix | Delete
*
[33487] Fix | Delete
* @param {string|Object} blockType Block name or Block Type object.
[33488] Fix | Delete
*
[33489] Fix | Delete
* @return {boolean} Whether there is support.
[33490] Fix | Delete
*/
[33491] Fix | Delete
function hasFixedPositionSupport(blockType) {
[33492] Fix | Delete
const support = (0,external_wp_blocks_namespaceObject.getBlockSupport)(blockType, POSITION_SUPPORT_KEY);
[33493] Fix | Delete
return !!(true === support || support?.fixed);
[33494] Fix | Delete
}
[33495] Fix | Delete
[33496] Fix | Delete
/**
[33497] Fix | Delete
* Determines if there is position support.
[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