Files
klz-cables.com/.pnpm-store/v10/files/cf/a290a2de811c117c26f02b9de9fd54b5164a8d65d703c6c8101cdf0425c6a46cd75296cd6968c9220749a4559f59ec30016d0cd834a7e20d272799bdde12d1
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

53 lines
1.5 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.
*
*/
import { TRANSFORMERS, registerMarkdownShortcuts } from '@lexical/markdown';
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
import { HorizontalRuleNode, $isHorizontalRuleNode, $createHorizontalRuleNode } from '@lexical/react/LexicalHorizontalRuleNode';
import { useEffect } from 'react';
/**
* 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 HR = {
dependencies: [HorizontalRuleNode],
export: node => {
return $isHorizontalRuleNode(node) ? '***' : null;
},
regExp: /^(---|\*\*\*|___)\s?$/,
replace: (parentNode, _1, _2, isImport) => {
const line = $createHorizontalRuleNode();
// TODO: Get rid of isImport flag
if (isImport || parentNode.getNextSibling() != null) {
parentNode.replace(line);
} else {
parentNode.insertBefore(line);
}
line.selectNext();
},
type: 'element'
};
const DEFAULT_TRANSFORMERS = [HR, ...TRANSFORMERS];
function MarkdownShortcutPlugin({
transformers = DEFAULT_TRANSFORMERS
}) {
const [editor] = useLexicalComposerContext();
useEffect(() => {
return registerMarkdownShortcuts(editor, transformers);
}, [editor, transformers]);
return null;
}
export { DEFAULT_TRANSFORMERS, MarkdownShortcutPlugin };