Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const SingleLineDiv = styled.div<DivProps>`
export const TextDiv = styled.div`
${StandardFontCSS};
${MultilineCSS};
white-space: pre-wrap;
line-height: 16px;
display: inline-block;
`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { LgTemplateRef } from '@bfc/shared';

import { NodeRendererContext } from '../store/NodeRendererContext';

import { normalizeLgTemplate } from './normalizeLgTemplate';

export const useLgTemplate = (str?: string, dialogId?: string) => {
const { getLgTemplates } = useContext(NodeRendererContext);
const [templateText, setTemplateText] = useState('');
Expand All @@ -33,8 +35,7 @@ export const useLgTemplate = (str?: string, dialogId?: string) => {
}

if (template && template.body) {
const [firstLine] = template.body.split('\n');
setTemplateText(firstLine.startsWith('-') ? firstLine.substring(1) : firstLine);
setTemplateText(normalizeLgTemplate(template));
} else {
setTemplateText('');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

import { LGTemplate } from 'botbuilder-lg';

export function normalizeLgTemplate(template: LGTemplate): string {
const templateTexts = template.body.split('\n').map(line => (line.startsWith('-') ? line.substring(1) : line));
let showText = '';

if (templateTexts[0] && templateTexts[0].trim() === '[Activity') {
showText = templateTexts.find(text => text.includes('Text = '))?.split('Text = ')[1] || '';
} else {
showText = templateTexts.join('\n');
}
return showText;
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,15 @@
{
"$type": "Microsoft.SendActivity",
"$designer": {
"id": "684852",
"id": "212971",
"name": "Send a response"
},
"activity": "${bfdactivity-212971()}"
},
{
"$type": "Microsoft.TextInput",
"$designer": {
"id": "038757",
"id": "879447",
"name": "Text input"
},
"prompt": "${bfdprompt-879447()}",
Expand All @@ -346,7 +346,7 @@
{
"$type": "Microsoft.SendActivity",
"$designer": {
"id": "593087",
"id": "056974",
"name": "Send a response"
},
"activity": "${bfdactivity-056974()}"
Expand All @@ -356,7 +356,7 @@
{
"$type": "Microsoft.SendActivity",
"$designer": {
"id": "253146",
"id": "084161",
"name": "Send a response"
},
"activity": "${bfdactivity-084161()}"
Expand Down