Skip to content

Commit

Permalink
Fixed issue with unselecting mention. Closes ivirabyan#35
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirabyan committed Jun 23, 2015
1 parent 241e9cd commit d930934
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 79 deletions.
14 changes: 6 additions & 8 deletions jquery.mentions.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ $.widget( "ui.areacomplete", $.ui.autocomplete,
after = value.substring(@end)
newval = ui.item.value
value = before + newval + after
if @overriden.select
ui.item.pos = @start
ui.value = value
if @overriden.select(event, ui) == false
return false

@_value(value)
@element.change()
Selection.set(@element, before.length + newval.length)

if @overriden.select
ui.item.pos = @start
@overriden.select(event, ui)
return false

focusCallback: ->
Expand Down Expand Up @@ -284,8 +281,9 @@ class MentionsInput extends MentionsBase
return a.pos - b.pos

_onSelect: (event, ui) =>
@_updateMentions()
@_addMention(name: ui.item.value, pos: ui.item.pos, uid: ui.item.uid)
@value = ui.value
@_updateValue()

_updateValue: =>
value = @input.val()
Expand Down
137 changes: 66 additions & 71 deletions jquery.mentions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d930934

Please sign in to comment.