/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ (function(){function h(a){function m(){d=a.document;n=d[CKEDITOR.env.ie?"getBody":"getDocumentElement"]();c=CKEDITOR.env.quirks?d.getBody():d.getDocumentElement();e=CKEDITOR.dom.element.createFromHtml('\x3cspan style\x3d"margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;"\x3e'+(CKEDITOR.env.webkit?"\x26nbsp;":"")+"\x3c/span\x3e",d)}function f(){k&&c.setStyle("overflow-y","hidden");var g=a.window.getViewPaneSize().height,b;n.append(e);b=e.getDocumentPosition(d).y+e.$.offsetHeight; e.remove();b+=h;b=Math.max(b,r);b=Math.min(b,p);b!=g&&l!=b&&(b=a.fire("autoGrow",{currentHeight:g,newHeight:b}).newHeight,a.resize(a.container.getStyle("width"),b,!0),l=b);k||(b
c.$.clientHeight?c.setStyle("overflow-y","hidden"):c.removeStyle("overflow-y"))}var l,d,n,c,e,h=a.config.autoGrow_bottomSpace||0,r=void 0!==a.config.autoGrow_minHeight?a.config.autoGrow_minHeight:200,p=a.config.autoGrow_maxHeight||Infinity,k=!a.config.autoGrow_maxHeight;a.addCommand("autogrow",{exec:f, modes:{wysiwyg:1},readOnly:1,canUndo:!1,editorFocus:!1});var t={contentDom:1,key:1,selectionChange:1,insertElement:1,mode:1},q;for(q in t)a.on(q,function(g){"wysiwyg"==g.editor.mode&&setTimeout(function(){var b=a.getCommand("maximize");!a.window||b&&b.state==CKEDITOR.TRISTATE_ON?l=null:(f(),k||f())},100)});a.on("afterCommandExec",function(a){"maximize"==a.data.name&&"wysiwyg"==a.editor.mode&&(a.data.command.state==CKEDITOR.TRISTATE_ON?c.removeStyle("overflow-y"):f())});a.on("contentDom",m);m();a.config.autoGrow_onStartup&& a.execCommand("autogrow")}CKEDITOR.plugins.add("autogrow",{init:function(a){if(a.elementMode!=CKEDITOR.ELEMENT_MODE_INLINE)a.on("instanceReady",function(){a.editable().isInline()?a.ui.space("contents").setStyle("height","auto"):h(a)})}})})();