feat: 斜杠命令新增 /查看资料,直接打开用户名片
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
// 斜杠命令菜单模块
|
||||
// 输入 / 时弹出可用命令列表,支持键盘/鼠标选择,可扩展的命令注册表。
|
||||
|
||||
// ── 命令注册表(后续新命令只需 push 到此数组)──
|
||||
|
||||
const SLASH_COMMANDS = [
|
||||
@@ -8,20 +9,32 @@ const SLASH_COMMANDS = [
|
||||
name: "/拍一拍",
|
||||
description: "向当前选中的聊天对象发送拍一拍,屏幕会抖动",
|
||||
icon: "👋",
|
||||
/**
|
||||
* 选中命令后执行的填充逻辑。
|
||||
* 返回填充后的输入框文本,或 false 由框架自动填入 name。
|
||||
*/
|
||||
fill(input) {
|
||||
input.value = "/拍一拍";
|
||||
window.persistChatDraft?.("/拍一拍");
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "profile",
|
||||
name: "/查看资料",
|
||||
description: "查看当前选中对象的个人资料名片",
|
||||
icon: "📋",
|
||||
fill(_input) {
|
||||
const toUserSelect = document.getElementById("to_user");
|
||||
const target = toUserSelect?.value?.trim() || null;
|
||||
if (!target || target === "大家") {
|
||||
window.chatDialog?.alert("请先选择一个聊天对象,再查看资料。", "查看资料", "#6366f1");
|
||||
return;
|
||||
}
|
||||
if (typeof window.openUserCard === "function") {
|
||||
window.openUserCard(target);
|
||||
}
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
// ── 菜单状态 ──
|
||||
|
||||
let menuElement = null;
|
||||
let visible = false;
|
||||
let selectedIndex = 0;
|
||||
let currentFilter = "";
|
||||
|
||||
Reference in New Issue
Block a user