socialforge/public/assets/kindeditor/at/config.js

47 lines
1.3 KiB
JavaScript

var enableAt = function(_editor) {
var editor = _editor;
if(editor.edit == undefined || editor.edit.iframe == undefined){
return;
}
var id = arguments[1] ? arguments[1] : undefined;
var type = arguments[2] ? arguments[2] : 'Activity';
var ifr = editor.edit.iframe[0];
var doc = ifr.contentDocument || iframe.contentWindow.document;
var ifrBody = doc.body;
ifrBody.contentEditable = true;
console.log("enable at");
$.fn.atwho.debug = true;
var names = [];
if("undefined" !== (typeof atPersonLists)){
names = atPersonLists;
}
if('undefined' != (typeof id)){
names = '/at/' + id + '?type='+type;
}
//var names = ["Jacob","Isabella","Ethan","Emma","Michael","Olivia","Alexander","Sophia","William","Ava","Joshua","Emily","Daniel","Madison","Jayden","Abigail","Noah","Chloe","你好","你你你", "가"];
//
//var names = $.map(names,function(value,i) {
// return {'id':i,'name':value,'email':value+"@email.com"};
//});
var at_config = {
at: "@",
data: names,
insertTpl: '@${name}(${login})',
displayTpl: "<li>${name} <small>${login}</small></li>",
searchKey: 'searchKey',
limit: 200
};
$inputor = $(ifrBody).atwho(at_config);
$inputor.caret('pos', 47);
$inputor.focus().atwho('run');
};