将contentEditable改为enable_at

This commit is contained in:
guange 2015-12-18 17:41:14 +08:00
parent e02b865fa6
commit 9dea58c921
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 ifr = editor.edit.iframe[0];
var doc = ifr.contentDocument || iframe.contentWindow.document; var doc = ifr.contentDocument || iframe.contentWindow.document;
var ifrBody = doc.body; var ifrBody = doc.body;
ifrBody.contentEditable = true; //ifrBody.contentEditable = false;
$(ifrBody).attr('enable_at', 'true');
console.log("enable at"); console.log("enable at");
$.fn.atwho.debug = true; //$.fn.atwho.debug = true;
var names = []; var names = [];
@ -41,6 +42,6 @@ var enableAt = function(_editor) {
}; };
$inputor = $(ifrBody).atwho(at_config); $inputor = $(ifrBody).atwho(at_config);
$inputor.caret('pos', 47); //$inputor.caret('pos', 47);
$inputor.focus().atwho('run'); //$inputor.focus().atwho('run');
}; };

View File

@ -97,7 +97,7 @@ App = (function() {
App.prototype.reg = function(flag, setting) { App.prototype.reg = function(flag, setting) {
var base, controller; 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) { if (setting.alias) {
this.aliasMaps[setting.alias] = flag; this.aliasMaps[setting.alias] = flag;
} }
@ -1110,7 +1110,7 @@ $.fn.atwho = function(method) {
var _args, result; var _args, result;
_args = arguments; _args = arguments;
result = null; 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; var $this, app;
if (!(app = ($this = $(this)).data("atwho"))) { if (!(app = ($this = $(this)).data("atwho"))) {
$this.data('atwho', (app = new App(this))); $this.data('atwho', (app = new App(this)));