diff --git a/packages/survey-angular-ui/src/string-viewer.component.html b/packages/survey-angular-ui/src/string-viewer.component.html index a7a5520e65..c2135f1d6b 100644 --- a/packages/survey-angular-ui/src/string-viewer.component.html +++ b/packages/survey-angular-ui/src/string-viewer.component.html @@ -1,2 +1,2 @@ -{{model.renderedHtml}} - \ No newline at end of file +{{model.renderedHtml}} + \ No newline at end of file diff --git a/packages/survey-angular-ui/src/string-viewer.component.ts b/packages/survey-angular-ui/src/string-viewer.component.ts index 8ecee91cee..cb160af105 100644 --- a/packages/survey-angular-ui/src/string-viewer.component.ts +++ b/packages/survey-angular-ui/src/string-viewer.component.ts @@ -9,10 +9,12 @@ import { AngularComponentFactory } from "./component-factory"; }) export class StringViewerComponent implements DoCheck { @Input() model!: LocalizableString; + className: string = ""; private previousModel: LocalizableString | undefined; constructor(private changeDetectorRef: ChangeDetectorRef) {} ngDoCheck(): void { if(this.model !== this.previousModel) { + this.className = this.model.allowLineBreaks ? "sv-string-viewer sv-string-viewer--multiline" : "sv-string-viewer"; if(!!this.previousModel) { this.clearOnChanged(this.previousModel); } diff --git a/packages/survey-vue3-ui/src/StringViewer.vue b/packages/survey-vue3-ui/src/StringViewer.vue index bea62832f9..fa967dc2c6 100644 --- a/packages/survey-vue3-ui/src/StringViewer.vue +++ b/packages/survey-vue3-ui/src/StringViewer.vue @@ -1,10 +1,10 @@ diff --git a/src/common-styles/sv-string-viewer.scss b/src/common-styles/sv-string-viewer.scss index 634812980f..93b9724899 100644 --- a/src/common-styles/sv-string-viewer.scss +++ b/src/common-styles/sv-string-viewer.scss @@ -1,5 +1,5 @@ .sv-string-viewer { - .sv-string-viewer--multiline { + &.sv-string-viewer--multiline { white-space: pre-wrap; } } \ No newline at end of file diff --git a/src/react/string-viewer.tsx b/src/react/string-viewer.tsx index 17754bb5d0..3e3f50e82a 100644 --- a/src/react/string-viewer.tsx +++ b/src/react/string-viewer.tsx @@ -44,11 +44,12 @@ export class SurveyLocStringViewer extends React.Component { return strEl; } protected renderString(): JSX.Element { + const className = this.locStr.allowLineBreaks ? "sv-string-viewer sv-string-viewer--multiline" : "sv-string-viewer"; if (this.locStr.hasHtml) { let htmlValue = { __html: this.locStr.renderedHtml }; - return ; + return ; } - return {this.locStr.renderedHtml}; + return {this.locStr.renderedHtml}; } } diff --git a/src/vue/string-viewer.vue b/src/vue/string-viewer.vue index e12ced01a1..952697a556 100644 --- a/src/vue/string-viewer.vue +++ b/src/vue/string-viewer.vue @@ -1,10 +1,10 @@