feat(shangwutong): render inbound images inline

This commit is contained in:
2026-09-12 15:26:03 +08:00
parent c415d6d13f
commit 6e62f5094f
9 changed files with 227 additions and 31 deletions
@@ -8,6 +8,7 @@ import FileChip from 'next/message/chips/File.vue';
import { useMessageContext } from '../provider.js';
import { ATTACHMENT_TYPES } from '../constants';
import { shangwutongInlineMediaIndexes } from '../inlineMedia.js';
/**
* @typedef {Object} Attachment
@@ -34,7 +35,7 @@ defineOptions({
});
const attrs = useAttrs();
const { orientation } = useMessageContext();
const { orientation, contentAttributes } = useMessageContext();
const classToApply = computed(() => {
const baseClasses = [attrs.class, 'flex', 'flex-wrap'];
@@ -46,8 +47,15 @@ const classToApply = computed(() => {
return baseClasses;
});
const inlineAttachmentIndexes = computed(() =>
shangwutongInlineMediaIndexes(contentAttributes.value)
);
const allAttachments = computed(() => {
return Array.isArray(props.attachments) ? props.attachments : [];
const attachments = Array.isArray(props.attachments) ? props.attachments : [];
return attachments.filter(
(_, index) => !inlineAttachmentIndexes.value.has(index)
);
});
const mediaAttachments = computed(() => {