diff --git a/client/src/components/CodeEditorMonaco/index.tsx b/client/src/components/CodeEditorMonaco/index.tsx index 6bc64a4..e851e34 100644 --- a/client/src/components/CodeEditorMonaco/index.tsx +++ b/client/src/components/CodeEditorMonaco/index.tsx @@ -70,6 +70,10 @@ const Component = (props: Props, ref: ForwardedRef) => { value: codeCache || template[type], language: languageMap[type], theme: themeType, + formatOnType: true, + smoothScrolling: true, + formatOnPaste: true, + readOnly: false, }); return () => editorRef.current?.dispose(); diff --git a/client/src/pages/editor/index.tsx b/client/src/pages/editor/index.tsx index a7c97f3..e5d956e 100644 --- a/client/src/pages/editor/index.tsx +++ b/client/src/pages/editor/index.tsx @@ -113,15 +113,19 @@ const Component = () => { ?.getModel() ?.onDidChangeContent( debounce(() => { - storage.set( - CodeStorageKey[codeType], - editorRef.current?.getEditor()?.getValue() - ); + saveCode(); }, 1500) ); } }, [editorRef.current]); + const saveCode = () => { + storage.set( + CodeStorageKey[codeType], + editorRef.current?.getEditor()?.getValue() + ); + }; + const renderInput = () => { return (