static/admin/TinyMCETextArea.js
function () {
        var me = this;

        if (me.noWysiwyg || me.intializationInProgress || me.wysiwygIntialized) { return; }

        me.intializationInProgress = true;

        if (!me.tinyMCEConfig) {
            me.tinyMCEConfig = {};
        }
        else {
            // We need clone, not reference.
            // The configuration of the wysiwyg might be passed as an object to
            // many editor instances. Through cloning, we prevent
            // side effects on other editors upon internal modifications
            // of the tinyMCEConfig
            var tmp_cfg = me.tinyMCEConfig;
            me.tinyMCEConfig = {};
            Ext.Object.merge(me.tinyMCEConfig, tmp_cfg);
        }

        me.tinyMCEConfig.mode = "exact";
        me.tinyMCEConfig.elements = me.getInputId();

        // This type of resizing s very harmful by integration with ExtJS.
        // The editor should occupy only the place given to it by the
        // layout manager.
        me.tinyMCEConfig.theme_advanced_resizing = false;

        // we pass the height and width explicitly to the editor
        me.tinyMCEConfig.width = me.lastWidth + me.getWidthCorrection();
        me.tinyMCEConfig.height = me.lastHeight;

        if (me.readOnly) {
            me.tinyMCEConfig.readonly = true;
            me.tinyMCEConfig.height -= 3;
        }

        if (me.labelEl) {
            me.labelEl.on('click', function (ev, elm, opts) {
                me.focus(false);
            }, me.labelEl);
        }

        var user_setup = null;
        var user_onchange_callback = null;

        if (me.tinyMCEConfig.setup) { user_setup = me.tinyMCEConfig.setup; }
        if (me.tinyMCEConfig.onchange_callback) { user_onchange_callback = me.tinyMCEConfig.onchange_callback; }

        me.tinyMCEConfig.onchange_callback = function (ed) {

            var oldval = me.getValue();
            var newval = ed.getContent();

            ed.save();

            me.fireEvent('change', me, newval, oldval, {});

            if (me.validateOnChange) {
                me.validate();
            }

            if (user_onchange_callback) { user_onchange_callback(ed); }
        };

        me.tinyMCEConfig.setup = function (ed) {

            ed.onExecCommand.add(function (ed, cmd, ui, val) {

                if (cmd !== 'mceFullScreen') { return; }

                var fullscreen_container = document.getElementById("mce_fullscreen_container");
                if (!fullscreen_container) { return; }

                fullscreen_container.style.zIndex = Ext.ZIndexManager.zBase + 2;

                var fullscreen_ed = tinyMCE.get(ed.getParam('fullscreen_editor_id'));
                if (fullscreen_ed) {
                    fullscreen_ed.windowManager = Ext.create('Ext.ux.form.TinyMCETextAreaWindowManager', {
                        control: me,
                        editor: fullscreen_ed
                    });
                }
            });

            ed.onInit.add(function (ed) {
                me.wysiwygIntialized = true;
                me.intializationInProgress = false;

                if (me.isDisabled()) { me.disableEditor(); }

                tinymce.dom.Event.add(ed.getWin(), 'focus', function (e) {
                    var w = me.findParentByType('window');
                    if (w && !me.popupActive) {
                      // we use toFront to bring the parent window
                      // to the front when the editor gets focus.
                      // Under IE10, the editor gets focus, even if
                      // a popup like image insert is opened. This is 
                      // bad, because the popup goes into the back, and 
                      // the editor to the front.
                      //
                      // We have introduced the flag 'popupActive',
                      // which is set when the popup is opened and unset 
                      // when the popup is closed.
                      //
                      // We do not do toFront id the popup is active.
                      
                      w.toFront(true);
                    }
                });
            });

            ed.onPostRender.add(function (ed, controlManager) {
                ed.windowManager = Ext.create('Ext.ux.form.TinyMCETextAreaWindowManager', {
                    control: me,
                    editor: ed
                });
            });

            if (user_setup) { user_setup(ed); }
        };

        if (!tinymce.dom.Event.domLoaded) {
            tinymce.dom.Event.domLoaded = true;
        }

        tinymce.init(me.tinyMCEConfig);
    }
function () {
        var me = this;

        if (me.noWysiwyg || me.intializationInProgress || me.wysiwygIntialized) { return; }

        me.intializationInProgress = true;

        if (!me.tinyMCEConfig) {
            me.tinyMCEConfig = {};
        }
        else {
            // We need clone, not reference.
            // The configuration of the wysiwyg might be passed as an object to
            // many editor instances. Through cloning, we prevent
            // side effects on other editors upon internal modifications
            // of the tinyMCEConfig
            var tmp_cfg = me.tinyMCEConfig;
            me.tinyMCEConfig = {};
            Ext.Object.merge(me.tinyMCEConfig, tmp_cfg);
        }

        me.tinyMCEConfig.mode = "exact";
        me.tinyMCEConfig.elements = me.getInputId();

        // This type of resizing s very harmful by integration with ExtJS.
        // The editor should occupy only the place given to it by the
        // layout manager.
        me.tinyMCEConfig.theme_advanced_resizing = false;

        // we pass the height and width explicitly to the editor
        me.tinyMCEConfig.width = me.lastWidth + me.getWidthCorrection();
        me.tinyMCEConfig.height = me.lastHeight;

        if (me.readOnly) {
            me.tinyMCEConfig.readonly = true;
            me.tinyMCEConfig.height -= 3;
        }

        if (me.labelEl) {
            me.labelEl.on('click', function (ev, elm, opts) {
                me.focus(false);
            }, me.labelEl);
        }

        var user_setup = null;
        var user_onchange_callback = null;

        if (me.tinyMCEConfig.setup) { user_setup = me.tinyMCEConfig.setup; }
        if (me.tinyMCEConfig.onchange_callback) { user_onchange_callback = me.tinyMCEConfig.onchange_callback; }

        me.tinyMCEConfig.onchange_callback = function (ed) {

            var oldval = me.getValue();
            var newval = ed.getContent();

            ed.save();

            me.fireEvent('change', me, newval, oldval, {});

            if (me.validateOnChange) {
                me.validate();
            }

            if (user_onchange_callback) { user_onchange_callback(ed); }
        };

        me.tinyMCEConfig.setup = function (ed) {

            ed.onExecCommand.add(function (ed, cmd, ui, val) {

                if (cmd !== 'mceFullScreen') { return; }

                var fullscreen_container = document.getElementById("mce_fullscreen_container");
                if (!fullscreen_container) { return; }

                fullscreen_container.style.zIndex = Ext.ZIndexManager.zBase + 2;

                var fullscreen_ed = tinyMCE.get(ed.getParam('fullscreen_editor_id'));
                if (fullscreen_ed) {
                    fullscreen_ed.windowManager = Ext.create('Ext.ux.form.TinyMCETextAreaWindowManager', {
                        control: me,
                        editor: fullscreen_ed
                    });
                }
            });

            ed.onInit.add(function (ed) {
                me.wysiwygIntialized = true;
                me.intializationInProgress = false;

                if (me.isDisabled()) { me.disableEditor(); }

                tinymce.dom.Event.add(ed.getWin(), 'focus', function (e) {
                    var w = me.findParentByType('window');
                    if (w && !me.popupActive) {
                      // we use toFront to bring the parent window
                      // to the front when the editor gets focus.
                      // Under IE10, the editor gets focus, even if
                      // a popup like image insert is opened. This is 
                      // bad, because the popup goes into the back, and 
                      // the editor to the front.
                      //
                      // We have introduced the flag 'popupActive',
                      // which is set when the popup is opened and unset 
                      // when the popup is closed.
                      //
                      // We do not do toFront id the popup is active.
                      
                      w.toFront(true);
                    }
                });
            });

            ed.onPostRender.add(function (ed, controlManager) {
                ed.windowManager = Ext.create('Ext.ux.form.TinyMCETextAreaWindowManager', {
                    control: me,
                    editor: ed
                });
            });

            if (user_setup) { user_setup(ed); }
        };

        if (!tinymce.dom.Event.domLoaded) {
            tinymce.dom.Event.domLoaded = true;
        }

        tinymce.init(me.tinyMCEConfig);
    }
-----------------------------------------------------------------