our web application shares code. To share the proper code we have used htmlEncode and htmlDecode as follow so that all the htmlTags are handled properly when they pass via http protocol as follows
htmlEncode = function (value) {
if (value) {
return $('<div />').text(value).html();
}
else {
return '';
}
},
htmlDecode = function (value) {
if (value) {
return $('<div />').html(value).text();
}
else {
return '';
}
},
Now if user gave more spaces within the code, it gets coverted to single space (which ofcourse is not a big issue).
But the issue with this kind of implementation is if user has clicked EnterKey twice or thrice within the code sharing section, then its not taken as it is but the output is in a single line as follows:
UserInput:
Actual Output
Expected Output
Any solution?