Skip to content

Commit

Permalink
Added option 'suffix'. ivirabyan#46
Browse files Browse the repository at this point in the history
  • Loading branch information
ivirabyan committed Feb 17, 2016
1 parent b8fe2b3 commit 47e2c1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion jquery.mentions.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ escapeHtml = (text) ->
$.widget( "ui.areacomplete", $.ui.autocomplete,
options: $.extend({}, $.ui.autocomplete.prototype.options,
matcher: "(\\b[^,]*)",
suffix: ''
)

_create: ->
Expand All @@ -44,7 +45,7 @@ $.widget( "ui.areacomplete", $.ui.autocomplete,
value = @_value()
before = value.substring(0, @start)
after = value.substring(@end)
newval = ui.item.value
newval = ui.item.value + @options.suffix
value = before + newval + after
@_value(value)
Selection.set(@element, before.length + newval.length)
Expand Down Expand Up @@ -159,6 +160,7 @@ class MentionsInput extends MentionsBase
@settings =
trigger: '@',
widget: 'areacomplete',
suffix: '',
autocomplete: {
autoFocus: true,
delay: 0
Expand Down Expand Up @@ -186,6 +188,7 @@ class MentionsInput extends MentionsBase
options = $.extend(
matcher: @_getMatcher(),
select: @_onSelect,
suffix: @options.suffix,
source: @options.source,
appendTo: @input.parent()
, @options.autocomplete)
Expand Down
7 changes: 5 additions & 2 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 47e2c1a

Please sign in to comment.