Files
klz-cables.com/.pnpm-store/v10/files/92/020559d6203b5bbb08873c0f1f5f3a88743453083769017cafe8d0d0fa1e09a84b641353e19628e109e651c6daee0da528a0b6664e145390aaa0e0026b75ca
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

117 lines
3.3 KiB
Plaintext

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
var LexicalComposerContext = require('@lexical/react/LexicalComposerContext');
var useLexicalNodeSelection = require('@lexical/react/useLexicalNodeSelection');
var utils = require('@lexical/utils');
var lexical = require('lexical');
var react = require('react');
var jsxRuntime = require('react/jsx-runtime');
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
const INSERT_HORIZONTAL_RULE_COMMAND = lexical.createCommand('INSERT_HORIZONTAL_RULE_COMMAND');
function HorizontalRuleComponent({
nodeKey
}) {
const [editor] = LexicalComposerContext.useLexicalComposerContext();
const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection.useLexicalNodeSelection(nodeKey);
react.useEffect(() => {
return utils.mergeRegister(editor.registerCommand(lexical.CLICK_COMMAND, event => {
const hrElem = editor.getElementByKey(nodeKey);
if (event.target === hrElem) {
if (!event.shiftKey) {
clearSelection();
}
setSelected(!isSelected);
return true;
}
return false;
}, lexical.COMMAND_PRIORITY_LOW));
}, [clearSelection, editor, isSelected, nodeKey, setSelected]);
react.useEffect(() => {
const hrElem = editor.getElementByKey(nodeKey);
const isSelectedClassName = editor._config.theme.hrSelected ?? 'selected';
if (hrElem !== null) {
if (isSelected) {
utils.addClassNamesToElement(hrElem, isSelectedClassName);
} else {
utils.removeClassNamesFromElement(hrElem, isSelectedClassName);
}
}
}, [editor, isSelected, nodeKey]);
return null;
}
class HorizontalRuleNode extends lexical.DecoratorNode {
static getType() {
return 'horizontalrule';
}
static clone(node) {
return new HorizontalRuleNode(node.__key);
}
static importJSON(serializedNode) {
return $createHorizontalRuleNode().updateFromJSON(serializedNode);
}
static importDOM() {
return {
hr: () => ({
conversion: $convertHorizontalRuleElement,
priority: 0
})
};
}
exportDOM() {
return {
element: document.createElement('hr')
};
}
createDOM(config) {
const element = document.createElement('hr');
utils.addClassNamesToElement(element, config.theme.hr);
return element;
}
getTextContent() {
return '\n';
}
isInline() {
return false;
}
updateDOM() {
return false;
}
decorate() {
return /*#__PURE__*/jsxRuntime.jsx(HorizontalRuleComponent, {
nodeKey: this.__key
});
}
}
function $convertHorizontalRuleElement() {
return {
node: $createHorizontalRuleNode()
};
}
function $createHorizontalRuleNode() {
return lexical.$applyNodeReplacement(new HorizontalRuleNode());
}
function $isHorizontalRuleNode(node) {
return node instanceof HorizontalRuleNode;
}
exports.$createHorizontalRuleNode = $createHorizontalRuleNode;
exports.$isHorizontalRuleNode = $isHorizontalRuleNode;
exports.HorizontalRuleNode = HorizontalRuleNode;
exports.INSERT_HORIZONTAL_RULE_COMMAND = INSERT_HORIZONTAL_RULE_COMMAND;