ui-mention icon indicating copy to clipboard operation
ui-mention copied to clipboard

Mention replacement can occur recursively

Open ProLoser opened this issue 10 years ago • 2 comments
trafficstars

Due to how the mentions of someone's names may occur, there is a chance that the rendering may parse mentions recursively. For example, if you replace @mentions with mentions then try to highlight that, yet the code is @[mentions] then you may end up replacing things over and over.

ProLoser avatar Aug 12 '15 10:08 ProLoser

We have two method to slove this:

  1. return value of function label could be not contain return value encode
  2. use replace by regex instead String.prototype.replace in ngModel.$parsers.push...

NamPNQ avatar Jun 16 '16 13:06 NamPNQ

Hello for those looking for a solution we used this snippet :

var regex = new RegExp("(?<![\\w])"+_this.label(mention)+"(?![\\w])", 'g');
return value = value.replace(regex, _this.encode(mention));

peacepostman avatar Sep 27 '19 10:09 peacepostman