Files
klz-cables.com/.pnpm-store/v10/files/ef/743f21e7710e75cdce9bee48ddcd2c48dae37edc95138e49abcbaf4980490b9b0661b3029115ee0ff2babb8758204939a632f1a01e67cb25a5beadc5e738f2
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

77 lines
2.1 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 lexical = require('lexical');
var react = require('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 CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
/**
* 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.
*
*/
// This workaround is no longer necessary in React 19,
// but we currently support React >=17.x
// https://github.com/facebook/react/pull/26395
const useLayoutEffectImpl = CAN_USE_DOM ? react.useLayoutEffect : react.useEffect;
/**
* 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.
*
*/
function ClearEditorPlugin({
onClear
}) {
const [editor] = LexicalComposerContext.useLexicalComposerContext();
useLayoutEffectImpl(() => {
return editor.registerCommand(lexical.CLEAR_EDITOR_COMMAND, payload => {
editor.update(() => {
if (onClear == null) {
const root = lexical.$getRoot();
const selection = lexical.$getSelection();
const paragraph = lexical.$createParagraphNode();
root.clear();
root.append(paragraph);
if (selection !== null) {
paragraph.select();
}
if (lexical.$isRangeSelection(selection)) {
selection.format = 0;
}
} else {
onClear();
}
});
return true;
}, lexical.COMMAND_PRIORITY_EDITOR);
}, [editor, onClear]);
return null;
}
exports.ClearEditorPlugin = ClearEditorPlugin;