From 18ed21474fefa678fba0667aa6122722e15bb703 Mon Sep 17 00:00:00 2001 From: Ivan Virabyan Date: Tue, 31 Mar 2015 12:48:29 +0300 Subject: [PATCH] Do not escape html from actual value. Closes #33 --- jquery.mentions.coffee | 4 +++- jquery.mentions.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jquery.mentions.coffee b/jquery.mentions.coffee index b3138a8..4ce50e1 100644 --- a/jquery.mentions.coffee +++ b/jquery.mentions.coffee @@ -304,7 +304,9 @@ class MentionsInput extends MentionsBase @_addMention(name: ui.item.value, pos: ui.item.pos, uid: ui.item.uid) _updateValue: => - value = hlContent = escapeHtml(@input.val()) + value = @input.val() + hlContent = escapeHtml(value) + for mention in @mentions markedName = @_mark(mention.name) hlContent = hlContent.replace(markedName, "#{mention.name}") diff --git a/jquery.mentions.js b/jquery.mentions.js index a5fccc9..ff35ef2 100644 --- a/jquery.mentions.js +++ b/jquery.mentions.js @@ -405,7 +405,8 @@ MentionsInput.prototype._updateValue = function() { var hlContent, markedName, mention, value, _i, _len, _ref; - value = hlContent = escapeHtml(this.input.val()); + value = this.input.val(); + hlContent = escapeHtml(value); _ref = this.mentions; for (_i = 0, _len = _ref.length; _i < _len; _i++) { mention = _ref[_i];