-
Notifications
You must be signed in to change notification settings - Fork 669
Insert the `at` or not.
PS. All blocks in this article like this word
would be an option in settings
Somebody want to insert the at
into inputor(textarea/contentEditable), but somebody don't.
So, maybe I can just add an optional setting, But i think there is a better way: using the tpl
.
First, After v0.4.0, At.js will not insert the at
anymore. But the default tpl
will do it instead!
So, If you have to customize tpl
or inserted_tpl
and want to insert the at
as well, You have to do it yourself.
Now At.js will just insert the data-value in tpl
, so you can just put the at
into it or remove it:
// for {at: "@"} and don't insert it.
<li data-value='${name}'>${name}</li>
// for emojis {at: ":"} and insert it.
<li data-value=':${name}:'>${name}</li>
In default tpl
: <li data-value='${atwho-at}${name}'>${name}</li>
, The variable: atwho-at would just be
the current at
. you can use it if you like. ;)
In contentEditable mode, At.js will just insert data-value in tpl
by default too.
so if you want to customize inserted_tpl
, choose to insert the at
or not by yourself.
For example:
// Default inserted_tpl:
<span>${atwho-data-value}</span>
// Customize and Don't insert `at`:
<div>${name}<span class="large">${title}</span></div>
// Customize and insert `at`:
<div><span class="at-class">@</span><span class="user-name">${name}</span></div>