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

10 lines
2.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 e=require("@lexical/link"),t=require("@lexical/react/LexicalComposerContext"),n=require("@lexical/react/LexicalNodeMenuPlugin"),o=require("@lexical/utils"),i=require("lexical"),r=require("react"),l=require("react/jsx-runtime");const s=i.createCommand("INSERT_EMBED_COMMAND");class u extends n.MenuOption{constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}exports.AutoEmbedOption=u,exports.INSERT_EMBED_COMMAND=s,exports.LexicalAutoEmbedPlugin=function({embedConfigs:u,onOpenEmbedModalForConfig:a,getMenuOptions:c,menuRenderFn:d,menuCommandPriority:m=i.COMMAND_PRIORITY_LOW}){const[p]=t.useLexicalComposerContext(),[x,C]=r.useState(null),[f,M]=r.useState(null),g=r.useCallback((()=>{C(null),M(null)}),[]),E=r.useCallback((async t=>{const n=p.getEditorState().read((function(){const n=i.$getNodeByKey(t);if(e.$isLinkNode(n))return n.getURL()}));if(void 0!==n)for(const e of u){null!=await Promise.resolve(e.parseUrl(n))&&(M(e),C(t))}}),[p,u]);r.useEffect((()=>o.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map((e=>p.registerMutationListener(e,((...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has(i.PASTE_TAG)&&n.size<=3?E(o):o===x&&g()})(...e)),{skipInitialization:!0}))))),[E,p,u,x,g]),r.useEffect((()=>p.registerCommand(s,(e=>{const t=u.find((({type:t})=>t===e));return!!t&&(a(t),!0)}),i.COMMAND_PRIORITY_EDITOR)),[p,u,a]);const N=r.useCallback((async function(){if(null!=f&&null!=x){const t=p.getEditorState().read((()=>{const t=i.$getNodeByKey(x);return e.$isLinkNode(t)?t:null}));if(e.$isLinkNode(t)){const e=await Promise.resolve(f.parseUrl(t.__url));null!=e&&p.update((()=>{i.$getSelection()||t.selectEnd(),f.insertNode(p,e),t.isAttached()&&t.remove()}))}}}),[f,p,x]),L=r.useMemo((()=>null!=f&&null!=x?c(f,N,g):[]),[f,N,c,x,g]),A=r.useCallback(((e,t,n)=>{p.update((()=>{e.onSelect(t),n()}))}),[p]);return null!=x?l.jsx(n.LexicalNodeMenuPlugin,{nodeKey:x,onClose:g,onSelectOption:A,options:L,menuRenderFn:d,commandPriority:m}):null},exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;