From 9dea58c921454484acfaaceacfb909170a3c49da Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 18 Dec 2015 17:41:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86contentEditable=E6=94=B9=E4=B8=BAenabl?= =?UTF-8?q?e=5Fat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/kindeditor/at/config.js | 9 +++++---- public/assets/kindeditor/at/jquery.atwho.js | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/public/assets/kindeditor/at/config.js b/public/assets/kindeditor/at/config.js index f26685f00..45e7c3195 100644 --- a/public/assets/kindeditor/at/config.js +++ b/public/assets/kindeditor/at/config.js @@ -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'); }; diff --git a/public/assets/kindeditor/at/jquery.atwho.js b/public/assets/kindeditor/at/jquery.atwho.js index 1e6c8ec25..cd2caf6ca 100644 --- a/public/assets/kindeditor/at/jquery.atwho.js +++ b/public/assets/kindeditor/at/jquery.atwho.js @@ -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)));