ui-mention
ui-mention copied to clipboard
Mention replacement can occur recursively
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.
We have two method to slove this:
- return value of function
labelcould be not contain return valueencode - use replace by regex instead
String.prototype.replaceinngModel.$parsers.push...
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));