/** * Layout class for {@link Ext.form.field.HtmlEditor} fields. Sizes textarea and iframe elements. * @private */Ext.define('Ext.layout.component.field.HtmlEditor', { extend: 'Ext.layout.component.field.FieldContainer', alias: ['layout.htmleditor'], type: 'htmleditor', naturalHeight: 150, naturalWidth: 300, beginLayout: function(ownerContext) { var owner = this.owner, dom; // In gecko, it can cause the browser to hang if we're running a layout with // a heap of data in the textarea (think several images with data urls). // So clear the value at the start, then re-insert it once we're done if (Ext.isGecko) { dom = owner.textareaEl.dom; this.lastValue = dom.value; dom.value = ''; } this.callParent(arguments); ownerContext.toolbarContext = ownerContext.context.getCmp(owner.toolbar); ownerContext.inputCmpContext = ownerContext.context.getCmp(owner.inputCmp); ownerContext.bodyCellContext = ownerContext.getEl('bodyEl'); ownerContext.textAreaContext = ownerContext.getEl('textareaEl'); ownerContext.iframeContext = ownerContext.getEl('iframeEl'); }, beginLayoutCycle: function(ownerContext) { var me = this, widthModel = ownerContext.widthModel, heightModel = ownerContext.heightModel, owner = me.owner, iframeEl = owner.iframeEl, textareaEl = owner.textareaEl; me.callParent(arguments); if (widthModel.shrinkWrap) { iframeEl.setStyle('width', ''); textareaEl.setStyle('width', ''); } else if (widthModel.natural) { ownerContext.bodyCellContext.setWidth(me.naturalWidth); } if (heightModel.natural || heightModel.shrinkWrap) { iframeEl.setHeight(me.naturalHeight); textareaEl.setHeight(me.naturalHeight); } }, finishedLayout: function(){ var owner = this.owner; this.callParent(arguments); if (Ext.isGecko) { owner.textareaEl.dom.value = this.lastValue; } }});