Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / src / layout / component / field / HtmlEditor.js
1 /**
2  * @private
3  * @class Ext.layout.component.field.HtmlEditor
4  * @extends Ext.layout.component.field.Field
5  * Layout class for {@link Ext.form.field.HtmlEditor} fields. Sizes the toolbar, textarea, and iframe elements.
6  * @private
7  */
8
9 Ext.define('Ext.layout.component.field.HtmlEditor', {
10     extend: 'Ext.layout.component.field.Field',
11     alias: ['layout.htmleditor'],
12
13     type: 'htmleditor',
14
15     sizeBodyContents: function(width, height) {
16         var me = this,
17             owner = me.owner,
18             bodyEl = owner.bodyEl,
19             toolbar = owner.getToolbar(),
20             textarea = owner.textareaEl,
21             iframe = owner.iframeEl,
22             editorHeight;
23
24         if (Ext.isNumber(width)) {
25             width -= bodyEl.getFrameWidth('lr');
26         }
27         toolbar.setWidth(width);
28         textarea.setWidth(width);
29         iframe.setWidth(width);
30
31         // If fixed height, subtract toolbar height from the input area height
32         if (Ext.isNumber(height)) {
33             editorHeight = height - toolbar.getHeight() - bodyEl.getFrameWidth('tb');
34             textarea.setHeight(editorHeight);
35             iframe.setHeight(editorHeight);
36         }
37     }
38 });