Skip to content

Commit e77cdbf

Browse files
committed
chore(*): Fixed the message with the code block.
1 parent 8c5f6af commit e77cdbf

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

src/app/interactions/chat/features-sample/features-sample.component.ts

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AsyncPipe } from '@angular/common';
22
import { Component, effect, signal, viewChild } from '@angular/core';
3-
import { IgxChatComponent, IgxChatMessageContextDirective, IgxChatOptions } from 'igniteui-angular';
3+
import { IgxChatComponent, IgxChatMessageContextDirective, type IgxChatOptions } from 'igniteui-angular';
44
import { MarkdownPipe } from 'igniteui-angular/chat-extras';
55

66
@Component({
@@ -45,16 +45,16 @@ export class ChatFeaturesSampleComponent {
4545
{
4646
id: '4',
4747
text:
48-
`Thank you for your patience. It seems that the issue is the name of the CSS part. Here is the fixed code:
49-
\`\`\`css
50-
igc-avatar::part(base) {
48+
`Thank you for your patience. It seems that the issue is the name of the CSS part. Here is the fixed code:
49+
\`\`\`css
50+
igc-avatar::part(base) {
5151
--size: 60px;
5252
color: var(--ig-success-500-contrast);
5353
background: var(--ig-success-500);
5454
border-radius: 20px;
55-
}
56-
\`\`\`
57-
`,
55+
}
56+
\`\`\`
57+
`,
5858
sender: 'support',
5959
timestamp: (Date.now() - 3200000).toString()
6060
}
@@ -73,9 +73,18 @@ export class ChatFeaturesSampleComponent {
7373

7474
constructor() {
7575
effect(() => {
76-
this.templates.set({ messageContent: this._messageContent(), messageHeader: this._messageHeader(), suggestionPrefix: this._suggestionPrefix() });
77-
});
76+
const messageHeader = this._messageHeader();
77+
const suggestionPrefix = this._suggestionPrefix();
78+
const messageContent = this._messageContent();
7879

80+
if (messageHeader && suggestionPrefix && messageContent) {
81+
this.templates.set({
82+
messageHeader: messageHeader,
83+
suggestionPrefix: suggestionPrefix,
84+
messageContent: messageContent
85+
});
86+
}
87+
});
7988
}
8089

8190
public onMessageCreated(e: any): void {

0 commit comments

Comments
 (0)