fix: add search functionality to code editor (#7949)

* Updated packages

* added external searchbox to not cause conflicts on run-cli and desktop

* Fixed lint error in code area modal
This commit is contained in:
Lucas Oliveira 2025-05-08 13:13:55 -03:00 • committed by GitHub
commit 4fbc2af92d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 17 additions and 14 deletions

View file

@ -34,7 +34,7 @@
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/react-syntax-highlighter": "^15.5.13", "@types/react-syntax-highlighter": "^15.5.13",
"@xyflow/react": "^12.3.6", "@xyflow/react": "^12.3.6",
"ace-builds": "^1.35.0", "ace-builds": "^1.41.0",
"ag-grid-community": "^32.0.2", "ag-grid-community": "^32.0.2",
"ag-grid-react": "^32.0.2", "ag-grid-react": "^32.0.2",
"ansi-to-html": "^0.7.2", "ansi-to-html": "^0.7.2",
@ -5794,9 +5794,10 @@
} }
}, },
"node_modules/ace-builds": { "node_modules/ace-builds": {
"version": "1.40.1", "version": "1.41.0",
"resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.40.1.tgz", "resolved": "https://registry.npmjs.org/ace-builds/-/ace-builds-1.41.0.tgz",
"integrity": "sha512-32uwJNwmhqpnYtr6oq8RoO1D6F6tnxisv5f9w2XPX3vi4QruuHNikadHUiHvnxLAV1n5Azv4LFtpItQ5dD1eRw==" "integrity": "sha512-tiEUfw7V/FpHuI4tG7KS+muOTMIuPh6zReBAD2Uqhe9t00tLeyVGxjXu0tSqz5OIPWy7/wvuJBVXAsNWx0rYvQ==",
"license": "BSD-3-Clause"
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.14.1", "version": "8.14.1",
@ -12852,6 +12853,7 @@
"version": "11.0.1", "version": "11.0.1",
"resolved": "https://registry.npmjs.org/react-ace/-/react-ace-11.0.1.tgz", "resolved": "https://registry.npmjs.org/react-ace/-/react-ace-11.0.1.tgz",
"integrity": "sha512-ulk2851Fx2j59AAahZHTe7rmQ5bITW1xytskAt11F8dv3rPLtdwBXCyT2qSbRnJvOq8UpuAhWO4/JhKGqQBEDA==", "integrity": "sha512-ulk2851Fx2j59AAahZHTe7rmQ5bITW1xytskAt11F8dv3rPLtdwBXCyT2qSbRnJvOq8UpuAhWO4/JhKGqQBEDA==",
"license": "MIT",
"dependencies": { "dependencies": {
"ace-builds": "^1.32.8", "ace-builds": "^1.32.8",
"diff-match-patch": "^1.0.5", "diff-match-patch": "^1.0.5",

View file

@ -29,7 +29,7 @@
"@types/axios": "^0.14.0", "@types/axios": "^0.14.0",
"@types/react-syntax-highlighter": "^15.5.13", "@types/react-syntax-highlighter": "^15.5.13",
"@xyflow/react": "^12.3.6", "@xyflow/react": "^12.3.6",
"ace-builds": "^1.35.0", "ace-builds": "^1.41.0",
"ag-grid-community": "^32.0.2", "ag-grid-community": "^32.0.2",
"ag-grid-react": "^32.0.2", "ag-grid-react": "^32.0.2",
"ansi-to-html": "^0.7.2", "ansi-to-html": "^0.7.2",

View file

@ -1,12 +1,12 @@
import "ace-builds/src-noconflict/ace";
import "ace-builds/src-noconflict/ext-language_tools";
import "ace-builds/src-noconflict/mode-python";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/theme-twilight";
// import "ace-builds/webpack-resolver";
import { usePostValidateCode } from "@/controllers/API/queries/nodes/use-post-validate-code"; import { usePostValidateCode } from "@/controllers/API/queries/nodes/use-post-validate-code";
import { usePostValidateComponentCode } from "@/controllers/API/queries/nodes/use-post-validate-component-code"; import { usePostValidateComponentCode } from "@/controllers/API/queries/nodes/use-post-validate-component-code";
import useFlowStore from "@/stores/flowStore"; import useFlowStore from "@/stores/flowStore";
import "ace-builds/src-noconflict/ace";
import "ace-builds/src-noconflict/ext-language_tools";
import "ace-builds/src-noconflict/ext-searchbox";
import "ace-builds/src-noconflict/mode-python";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/theme-twilight";
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import AceEditor from "react-ace"; import AceEditor from "react-ace";
import ReactAce from "react-ace/lib/ace"; import ReactAce from "react-ace/lib/ace";
@ -54,13 +54,12 @@ export default function CodeAreaModal({
const setErrorData = useAlertStore((state) => state.setErrorData); const setErrorData = useAlertStore((state) => state.setErrorData);
const [openConfirmation, setOpenConfirmation] = useState(false); const [openConfirmation, setOpenConfirmation] = useState(false);
const codeRef = useRef<ReactAce | null>(null); const codeRef = useRef<ReactAce | null>(null);
const { mutate, isPending } = usePostValidateCode(); const { mutate } = usePostValidateCode();
const [error, setError] = useState<{ const [error, setError] = useState<{
detail: CodeErrorDataTypeAPI; detail: CodeErrorDataTypeAPI;
} | null>(null); } | null>(null);
const { mutate: validateComponentCode } = usePostValidateComponentCode(); const { mutate: validateComponentCode } = usePostValidateComponentCode();
const setNode = useFlowStore((state) => state.setNode);
useEffect(() => { useEffect(() => {
// if nodeClass.template has more fields other than code and dynamic is true // if nodeClass.template has more fields other than code and dynamic is true
@ -177,6 +176,8 @@ export default function CodeAreaModal({
} else { } else {
if ( if (
!( !(
codeRef.current?.editor.completer &&
"popup" in codeRef.current?.editor.completer &&
codeRef.current?.editor.completer.popup && codeRef.current?.editor.completer.popup &&
codeRef.current?.editor.completer.popup.isOpen codeRef.current?.editor.completer.popup.isOpen
) )