Skip to content

[devtools] Update Chat rendering to support blockquote #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2025

Conversation

Jesperholmbergmsft
Copy link
Contributor

Context

This PR addresses #243, where the dev tools aren't able to render quoted messages. The change here adds support for those and other common message formatting. There's still plenty ways to go if we want full parity with the Teams client - adaptive cards, deep link chiclets, code snippet colorization etc - but this moves us in the right direction.

Before this change, the message list would simply render the message payload as text:
image

After this change, quoted messages render similar to the standard Teams client, with timestamp and all:
image

How tested

  • ran npm run dev --workspace=@tests/echo and sent myself a message. The quoted reply now renders
  • In storybook, tested other common formatting in both light & dark mode; for both sent & received messages. Looks pretty good.

Storybook screen shots

Here's to illustrate how we support common message formatting:

Dark mode, received message
image

Light mode, sent message
image

@@ -28,6 +28,7 @@
"codemirror": "^6.0.1",
"date-fns": "^4.1.0",
"highlight.js": "^11.11.1",
"htmlparser2": "^10.0.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what TMP uses to parse chat messages, and bot builder relies on it too.

@@ -0,0 +1,106 @@
import React from 'react';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This component simply parses the HTML message payload, iterates through the element tree and renders the same components out again - with some small tweaks to attributes and content. If we want to go further and support richer content - adaptive cards, deep link chiclets, @mentions etc - we can build up the renderNode() function to render richer components as and when needed.
I kinda started by doing that - added a Link and a Code and a Quote - and then realized that I can solve the immediate problem mostly through styling.

heyitsaamir
heyitsaamir previously approved these changes Jun 11, 2025
@heyitsaamir heyitsaamir merged commit de1437f into microsoft:main Jun 11, 2025
5 checks passed
@Jesperholmbergmsft Jesperholmbergmsft deleted the jh/243 branch June 11, 2025 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants