Skip to content

Commit 2977e62

Browse files
ivicacclaude
andcommitted
2447 client - Fix Monaco editor keyboard input in Upload Sample Output dialog
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e4e8c42 commit 2977e62

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

client/src/pages/platform/workflow-editor/components/node-details-tabs/output-tab/OutputTabSampleDataDialog.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ const OutputTabSampleDataDialog = ({onClose, onUpload, open, placeholder}: Outpu
8080
}, [placeholder]);
8181

8282
return (
83-
<Dialog onOpenChange={handleOpenChange} open={open}>
84-
<DialogContent className="max-w-output-tab-sample-data-dialog-width">
83+
<Dialog modal={false} onOpenChange={handleOpenChange} open={open}>
84+
<DialogContent
85+
className="max-w-output-tab-sample-data-dialog-width"
86+
onInteractOutside={(event) => event.preventDefault()}
87+
>
8588
<DialogHeader className="flex flex-row items-center justify-between space-y-0">
8689
<div className="flex flex-col space-y-1">
8790
<DialogTitle>Upload Sample Output Data</DialogTitle>

client/src/pages/platform/workflow-editor/components/properties/components/property-json-schema-builder/PropertyJsonSchemaBuilderSampleDataDialog.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import MonacoEditorLoader from '@/shared/components/MonacoEditorLoader';
1414
import {EDITOR_PLACEHOLDER, SPACE} from '@/shared/constants';
1515
import {getCookie} from '@/shared/util/cookie-utils';
16-
import {Suspense, lazy, useState} from 'react';
16+
import {Suspense, lazy, useRef, useState} from 'react';
1717

1818
import type {StandaloneCodeEditorType} from '@/shared/components/MonacoTypes';
1919

@@ -34,6 +34,8 @@ const PropertyJsonSchemaBuilderSampleDataDialog = ({onChange}: {onChange?: (newS
3434
const [curSchema, setCurSchema] = useState<SchemaRecordType | undefined>();
3535
const [open, setOpen] = useState<boolean>(true);
3636

37+
const editorRef = useRef<StandaloneCodeEditorType | null>(null);
38+
3739
const handleEditorOnChange = (value: string | undefined) => {
3840
const placeholder = document.querySelector('#monaco-placeholder') as HTMLElement | null;
3941

@@ -72,6 +74,8 @@ const PropertyJsonSchemaBuilderSampleDataDialog = ({onChange}: {onChange?: (newS
7274
};
7375

7476
const handleEditorOnMount = (editor: StandaloneCodeEditorType) => {
77+
editorRef.current = editor;
78+
7579
const placeholder = document.querySelector('#monaco-placeholder') as HTMLElement | null;
7680

7781
if (!placeholder) {
@@ -80,7 +84,7 @@ const PropertyJsonSchemaBuilderSampleDataDialog = ({onChange}: {onChange?: (newS
8084

8185
placeholder.style.display = curSchema ? 'none' : 'block';
8286

83-
editor.focus();
87+
setTimeout(() => editor.focus(), 0);
8488
};
8589

8690
const handleOpenChange = (open: boolean) => {
@@ -97,7 +101,16 @@ const PropertyJsonSchemaBuilderSampleDataDialog = ({onChange}: {onChange?: (newS
97101
<Button label="Generate" variant="outline" />
98102
</DialogTrigger>
99103

100-
<DialogContent className="max-w-output-tab-sample-data-dialog-width">
104+
<DialogContent
105+
className="max-w-output-tab-sample-data-dialog-width"
106+
onFocusOutside={(event) => event.preventDefault()}
107+
onOpenAutoFocus={(event) => {
108+
event.preventDefault();
109+
110+
setTimeout(() => editorRef.current?.focus(), 0);
111+
}}
112+
onPointerDownOutside={(event) => event.preventDefault()}
113+
>
101114
<DialogHeader className="flex flex-row items-center justify-between space-y-0">
102115
<div className="flex flex-col space-y-1">
103116
<DialogTitle>Sample JSON</DialogTitle>

0 commit comments

Comments
 (0)