Merge pull request #865 from ONLYOFFICE/feature/fix-utils-html-encode

[common] extend htmlEncode function
This commit is contained in:
maxkadushkin 2021-05-06 16:44:52 +03:00 committed by GitHub
commit 0949cce8a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -587,8 +587,8 @@ Common.Utils.String = new (function() {
},
htmlEncode: function(string) {
//return _.escape(string);
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
return !!_ ? _.escape(string) :
string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
},
htmlDecode: function(string) {