diff --git a/next_app/src/components/layout.tsx b/next_app/src/components/layout.tsx index f6bb9ce..395d820 100644 --- a/next_app/src/components/layout.tsx +++ b/next_app/src/components/layout.tsx @@ -202,6 +202,10 @@ const CodeCell = ({ else monaco.editor.setTheme("vs-light"); // set font family editor.updateOptions({ fontFamily: "DM mono" }); + // run function on ctrl+enter + editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, () => { + runCellCode(); + }); }} onChange={(value) => { // console.log(value); @@ -246,10 +250,22 @@ const VisualCell = ( ) => { const [mouseHovered, setMouseHovered] = useState(false); const [editing, setEditing] = useState(file.content.cells[cellId].editing); + const [clickCount, setClickCount] = useState(0); const { theme } = useTheme(); const cellType = file.content.cells[cellId].type + function checkDoubleClick() { + if (editing) return + setClickCount(clickCount + 1); + setTimeout(() => { + if (clickCount == 1) { + setEditing(true); + } + setClickCount(0); + }, 200); + } + return