close dropdown after making new prompt file
This commit is contained in:
parent
bd612261f0
commit
6888753b20
1 changed files with 9 additions and 0 deletions
|
|
@ -216,6 +216,15 @@ const MentionList = forwardRef((props: MentionListProps, ref) => {
|
|||
type: "action",
|
||||
action: () => {
|
||||
ideMessenger.request("config/newPromptFile", undefined);
|
||||
const { tr } = props.editor.view.state;
|
||||
const text = tr.doc.textBetween(0, tr.selection.from);
|
||||
const start = text.lastIndexOf("@");
|
||||
if (start !== -1) {
|
||||
props.editor.view.dispatch(
|
||||
tr.delete(start, tr.selection.from).scrollIntoView(),
|
||||
);
|
||||
}
|
||||
props.onClose(); // Escape the mention list after creating a new prompt file
|
||||
},
|
||||
description: "Create a new .prompt file",
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue