myagent-ai 1.16.16 → 1.16.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.16.16",
3
+ "version": "1.16.17",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
@@ -2785,6 +2785,24 @@ function initAttachmentUI() {
2785
2785
  skipCompression: false, // 跳过压缩(如果图片已经足够小)
2786
2786
  };
2787
2787
 
2788
+ // [v1.16.16] 全局拖拽拦截 — 防止浏览器默认打开拖入的文件(PDF等)
2789
+ // 只在 inputBox 上处理实际 drop,但整个页面需要 preventDefault
2790
+ document.addEventListener('dragover', function(e) {
2791
+ if (e.dataTransfer && e.dataTransfer.types && e.dataTransfer.types.indexOf('Files') > -1) {
2792
+ e.preventDefault();
2793
+ }
2794
+ });
2795
+ document.addEventListener('drop', function(e) {
2796
+ if (e.dataTransfer && e.dataTransfer.types && e.dataTransfer.types.indexOf('Files') > -1) {
2797
+ e.preventDefault();
2798
+ e.stopPropagation();
2799
+ // 如果不是在 inputBox 上 drop 的,也当作文件处理
2800
+ if (e.target && !document.getElementById('inputBox').contains(e.target)) {
2801
+ handleDropEvent(e);
2802
+ }
2803
+ }
2804
+ });
2805
+
2788
2806
  // 创建隐藏的文件输入
2789
2807
  if (!document.getElementById('imageFileInput')) {
2790
2808
  var imgInput = document.createElement('input');