[Trunk | Admin]: div-help-contents.component & page-help-contents.component: Add regex to replace multiple spaces, new lines and tabs with one space.

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@56784 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2019-07-26 14:12:52 +00:00
parent 80ec909e4d
commit 4098e68852
2 changed files with 3 additions and 0 deletions

View File

@ -294,6 +294,7 @@ export class DivHelpContentsComponent implements OnInit {
public cutContent(divHelpContent: DivHelpContent) {
divHelpContent.content = divHelpContent.content.replace(/<[^>]*>/g, '');
divHelpContent.content = divHelpContent.content.replace(/(\r\n|\n|\r| +(?= ))|\s\s+/gm," ");
if(divHelpContent.content.length > 200) {
divHelpContent.content = divHelpContent.content.substr(0, 200) + "...";
}

View File

@ -303,6 +303,8 @@ export class PageHelpContentsComponent implements OnInit {
public cutContent(pageHelpContent: PageHelpContent) {
pageHelpContent.content = pageHelpContent.content.replace(/<[^>]*>/g, '');
pageHelpContent.content = pageHelpContent.content.replace(/(\r\n|\n|\r| +(?= ))/gm," ");
console.info(pageHelpContent.content.length, pageHelpContent.content);
if(pageHelpContent.content.length > 200) {
pageHelpContent.content = pageHelpContent.content.substr(0, 200) + "...";
}