Files
jerapah-flow/packages/web/src/components/CodeEditor.jsx
T
nsrb beb7e22652 feat(server): enhance workflow and script handling with new features
- Added `workflowLastModifiedAt` function to retrieve the last modified timestamp of workflow YAML files.
- Introduced `encodeBinaryForWire` and `reviveBinaryFromWire` functions for better handling of binary data in JSON.
- Implemented `useDeleteKv` hook for deleting key-value pairs in the web API.
- Enhanced `scriptsPluginFactory` to support dry-run evaluations with JSONata expressions.
- Added `set-dry-run-smoke.js` test to validate dry-run functionality.
- Updated profile configuration to include `overlayFromMerged` for better profile management.
- Introduced try-session management in the web components to handle step execution states.
- Improved various components to support new try-session features and maintain UI consistency.

Co-authored-by: Nasyarobby Putra <nasyarobby@gmail.com>
2026-08-22 17:52:17 +07:00

32 lines
958 B
React

import Editor from "@monaco-editor/react";
import { useTheme } from "../theme.jsx";
export function CodeEditor({ language, value, onChange, height = "50vh", readOnly = false }) {
const { theme } = useTheme();
const isMobile = typeof window !== "undefined" && window.innerWidth < 768;
return (
<div className="nokey overflow-hidden rounded-box border border-base-300 h-full min-h-0">
<Editor
height={height}
language={language}
value={value}
onChange={readOnly ? undefined : (v) => onChange(v ?? "")}
theme={theme === "dark" ? "vs-dark" : "light"}
options={{
readOnly,
minimap: { enabled: !isMobile },
lineNumbers: "on",
tabSize: 2,
insertSpaces: true,
autoIndent: "full",
automaticLayout: true,
wordWrap: "on",
scrollBeyondLastLine: false,
fontSize: 13,
}}
/>
</div>
);
}