Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / HtmlEditor.html
index 36919e8..0e8f8ec 100644 (file)
-<html>\r
-<head>\r
-  <title>The source code</title>\r
-    <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
-    <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body  onload="prettyPrint();">\r
-    <pre class="prettyprint lang-js"><div id="cls-Ext.form.HtmlEditor"></div>/**\r
- * @class Ext.form.HtmlEditor\r
- * @extends Ext.form.Field\r
- * Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be \r
- * automatically hidden when needed.  These are noted in the config options where appropriate.\r
- * <br><br>The editor's toolbar buttons have tooltips defined in the {@link #buttonTips} property, but they are not \r
- * enabled by default unless the global {@link Ext.QuickTips} singleton is {@link Ext.QuickTips#init initialized}.\r
- * <br><br><b>Note: The focus/blur and validation marking functionality inherited from Ext.form.Field is NOT\r
- * supported by this editor.</b>\r
- * <br><br>An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within\r
- * any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.\r
- * <br><br>Example usage:\r
- * <pre><code>\r
-// Simple example rendered with default options:\r
-Ext.QuickTips.init();  // enable tooltips\r
-new Ext.form.HtmlEditor({\r
-    renderTo: Ext.getBody(),\r
-    width: 800,\r
-    height: 300\r
-});\r
-\r
-// Passed via xtype into a container and with custom options:\r
-Ext.QuickTips.init();  // enable tooltips\r
-new Ext.Panel({\r
-    title: 'HTML Editor',\r
-    renderTo: Ext.getBody(),\r
-    width: 600,\r
-    height: 300,\r
-    frame: true,\r
-    layout: 'fit',\r
-    items: {\r
-        xtype: 'htmleditor',\r
-        enableColors: false,\r
-        enableAlignments: false\r
-    }\r
-});\r
-</code></pre>\r
- * @constructor\r
- * Create a new HtmlEditor\r
- * @param {Object} config\r
- * @xtype htmleditor\r
- */\r
-\r
-Ext.form.HtmlEditor = Ext.extend(Ext.form.Field, {\r
-    <div id="cfg-Ext.form.HtmlEditor-enableFormat"></div>/**\r
-     * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true)\r
-     */\r
-    enableFormat : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableFontSize"></div>/**\r
-     * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true)\r
-     */\r
-    enableFontSize : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableColors"></div>/**\r
-     * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true)\r
-     */\r
-    enableColors : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableAlignments"></div>/**\r
-     * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true)\r
-     */\r
-    enableAlignments : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableLists"></div>/**\r
-     * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true)\r
-     */\r
-    enableLists : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableSourceEdit"></div>/**\r
-     * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true)\r
-     */\r
-    enableSourceEdit : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableLinks"></div>/**\r
-     * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true)\r
-     */\r
-    enableLinks : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-enableFont"></div>/**\r
-     * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true)\r
-     */\r
-    enableFont : true,\r
-    <div id="cfg-Ext.form.HtmlEditor-createLinkText"></div>/**\r
-     * @cfg {String} createLinkText The default text for the create link prompt\r
-     */\r
-    createLinkText : 'Please enter the URL for the link:',\r
-    <div id="cfg-Ext.form.HtmlEditor-defaultLinkValue"></div>/**\r
-     * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /)\r
-     */\r
-    defaultLinkValue : 'http:/'+'/',\r
-    <div id="cfg-Ext.form.HtmlEditor-fontFamilies"></div>/**\r
-     * @cfg {Array} fontFamilies An array of available font families\r
-     */\r
-    fontFamilies : [\r
-        'Arial',\r
-        'Courier New',\r
-        'Tahoma',\r
-        'Times New Roman',\r
-        'Verdana'\r
-    ],\r
-    defaultFont: 'tahoma',\r
-    <div id="cfg-Ext.form.HtmlEditor-defaultValue"></div>/**\r
-     * @cfg {String} defaultValue A default value to be put into the editor to resolve focus issues (defaults to &#8203; (Zero-width space), &nbsp; (Non-breaking space) in Opera and IE6).\r
-     */\r
-    defaultValue: (Ext.isOpera || Ext.isIE6) ? '&nbsp;' : '&#8203;',\r
-\r
-    // private properties\r
-    actionMode: 'wrap',\r
-    validationEvent : false,\r
-    deferHeight: true,\r
-    initialized : false,\r
-    activated : false,\r
-    sourceEditMode : false,\r
-    onFocus : Ext.emptyFn,\r
-    iframePad:3,\r
-    hideMode:'offsets',\r
-    defaultAutoCreate : {\r
-        tag: "textarea",\r
-        style:"width:500px;height:300px;",\r
-        autocomplete: "off"\r
-    },\r
-\r
-    // private\r
-    initComponent : function(){\r
-        this.addEvents(\r
-            <div id="event-Ext.form.HtmlEditor-initialize"></div>/**\r
-             * @event initialize\r
-             * Fires when the editor is fully initialized (including the iframe)\r
-             * @param {HtmlEditor} this\r
-             */\r
-            'initialize',\r
-            <div id="event-Ext.form.HtmlEditor-activate"></div>/**\r
-             * @event activate\r
-             * Fires when the editor is first receives the focus. Any insertion must wait\r
-             * until after this event.\r
-             * @param {HtmlEditor} this\r
-             */\r
-            'activate',\r
-             <div id="event-Ext.form.HtmlEditor-beforesync"></div>/**\r
-             * @event beforesync\r
-             * Fires before the textarea is updated with content from the editor iframe. Return false\r
-             * to cancel the sync.\r
-             * @param {HtmlEditor} this\r
-             * @param {String} html\r
-             */\r
-            'beforesync',\r
-             <div id="event-Ext.form.HtmlEditor-beforepush"></div>/**\r
-             * @event beforepush\r
-             * Fires before the iframe editor is updated with content from the textarea. Return false\r
-             * to cancel the push.\r
-             * @param {HtmlEditor} this\r
-             * @param {String} html\r
-             */\r
-            'beforepush',\r
-             <div id="event-Ext.form.HtmlEditor-sync"></div>/**\r
-             * @event sync\r
-             * Fires when the textarea is updated with content from the editor iframe.\r
-             * @param {HtmlEditor} this\r
-             * @param {String} html\r
-             */\r
-            'sync',\r
-             <div id="event-Ext.form.HtmlEditor-push"></div>/**\r
-             * @event push\r
-             * Fires when the iframe editor is updated with content from the textarea.\r
-             * @param {HtmlEditor} this\r
-             * @param {String} html\r
-             */\r
-            'push',\r
-             <div id="event-Ext.form.HtmlEditor-editmodechange"></div>/**\r
-             * @event editmodechange\r
-             * Fires when the editor switches edit modes\r
-             * @param {HtmlEditor} this\r
-             * @param {Boolean} sourceEdit True if source edit, false if standard editing.\r
-             */\r
-            'editmodechange'\r
-        )\r
-    },\r
-\r
-    // private\r
-    createFontOptions : function(){\r
-        var buf = [], fs = this.fontFamilies, ff, lc;\r
-        for(var i = 0, len = fs.length; i< len; i++){\r
-            ff = fs[i];\r
-            lc = ff.toLowerCase();\r
-            buf.push(\r
-                '<option value="',lc,'" style="font-family:',ff,';"',\r
-                    (this.defaultFont == lc ? ' selected="true">' : '>'),\r
-                    ff,\r
-                '</option>'\r
-            );\r
-        }\r
-        return buf.join('');\r
-    },\r
-    \r
-    /*\r
-     * Protected method that will not generally be called directly. It\r
-     * is called when the editor creates its toolbar. Override this method if you need to\r
-     * add custom toolbar buttons.\r
-     * @param {HtmlEditor} editor\r
-     */\r
-    createToolbar : function(editor){\r
-        \r
-        var tipsEnabled = Ext.QuickTips && Ext.QuickTips.isEnabled();\r
-        \r
-        function btn(id, toggle, handler){\r
-            return {\r
-                itemId : id,\r
-                cls : 'x-btn-icon',\r
-                iconCls: 'x-edit-'+id,\r
-                enableToggle:toggle !== false,\r
-                scope: editor,\r
-                handler:handler||editor.relayBtnCmd,\r
-                clickEvent:'mousedown',\r
-                tooltip: tipsEnabled ? editor.buttonTips[id] || undefined : undefined,\r
-                overflowText: editor.buttonTips[id].title || undefined,\r
-                tabIndex:-1\r
-            };\r
-        }\r
-\r
-        // build the toolbar\r
-        var tb = new Ext.Toolbar({\r
-            renderTo:this.wrap.dom.firstChild\r
-        });\r
-\r
-        // stop form submits\r
-        this.mon(tb.el, 'click', function(e){\r
-            e.preventDefault();\r
-        });\r
-\r
-        if(this.enableFont && !Ext.isSafari2){\r
-            this.fontSelect = tb.el.createChild({\r
-                tag:'select',\r
-                cls:'x-font-select',\r
-                html: this.createFontOptions()\r
-            });\r
-            this.mon(this.fontSelect, 'change', function(){\r
-                var font = this.fontSelect.dom.value;\r
-                this.relayCmd('fontname', font);\r
-                this.deferFocus();\r
-            }, this);\r
-\r
-            tb.add(\r
-                this.fontSelect.dom,\r
-                '-'\r
-            );\r
-        }\r
-\r
-        if(this.enableFormat){\r
-            tb.add(\r
-                btn('bold'),\r
-                btn('italic'),\r
-                btn('underline')\r
-            );\r
-        }\r
-\r
-        if(this.enableFontSize){\r
-            tb.add(\r
-                '-',\r
-                btn('increasefontsize', false, this.adjustFont),\r
-                btn('decreasefontsize', false, this.adjustFont)\r
-            );\r
-        }\r
-\r
-        if(this.enableColors){\r
-            tb.add(\r
-                '-', {\r
-                    itemId:'forecolor',\r
-                    cls:'x-btn-icon',\r
-                    iconCls: 'x-edit-forecolor',\r
-                    clickEvent:'mousedown',\r
-                    tooltip: tipsEnabled ? editor.buttonTips.forecolor || undefined : undefined,\r
-                    tabIndex:-1,\r
-                    menu : new Ext.menu.ColorMenu({\r
-                        allowReselect: true,\r
-                        focus: Ext.emptyFn,\r
-                        value:'000000',\r
-                        plain:true,\r
-                        listeners: {\r
-                            scope: this,\r
-                            select: function(cp, color){\r
-                                this.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);\r
-                                this.deferFocus();\r
-                            }\r
-                        },\r
-                        clickEvent:'mousedown'\r
-                    })\r
-                }, {\r
-                    itemId:'backcolor',\r
-                    cls:'x-btn-icon',\r
-                    iconCls: 'x-edit-backcolor',\r
-                    clickEvent:'mousedown',\r
-                    tooltip: tipsEnabled ? editor.buttonTips.backcolor || undefined : undefined,\r
-                    tabIndex:-1,\r
-                    menu : new Ext.menu.ColorMenu({\r
-                        focus: Ext.emptyFn,\r
-                        value:'FFFFFF',\r
-                        plain:true,\r
-                        allowReselect: true,\r
-                        listeners: {\r
-                            scope: this,\r
-                            select: function(cp, color){\r
-                                if(Ext.isGecko){\r
-                                    this.execCmd('useCSS', false);\r
-                                    this.execCmd('hilitecolor', color);\r
-                                    this.execCmd('useCSS', true);\r
-                                    this.deferFocus();\r
-                                }else{\r
-                                    this.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);\r
-                                    this.deferFocus();\r
-                                }\r
-                            }\r
-                        },\r
-                        clickEvent:'mousedown'\r
-                    })\r
-                }\r
-            );\r
-        }\r
-\r
-        if(this.enableAlignments){\r
-            tb.add(\r
-                '-',\r
-                btn('justifyleft'),\r
-                btn('justifycenter'),\r
-                btn('justifyright')\r
-            );\r
-        }\r
-\r
-        if(!Ext.isSafari2){\r
-            if(this.enableLinks){\r
-                tb.add(\r
-                    '-',\r
-                    btn('createlink', false, this.createLink)\r
-                );\r
-            }\r
-\r
-            if(this.enableLists){\r
-                tb.add(\r
-                    '-',\r
-                    btn('insertorderedlist'),\r
-                    btn('insertunorderedlist')\r
-                );\r
-            }\r
-            if(this.enableSourceEdit){\r
-                tb.add(\r
-                    '-',\r
-                    btn('sourceedit', true, function(btn){\r
-                        this.toggleSourceEdit(!this.sourceEditMode);\r
-                    })\r
-                );\r
-            }\r
-        }\r
-\r
-        this.tb = tb;\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-getDocMarkup"></div>/**\r
-     * Protected method that will not generally be called directly. It\r
-     * is called when the editor initializes the iframe with HTML contents. Override this method if you\r
-     * want to change the initialization markup of the iframe (e.g. to add stylesheets).\r
-     */\r
-    getDocMarkup : function(){\r
-        return '<html><head><style type="text/css">body{border:0;margin:0;padding:3px;height:98%;cursor:text;}</style></head><body></body></html>';\r
-    },\r
-\r
-    // private\r
-    getEditorBody : function(){\r
-        return this.doc.body || this.doc.documentElement;\r
-    },\r
-\r
-    // private\r
-    getDoc : function(){\r
-        return Ext.isIE ? this.getWin().document : (this.iframe.contentDocument || this.getWin().document);\r
-    },\r
-\r
-    // private\r
-    getWin : function(){\r
-        return Ext.isIE ? this.iframe.contentWindow : window.frames[this.iframe.name];\r
-    },\r
-\r
-    // private\r
-    onRender : function(ct, position){\r
-        Ext.form.HtmlEditor.superclass.onRender.call(this, ct, position);\r
-        this.el.dom.style.border = '0 none';\r
-        this.el.dom.setAttribute('tabIndex', -1);\r
-        this.el.addClass('x-hidden');\r
-        if(Ext.isIE){ // fix IE 1px bogus margin\r
-            this.el.applyStyles('margin-top:-1px;margin-bottom:-1px;')\r
-        }\r
-        this.wrap = this.el.wrap({\r
-            cls:'x-html-editor-wrap', cn:{cls:'x-html-editor-tb'}\r
-        });\r
-\r
-        this.createToolbar(this);\r
-\r
-        this.disableItems(true);\r
-        // is this needed?\r
-        // this.tb.doLayout();\r
-\r
-        this.createIFrame();\r
-\r
-        if(!this.width){\r
-            var sz = this.el.getSize();\r
-            this.setSize(sz.width, this.height || sz.height);\r
-        }\r
-    },\r
-\r
-    createIFrame: function(){\r
-        var iframe = document.createElement('iframe');\r
-        iframe.name = Ext.id();\r
-        iframe.frameBorder = '0';\r
-        iframe.src = Ext.isIE ? Ext.SSL_SECURE_URL : "javascript:;";\r
-        this.wrap.dom.appendChild(iframe);\r
-\r
-        this.iframe = iframe;\r
-\r
-        this.monitorTask = Ext.TaskMgr.start({\r
-            run: this.checkDesignMode,\r
-            scope: this,\r
-            interval:100\r
-        });\r
-    },\r
-\r
-    initFrame : function(){\r
-        Ext.TaskMgr.stop(this.monitorTask);\r
-        this.doc = this.getDoc();\r
-        this.win = this.getWin();\r
-\r
-        this.doc.open();\r
-        this.doc.write(this.getDocMarkup());\r
-        this.doc.close();\r
-\r
-        var task = { // must defer to wait for browser to be ready\r
-            run : function(){\r
-                if(this.doc.body || this.doc.readyState == 'complete'){\r
-                    Ext.TaskMgr.stop(task);\r
-                    this.doc.designMode="on";\r
-                    this.initEditor.defer(10, this);\r
-                }\r
-            },\r
-            interval : 10,\r
-            duration:10000,\r
-            scope: this\r
-        };\r
-        Ext.TaskMgr.start(task);\r
-    },\r
-\r
-\r
-    checkDesignMode : function(){\r
-        if(this.wrap && this.wrap.dom.offsetWidth){\r
-            var doc = this.getDoc();\r
-            if(!doc){\r
-                return;\r
-            }\r
-            if(!doc.editorInitialized || String(doc.designMode).toLowerCase() != 'on'){\r
-                this.initFrame();\r
-            }\r
-        }\r
-    },\r
-    \r
-    disableItems: function(disabled){\r
-        if(this.fontSelect){\r
-            this.fontSelect.dom.disabled = disabled;\r
-        }\r
-        this.tb.items.each(function(item){\r
-            if(item.itemId != 'sourceedit'){\r
-                item.setDisabled(disabled);\r
-            }\r
-        });\r
-    },\r
-\r
-    // private\r
-    onResize : function(w, h){\r
-        Ext.form.HtmlEditor.superclass.onResize.apply(this, arguments);\r
-        if(this.el && this.iframe){\r
-            if(typeof w == 'number'){\r
-                var aw = w - this.wrap.getFrameWidth('lr');\r
-                this.el.setWidth(this.adjustWidth('textarea', aw));\r
-                this.tb.setWidth(aw);\r
-                this.iframe.style.width = Math.max(aw, 0) + 'px';\r
-            }\r
-            if(typeof h == 'number'){\r
-                var ah = h - this.wrap.getFrameWidth('tb') - this.tb.el.getHeight();\r
-                this.el.setHeight(this.adjustWidth('textarea', ah));\r
-                this.iframe.style.height = Math.max(ah, 0) + 'px';\r
-                if(this.doc){\r
-                    this.getEditorBody().style.height = Math.max((ah - (this.iframePad*2)), 0) + 'px';\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-toggleSourceEdit"></div>/**\r
-     * Toggles the editor between standard and source edit mode.\r
-     * @param {Boolean} sourceEdit (optional) True for source edit, false for standard\r
-     */\r
-    toggleSourceEdit : function(sourceEditMode){\r
-        if(sourceEditMode === undefined){\r
-            sourceEditMode = !this.sourceEditMode;\r
-        }\r
-        this.sourceEditMode = sourceEditMode === true;\r
-        var btn = this.tb.items.get('sourceedit');\r
-        if(btn.pressed !== this.sourceEditMode){\r
-            btn.toggle(this.sourceEditMode);\r
-            if(!btn.xtbHidden){\r
-                return;\r
-            }\r
-        }\r
-        if(this.sourceEditMode){\r
-            this.disableItems(true);\r
-            this.syncValue();\r
-            this.iframe.className = 'x-hidden';\r
-            this.el.removeClass('x-hidden');\r
-            this.el.dom.removeAttribute('tabIndex');\r
-            this.el.focus();\r
-        }else{\r
-            if(this.initialized){\r
-                this.disableItems(false);\r
-            }\r
-            this.pushValue();\r
-            this.iframe.className = '';\r
-            this.el.addClass('x-hidden');\r
-            this.el.dom.setAttribute('tabIndex', -1);\r
-            this.deferFocus();\r
-        }\r
-        var lastSize = this.lastSize;\r
-        if(lastSize){\r
-            delete this.lastSize;\r
-            this.setSize(lastSize);\r
-        }\r
-        this.fireEvent('editmodechange', this, this.sourceEditMode);\r
-    },\r
-\r
-    // private used internally\r
-    createLink : function(){\r
-        var url = prompt(this.createLinkText, this.defaultLinkValue);\r
-        if(url && url != 'http:/'+'/'){\r
-            this.relayCmd('createlink', url);\r
-        }\r
-    },\r
-\r
-    // private (for BoxComponent)\r
-    adjustSize : Ext.BoxComponent.prototype.adjustSize,\r
-\r
-    // private (for BoxComponent)\r
-    getResizeEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private (for BoxComponent)\r
-    getPositionEl : function(){\r
-        return this.wrap;\r
-    },\r
-\r
-    // private\r
-    initEvents : function(){\r
-        this.originalValue = this.getValue();\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-markInvalid"></div>/**\r
-     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide\r
-     * @method\r
-     */\r
-    markInvalid : Ext.emptyFn,\r
-    \r
-    <div id="method-Ext.form.HtmlEditor-clearInvalid"></div>/**\r
-     * Overridden and disabled. The editor element does not support standard valid/invalid marking. @hide\r
-     * @method\r
-     */\r
-    clearInvalid : Ext.emptyFn,\r
-\r
-    // docs inherit from Field\r
-    setValue : function(v){\r
-        Ext.form.HtmlEditor.superclass.setValue.call(this, v);\r
-        this.pushValue();\r
-        return this;\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-cleanHtml"></div>/**\r
-     * Protected method that will not generally be called directly. If you need/want\r
-     * custom HTML cleanup, this is the method you should override.\r
-     * @param {String} html The HTML to be cleaned\r
-     * @return {String} The cleaned HTML\r
-     */\r
-    cleanHtml : function(html){\r
-        html = String(html);\r
-        if(html.length > 5){\r
-            if(Ext.isWebKit){ // strip safari nonsense\r
-                html = html.replace(/\sclass="(?:Apple-style-span|khtml-block-placeholder)"/gi, '');\r
-            }\r
-        }\r
-        if(html == this.defaultValue){\r
-            html = '';\r
-        }\r
-        return html;\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-syncValue"></div>/**\r
-     * Protected method that will not generally be called directly. Syncs the contents\r
-     * of the editor iframe with the textarea.\r
-     */\r
-    syncValue : function(){\r
-        if(this.initialized){\r
-            var bd = this.getEditorBody();\r
-            var html = bd.innerHTML;\r
-            if(Ext.isWebKit){\r
-                var bs = bd.getAttribute('style'); // Safari puts text-align styles on the body element!\r
-                var m = bs.match(/text-align:(.*?);/i);\r
-                if(m && m[1]){\r
-                    html = '<div style="'+m[0]+'">' + html + '</div>';\r
-                }\r
-            }\r
-            html = this.cleanHtml(html);\r
-            if(this.fireEvent('beforesync', this, html) !== false){\r
-                this.el.dom.value = html;\r
-                this.fireEvent('sync', this, html);\r
-            }\r
-        }\r
-    },\r
-    \r
-    //docs inherit from Field\r
-    getValue : function() {\r
-        this[this.sourceEditMode ? 'pushValue' : 'syncValue']();\r
-        return Ext.form.HtmlEditor.superclass.getValue.call(this);\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-pushValue"></div>/**\r
-     * Protected method that will not generally be called directly. Pushes the value of the textarea\r
-     * into the iframe editor.\r
-     */\r
-    pushValue : function(){\r
-        if(this.initialized){\r
-            var v = this.el.dom.value;\r
-            if(!this.activated && v.length < 1){\r
-                v = this.defaultValue;\r
-            }\r
-            if(this.fireEvent('beforepush', this, v) !== false){\r
-                this.getEditorBody().innerHTML = v;\r
-                if(Ext.isGecko){\r
-                    // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8\r
-                    var d = this.doc,\r
-                        mode = d.designMode.toLowerCase();\r
-                    \r
-                    d.designMode = mode.toggle('on', 'off');\r
-                    d.designMode = mode;\r
-                }\r
-                this.fireEvent('push', this, v);\r
-            }\r
-        }\r
-    },\r
-\r
-    // private\r
-    deferFocus : function(){\r
-        this.focus.defer(10, this);\r
-    },\r
-\r
-    // docs inherit from Field\r
-    focus : function(){\r
-        if(this.win && !this.sourceEditMode){\r
-            this.win.focus();\r
-        }else{\r
-            this.el.focus();\r
-        }\r
-    },\r
-\r
-    // private\r
-    initEditor : function(){\r
-        //Destroying the component during/before initEditor can cause issues.\r
-        try{\r
-            var dbody = this.getEditorBody();\r
-            var ss = this.el.getStyles('font-size', 'font-family', 'background-image', 'background-repeat');\r
-            ss['background-attachment'] = 'fixed'; // w3c\r
-            dbody.bgProperties = 'fixed'; // ie\r
-\r
-            Ext.DomHelper.applyStyles(dbody, ss);\r
-\r
-            if(this.doc){\r
-                try{\r
-                    Ext.EventManager.removeAll(this.doc);\r
-                }catch(e){}\r
-            }\r
-\r
-            this.doc = this.getDoc();\r
-\r
-            Ext.EventManager.on(this.doc, {\r
-                'mousedown': this.onEditorEvent,\r
-                'dblclick': this.onEditorEvent,\r
-                'click': this.onEditorEvent,\r
-                'keyup': this.onEditorEvent,\r
-                buffer:100,\r
-                scope: this\r
-            });\r
-\r
-            if(Ext.isGecko){\r
-                Ext.EventManager.on(this.doc, 'keypress', this.applyCommand, this);\r
-            }\r
-            if(Ext.isIE || Ext.isWebKit || Ext.isOpera){\r
-                Ext.EventManager.on(this.doc, 'keydown', this.fixKeys, this);\r
-            }\r
-            this.initialized = true;\r
-            this.fireEvent('initialize', this);\r
-            this.doc.editorInitialized = true;\r
-            this.pushValue();\r
-        }catch(e){}\r
-    },\r
-\r
-    // private\r
-    onDestroy : function(){\r
-        if(this.monitorTask){\r
-            Ext.TaskMgr.stop(this.monitorTask);\r
-        }\r
-        if(this.rendered){\r
-            Ext.destroy(this.tb);\r
-            if(this.wrap){\r
-                this.wrap.dom.innerHTML = '';\r
-                this.wrap.remove();\r
-            }\r
-        }\r
-        if(this.el){\r
-            this.el.removeAllListeners();\r
-            this.el.remove();\r
-        }\r
\r
-        if(this.doc){\r
-            try{\r
-                Ext.EventManager.removeAll(this.doc);\r
-                for (var prop in this.doc){\r
-                   delete this.doc[prop];\r
-                }\r
-            }catch(e){}\r
-        }\r
-        this.purgeListeners();\r
-    },\r
-\r
-    // private\r
-    onFirstFocus : function(){\r
-        this.activated = true;\r
-        this.disableItems(false);\r
-        if(Ext.isGecko){ // prevent silly gecko errors\r
-            this.win.focus();\r
-            var s = this.win.getSelection();\r
-            if(!s.focusNode || s.focusNode.nodeType != 3){\r
-                var r = s.getRangeAt(0);\r
-                r.selectNodeContents(this.getEditorBody());\r
-                r.collapse(true);\r
-                this.deferFocus();\r
-            }\r
-            try{\r
-                this.execCmd('useCSS', true);\r
-                this.execCmd('styleWithCSS', false);\r
-            }catch(e){}\r
-        }\r
-        this.fireEvent('activate', this);\r
-    },\r
-\r
-    // private\r
-    adjustFont: function(btn){\r
-        var adjust = btn.itemId == 'increasefontsize' ? 1 : -1;\r
-\r
-        var v = parseInt(this.doc.queryCommandValue('FontSize') || 2, 10);\r
-        if((Ext.isSafari && !Ext.isSafari2) || Ext.isChrome || Ext.isAir){\r
-            // Safari 3 values\r
-            // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px\r
-            if(v <= 10){\r
-                v = 1 + adjust;\r
-            }else if(v <= 13){\r
-                v = 2 + adjust;\r
-            }else if(v <= 16){\r
-                v = 3 + adjust;\r
-            }else if(v <= 18){\r
-                v = 4 + adjust;\r
-            }else if(v <= 24){\r
-                v = 5 + adjust;\r
-            }else {\r
-                v = 6 + adjust;\r
-            }\r
-            v = v.constrain(1, 6);\r
-        }else{\r
-            if(Ext.isSafari){ // safari\r
-                adjust *= 2;\r
-            }\r
-            v = Math.max(1, v+adjust) + (Ext.isSafari ? 'px' : 0);\r
-        }\r
-        this.execCmd('FontSize', v);\r
-    },\r
-\r
-    // private\r
-    onEditorEvent : function(e){\r
-        this.updateToolbar();\r
-    },\r
-\r
-\r
-    <div id="method-Ext.form.HtmlEditor-updateToolbar"></div>/**\r
-     * Protected method that will not generally be called directly. It triggers\r
-     * a toolbar update by reading the markup state of the current selection in the editor.\r
-     */\r
-    updateToolbar: function(){\r
-\r
-        if(!this.activated){\r
-            this.onFirstFocus();\r
-            return;\r
-        }\r
-\r
-        var btns = this.tb.items.map, doc = this.doc;\r
-\r
-        if(this.enableFont && !Ext.isSafari2){\r
-            var name = (this.doc.queryCommandValue('FontName')||this.defaultFont).toLowerCase();\r
-            if(name != this.fontSelect.dom.value){\r
-                this.fontSelect.dom.value = name;\r
-            }\r
-        }\r
-        if(this.enableFormat){\r
-            btns.bold.toggle(doc.queryCommandState('bold'));\r
-            btns.italic.toggle(doc.queryCommandState('italic'));\r
-            btns.underline.toggle(doc.queryCommandState('underline'));\r
-        }\r
-        if(this.enableAlignments){\r
-            btns.justifyleft.toggle(doc.queryCommandState('justifyleft'));\r
-            btns.justifycenter.toggle(doc.queryCommandState('justifycenter'));\r
-            btns.justifyright.toggle(doc.queryCommandState('justifyright'));\r
-        }\r
-        if(!Ext.isSafari2 && this.enableLists){\r
-            btns.insertorderedlist.toggle(doc.queryCommandState('insertorderedlist'));\r
-            btns.insertunorderedlist.toggle(doc.queryCommandState('insertunorderedlist'));\r
-        }\r
-        \r
-        Ext.menu.MenuMgr.hideAll();\r
-\r
-        this.syncValue();\r
-    },\r
-\r
-    // private\r
-    relayBtnCmd : function(btn){\r
-        this.relayCmd(btn.itemId);\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-relayCmd"></div>/**\r
-     * Executes a Midas editor command on the editor document and performs necessary focus and\r
-     * toolbar updates. <b>This should only be called after the editor is initialized.</b>\r
-     * @param {String} cmd The Midas command\r
-     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)\r
-     */\r
-    relayCmd : function(cmd, value){\r
-        (function(){\r
-            this.focus();\r
-            this.execCmd(cmd, value);\r
-            this.updateToolbar();\r
-        }).defer(10, this);\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-execCmd"></div>/**\r
-     * Executes a Midas editor command directly on the editor document.\r
-     * For visual commands, you should use {@link #relayCmd} instead.\r
-     * <b>This should only be called after the editor is initialized.</b>\r
-     * @param {String} cmd The Midas command\r
-     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)\r
-     */\r
-    execCmd : function(cmd, value){\r
-        this.doc.execCommand(cmd, false, value === undefined ? null : value);\r
-        this.syncValue();\r
-    },\r
-\r
-    // private\r
-    applyCommand : function(e){\r
-        if(e.ctrlKey){\r
-            var c = e.getCharCode(), cmd;\r
-            if(c > 0){\r
-                c = String.fromCharCode(c);\r
-                switch(c){\r
-                    case 'b':\r
-                        cmd = 'bold';\r
-                    break;\r
-                    case 'i':\r
-                        cmd = 'italic';\r
-                    break;\r
-                    case 'u':\r
-                        cmd = 'underline';\r
-                    break;\r
-                }\r
-                if(cmd){\r
-                    this.win.focus();\r
-                    this.execCmd(cmd);\r
-                    this.deferFocus();\r
-                    e.preventDefault();\r
-                }\r
-            }\r
-        }\r
-    },\r
-\r
-    <div id="method-Ext.form.HtmlEditor-insertAtCursor"></div>/**\r
-     * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated\r
-     * to insert text.\r
-     * @param {String} text\r
-     */\r
-    insertAtCursor : function(text){\r
-        if(!this.activated){\r
-            return;\r
-        }\r
-        if(Ext.isIE){\r
-            this.win.focus();\r
-            var r = this.doc.selection.createRange();\r
-            if(r){\r
-                r.collapse(true);\r
-                r.pasteHTML(text);\r
-                this.syncValue();\r
-                this.deferFocus();\r
-            }\r
-        }else if(Ext.isGecko || Ext.isOpera){\r
-            this.win.focus();\r
-            this.execCmd('InsertHTML', text);\r
-            this.deferFocus();\r
-        }else if(Ext.isWebKit){\r
-            this.execCmd('InsertText', text);\r
-            this.deferFocus();\r
-        }\r
-    },\r
-\r
-    // private\r
-    fixKeys : function(){ // load time branching for fastest keydown performance\r
-        if(Ext.isIE){\r
-            return function(e){\r
-                var k = e.getKey(), r;\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    r = this.doc.selection.createRange();\r
-                    if(r){\r
-                        r.collapse(true);\r
-                        r.pasteHTML('&nbsp;&nbsp;&nbsp;&nbsp;');\r
-                        this.deferFocus();\r
-                    }\r
-                }else if(k == e.ENTER){\r
-                    r = this.doc.selection.createRange();\r
-                    if(r){\r
-                        var target = r.parentElement();\r
-                        if(!target || target.tagName.toLowerCase() != 'li'){\r
-                            e.stopEvent();\r
-                            r.pasteHTML('<br />');\r
-                            r.collapse(false);\r
-                            r.select();\r
-                        }\r
-                    }\r
-                }\r
-            };\r
-        }else if(Ext.isOpera){\r
-            return function(e){\r
-                var k = e.getKey();\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    this.win.focus();\r
-                    this.execCmd('InsertHTML','&nbsp;&nbsp;&nbsp;&nbsp;');\r
-                    this.deferFocus();\r
-                }\r
-            };\r
-        }else if(Ext.isWebKit){\r
-            return function(e){\r
-                var k = e.getKey();\r
-                if(k == e.TAB){\r
-                    e.stopEvent();\r
-                    this.execCmd('InsertText','\t');\r
-                    this.deferFocus();\r
-                }\r
-             };\r
-        }\r
-    }(),\r
-\r
-    <div id="method-Ext.form.HtmlEditor-getToolbar"></div>/**\r
-     * Returns the editor's toolbar. <b>This is only available after the editor has been rendered.</b>\r
-     * @return {Ext.Toolbar}\r
-     */\r
-    getToolbar : function(){\r
-        return this.tb;\r
-    },\r
-\r
-    <div id="prop-Ext.form.HtmlEditor-buttonTips"></div>/**\r
-     * Object collection of toolbar tooltips for the buttons in the editor. The key\r
-     * is the command id associated with that button and the value is a valid QuickTips object.\r
-     * For example:\r
-<pre><code>\r
-{\r
-    bold : {\r
-        title: 'Bold (Ctrl+B)',\r
-        text: 'Make the selected text bold.',\r
-        cls: 'x-html-editor-tip'\r
-    },\r
-    italic : {\r
-        title: 'Italic (Ctrl+I)',\r
-        text: 'Make the selected text italic.',\r
-        cls: 'x-html-editor-tip'\r
-    },\r
-    ...\r
-</code></pre>\r
-    * @type Object\r
-     */\r
-    buttonTips : {\r
-        bold : {\r
-            title: 'Bold (Ctrl+B)',\r
-            text: 'Make the selected text bold.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        italic : {\r
-            title: 'Italic (Ctrl+I)',\r
-            text: 'Make the selected text italic.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        underline : {\r
-            title: 'Underline (Ctrl+U)',\r
-            text: 'Underline the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        increasefontsize : {\r
-            title: 'Grow Text',\r
-            text: 'Increase the font size.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        decreasefontsize : {\r
-            title: 'Shrink Text',\r
-            text: 'Decrease the font size.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        backcolor : {\r
-            title: 'Text Highlight Color',\r
-            text: 'Change the background color of the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        forecolor : {\r
-            title: 'Font Color',\r
-            text: 'Change the color of the selected text.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifyleft : {\r
-            title: 'Align Text Left',\r
-            text: 'Align text to the left.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifycenter : {\r
-            title: 'Center Text',\r
-            text: 'Center text in the editor.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        justifyright : {\r
-            title: 'Align Text Right',\r
-            text: 'Align text to the right.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        insertunorderedlist : {\r
-            title: 'Bullet List',\r
-            text: 'Start a bulleted list.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        insertorderedlist : {\r
-            title: 'Numbered List',\r
-            text: 'Start a numbered list.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        createlink : {\r
-            title: 'Hyperlink',\r
-            text: 'Make the selected text a hyperlink.',\r
-            cls: 'x-html-editor-tip'\r
-        },\r
-        sourceedit : {\r
-            title: 'Source Edit',\r
-            text: 'Switch to source editing mode.',\r
-            cls: 'x-html-editor-tip'\r
-        }\r
-    }\r
-\r
-    // hide stuff that is not compatible\r
-    <div id="event-Ext.form.HtmlEditor-blur"></div>/**\r
-     * @event blur\r
-     * @hide\r
-     */\r
-    <div id="event-Ext.form.HtmlEditor-change"></div>/**\r
-     * @event change\r
-     * @hide\r
-     */\r
-    <div id="event-Ext.form.HtmlEditor-focus"></div>/**\r
-     * @event focus\r
-     * @hide\r
-     */\r
-    <div id="event-Ext.form.HtmlEditor-specialkey"></div>/**\r
-     * @event specialkey\r
-     * @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-fieldClass"></div>/**\r
-     * @cfg {String} fieldClass @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-focusClass"></div>/**\r
-     * @cfg {String} focusClass @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-autoCreate"></div>/**\r
-     * @cfg {String} autoCreate @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-inputType"></div>/**\r
-     * @cfg {String} inputType @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-invalidClass"></div>/**\r
-     * @cfg {String} invalidClass @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-invalidText"></div>/**\r
-     * @cfg {String} invalidText @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-msgFx"></div>/**\r
-     * @cfg {String} msgFx @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-validateOnBlur"></div>/**\r
-     * @cfg {String} validateOnBlur @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-allowDomMove"></div>/**\r
-     * @cfg {Boolean} allowDomMove  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-applyTo"></div>/**\r
-     * @cfg {String} applyTo @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-autoHeight"></div>/**\r
-     * @cfg {String} autoHeight  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-autoWidth"></div>/**\r
-     * @cfg {String} autoWidth  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-cls"></div>/**\r
-     * @cfg {String} cls  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-disabled"></div>/**\r
-     * @cfg {String} disabled  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-disabledClass"></div>/**\r
-     * @cfg {String} disabledClass  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-msgTarget"></div>/**\r
-     * @cfg {String} msgTarget  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-readOnly"></div>/**\r
-     * @cfg {String} readOnly  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-style"></div>/**\r
-     * @cfg {String} style  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-validationDelay"></div>/**\r
-     * @cfg {String} validationDelay  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-validationEvent"></div>/**\r
-     * @cfg {String} validationEvent  @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-tabIndex"></div>/**\r
-     * @cfg {String} tabIndex  @hide\r
-     */\r
-    <div id="prop-Ext.form.HtmlEditor-disabled"></div>/**\r
-     * @property disabled\r
-     * @hide\r
-     */\r
-    <div id="method-Ext.form.HtmlEditor-applyToMarkup"></div>/**\r
-     * @method applyToMarkup\r
-     * @hide\r
-     */\r
-    <div id="method-Ext.form.HtmlEditor-disable"></div>/**\r
-     * @method disable\r
-     * @hide\r
-     */\r
-    <div id="method-Ext.form.HtmlEditor-enable"></div>/**\r
-     * @method enable\r
-     * @hide\r
-     */\r
-    <div id="method-Ext.form.HtmlEditor-validate"></div>/**\r
-     * @method validate\r
-     * @hide\r
-     */\r
-    <div id="event-Ext.form.HtmlEditor-valid"></div>/**\r
-     * @event valid\r
-     * @hide\r
-     */\r
-    <div id="method-Ext.form.HtmlEditor-setDisabled"></div>/**\r
-     * @method setDisabled\r
-     * @hide\r
-     */\r
-    <div id="cfg-Ext.form.HtmlEditor-null"></div>/**\r
-     * @cfg keys\r
-     * @hide\r
-     */\r
-});\r
-Ext.reg('htmleditor', Ext.form.HtmlEditor);</pre>    \r
-</body>\r
-</html>
\ No newline at end of file
+<!DOCTYPE html>
+<html>
+<head>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+  <title>The source code</title>
+  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
+  <script type="text/javascript" src="../prettify/prettify.js"></script>
+  <style type="text/css">
+    .highlight { display: block; background-color: #ddd; }
+  </style>
+  <script type="text/javascript">
+    function highlight() {
+      document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
+    }
+  </script>
+</head>
+<body onload="prettyPrint(); highlight();">
+  <pre class="prettyprint lang-js"><span id='Ext-form-field-HtmlEditor-method-constructor'><span id='Ext-form-field-HtmlEditor'>/**
+</span></span> * @class Ext.form.field.HtmlEditor
+ * @extends Ext.Component
+ *
+ * Provides a lightweight HTML Editor component. Some toolbar features are not supported by Safari and will be
+ * automatically hidden when needed. These are noted in the config options where appropriate.
+ * 
+ * The editor's toolbar buttons have tooltips defined in the {@link #buttonTips} property, but they are not
+ * enabled by default unless the global {@link Ext.tip.QuickTipManager} singleton is {@link Ext.tip.QuickTipManager#init initialized}.
+ * 
+ * An Editor is a sensitive component that can't be used in all spots standard fields can be used. Putting an Editor within
+ * any element that has display set to 'none' can cause problems in Safari and Firefox due to their default iframe reloading bugs.
+ *
+ * {@img Ext.form.HtmlEditor/Ext.form.HtmlEditor1.png Ext.form.HtmlEditor component}
+ *
+ * ## Example usage
+ *
+ * {@img Ext.form.HtmlEditor/Ext.form.HtmlEditor2.png Ext.form.HtmlEditor component}
+ *
+ *     // Simple example rendered with default options:
+ *     Ext.tip.QuickTips.init();  // enable tooltips
+ *     Ext.create('Ext.form.HtmlEditor', {
+ *         width: 580,
+ *         height: 250,
+ *         renderTo: Ext.getBody()        
+ *     });
+ * 
+ * {@img Ext.form.HtmlEditor/Ext.form.HtmlEditor2.png Ext.form.HtmlEditor component}
+ * 
+ *     // Passed via xtype into a container and with custom options:
+ *     Ext.tip.QuickTips.init();  // enable tooltips
+ *     new Ext.panel.Panel({
+ *         title: 'HTML Editor',
+ *         renderTo: Ext.getBody(),
+ *         width: 550,
+ *         height: 250,
+ *         frame: true,
+ *         layout: 'fit',
+ *         items: {
+ *             xtype: 'htmleditor',
+ *             enableColors: false,
+ *             enableAlignments: false
+ *         }
+ *     });
+ *
+ * @constructor
+ * Create a new HtmlEditor
+ * @param {Object} config
+ * @xtype htmleditor
+ */
+Ext.define('Ext.form.field.HtmlEditor', {
+    extend:'Ext.Component',
+    mixins: {
+        labelable: 'Ext.form.Labelable',
+        field: 'Ext.form.field.Field'
+    },
+    alias: 'widget.htmleditor',
+    alternateClassName: 'Ext.form.HtmlEditor',
+    requires: [
+        'Ext.tip.QuickTipManager',
+        'Ext.picker.Color',
+        'Ext.toolbar.Item',
+        'Ext.toolbar.Toolbar',
+        'Ext.util.Format',
+        'Ext.layout.component.field.HtmlEditor'
+    ],
+
+    fieldSubTpl: [
+        '&lt;div class=&quot;{toolbarWrapCls}&quot;&gt;&lt;/div&gt;',
+        '&lt;textarea id=&quot;{id}&quot; name=&quot;{name}&quot; tabIndex=&quot;-1&quot; class=&quot;{textareaCls}&quot; ',
+            'style=&quot;{size}&quot; autocomplete=&quot;off&quot;&gt;&lt;/textarea&gt;',
+        '&lt;iframe name=&quot;{iframeName}&quot; frameBorder=&quot;0&quot; style=&quot;overflow:auto;{size}&quot; src=&quot;{iframeSrc}&quot;&gt;&lt;/iframe&gt;',
+        {
+            compiled: true,
+            disableFormats: true
+        }
+    ],
+
+<span id='Ext-form-field-HtmlEditor-cfg-enableFormat'>    /**
+</span>     * @cfg {Boolean} enableFormat Enable the bold, italic and underline buttons (defaults to true)
+     */
+    enableFormat : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableFontSize'>    /**
+</span>     * @cfg {Boolean} enableFontSize Enable the increase/decrease font size buttons (defaults to true)
+     */
+    enableFontSize : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableColors'>    /**
+</span>     * @cfg {Boolean} enableColors Enable the fore/highlight color buttons (defaults to true)
+     */
+    enableColors : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableAlignments'>    /**
+</span>     * @cfg {Boolean} enableAlignments Enable the left, center, right alignment buttons (defaults to true)
+     */
+    enableAlignments : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableLists'>    /**
+</span>     * @cfg {Boolean} enableLists Enable the bullet and numbered list buttons. Not available in Safari. (defaults to true)
+     */
+    enableLists : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableSourceEdit'>    /**
+</span>     * @cfg {Boolean} enableSourceEdit Enable the switch to source edit button. Not available in Safari. (defaults to true)
+     */
+    enableSourceEdit : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableLinks'>    /**
+</span>     * @cfg {Boolean} enableLinks Enable the create link button. Not available in Safari. (defaults to true)
+     */
+    enableLinks : true,
+<span id='Ext-form-field-HtmlEditor-cfg-enableFont'>    /**
+</span>     * @cfg {Boolean} enableFont Enable font selection. Not available in Safari. (defaults to true)
+     */
+    enableFont : true,
+<span id='Ext-form-field-HtmlEditor-cfg-createLinkText'>    /**
+</span>     * @cfg {String} createLinkText The default text for the create link prompt
+     */
+    createLinkText : 'Please enter the URL for the link:',
+<span id='Ext-form-field-HtmlEditor-cfg-defaultLinkValue'>    /**
+</span>     * @cfg {String} defaultLinkValue The default value for the create link prompt (defaults to http:/ /)
+     */
+    defaultLinkValue : 'http:/'+'/',
+<span id='Ext-form-field-HtmlEditor-cfg-fontFamilies'>    /**
+</span>     * @cfg {Array} fontFamilies An array of available font families
+     */
+    fontFamilies : [
+        'Arial',
+        'Courier New',
+        'Tahoma',
+        'Times New Roman',
+        'Verdana'
+    ],
+    defaultFont: 'tahoma',
+<span id='Ext-form-field-HtmlEditor-cfg-defaultValue'>    /**
+</span>     * @cfg {String} defaultValue A default value to be put into the editor to resolve focus issues (defaults to &amp;#160; (Non-breaking space) in Opera and IE6, &amp;#8203; (Zero-width space) in all other browsers).
+     */
+    defaultValue: (Ext.isOpera || Ext.isIE6) ? '&amp;#160;' : '&amp;#8203;',
+
+    fieldBodyCls: Ext.baseCSSPrefix + 'html-editor-wrap',
+
+    componentLayout: 'htmleditor',
+
+    // private properties
+    initialized : false,
+    activated : false,
+    sourceEditMode : false,
+    iframePad:3,
+    hideMode:'offsets',
+
+    maskOnDisable: true,
+    
+    // private
+    initComponent : function(){
+        var me = this;
+
+        me.addEvents(
+<span id='Ext-form-field-HtmlEditor-event-initialize'>            /**
+</span>             * @event initialize
+             * Fires when the editor is fully initialized (including the iframe)
+             * @param {Ext.form.field.HtmlEditor} this
+             */
+            'initialize',
+<span id='Ext-form-field-HtmlEditor-event-activate'>            /**
+</span>             * @event activate
+             * Fires when the editor is first receives the focus. Any insertion must wait
+             * until after this event.
+             * @param {Ext.form.field.HtmlEditor} this
+             */
+            'activate',
+<span id='Ext-form-field-HtmlEditor-event-beforesync'>             /**
+</span>             * @event beforesync
+             * Fires before the textarea is updated with content from the editor iframe. Return false
+             * to cancel the sync.
+             * @param {Ext.form.field.HtmlEditor} this
+             * @param {String} html
+             */
+            'beforesync',
+<span id='Ext-form-field-HtmlEditor-event-beforepush'>             /**
+</span>             * @event beforepush
+             * Fires before the iframe editor is updated with content from the textarea. Return false
+             * to cancel the push.
+             * @param {Ext.form.field.HtmlEditor} this
+             * @param {String} html
+             */
+            'beforepush',
+<span id='Ext-form-field-HtmlEditor-event-sync'>             /**
+</span>             * @event sync
+             * Fires when the textarea is updated with content from the editor iframe.
+             * @param {Ext.form.field.HtmlEditor} this
+             * @param {String} html
+             */
+            'sync',
+<span id='Ext-form-field-HtmlEditor-event-push'>             /**
+</span>             * @event push
+             * Fires when the iframe editor is updated with content from the textarea.
+             * @param {Ext.form.field.HtmlEditor} this
+             * @param {String} html
+             */
+            'push',
+<span id='Ext-form-field-HtmlEditor-event-editmodechange'>             /**
+</span>             * @event editmodechange
+             * Fires when the editor switches edit modes
+             * @param {Ext.form.field.HtmlEditor} this
+             * @param {Boolean} sourceEdit True if source edit, false if standard editing.
+             */
+            'editmodechange'
+        );
+
+        me.callParent(arguments);
+
+        // Init mixins
+        me.initLabelable();
+        me.initField();
+    },
+
+    /*
+     * Protected method that will not generally be called directly. It
+     * is called when the editor creates its toolbar. Override this method if you need to
+     * add custom toolbar buttons.
+     * @param {Ext.form.field.HtmlEditor} editor
+     */
+    createToolbar : function(editor){
+        var me = this,
+            items = [],
+            tipsEnabled = Ext.tip.QuickTipManager &amp;&amp; Ext.tip.QuickTipManager.isEnabled(),
+            baseCSSPrefix = Ext.baseCSSPrefix,
+            fontSelectItem, toolbar, undef;
+
+        function btn(id, toggle, handler){
+            return {
+                itemId : id,
+                cls : baseCSSPrefix + 'btn-icon',
+                iconCls: baseCSSPrefix + 'edit-'+id,
+                enableToggle:toggle !== false,
+                scope: editor,
+                handler:handler||editor.relayBtnCmd,
+                clickEvent:'mousedown',
+                tooltip: tipsEnabled ? editor.buttonTips[id] || undef : undef,
+                overflowText: editor.buttonTips[id].title || undef,
+                tabIndex:-1
+            };
+        }
+
+
+        if (me.enableFont &amp;&amp; !Ext.isSafari2) {
+            fontSelectItem = Ext.widget('component', {
+                renderTpl: [
+                    '&lt;select class=&quot;{cls}&quot;&gt;',
+                        '&lt;tpl for=&quot;fonts&quot;&gt;',
+                            '&lt;option value=&quot;{[values.toLowerCase()]}&quot; style=&quot;font-family:{.}&quot;&lt;tpl if=&quot;values.toLowerCase()==parent.defaultFont&quot;&gt; selected&lt;/tpl&gt;&gt;{.}&lt;/option&gt;',
+                        '&lt;/tpl&gt;',
+                    '&lt;/select&gt;'
+                ],
+                renderData: {
+                    cls: baseCSSPrefix + 'font-select',
+                    fonts: me.fontFamilies,
+                    defaultFont: me.defaultFont
+                },
+                renderSelectors: {
+                    selectEl: 'select'
+                },
+                onDisable: function() {
+                    var selectEl = this.selectEl;
+                    if (selectEl) {
+                        selectEl.dom.disabled = true;
+                    }
+                    Ext.Component.superclass.onDisable.apply(this, arguments);
+                },
+                onEnable: function() {
+                    var selectEl = this.selectEl;
+                    if (selectEl) {
+                        selectEl.dom.disabled = false;
+                    }
+                    Ext.Component.superclass.onEnable.apply(this, arguments);
+                }
+            });
+
+            items.push(
+                fontSelectItem,
+                '-'
+            );
+        }
+
+        if (me.enableFormat) {
+            items.push(
+                btn('bold'),
+                btn('italic'),
+                btn('underline')
+            );
+        }
+
+        if (me.enableFontSize) {
+            items.push(
+                '-',
+                btn('increasefontsize', false, me.adjustFont),
+                btn('decreasefontsize', false, me.adjustFont)
+            );
+        }
+
+        if (me.enableColors) {
+            items.push(
+                '-', {
+                    itemId: 'forecolor',
+                    cls: baseCSSPrefix + 'btn-icon',
+                    iconCls: baseCSSPrefix + 'edit-forecolor',
+                    overflowText: editor.buttonTips.forecolor.title,
+                    tooltip: tipsEnabled ? editor.buttonTips.forecolor || undef : undef,
+                    tabIndex:-1,
+                    menu : Ext.widget('menu', {
+                        plain: true,
+                        items: [{
+                            xtype: 'colorpicker',
+                            allowReselect: true,
+                            focus: Ext.emptyFn,
+                            value: '000000',
+                            plain: true,
+                            clickEvent: 'mousedown',
+                            handler: function(cp, color) {
+                                me.execCmd('forecolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
+                                me.deferFocus();
+                                this.up('menu').hide();
+                            }
+                        }]
+                    })
+                }, {
+                    itemId: 'backcolor',
+                    cls: baseCSSPrefix + 'btn-icon',
+                    iconCls: baseCSSPrefix + 'edit-backcolor',
+                    overflowText: editor.buttonTips.backcolor.title,
+                    tooltip: tipsEnabled ? editor.buttonTips.backcolor || undef : undef,
+                    tabIndex:-1,
+                    menu : Ext.widget('menu', {
+                        plain: true,
+                        items: [{
+                            xtype: 'colorpicker',
+                            focus: Ext.emptyFn,
+                            value: 'FFFFFF',
+                            plain: true,
+                            allowReselect: true,
+                            clickEvent: 'mousedown',
+                            handler: function(cp, color) {
+                                if (Ext.isGecko) {
+                                    me.execCmd('useCSS', false);
+                                    me.execCmd('hilitecolor', color);
+                                    me.execCmd('useCSS', true);
+                                    me.deferFocus();
+                                } else {
+                                    me.execCmd(Ext.isOpera ? 'hilitecolor' : 'backcolor', Ext.isWebKit || Ext.isIE ? '#'+color : color);
+                                    me.deferFocus();
+                                }
+                                this.up('menu').hide();
+                            }
+                        }]
+                    })
+                }
+            );
+        }
+
+        if (me.enableAlignments) {
+            items.push(
+                '-',
+                btn('justifyleft'),
+                btn('justifycenter'),
+                btn('justifyright')
+            );
+        }
+
+        if (!Ext.isSafari2) {
+            if (me.enableLinks) {
+                items.push(
+                    '-',
+                    btn('createlink', false, me.createLink)
+                );
+            }
+
+            if (me.enableLists) {
+                items.push(
+                    '-',
+                    btn('insertorderedlist'),
+                    btn('insertunorderedlist')
+                );
+            }
+            if (me.enableSourceEdit) {
+                items.push(
+                    '-',
+                    btn('sourceedit', true, function(btn){
+                        me.toggleSourceEdit(!me.sourceEditMode);
+                    })
+                );
+            }
+        }
+
+        // build the toolbar
+        toolbar = Ext.widget('toolbar', {
+            renderTo: me.toolbarWrap,
+            enableOverflow: true,
+            items: items
+        });
+
+        if (fontSelectItem) {
+            me.fontSelect = fontSelectItem.selectEl;
+
+            me.mon(me.fontSelect, 'change', function(){
+                me.relayCmd('fontname', me.fontSelect.dom.value);
+                me.deferFocus();
+            });
+        }
+
+        // stop form submits
+        me.mon(toolbar.el, 'click', function(e){
+            e.preventDefault();
+        });
+
+        me.toolbar = toolbar;
+    },
+
+    onDisable: function() {
+        this.bodyEl.mask();
+        this.callParent(arguments);
+    },
+
+    onEnable: function() {
+        this.bodyEl.unmask();
+        this.callParent(arguments);
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-setReadOnly'>    /**
+</span>     * Sets the read only state of this field.
+     * @param {Boolean} readOnly Whether the field should be read only.
+     */
+    setReadOnly: function(readOnly) {
+        var me = this,
+            textareaEl = me.textareaEl,
+            iframeEl = me.iframeEl,
+            body;
+
+        me.readOnly = readOnly;
+
+        if (textareaEl) {
+            textareaEl.dom.readOnly = readOnly;
+        }
+
+        if (me.initialized) {
+            body = me.getEditorBody();
+            if (Ext.isIE) {
+                // Hide the iframe while setting contentEditable so it doesn't grab focus
+                iframeEl.setDisplayed(false);
+                body.contentEditable = !readOnly;
+                iframeEl.setDisplayed(true);
+            } else {
+                me.setDesignMode(!readOnly);
+            }
+            if (body) {
+                body.style.cursor = readOnly ? 'default' : 'text';
+            }
+            me.disableItems(readOnly);
+        }
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-getDocMarkup'>    /**
+</span>     * Protected method that will not generally be called directly. It
+     * is called when the editor initializes the iframe with HTML contents. Override this method if you
+     * want to change the initialization markup of the iframe (e.g. to add stylesheets).
+     *
+     * Note: IE8-Standards has unwanted scroller behavior, so the default meta tag forces IE7 compatibility.
+     * Also note that forcing IE7 mode works when the page is loaded normally, but if you are using IE's Web
+     * Developer Tools to manually set the document mode, that will take precedence and override what this
+     * code sets by default. This can be confusing when developing, but is not a user-facing issue.
+     */
+    getDocMarkup: function() {
+        var me = this,
+            h = me.iframeEl.getHeight() - me.iframePad * 2;
+        return Ext.String.format('&lt;html&gt;&lt;head&gt;&lt;style type=&quot;text/css&quot;&gt;body{border:0;margin:0;padding:{0}px;height:{1}px;cursor:text}&lt;/style&gt;&lt;/head&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;', me.iframePad, h);
+    },
+
+    // private
+    getEditorBody: function() {
+        var doc = this.getDoc();
+        return doc.body || doc.documentElement;
+    },
+
+    // private
+    getDoc: function() {
+        return (!Ext.isIE &amp;&amp; this.iframeEl.dom.contentDocument) || this.getWin().document;
+    },
+
+    // private
+    getWin: function() {
+        return Ext.isIE ? this.iframeEl.dom.contentWindow : window.frames[this.iframeEl.dom.name];
+    },
+
+    // private
+    onRender: function() {
+        var me = this,
+            renderSelectors = me.renderSelectors;
+
+        Ext.applyIf(renderSelectors, me.getLabelableSelectors());
+
+        Ext.applyIf(renderSelectors, {
+            toolbarWrap: 'div.' + Ext.baseCSSPrefix + 'html-editor-tb',
+            iframeEl: 'iframe',
+            textareaEl: 'textarea'
+        });
+
+        me.callParent(arguments);
+
+        me.textareaEl.dom.value = me.value || '';
+
+        // Start polling for when the iframe document is ready to be manipulated
+        me.monitorTask = Ext.TaskManager.start({
+            run: me.checkDesignMode,
+            scope: me,
+            interval:100
+        });
+
+        me.createToolbar(me);
+        me.disableItems(true);
+    },
+
+    initRenderTpl: function() {
+        var me = this;
+        if (!me.hasOwnProperty('renderTpl')) {
+            me.renderTpl = me.getTpl('labelableRenderTpl');
+        }
+        return me.callParent();
+    },
+
+    initRenderData: function() {
+        return Ext.applyIf(this.callParent(), this.getLabelableRenderData());
+    },
+
+    getSubTplData: function() {
+        var cssPrefix = Ext.baseCSSPrefix;
+        return {
+            toolbarWrapCls: cssPrefix + 'html-editor-tb',
+            textareaCls: cssPrefix + 'hidden',
+            iframeName: Ext.id(),
+            iframeSrc: Ext.SSL_SECURE_URL,
+            size: 'height:100px;'
+        };
+    },
+
+    getSubTplMarkup: function() {
+        return this.getTpl('fieldSubTpl').apply(this.getSubTplData());
+    },
+
+    getBodyNaturalWidth: function() {
+        return 565;
+    },
+
+    initFrameDoc: function() {
+        var me = this,
+            doc, task;
+
+        Ext.TaskManager.stop(me.monitorTask);
+
+        doc = me.getDoc();
+        me.win = me.getWin();
+
+        doc.open();
+        doc.write(me.getDocMarkup());
+        doc.close();
+
+        task = { // must defer to wait for browser to be ready
+            run: function() {
+                var doc = me.getDoc();
+                if (doc.body || doc.readyState === 'complete') {
+                    Ext.TaskManager.stop(task);
+                    me.setDesignMode(true);
+                    Ext.defer(me.initEditor, 10, me);
+                }
+            },
+            interval : 10,
+            duration:10000,
+            scope: me
+        };
+        Ext.TaskManager.start(task);
+    },
+
+    checkDesignMode: function() {
+        var me = this,
+            doc = me.getDoc();
+        if (doc &amp;&amp; (!doc.editorInitialized || me.getDesignMode() !== 'on')) {
+            me.initFrameDoc();
+        }
+    },
+
+    /* private
+     * set current design mode. To enable, mode can be true or 'on', off otherwise
+     */
+    setDesignMode: function(mode) {
+        var me = this,
+            doc = me.getDoc();
+        if (doc) {
+            if (me.readOnly) {
+                mode = false;
+            }
+            doc.designMode = (/on|true/i).test(String(mode).toLowerCase()) ?'on':'off';
+        }
+    },
+
+    // private
+    getDesignMode: function() {
+        var doc = this.getDoc();
+        return !doc ? '' : String(doc.designMode).toLowerCase();
+    },
+
+    disableItems: function(disabled) {
+        this.getToolbar().items.each(function(item){
+            if(item.getItemId() !== 'sourceedit'){
+                item.setDisabled(disabled);
+            }
+        });
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-toggleSourceEdit'>    /**
+</span>     * Toggles the editor between standard and source edit mode.
+     * @param {Boolean} sourceEditMode (optional) True for source edit, false for standard
+     */
+    toggleSourceEdit: function(sourceEditMode) {
+        var me = this,
+            iframe = me.iframeEl,
+            textarea = me.textareaEl,
+            hiddenCls = Ext.baseCSSPrefix + 'hidden',
+            btn = me.getToolbar().getComponent('sourceedit');
+
+        if (!Ext.isBoolean(sourceEditMode)) {
+            sourceEditMode = !me.sourceEditMode;
+        }
+        me.sourceEditMode = sourceEditMode;
+
+        if (btn.pressed !== sourceEditMode) {
+            btn.toggle(sourceEditMode);
+        }
+        if (sourceEditMode) {
+            me.disableItems(true);
+            me.syncValue();
+            iframe.addCls(hiddenCls);
+            textarea.removeCls(hiddenCls);
+            textarea.dom.removeAttribute('tabIndex');
+            textarea.focus();
+        }
+        else {
+            if (me.initialized) {
+                me.disableItems(me.readOnly);
+            }
+            me.pushValue();
+            iframe.removeCls(hiddenCls);
+            textarea.addCls(hiddenCls);
+            textarea.dom.setAttribute('tabIndex', -1);
+            me.deferFocus();
+        }
+        me.fireEvent('editmodechange', me, sourceEditMode);
+        me.doComponentLayout();
+    },
+
+    // private used internally
+    createLink : function() {
+        var url = prompt(this.createLinkText, this.defaultLinkValue);
+        if (url &amp;&amp; url !== 'http:/'+'/') {
+            this.relayCmd('createlink', url);
+        }
+    },
+
+    clearInvalid: Ext.emptyFn,
+
+    // docs inherit from Field
+    setValue: function(value) {
+        var me = this,
+            textarea = me.textareaEl;
+        me.mixins.field.setValue.call(me, value);
+        if (value === null || value === undefined) {
+            value = '';
+        }
+        if (textarea) {
+            textarea.dom.value = value;
+        }
+        me.pushValue();
+        return this;
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-cleanHtml'>    /**
+</span>     * Protected method that will not generally be called directly. If you need/want
+     * custom HTML cleanup, this is the method you should override.
+     * @param {String} html The HTML to be cleaned
+     * @return {String} The cleaned HTML
+     */
+    cleanHtml: function(html) {
+        html = String(html);
+        if (Ext.isWebKit) { // strip safari nonsense
+            html = html.replace(/\sclass=&quot;(?:Apple-style-span|khtml-block-placeholder)&quot;/gi, '');
+        }
+
+        /*
+         * Neat little hack. Strips out all the non-digit characters from the default
+         * value and compares it to the character code of the first character in the string
+         * because it can cause encoding issues when posted to the server.
+         */
+        if (html.charCodeAt(0) === this.defaultValue.replace(/\D/g, '')) {
+            html = html.substring(1);
+        }
+        return html;
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-syncValue'>    /**
+</span>     * @protected method that will not generally be called directly. Syncs the contents
+     * of the editor iframe with the textarea.
+     */
+    syncValue : function(){
+        var me = this,
+            body, html, bodyStyle, match;
+        if (me.initialized) {
+            body = me.getEditorBody();
+            html = body.innerHTML;
+            if (Ext.isWebKit) {
+                bodyStyle = body.getAttribute('style'); // Safari puts text-align styles on the body element!
+                match = bodyStyle.match(/text-align:(.*?);/i);
+                if (match &amp;&amp; match[1]) {
+                    html = '&lt;div style=&quot;' + match[0] + '&quot;&gt;' + html + '&lt;/div&gt;';
+                }
+            }
+            html = me.cleanHtml(html);
+            if (me.fireEvent('beforesync', me, html) !== false) {
+                me.textareaEl.dom.value = html;
+                me.fireEvent('sync', me, html);
+            }
+        }
+    },
+
+    //docs inherit from Field
+    getValue : function() {
+        var me = this,
+            value;
+        if (!me.sourceEditMode) {
+            me.syncValue();
+        }
+        value = me.rendered ? me.textareaEl.dom.value : me.value;
+        me.value = value;
+        return value;
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-pushValue'>    /**
+</span>     * @protected method that will not generally be called directly. Pushes the value of the textarea
+     * into the iframe editor.
+     */
+    pushValue: function() {
+        var me = this,
+            v;
+        if(me.initialized){
+            v = me.textareaEl.dom.value || '';
+            if (!me.activated &amp;&amp; v.length &lt; 1) {
+                v = me.defaultValue;
+            }
+            if (me.fireEvent('beforepush', me, v) !== false) {
+                me.getEditorBody().innerHTML = v;
+                if (Ext.isGecko) {
+                    // Gecko hack, see: https://bugzilla.mozilla.org/show_bug.cgi?id=232791#c8
+                    me.setDesignMode(false);  //toggle off first
+                    me.setDesignMode(true);
+                }
+                me.fireEvent('push', me, v);
+            }
+        }
+    },
+
+    // private
+    deferFocus : function(){
+         this.focus(false, true);
+    },
+
+    getFocusEl: function() {
+        var me = this,
+            win = me.win;
+        return win &amp;&amp; !me.sourceEditMode ? win : me.textareaEl;
+    },
+
+    // private
+    initEditor : function(){
+        //Destroying the component during/before initEditor can cause issues.
+        try {
+            var me = this,
+                dbody = me.getEditorBody(),
+                ss = me.textareaEl.getStyles('font-size', 'font-family', 'background-image', 'background-repeat', 'background-color', 'color'),
+                doc,
+                fn;
+
+            ss['background-attachment'] = 'fixed'; // w3c
+            dbody.bgProperties = 'fixed'; // ie
+
+            Ext.core.DomHelper.applyStyles(dbody, ss);
+
+            doc = me.getDoc();
+
+            if (doc) {
+                try {
+                    Ext.EventManager.removeAll(doc);
+                } catch(e) {}
+            }
+
+            /*
+             * We need to use createDelegate here, because when using buffer, the delayed task is added
+             * as a property to the function. When the listener is removed, the task is deleted from the function.
+             * Since onEditorEvent is shared on the prototype, if we have multiple html editors, the first time one of the editors
+             * is destroyed, it causes the fn to be deleted from the prototype, which causes errors. Essentially, we're just anonymizing the function.
+             */
+            fn = Ext.Function.bind(me.onEditorEvent, me);
+            Ext.EventManager.on(doc, {
+                mousedown: fn,
+                dblclick: fn,
+                click: fn,
+                keyup: fn,
+                buffer:100
+            });
+
+            // These events need to be relayed from the inner document (where they stop
+            // bubbling) up to the outer document. This has to be done at the DOM level so
+            // the event reaches listeners on elements like the document body. The effected
+            // mechanisms that depend on this bubbling behavior are listed to the right
+            // of the event.
+            fn = me.onRelayedEvent;
+            Ext.EventManager.on(doc, {
+                mousedown: fn, // menu dismisal (MenuManager) and Window onMouseDown (toFront)
+                mousemove: fn, // window resize drag detection
+                mouseup: fn,   // window resize termination
+                click: fn,     // not sure, but just to be safe
+                dblclick: fn,  // not sure again
+                scope: me
+            });
+
+            if (Ext.isGecko) {
+                Ext.EventManager.on(doc, 'keypress', me.applyCommand, me);
+            }
+            if (me.fixKeys) {
+                Ext.EventManager.on(doc, 'keydown', me.fixKeys, me);
+            }
+
+            // We need to be sure we remove all our events from the iframe on unload or we're going to LEAK!
+            Ext.EventManager.on(window, 'unload', me.beforeDestroy, me);
+            doc.editorInitialized = true;
+
+            me.initialized = true;
+            me.pushValue();
+            me.setReadOnly(me.readOnly);
+            me.fireEvent('initialize', me);
+        } catch(ex) {
+            // ignore (why?)
+        }
+    },
+
+    // private
+    beforeDestroy : function(){
+        var me = this,
+            monitorTask = me.monitorTask,
+            doc, prop;
+
+        if (monitorTask) {
+            Ext.TaskManager.stop(monitorTask);
+        }
+        if (me.rendered) {
+            try {
+                doc = me.getDoc();
+                if (doc) {
+                    Ext.EventManager.removeAll(doc);
+                    for (prop in doc) {
+                        if (doc.hasOwnProperty(prop)) {
+                            delete doc[prop];
+                        }
+                    }
+                }
+            } catch(e) {
+                // ignore (why?)
+            }
+            Ext.destroyMembers('tb', 'toolbarWrap', 'iframeEl', 'textareaEl');
+        }
+        me.callParent();
+    },
+
+    // private
+    onRelayedEvent: function (event) {
+        // relay event from the iframe's document to the document that owns the iframe...
+
+        var iframeEl = this.iframeEl,
+            iframeXY = iframeEl.getXY(),
+            eventXY = event.getXY();
+
+        // the event from the inner document has XY relative to that document's origin,
+        // so adjust it to use the origin of the iframe in the outer document:
+        event.xy = [iframeXY[0] + eventXY[0], iframeXY[1] + eventXY[1]];
+
+        event.injectEvent(iframeEl); // blame the iframe for the event...
+
+        event.xy = eventXY; // restore the original XY (just for safety)
+    },
+
+    // private
+    onFirstFocus : function(){
+        var me = this,
+            selection, range;
+        me.activated = true;
+        me.disableItems(me.readOnly);
+        if (Ext.isGecko) { // prevent silly gecko errors
+            me.win.focus();
+            selection = me.win.getSelection();
+            if (!selection.focusNode || selection.focusNode.nodeType !== 3) {
+                range = selection.getRangeAt(0);
+                range.selectNodeContents(me.getEditorBody());
+                range.collapse(true);
+                me.deferFocus();
+            }
+            try {
+                me.execCmd('useCSS', true);
+                me.execCmd('styleWithCSS', false);
+            } catch(e) {
+                // ignore (why?)
+            }
+        }
+        me.fireEvent('activate', me);
+    },
+
+    // private
+    adjustFont: function(btn) {
+        var adjust = btn.getItemId() === 'increasefontsize' ? 1 : -1,
+            size = this.getDoc().queryCommandValue('FontSize') || '2',
+            isPxSize = Ext.isString(size) &amp;&amp; size.indexOf('px') !== -1,
+            isSafari;
+        size = parseInt(size, 10);
+        if (isPxSize) {
+            // Safari 3 values
+            // 1 = 10px, 2 = 13px, 3 = 16px, 4 = 18px, 5 = 24px, 6 = 32px
+            if (size &lt;= 10) {
+                size = 1 + adjust;
+            }
+            else if (size &lt;= 13) {
+                size = 2 + adjust;
+            }
+            else if (size &lt;= 16) {
+                size = 3 + adjust;
+            }
+            else if (size &lt;= 18) {
+                size = 4 + adjust;
+            }
+            else if (size &lt;= 24) {
+                size = 5 + adjust;
+            }
+            else {
+                size = 6 + adjust;
+            }
+            size = Ext.Number.constrain(size, 1, 6);
+        } else {
+            isSafari = Ext.isSafari;
+            if (isSafari) { // safari
+                adjust *= 2;
+            }
+            size = Math.max(1, size + adjust) + (isSafari ? 'px' : 0);
+        }
+        this.execCmd('FontSize', size);
+    },
+
+    // private
+    onEditorEvent: function(e) {
+        this.updateToolbar();
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-updateToolbar'>    /**
+</span>     * Protected method that will not generally be called directly. It triggers
+     * a toolbar update by reading the markup state of the current selection in the editor.
+     */
+    updateToolbar: function() {
+        var me = this,
+            btns, doc, name, fontSelect;
+
+        if (me.readOnly) {
+            return;
+        }
+
+        if (!me.activated) {
+            me.onFirstFocus();
+            return;
+        }
+
+        btns = me.getToolbar().items.map;
+        doc = me.getDoc();
+
+        if (me.enableFont &amp;&amp; !Ext.isSafari2) {
+            name = (doc.queryCommandValue('FontName') || me.defaultFont).toLowerCase();
+            fontSelect = me.fontSelect.dom;
+            if (name !== fontSelect.value) {
+                fontSelect.value = name;
+            }
+        }
+
+        function updateButtons() {
+            Ext.Array.forEach(Ext.Array.toArray(arguments), function(name) {
+                btns[name].toggle(doc.queryCommandState(name));
+            });
+        }
+        if(me.enableFormat){
+            updateButtons('bold', 'italic', 'underline');
+        }
+        if(me.enableAlignments){
+            updateButtons('justifyleft', 'justifycenter', 'justifyright');
+        }
+        if(!Ext.isSafari2 &amp;&amp; me.enableLists){
+            updateButtons('insertorderedlist', 'insertunorderedlist');
+        }
+
+        Ext.menu.Manager.hideAll();
+
+        me.syncValue();
+    },
+
+    // private
+    relayBtnCmd: function(btn) {
+        this.relayCmd(btn.getItemId());
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-relayCmd'>    /**
+</span>     * Executes a Midas editor command on the editor document and performs necessary focus and
+     * toolbar updates. &lt;b&gt;This should only be called after the editor is initialized.&lt;/b&gt;
+     * @param {String} cmd The Midas command
+     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
+     */
+    relayCmd: function(cmd, value) {
+        Ext.defer(function() {
+            var me = this;
+            me.focus();
+            me.execCmd(cmd, value);
+            me.updateToolbar();
+        }, 10, this);
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-execCmd'>    /**
+</span>     * Executes a Midas editor command directly on the editor document.
+     * For visual commands, you should use {@link #relayCmd} instead.
+     * &lt;b&gt;This should only be called after the editor is initialized.&lt;/b&gt;
+     * @param {String} cmd The Midas command
+     * @param {String/Boolean} value (optional) The value to pass to the command (defaults to null)
+     */
+    execCmd : function(cmd, value){
+        var me = this,
+            doc = me.getDoc(),
+            undef;
+        doc.execCommand(cmd, false, value === undef ? null : value);
+        me.syncValue();
+    },
+
+    // private
+    applyCommand : function(e){
+        if (e.ctrlKey) {
+            var me = this,
+                c = e.getCharCode(), cmd;
+            if (c &gt; 0) {
+                c = String.fromCharCode(c);
+                switch (c) {
+                    case 'b':
+                        cmd = 'bold';
+                    break;
+                    case 'i':
+                        cmd = 'italic';
+                    break;
+                    case 'u':
+                        cmd = 'underline';
+                    break;
+                }
+                if (cmd) {
+                    me.win.focus();
+                    me.execCmd(cmd);
+                    me.deferFocus();
+                    e.preventDefault();
+                }
+            }
+        }
+    },
+
+<span id='Ext-form-field-HtmlEditor-method-insertAtCursor'>    /**
+</span>     * Inserts the passed text at the current cursor position. Note: the editor must be initialized and activated
+     * to insert text.
+     * @param {String} text
+     */
+    insertAtCursor : function(text){
+        var me = this,
+            range;
+
+        if (me.activated) {
+            me.win.focus();
+            if (Ext.isIE) {
+                range = me.getDoc().selection.createRange();
+                if (range) {
+                    range.pasteHTML(text);
+                    me.syncValue();
+                    me.deferFocus();
+                }
+            }else{
+                me.execCmd('InsertHTML', text);
+                me.deferFocus();
+            }
+        }
+    },
+
+    // private
+    fixKeys: function() { // load time branching for fastest keydown performance
+        if (Ext.isIE) {
+            return function(e){
+                var me = this,
+                    k = e.getKey(),
+                    doc = me.getDoc(),
+                    range, target;
+                if (k === e.TAB) {
+                    e.stopEvent();
+                    range = doc.selection.createRange();
+                    if(range){
+                        range.collapse(true);
+                        range.pasteHTML('&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;');
+                        me.deferFocus();
+                    }
+                }
+                else if (k === e.ENTER) {
+                    range = doc.selection.createRange();
+                    if (range) {
+                        target = range.parentElement();
+                        if(!target || target.tagName.toLowerCase() !== 'li'){
+                            e.stopEvent();
+                            range.pasteHTML('&lt;br /&gt;');
+                            range.collapse(false);
+                            range.select();
+                        }
+                    }
+                }
+            };
+        }
+
+        if (Ext.isOpera) {
+            return function(e){
+                var me = this;
+                if (e.getKey() === e.TAB) {
+                    e.stopEvent();
+                    me.win.focus();
+                    me.execCmd('InsertHTML','&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;');
+                    me.deferFocus();
+                }
+            };
+        }
+
+        if (Ext.isWebKit) {
+            return function(e){
+                var me = this,
+                    k = e.getKey();
+                if (k === e.TAB) {
+                    e.stopEvent();
+                    me.execCmd('InsertText','\t');
+                    me.deferFocus();
+                }
+                else if (k === e.ENTER) {
+                    e.stopEvent();
+                    me.execCmd('InsertHtml','&lt;br /&gt;&lt;br /&gt;');
+                    me.deferFocus();
+                }
+            };
+        }
+
+        return null; // not needed, so null
+    }(),
+
+<span id='Ext-form-field-HtmlEditor-method-getToolbar'>    /**
+</span>     * Returns the editor's toolbar. &lt;b&gt;This is only available after the editor has been rendered.&lt;/b&gt;
+     * @return {Ext.toolbar.Toolbar}
+     */
+    getToolbar : function(){
+        return this.toolbar;
+    },
+
+<span id='Ext-form-field-HtmlEditor-property-buttonTips'>    /**
+</span>     * Object collection of toolbar tooltips for the buttons in the editor. The key
+     * is the command id associated with that button and the value is a valid QuickTips object.
+     * For example:
+&lt;pre&gt;&lt;code&gt;
+{
+    bold : {
+        title: 'Bold (Ctrl+B)',
+        text: 'Make the selected text bold.',
+        cls: 'x-html-editor-tip'
+    },
+    italic : {
+        title: 'Italic (Ctrl+I)',
+        text: 'Make the selected text italic.',
+        cls: 'x-html-editor-tip'
+    },
+    ...
+&lt;/code&gt;&lt;/pre&gt;
+    * @type Object
+     */
+    buttonTips : {
+        bold : {
+            title: 'Bold (Ctrl+B)',
+            text: 'Make the selected text bold.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        italic : {
+            title: 'Italic (Ctrl+I)',
+            text: 'Make the selected text italic.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        underline : {
+            title: 'Underline (Ctrl+U)',
+            text: 'Underline the selected text.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        increasefontsize : {
+            title: 'Grow Text',
+            text: 'Increase the font size.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        decreasefontsize : {
+            title: 'Shrink Text',
+            text: 'Decrease the font size.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        backcolor : {
+            title: 'Text Highlight Color',
+            text: 'Change the background color of the selected text.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        forecolor : {
+            title: 'Font Color',
+            text: 'Change the color of the selected text.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        justifyleft : {
+            title: 'Align Text Left',
+            text: 'Align text to the left.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        justifycenter : {
+            title: 'Center Text',
+            text: 'Center text in the editor.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        justifyright : {
+            title: 'Align Text Right',
+            text: 'Align text to the right.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        insertunorderedlist : {
+            title: 'Bullet List',
+            text: 'Start a bulleted list.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        insertorderedlist : {
+            title: 'Numbered List',
+            text: 'Start a numbered list.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        createlink : {
+            title: 'Hyperlink',
+            text: 'Make the selected text a hyperlink.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        },
+        sourceedit : {
+            title: 'Source Edit',
+            text: 'Switch to source editing mode.',
+            cls: Ext.baseCSSPrefix + 'html-editor-tip'
+        }
+    }
+
+    // hide stuff that is not compatible
+<span id='Ext-form-field-HtmlEditor-event-blur'>    /**
+</span>     * @event blur
+     * @hide
+     */
+<span id='Ext-form-field-HtmlEditor-event-change'>    /**
+</span>     * @event change
+     * @hide
+     */
+<span id='Ext-form-field-HtmlEditor-event-focus'>    /**
+</span>     * @event focus
+     * @hide
+     */
+<span id='Ext-form-field-HtmlEditor-event-specialkey'>    /**
+</span>     * @event specialkey
+     * @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-fieldCls'>    /**
+</span>     * @cfg {String} fieldCls @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-focusCls'>    /**
+</span>     * @cfg {String} focusCls @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-autoCreate'>    /**
+</span>     * @cfg {String} autoCreate @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-inputType'>    /**
+</span>     * @cfg {String} inputType @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-invalidCls'>    /**
+</span>     * @cfg {String} invalidCls @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-invalidText'>    /**
+</span>     * @cfg {String} invalidText @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-msgFx'>    /**
+</span>     * @cfg {String} msgFx @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-allowDomMove'>    /**
+</span>     * @cfg {Boolean} allowDomMove  @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-applyTo'>    /**
+</span>     * @cfg {String} applyTo @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-readOnly'>    /**
+</span>     * @cfg {String} readOnly  @hide
+     */
+<span id='Ext-form-field-HtmlEditor-cfg-tabIndex'>    /**
+</span>     * @cfg {String} tabIndex  @hide
+     */
+<span id='Ext-form-field-HtmlEditor-method-validate'>    /**
+</span>     * @method validate
+     * @hide
+     */
+});
+</pre>
+</body>
+</html>