This commit is contained in:
ouyangxuhua 2015-12-18 17:51:42 +08:00
commit 22d214cdd3
2 changed files with 7 additions and 6 deletions

View File

@ -10,10 +10,11 @@ var enableAt = function(_editor) {
var ifr = editor.edit.iframe[0];
var doc = ifr.contentDocument || iframe.contentWindow.document;
var ifrBody = doc.body;
ifrBody.contentEditable = true;
//ifrBody.contentEditable = false;
$(ifrBody).attr('enable_at', 'true');
console.log("enable at");
$.fn.atwho.debug = true;
//$.fn.atwho.debug = true;
var names = [];
@ -41,6 +42,6 @@ var enableAt = function(_editor) {
};
$inputor = $(ifrBody).atwho(at_config);
$inputor.caret('pos', 47);
$inputor.focus().atwho('run');
//$inputor.caret('pos', 47);
//$inputor.focus().atwho('run');
};

View File

@ -97,7 +97,7 @@ App = (function() {
App.prototype.reg = function(flag, setting) {
var base, controller;
controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[contentEditable]') ? new EditableController(this, flag) : new TextareaController(this, flag));
controller = (base = this.controllers)[flag] || (base[flag] = this.$inputor.is('[enable_at]') ? new EditableController(this, flag) : new TextareaController(this, flag));
if (setting.alias) {
this.aliasMaps[setting.alias] = flag;
}
@ -1110,7 +1110,7 @@ $.fn.atwho = function(method) {
var _args, result;
_args = arguments;
result = null;
this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each(function() {
this.filter('textarea, input, [contenteditable=""], [contenteditable=true], [enable_at=true]').each(function() {
var $this, app;
if (!(app = ($this = $(this)).data("atwho"))) {
$this.data('atwho', (app = new App(this)));