-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
[Bug] 局域网IP的HTTP访问时WebUI 代码块复制按钮无效 #7739
Copy link
Copy link
Closed
Labels
area:webuiThe bug / feature is about webui(dashboard) of astrbot.The bug / feature is about webui(dashboard) of astrbot.bugSomething isn't workingSomething isn't working
Metadata
Metadata
Assignees
Labels
area:webuiThe bug / feature is about webui(dashboard) of astrbot.The bug / feature is about webui(dashboard) of astrbot.bugSomething isn't workingSomething isn't working
Type
Fields
Give feedbackNo fields configured for issues without a type.
What happened / 发生了什么
问题描述
WebUI 中代码块右上角的复制按钮点击无任何反应,控制台无输出。
原因分析
按钮使用了@click.stop或stopPropagation(),导致点击事件无法冒泡,同时内部绑定的复制逻辑未正常执行。复现步骤
环境信息
临时解决方案
在控制台手动覆盖按钮的 onclick:
document.querySelectorAll('.code-action-btn[aria-label="Copy"]').forEach(btn => {
btn.onclick = function() {
const code = this.closest('.code-block-container')?.querySelector('pre code')?.innerText;
if (!code) return;
const ta = document.createElement('textarea');
ta.value = code;
document.body.appendChild(ta);
ta.select();
document.execCommand('copy');
document.body.removeChild(ta);
};
});
建议修复方式
去掉按钮上的 stopPropagation,或确保内部复制逻辑正确执行。Reproduce / 如何复现?
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
AstrBot 版本:v4.23.2
部署方式:Docker
消息平台:WebUI
OS
Windows
Logs / 报错日志
控制台无任何报错输出,点击按钮后无日志。
Are you willing to submit a PR? / 你愿意提交 PR 吗?
Code of Conduct