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
@@ -10,6 +10,7 @@ import { useI18n } from 'vue-i18n';
import MessageFormatter from 'shared/helpers/MessageFormatter.js';
import { BUS_EVENTS } from 'shared/constants/busEvents';
import { MESSAGE_VARIANTS, ORIENTATION } from '../constants';
import { formatShangwutongInlineContent } from '../inlineMedia.js';
const props = defineProps({
hideMeta: { type: Boolean, default: false },
@@ -77,11 +78,19 @@ const shouldShowMeta = computed(
);
const replyToPreview = computed(() => {
if (!inReplyTo) return '';
if (!inReplyTo?.value) return '';
const { content, attachments } = inReplyTo.value;
const { content, attachments, contentAttributes, content_attributes } =
inReplyTo.value;
if (content) return new MessageFormatter(content).formattedMessage;
if (content) {
const formattedContent = formatShangwutongInlineContent(
content,
attachments,
contentAttributes ?? content_attributes
);
return new MessageFormatter(formattedContent).formattedMessage;
}
if (attachments?.length) {
const firstAttachment = attachments[0];
const fileType = firstAttachment.fileType ?? firstAttachment.file_type;
@@ -4,6 +4,7 @@ import { useMessageContext } from '../../provider.js';
import MessageFormatter from 'shared/helpers/MessageFormatter.js';
import { MESSAGE_VARIANTS } from '../../constants';
import { formatShangwutongInlineContent } from '../../inlineMedia.js';
const props = defineProps({
content: {
@@ -12,14 +13,20 @@ const props = defineProps({
},
});
const { variant } = useMessageContext();
const { variant, attachments, contentAttributes } = useMessageContext();
const formattedContent = computed(() => {
const content = formatShangwutongInlineContent(
props.content,
attachments.value,
contentAttributes.value
);
if (variant.value === MESSAGE_VARIANTS.ACTIVITY) {
return props.content;
return content;
}
return new MessageFormatter(props.content).formattedMessage;
return new MessageFormatter(content).formattedMessage;
});
</script>