Fixed bug where handles are not connecting

This commit is contained in:
Lucas Oliveira 2023-08-21 20:14:32 -03:00
commit a463641b8f

View file

@ -299,7 +299,6 @@ export function handleKeyDown(
inputValue: string | string[] | null, inputValue: string | string[] | null,
block: string block: string
) { ) {
console.log(e, inputValue, block);
//condition to fix bug control+backspace on Windows/Linux //condition to fix bug control+backspace on Windows/Linux
if ( if (
(typeof inputValue === "string" && (typeof inputValue === "string" &&
@ -332,11 +331,10 @@ export function getConnectedNodes(
} }
export function scapedJSONStringfy(json: object): string { export function scapedJSONStringfy(json: object): string {
return customStringify(json).replace(/"/g, '\\"'); return customStringify(json).replace(/"/g, "œ");
} }
export function scapeJSONParse(json: string): any { export function scapeJSONParse(json: string): any {
console.log(json, json.replace(/\\"/g, '"')); return JSON.parse(json.replace(/œ/g, '"'));
return JSON.parse(json.replace(/\\"/g, '"'));
} }
// this function receives an array of edges and return true if any of the handles are not a json string // this function receives an array of edges and return true if any of the handles are not a json string
@ -350,10 +348,9 @@ export function checkOldEdgesHandles(edges: Edge[]): boolean {
); );
} }
function customStringify(obj: any): string { export function customStringify(obj: any): string {
console.log(obj);
if (typeof obj === "undefined") { if (typeof obj === "undefined") {
return '"undefined"'; return "null";
} }
if (obj === null || typeof obj !== "object") { if (obj === null || typeof obj !== "object") {