diff --git a/assets/style.css b/assets/style.css
index f86105f..be4ecfb 100644
--- a/assets/style.css
+++ b/assets/style.css
@@ -101,6 +101,10 @@ code {
margin-left: 20px;
}
+code.inline {
+ margin-left: 0;
+}
+
pre {
font-size: 12px;
padding: 2px 0 2px 12px;
diff --git a/docs/assets/style.css b/docs/assets/style.css
index f86105f..be4ecfb 100644
--- a/docs/assets/style.css
+++ b/docs/assets/style.css
@@ -101,6 +101,10 @@ code {
margin-left: 20px;
}
+code.inline {
+ margin-left: 0;
+}
+
pre {
font-size: 12px;
padding: 2px 0 2px 12px;
diff --git a/docs/index.html b/docs/index.html
index cfaa327..f1d24f6 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -105,6 +105,14 @@
Configuration
mentions input field.
+
+
+ | conserveTriggerChar |
+ false |
+
+ If this option is true, the triggerChar will be included into mention text.
+ |
+
| minChars |
2 |
diff --git a/index.html b/index.html
index 3ec97ac..2e01cc3 100644
--- a/index.html
+++ b/index.html
@@ -106,6 +106,13 @@ Configuration
mentions input field.
+
+ | conserveTriggerChar |
+ false |
+
+ If this option is true, the triggerChar will be included into mention text.
+ |
+
| minChars |
2 |
diff --git a/jquery.mentionsInput.js b/jquery.mentionsInput.js
index e75bb0a..d44249f 100644
--- a/jquery.mentionsInput.js
+++ b/jquery.mentionsInput.js
@@ -15,14 +15,15 @@
//Default settings
var defaultSettings = {
- triggerChar : '@', //Char that respond to event
- onDataRequest : $.noop, //Function where we can search the data
- minChars : 2, //Minimum chars to fire the event
- allowRepeat : false, //Allow repeat mentions
- showAvatars : true, //Show the avatars
- elastic : true, //Grow the textarea automatically
- defaultValue : '',
- onCaret : false,
+ triggerChar : '@', //Char that respond to event
+ onDataRequest : $.noop, //Function where we can search the data
+ minChars : 2, //Minimum chars to fire the event
+ allowRepeat : false, //Allow repeat mentions
+ showAvatars : true, //Show the avatars
+ elastic : true, //Grow the textarea automatically
+ defaultValue : '',
+ onCaret : false,
+ conserveTriggerChar : false,
classes : {
autoCompleteItemActive : "active" //Classes to apply in each item
},
@@ -208,6 +209,10 @@
var end = currentMessage.substr(currentCaretPosition, currentMessage.length);
var startEndIndex = (start + mention.value).length + 1;
+ if (settings.conserveTriggerChar) {
+ mention.value = settings.triggerChar + mention.value;
+ }
+
// See if there's the same mention in the list
if( !_.find(mentionsCollection, function (object) { return object.id == mention.id; }) ) {
mentionsCollection.push(mention);//Add the mention to mentionsColletions