feat(shangwutong): render inbound images inline
This commit is contained in:
+10
-2
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user