Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)
Python
feat: support edit code
clean9930ab9e384a7f
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsxindex c2ec3feb..949582ce 100644--- a/frontend/src/App.tsx+++ b/frontend/src/App.tsx@@ -246,6 +246,7 @@ function App() {<CodeMirrorcode={generatedCode}editorTheme={settings.editorTheme}+ onCodeChange={setGeneratedCode}/></TabsContent></Tabs>diff --git a/frontend/src/components/CodeMirror.tsx b/frontend/src/components/CodeMirror.tsxindex 21008bc9..0c268a54 100644--- a/frontend/src/components/CodeMirror.tsx+++ b/frontend/src/components/CodeMirror.tsx@@ -15,9 +15,10 @@ import { html } from "@codemirror/lang-html";interface Props {code: string;editorTheme: string;+ onCodeChange: (code: string) => void;}-function CodeMirror({ code, editorTheme }: Props) {+function CodeMirror({ code, editorTheme, onCodeChange }: Props) {const ref = useRef<HTMLDivElement>(null);const view = useRef<EditorView | null>(null);@@ -42,6 +43,11 @@ function CodeMirror({ code, editorTheme }: Props) {html(),selectedTheme,EditorView.lineWrapping,+ EditorView.updateListener.of(update => {+ if (update.changes) {+ onCodeChange(view.current?.state.doc.toString() || "");+ }+ }),],}),parent: ref.current as Element,@@ -69,3 +75,4 @@ function CodeMirror({ code, editorTheme }: Props) {}export default CodeMirror;+