Skip to content

Commit f6a0477

Browse files
authored
Update meeting-interop-features-inline-image-receiving-javascript.md
1 parent 80571b1 commit f6a0477

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

articles/communication-services/tutorials/chat-interop/includes/meeting-interop-features-inline-image-receiving-javascript.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ Upon clicking the preview image by the Azure Communication Services user, an ove
336336

337337
[!INCLUDE [Public Preview Notice](../../../includes/public-preview-include.md)]
338338

339-
In addition to handle messages with inline images, Chat SDK for JavaScript also provides a solution to allow the Communication User to send image attachments or inline images to the Microsoft Teams user in an interoperability chat.
339+
In addition to handle messages with inline images, Chat SDK for JavaScript also provides a solution to allow the Communication User to send inline images to the Microsoft Teams user in an interoperability chat.
340340

341341

342342
### Prerequisites
@@ -411,27 +411,32 @@ Lastly we need to modify the sendMessageButton event listener we created previou
411411
```js
412412
sendMessageButton.addEventListener("click", async () => {
413413
let message = messagebox.value;
414-
415414
let attachments = uploadedImageModels;
415+
416+
// inject image tags for images we have selected
417+
// so they can be treated as inline images
418+
// alternatively, we can use some 3rd party libraries
419+
// to have a rich text editor with inline image support
420+
message += attachments.map((attachment) => `<img id="${attachment.id}" />`).join("");
421+
416422
let sendMessageRequest = {
417423
content: message,
418-
attachments: attachments, // NEW
424+
attachments: attachments,
419425
};
420426

421-
422427
let sendMessageOptions = {
423428
senderDisplayName: "Jack",
429+
type: "html"
424430
};
431+
425432
let sendChatMessageResult = await chatThreadClient.sendMessage(
426433
sendMessageRequest,
427434
sendMessageOptions
428435
);
429436
let messageId = sendChatMessageResult.id;
430-
431-
uploadedImageModels = []; // NEW
437+
uploadedImageModels = [];
432438

433439
messagebox.value = "";
434-
435440
document.getElementById("upload").value = "";
436441
console.log(`Message sent!, message id:${messageId}`);
437442
});

0 commit comments

Comments
 (0)