///import core
///commands 当输入内容超过编辑器高度时，编辑器自动增高
///commandsName  AutoHeight,autoHeightEnabled
///commandsTitle  自动增高
/*
 * @description 自动伸展
 * @author zhanyi
 */
UE.plugins['autoheight'] = function () {
    var me = this;
    //提供开关，就算加载也可以关闭
    me.autoHeightEnabled = me.options.autoHeightEnabled !== false;
    if (!me.autoHeightEnabled) {
        return;
    }

    var bakOverflow,
        span, tmpNode,
        lastHeight = 0,
        options = me.options,
        currentHeight,
        timer;

    function adjustHeight() {
        var me = this;
        clearTimeout(timer);
        if(isFullscreen)return;
        timer = setTimeout(function () {
            if (!me.queryCommandState || me.queryCommandState && me.queryCommandState('source') != 1) {
                if (!span) {
                    span = me.document.createElement('span');
                    //trace:1764
                    span.style.cssText = 'display:block;width:0;margin:0;padding:0;border:0;clear:both;';
                    span.innerHTML = '.';
                }
                tmpNode = span.cloneNode(true);
                me.body.appendChild(tmpNode);
                currentHeight = Math.max(domUtils.getXY(tmpNode).y + tmpNode.offsetHeight,Math.max(options.minFrameHeight, options.initialFrameHeight));
                if (currentHeight != lastHeight) {

                    me.setHeight(currentHeight,true);

                    lastHeight = currentHeight;
                }
                domUtils.remove(tmpNode);

            }
        }, 50);
    }
    var isFullscreen;
    me.addListener('fullscreenchanged',function(cmd,f){
        isFullscreen = f
    });
    me.addListener('destroy', function () {
        me.removeListener('contentchange afterinserthtml keyup mouseup',adjustHeight)
    });
    me.enableAutoHeight = function () {
        var me = this;
        if (!me.autoHeightEnabled) {
            return;
        }
        var doc = me.document;
        me.autoHeightEnabled = true;
        bakOverflow = doc.body.style.overflowY;
        doc.body.style.overflowY = 'hidden';
        me.addListener('contentchange afterinserthtml keyup mouseup',adjustHeight);
        //ff不给事件算得不对

        setTimeout(function () {
            adjustHeight.call(me);
        }, browser.gecko ? 100 : 0);
        me.fireEvent('autoheightchanged', me.autoHeightEnabled);
    };
    me.disableAutoHeight = function () {

        me.body.style.overflowY = bakOverflow || '';

        me.removeListener('contentchange', adjustHeight);
        me.removeListener('keyup', adjustHeight);
        me.removeListener('mouseup', adjustHeight);
        me.autoHeightEnabled = false;
        me.fireEvent('autoheightchanged', me.autoHeightEnabled);
    };
    me.addListener('ready', function () {
        me.enableAutoHeight();
        //trace:1764
        var timer;
        domUtils.on(browser.ie ? me.body : me.document, browser.webkit ? 'dragover' : 'drop', function () {
            clearTimeout(timer);
            timer = setTimeout(function () {
                adjustHeight.call(me);
            }, 100);

        });
    });


};


@@ -403,32 +403,8 @@
 w,%0D%0A
-        span, tmpNode,%0D%0A
     
@@ -424,16 +424,16 @@
 t = 0,%0D%0A
+
         
@@ -619,54 +619,8 @@
 n;%0D%0A
-        timer = setTimeout(function () %7B%0D%0A    
     
@@ -732,385 +732,84 @@
     
-    if (!span) %7B%0D%0A                    span = me.document.createElement('span');%0D%0A                    //trace:1764%0D%0A                    span.style.cssText = 'display:block;width:0;margin:0;padding:0;border:0;clear:both;';%0D%0A                    span.innerHTML = '.';%0D%0A                %7D%0D%0A                tmpNode = span.cloneNode(true);%0D%0A                me.body.appendChild(tmpNode)
+timer = setTimeout(function()%7B%0D%0A                var node = me.body.lastChild
 ;%0D%0A 
@@ -863,20 +863,17 @@
 s.getXY(
-tmpN
+n
 ode).y +
@@ -873,20 +873,17 @@
 de).y + 
-tmpN
+n
 ode.offs
@@ -890,16 +890,22 @@
 etHeight
+ + 25 
 ,Math.ma
@@ -958,16 +958,17 @@
 Height))
+ 
 ;%0D%0A     
@@ -1010,26 +1010,24 @@
 tHeight) %7B%0D%0A
-%0D%0A
             
@@ -1065,26 +1065,24 @@
 ght,true);%0D%0A
-%0D%0A
             
@@ -1153,71 +1153,24 @@
     
-    domUtils.remove(tmpNode);%0D%0A%0D%0A            %7D%0D%0A        %7D, 50);
+%7D,50)%0D%0A        %7D
 %0D%0A  

修复ie11下不能输入中文的问题