Przeglądaj źródła

fix(ai): 附件 chip 的移除按钮改为文本 ×,补图标白名单

移除按钮原来用 Icon 组件,而 Icon 是运行时拼 i-mdi:close-circle-outline 类名,
UnoCSS 静态扫描不到就没生成 CSS,按钮渲染成 0×0(看不见也点不到),
表现为「已选文件没有移除功能」。改为文本 × 按钮:不依赖图标 CSS,
解析中也能移除,并补 title/aria-label。
同时把 i-mdi:paperclip / i-mdi:close-circle-outline 加入 uno safelist ——
附件按钮与消息附件徽标的回形针图标同样缺失(实测 0×0)。
cc 3 tygodni temu
rodzic
commit
d53eceabbc

+ 23 - 7
ai-electron/frontend/src/ai/components/ChatComposer.vue

@@ -44,20 +44,24 @@
         </ul>
       </div>
 
-      <!-- 附件 chips:选择即上传,上传中显进度、失败可移除 -->
+      <!-- 附件 chips:选择即上传。移除按钮始终可见(解析中也能撤掉),解析中额外显示进度 -->
       <div v-if="attachments.length" class="ai-composer__atts">
         <span v-for="att in attachments" :key="att.localId" class="ai-att" :class="{ 'is-failed': att.failed }">
           <Icon :icon="att.icon" :size="13" />
           <span class="ai-att__name">{{ att.name }}</span>
           <span class="ai-att__meta">{{ att.meta }}</span>
           <span v-if="att.uploading" class="ai-att__progress">{{ att.progress }}%</span>
-          <Icon
-            v-else
+          <!-- 用文本 × 而不是 Icon:Icon 的类名是运行时拼的,UnoCSS 扫不到就渲染成 0×0,
+               删除按钮会「看不见也点不到」 -->
+          <button
+            type="button"
             class="ai-att__remove"
-            icon="mdi:close-circle-outline"
-            :size="13"
-            @click="removeAttachment(att.localId)"
-          />
+            :title="`移除 ${att.name}`"
+            :aria-label="`移除 ${att.name}`"
+            @click.stop="removeAttachment(att.localId)"
+          >
+            ×
+          </button>
         </span>
       </div>
 
@@ -756,7 +760,19 @@
       }
 
       &__remove {
+        display: inline-flex;
+        align-items: center;
+        justify-content: center;
+        width: 14px;
+        height: 14px;
+        padding: 0;
+        font-size: 14px;
+        line-height: 1;
+        color: var(--ai-text-2);
         cursor: pointer;
+        background: transparent;
+        border: 0;
+        border-radius: 50%;
 
         &:hover {
           color: @error-color;

+ 3 - 0
ai-electron/frontend/uno.config.ts

@@ -167,6 +167,9 @@ export default defineConfig({
     'i-mdi:eye-outline',
     'i-mdi:upload-outline',
     'i-mdi:download-outline',
+    // 输入框附件按钮 / 消息附件徽标(同为运行时拼接,漏了会渲染成 0×0)
+    'i-mdi:paperclip',
+    'i-mdi:close-circle-outline',
   ],
   presets: [
     presetWind3(),