mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-08 05:39:13 +00:00
Update slash command UX in chat UI of desktop app to match web app
Make commands in popup menu on typing slash in chat input selectable
This commit is contained in:
@@ -576,6 +576,16 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fillCommandInPrompt(command) {
|
||||||
|
let chatTooltip = document.getElementById("chat-tooltip");
|
||||||
|
chatTooltip.style.display = "none";
|
||||||
|
|
||||||
|
let chatInput = document.getElementById("chat-input");
|
||||||
|
chatInput.value = "/" + command + " ";
|
||||||
|
chatInput.classList.add("option-enabled");
|
||||||
|
chatInput.focus();
|
||||||
|
}
|
||||||
|
|
||||||
function onChatInput() {
|
function onChatInput() {
|
||||||
let chatInput = document.getElementById("chat-input");
|
let chatInput = document.getElementById("chat-input");
|
||||||
chatInput.value = chatInput.value.trimStart();
|
chatInput.value = chatInput.value.trimStart();
|
||||||
@@ -591,7 +601,7 @@
|
|||||||
const command = chatInput.value.split(" ")[0].substring(1);
|
const command = chatInput.value.split(" ")[0].substring(1);
|
||||||
for (let key in chatOptions) {
|
for (let key in chatOptions) {
|
||||||
if (!!!command || key.startsWith(command)) {
|
if (!!!command || key.startsWith(command)) {
|
||||||
helpText += "<b>/" + key + "</b>: " + chatOptions[key] + "<br>";
|
helpText += `<div class="helpoption" onclick="fillCommandInPrompt('${key}')"><b>/${key}</b>: ${chatOptions[key]}</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chatTooltip.innerHTML = helpText;
|
chatTooltip.innerHTML = helpText;
|
||||||
@@ -1853,6 +1863,9 @@
|
|||||||
text-align: left;
|
text-align: left;
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
}
|
}
|
||||||
|
div#chat-tooltip:hover {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
svg.new-convo-button {
|
svg.new-convo-button {
|
||||||
width: 20px;
|
width: 20px;
|
||||||
|
|||||||
Reference in New Issue
Block a user