Edit JSON node settings in a dialog from a one-line preview

A free setting typed json and a declared object or array setting (a Switch
node's rules, HTTP headers) show one line of their value; clicking opens a
Monaco JSON editor in a dialog that saves only once the text parses.
Declared object settings were not shown at all before. Escape in a dialog
opened from a side panel no longer closes the panel too.
This commit is contained in:
2026-10-05 23:49:42 +02:00
parent 6fe59347e0
commit 5a145b8f59
6 changed files with 192 additions and 14 deletions
+10 -4
View File
@@ -6,19 +6,24 @@ import { Skeleton } from "@/components/ui/skeleton"
import { monacoFontFamily, setupMonaco } from "./monacoSetup"
/**
* The embedded Python editor. Highlighting and bracket handling only: what the
* code actually does is checked by the engine, which reports load and run
* errors back onto the node.
* The embedded code editor, Python unless asked for JSON. Highlighting and
* bracket handling only: what the code actually does is checked by the engine,
* which reports load and run errors back onto the node.
*/
export default function NodeEditor({
value,
onChange,
language = "python",
readOnly = false,
autoFocus = false,
}: {
value: string
onChange: (next: string) => void
language?: "python" | "json"
/** Generated code: readable, and not this panel's to change. */
readOnly?: boolean
/** Take the caret once mounted, as an editor opened on purpose should. */
autoFocus?: boolean
}) {
const { resolvedTheme } = useTheme()
const [ready, setReady] = useState(false)
@@ -34,10 +39,11 @@ export default function NodeEditor({
return (
<Editor
language="python"
language={language}
theme={resolvedTheme === "dark" ? "fluksio-dark" : "fluksio-light"}
value={value}
onChange={(next) => onChange(next ?? "")}
onMount={autoFocus ? (editor) => editor.focus() : undefined}
loading={<Skeleton className="h-full w-full rounded-md" />}
options={{
readOnly,