diff --git a/frontend/src/components/ShuffleCodeEditor.jsx b/frontend/src/components/ShuffleCodeEditor.jsx
index af9d5b31..e7daa155 100644
--- a/frontend/src/components/ShuffleCodeEditor.jsx
+++ b/frontend/src/components/ShuffleCodeEditor.jsx
@@ -14,6 +14,7 @@ import {
Button,
} from '@material-ui/core';
+import theme from '../theme';
import Checkbox from '@mui/material/Checkbox';
import { orange } from '@mui/material/colors';
import { isMobile } from "react-device-detect"
@@ -34,10 +35,11 @@ import {
} from '@mui/icons-material';
import {
- AutoFixHigh as AutoFixHighIcon, CompressOutlined, QrCodeScannerOutlined,
+ AutoFixHigh as AutoFixHighIcon,
+ CompressOutlined,
+ QrCodeScannerOutlined,
} from '@mui/icons-material';
-import { useTheme } from '@material-ui/core/styles';
import { validateJson } from "../views/Workflows.jsx";
import ReactJson from "react-json-view";
import PaperComponent from "../components/PaperComponent.jsx";
@@ -50,6 +52,9 @@ import 'codemirror/theme/duotone-light.css';
import { padding, textAlign } from '@mui/system';
import data from '../frameworkStyle.jsx';
import { useNavigate, Link, useParams } from "react-router-dom";
+import { createTheme } from '@uiw/codemirror-themes';
+
+import { tags } from '@lezer/highlight';
const liquidFilters = [
{"name": "Size", "value": "size", "example": ""},
@@ -74,12 +79,44 @@ const pythonFilters = [
{"name": "Handle JSON", "value": `{% python %}\nimport json\njsondata = json.loads(r"""$nodename""")\n{% endpython %}`, "example": ``},
]
+const shuffleTheme = createTheme({
+ theme: 'dark',
+ settings: {
+ background: '#282828',
+ foreground: '#ffffff',
+ caret: '#5d00ff',
+ selection: '#036dd626',
+ selectionMatch: '#036dd626',
+ lineHighlight: '#8a91991a',
+ gutterBackground: '#fff',
+ gutterForeground: '#8a919966',
+ fontSize: 18,
+ borderRadius: theme.palette.borderRadius,
+ border: `2px solid ${theme.palette.inputColor}`,
+ },
+ styles: [
+ { tag: tags.comment, color: '#787b8099' },
+ { tag: tags.variableName, color: '#0080ff' },
+ { tag: [tags.string, tags.special(tags.brace)], color: '#5c6166' },
+ { tag: tags.number, color: '#5c6166' },
+ { tag: tags.bool, color: '#5c6166' },
+ { tag: tags.null, color: '#5c6166' },
+ { tag: tags.keyword, color: '#5c6166' },
+ { tag: tags.operator, color: '#5c6166' },
+ { tag: tags.className, color: '#5c6166' },
+ { tag: tags.definition(tags.typeName), color: '#5c6166' },
+ { tag: tags.typeName, color: '#5c6166' },
+ { tag: tags.angleBracket, color: '#5c6166' },
+ { tag: tags.tagName, color: '#5c6166' },
+ { tag: tags.attributeName, color: '#5c6166' },
+ ],
+});
+
const CodeEditor = (props) => {
const { globalUrl, fieldCount, setFieldCount, actionlist, changeActionParameterCodeMirror, expansionModalOpen, setExpansionModalOpen, codedata, setcodedata, isFileEditor, runUpdateText } = props
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
// const {codelang, setcodelang} = props
- const theme = useTheme();
const [validation, setValidation] = React.useState(false);
const [expOutput, setExpOutput] = React.useState(" ");
const [linewrap, setlinewrap] = React.useState(true);
@@ -298,7 +335,7 @@ const CodeEditor = (props) => {
var variable_occurence = current_code_line.match(/[\\]{0,1}[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
if (variable_occurence === null || variable_occurence === undefined) {
- console.log("No variables found. Returning")
+ //console.log("No variables found. Returning")
continue
}
@@ -310,7 +347,7 @@ const CodeEditor = (props) => {
}
variable_occurence = new_occurences.valueOf()
- console.log("Match2: ", variable_occurence)
+ //console.log("Match2: ", variable_occurence)
// console.log(variable_occurence)
// console.log()
@@ -410,10 +447,6 @@ const CodeEditor = (props) => {
//const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
const found = input.match(/[$]{1}([a-zA-Z0-9_-]+\.?){1}([a-zA-Z0-9#_-]+\.?){0,}/g)
- //if (found === null || found === undefined) {
- // console.log("No output found!")
- // return
- //}
console.log("FOUND: ", found)
@@ -510,7 +543,7 @@ const CodeEditor = (props) => {
}
}
} catch (e) {
- console.log("Outer replace error: ", e)
+ //console.log("Outer replace error: ", e)
}
const tmpValidation = validateJson(input.valueOf())
@@ -656,646 +689,696 @@ const CodeEditor = (props) => {
style: {
backgroundColor: theme.palette.surfaceColor,
color: "white",
- minWidth: isMobile ? "100%" : 600,
- maxHeight: isMobile ? "100%" : 800,
+ minWidth: isMobile ? "100%" : 1200,
+ maxWidth: isMobile ? "100%" : 1200,
+ minHeight: isMobile ? "100%" : 900,
+ maxHeight: isMobile ? "100%" : 900,
padding: isMobile ? "25px 10px 25px 10px" : 25,
border: theme.palette.defaultBorder,
zIndex: 12501,
},
}}
- >
- { isFileEditor ?
-
- :
-
-
-
+ { isFileEditor ?
+
- Code Editor
-
-
{
-
- }}
- >
-
-
-
-
-
-
-
{
- autoFormat(localcodedata)
- }}
- >
-
-
-
-
-
- }
-
-
- { isFileEditor ? null :
-
-
-
-
-
-
-
-
-
- }
- parentMenuOpen={!!menuPosition}
+
+
+ File Editor
+
+
+
+ :
+
+
+
+ Code Editor
+
+
{
- console.log("CLICKED: ", innerdata);
- console.log(innerdata.example)
- handleItemClick([innerdata]);
+
}}
>
-
+
+
+
+
+
+
+
{
+ autoFormat(localcodedata)
+ }}
+ >
+
+
+
+
+
+
+ }
+
+
+ { isFileEditor ? null :
+
+
+
+
+
+
+
+
+
+ }
+ parentMenuOpen={!!menuPosition}
+ style={{
+ color: "white",
+ minWidth: 250,
+ maxWidth: 250,
+ maxHeight: 50,
+ overflow: "hidden",
+ }}
+ onClick={() => {
+ console.log("CLICKED: ", innerdata);
+ console.log(innerdata.example)
+ handleItemClick([innerdata]);
+ }}
+ >
+
+
+ {parsedPaths.map((pathdata, index) => {
+ // FIXME: Should be recursive in here
+ //
+ const icon =
+ pathdata.type === "value" ? (
+
+ ) : pathdata.type === "list" ? (
+
+ ) : (
+
+ );
+ //
+
+ const indentation_count = (pathdata.name.match(/\./g) || []).length+1
+ //const boxPadding = pathdata.type === "object" ? "10px 0px 0px 0px" : 0
+ const boxPadding = 0
+ const namesplit = pathdata.name.split(".")
+ const newname = namesplit[namesplit.length-1]
+ return (
+
+ );
+ })}
+
+
+ ) : (
- {parsedPaths.map((pathdata, index) => {
- // FIXME: Should be recursive in here
- //
- const icon =
- pathdata.type === "value" ? (
-
- ) : pathdata.type === "list" ? (
-
- ) : (
-
- );
- //
+ );
+ })}
+
+
+ }
+
+ {
+ // console.log(value.getCursor())
+ setCurrentCharacter(value.getCursor().ch)
+ setCurrentLine(value.getCursor().line)
+ // console.log(value.getCursor().ch, value.getCursor().line)
+ findIndex(value.getCursor().line, value.getCursor().ch)
+ highlight_variables(value)
+ }}
+ onChange={(value) => {
+ setlocalcodedata(value.getValue())
+ expectedOutput(value.getValue())
- const indentation_count = (pathdata.name.match(/\./g) || []).length+1
- //const boxPadding = pathdata.type === "object" ? "10px 0px 0px 0px" : 0
- const boxPadding = 0
- const namesplit = pathdata.name.split(".")
- const newname = namesplit[namesplit.length-1]
- return (
-
- );
- })}
-
-
- ) : (
-