import { Menu } from '@headlessui/react' import { PropsWithChildren } from 'react' import { faArrowUpRightFromSquare } from '@fortawesome/free-solid-svg-icons' import { ActionIcon } from './ActionIcon' import styles from './CodeMenu.module.css' import { useConvertToVariable } from 'hooks/useToolbarGuards' import { editorShortcutMeta } from './TextEditor' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { kclManager } from 'lang/KclSingleton' export const CodeMenu = ({ children }: PropsWithChildren) => { const { enable: convertToVarEnabled, handleClick: handleConvertToVarClick } = useConvertToVariable() return (
{ const target = e.target as HTMLElement if (e.eventPhase === 3 && target.closest('a') === null) { e.stopPropagation() e.preventDefault() } }} > {convertToVarEnabled && ( )} Read the KCL docs On GitHub KCL samples On GitHub
) }