feat: add onChange handler to post editor content to parent window

This commit is contained in:
ngc2207 2025-01-08 16:38:13 +08:00
parent 79cbc92a87
commit 6a88409a32

View File

@ -58,6 +58,14 @@ function App() {
beforeMount={async (monaco: Monaco) => {
shikiToMonaco(await highlighter, monaco);
}}
onChange={(value) => {
if (value !== undefined) {
window.parent.postMessage(
{ type: "editor-info", language, code: value },
"*"
);
}
}}
/>
</TabsContent>
<TabsContent value="diff-editor" className="h-full">