fix keyboardEvent enter will add new nodes when search next node
This commit is contained in:
1 parent
b071f735e4
commit
37f8577e59
1 file changed
+9
@@ -42,6 +42,7 @@ interface FilterOption {
|
|||||||
filterFocus: boolean;
|
filterFocus: boolean;
|
||||||
filterType: "content" | "id";
|
filterType: "content" | "id";
|
||||||
placeholder: string;
|
placeholder: string;
|
||||||
|
isFocused: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const createMenu = () => {
|
const createMenu = () => {
|
||||||
@@ -151,6 +152,7 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
filterFocus: true,
|
filterFocus: true,
|
||||||
filterType: "content",
|
filterType: "content",
|
||||||
placeholder: "",
|
placeholder: "",
|
||||||
|
isFocused: false
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSearchChange = (option: FilterOption) => {
|
const onSearchChange = (option: FilterOption) => {
|
||||||
@@ -516,6 +518,10 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createNode = () => {
|
const createNode = () => {
|
||||||
|
if (filterOption.isFocused) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!editor.selectedId) {
|
if (!editor.selectedId) {
|
||||||
message.warning(t("node.noNodeSelected"));
|
message.warning(t("node.noNodeSelected"));
|
||||||
return;
|
return;
|
||||||
@@ -1188,6 +1194,8 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
index: 0,
|
index: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
onFocus={() => setFilterOption({ ...filterOption, isFocused: true })}
|
||||||
|
onBlur={() => setFilterOption({ ...filterOption, isFocused: false })}
|
||||||
onKeyDown={handleKeyDown}
|
onKeyDown={handleKeyDown}
|
||||||
suffix={
|
suffix={
|
||||||
<Flex gap="2px" style={{ alignItems: "center" }}>
|
<Flex gap="2px" style={{ alignItems: "center" }}>
|
||||||
@@ -1266,6 +1274,7 @@ export const Editor: FC<EditorProps> = ({ onUpdate: updateState, data: editor, .
|
|||||||
filterStr: "",
|
filterStr: "",
|
||||||
filterType: "content",
|
filterType: "content",
|
||||||
placeholder: "",
|
placeholder: "",
|
||||||
|
isFocused: false
|
||||||
});
|
});
|
||||||
keysRef.current?.focus();
|
keysRef.current?.focus();
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in new issue
Block a user