fix: text input jumps to the end of the text after writing one letter (#3090)
Fixed not being able to write in the middle of the component
This commit is contained in:
parent
1336ae0772
commit
6a1f1857e4
1 changed files with 108 additions and 102 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import { TEXT_FIELD_TYPES } from "@/CustomNodes/GenericNode/components/parameterComponent/constants";
|
import { TEXT_FIELD_TYPES } from "@/CustomNodes/GenericNode/components/parameterComponent/constants";
|
||||||
import { handleOnNewValueType } from "@/CustomNodes/hooks/use-handle-new-value";
|
import { handleOnNewValueType } from "@/CustomNodes/hooks/use-handle-new-value";
|
||||||
import { APIClassType, InputFieldType } from "@/types/api";
|
import { APIClassType, InputFieldType } from "@/types/api";
|
||||||
|
import { useMemo } from "react";
|
||||||
import CodeAreaComponent from "../codeAreaComponent";
|
import CodeAreaComponent from "../codeAreaComponent";
|
||||||
import DictComponent from "../dictComponent";
|
import DictComponent from "../dictComponent";
|
||||||
import FloatComponent from "../floatComponent";
|
import FloatComponent from "../floatComponent";
|
||||||
|
|
@ -44,7 +45,8 @@ export function ParameterRenderComponent({
|
||||||
templateData.name
|
templateData.name
|
||||||
).toLowerCase();
|
).toLowerCase();
|
||||||
|
|
||||||
return (
|
return useMemo(
|
||||||
|
() => (
|
||||||
<RefreshParameterComponent
|
<RefreshParameterComponent
|
||||||
templateData={templateData}
|
templateData={templateData}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
|
|
@ -68,7 +70,9 @@ export function ParameterRenderComponent({
|
||||||
<DictComponent
|
<DictComponent
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
editNode={editNode}
|
editNode={editNode}
|
||||||
value={(templateValue || "").toString() === "{}" ? {} : templateValue}
|
value={
|
||||||
|
(templateValue || "").toString() === "{}" ? {} : templateValue
|
||||||
|
}
|
||||||
onChange={onChange}
|
onChange={onChange}
|
||||||
id={`dict_${id}`}
|
id={`dict_${id}`}
|
||||||
/>
|
/>
|
||||||
|
|
@ -146,5 +150,7 @@ export function ParameterRenderComponent({
|
||||||
String(templateValue)
|
String(templateValue)
|
||||||
)}
|
)}
|
||||||
</RefreshParameterComponent>
|
</RefreshParameterComponent>
|
||||||
|
),
|
||||||
|
[templateData, disabled, nodeId, editNode, nodeClass, name, templateValue],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue