|
186 | 186 | </el-tree> |
187 | 187 |
|
188 | 188 | <div v-show="selectedPart" class="fill vfillpanel"> |
189 | | - <el-tabs value="headers" class="fill hfillpanel" type="border-card"> |
| 189 | + <el-tabs v-if="selectedPart" value="preview" class="fill hfillpanel" type="border-card"> |
| 190 | + |
| 191 | + <el-tab-pane label="Preview" id="preview" class="fill vfillpanel"> |
| 192 | + <template #label> |
| 193 | + <el-icon><View /></el-icon> Preview |
| 194 | + </template> |
| 195 | + <messagepartpreview :message="message" :part="selectedPart" class="nopad fill" /> |
| 196 | + </el-tab-pane> |
190 | 197 | <el-tab-pane label="Headers" id="headers" class="fill vfillpanel"> |
191 | 198 | <template #label> |
192 | 199 | <el-icon><Memo /></el-icon> Headers |
|
207 | 214 | </template> |
208 | 215 | <messagepartsource class="fill" :messageEntitySummary="selectedPart" type="raw"></messagepartsource> |
209 | 216 | </el-tab-pane> |
| 217 | + |
210 | 218 | </el-tabs> |
211 | 219 | </div> |
212 | 220 |
|
|
243 | 251 | import ServerController from '../ApiClient/ServerController'; |
244 | 252 | import MessageViewPlainText from "./messageviewplaintext.vue"; |
245 | 253 | import MessageCompose from "@/components/messagecompose.vue"; |
| 254 | + import MessagePartPreview from "@/components/messagepartpreview.vue"; |
246 | 255 | import { UseDark } from '@vueuse/components'; |
247 | 256 |
|
248 | 257 | @Component({ |
|
256 | 265 | messageclientanalysis: MessageClientAnalysis, |
257 | 266 | messagehtmlvalidation: MessageHtmlValidation, |
258 | 267 | messagecompose: MessageCompose, |
| 268 | + messagepartpreview: MessagePartPreview, |
259 | 269 | UseDark |
260 | 270 | } |
261 | 271 | }) |
|
444 | 454 | get selectedPartHeaders() { |
445 | 455 | return this.selectedPart != null ? this.selectedPart.headers : []; |
446 | 456 | } |
| 457 | +
|
| 458 | + get isSelectedPartPreviewable(): boolean { |
| 459 | + if (!this.selectedPart) return false; |
| 460 | + const header = this.selectedPart.headers.find(h => h.name.toLowerCase() === 'content-type'); |
| 461 | + const contentType = header ? header.value.split(';')[0].trim().toLowerCase() : ''; |
| 462 | + return contentType.startsWith('image/') || contentType === 'text/html' || contentType === 'application/pdf'; |
| 463 | + } |
447 | 464 | } |
448 | 465 |
|
449 | 466 | export default toNative(MessageView); |
|
0 commit comments