mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-02 21:19:12 +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() {
|
||||
let chatInput = document.getElementById("chat-input");
|
||||
chatInput.value = chatInput.value.trimStart();
|
||||
@@ -591,7 +601,7 @@
|
||||
const command = chatInput.value.split(" ")[0].substring(1);
|
||||
for (let key in chatOptions) {
|
||||
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;
|
||||
@@ -1853,6 +1863,9 @@
|
||||
text-align: left;
|
||||
font-size: medium;
|
||||
}
|
||||
div#chat-tooltip:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
svg.new-convo-button {
|
||||
width: 20px;
|
||||
|
||||
Reference in New Issue
Block a user