|
@@ -205,7 +205,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|
|
historyIndex: number
|
|
historyIndex: number
|
|
|
savedPrompt: Prompt | null
|
|
savedPrompt: Prompt | null
|
|
|
placeholder: number
|
|
placeholder: number
|
|
|
- dragging: boolean
|
|
|
|
|
|
|
+ draggingType: "image" | "@mention" | null
|
|
|
mode: "normal" | "shell"
|
|
mode: "normal" | "shell"
|
|
|
applyingHistory: boolean
|
|
applyingHistory: boolean
|
|
|
}>({
|
|
}>({
|
|
@@ -213,7 +213,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|
|
historyIndex: -1,
|
|
historyIndex: -1,
|
|
|
savedPrompt: null,
|
|
savedPrompt: null,
|
|
|
placeholder: Math.floor(Math.random() * EXAMPLES.length),
|
|
placeholder: Math.floor(Math.random() * EXAMPLES.length),
|
|
|
- dragging: false,
|
|
|
|
|
|
|
+ draggingType: null,
|
|
|
mode: "normal",
|
|
mode: "normal",
|
|
|
applyingHistory: false,
|
|
applyingHistory: false,
|
|
|
})
|
|
})
|
|
@@ -760,7 +760,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|
|
editor: () => editorRef,
|
|
editor: () => editorRef,
|
|
|
isFocused,
|
|
isFocused,
|
|
|
isDialogActive: () => !!dialog.active,
|
|
isDialogActive: () => !!dialog.active,
|
|
|
- setDragging: (value) => setStore("dragging", value),
|
|
|
|
|
|
|
+ setDraggingType: (type) => setStore("draggingType", type),
|
|
|
|
|
+ focusEditor: () => {
|
|
|
|
|
+ editorRef.focus()
|
|
|
|
|
+ setCursorPosition(editorRef, promptLength(prompt.current()))
|
|
|
|
|
+ },
|
|
|
addPart,
|
|
addPart,
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -946,11 +950,14 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|
|
"group/prompt-input": true,
|
|
"group/prompt-input": true,
|
|
|
"bg-surface-raised-stronger-non-alpha shadow-xs-border relative": true,
|
|
"bg-surface-raised-stronger-non-alpha shadow-xs-border relative": true,
|
|
|
"rounded-[14px] overflow-clip focus-within:shadow-xs-border": true,
|
|
"rounded-[14px] overflow-clip focus-within:shadow-xs-border": true,
|
|
|
- "border-icon-info-active border-dashed": store.dragging,
|
|
|
|
|
|
|
+ "border-icon-info-active border-dashed": store.draggingType !== null,
|
|
|
[props.class ?? ""]: !!props.class,
|
|
[props.class ?? ""]: !!props.class,
|
|
|
}}
|
|
}}
|
|
|
>
|
|
>
|
|
|
- <PromptDragOverlay dragging={store.dragging} label={language.t("prompt.dropzone.label")} />
|
|
|
|
|
|
|
+ <PromptDragOverlay
|
|
|
|
|
+ type={store.draggingType}
|
|
|
|
|
+ label={language.t(store.draggingType === "@mention" ? "prompt.dropzone.file.label" : "prompt.dropzone.label")}
|
|
|
|
|
+ />
|
|
|
<PromptContextItems
|
|
<PromptContextItems
|
|
|
items={prompt.context.items()}
|
|
items={prompt.context.items()}
|
|
|
active={(item) => {
|
|
active={(item) => {
|