Ticket #4459: 4459_3.patch

File 4459_3.patch, 2.9 KB (added by Garry Yao, 14 years ago)
  • _source/plugins/maximize/plugin.js

     
    7878                restoreFormStyles( data );
    7979        }
    8080
    81         function getResizeHandler( mainWindow, editor )
    82         {
    83                 return function()
    84                 {
    85                         var viewPaneSize = mainWindow.getViewPaneSize();
    86                         editor.resize( viewPaneSize.width, viewPaneSize.height, null, true );
    87                 };
    88         }
    89 
    9081        function refreshCursor( editor )
    9182        {
    9283                if ( editor.focusManager.hasFocus )
     
    10394                }
    10495        }
    10596
     97        /**
     98         * Adding an iframe shim to this element, OR removing the existing one if already applied.
     99         * Note: This will only affect IE version below 7.
     100         */
     101         function createIframeShim( element )
     102        {
     103                if ( !CKEDITOR.env.ie || CKEDITOR.env.version > 6 )
     104                        return;
     105
     106                var shim = CKEDITOR.dom.element.createFromHtml( '<iframe frameborder="0" tabindex="-1"' +
     107                                        ' src="javascript:' +
     108                                           'void((function(){' +
     109                                                   'document.open();' +
     110                                                   ( CKEDITOR.env.isCustomDomain() ? 'document.domain=\'' + this.getDocument().$.domain + '\';' : '' ) +
     111                                                   'document.close();' +
     112                                           '})())"' +
     113                                        ' style="display:block;position:absolute;z-index:-1;' +
     114                                        'progid:DXImageTransform.Microsoft.Alpha(opacity=0);' +
     115                                        '"></iframe>' );
     116                return element.append( shim, true );
     117        }
     118
    106119        CKEDITOR.plugins.add( 'maximize',
    107120        {
    108121                init : function( editor )
     
    118131                        // Saved scroll position for the outer window.
    119132                        var outerScroll;
    120133
     134                        var shim;
     135
    121136                        // Saved resize handler function.
    122                         var resizeHandler = getResizeHandler( mainWindow, editor );
     137                        function resizeHandler()
     138                        {
     139                                var viewPaneSize = mainWindow.getViewPaneSize();
     140                                shim && shim.setStyles( { width : viewPaneSize.width + 'px', height : viewPaneSize.height + 'px' } );
     141                                editor.resize( viewPaneSize.width, viewPaneSize.height, null, true );
     142                        };
    123143
    124144                        // Retain state after mode switches.
    125145                        var savedState = CKEDITOR.TRISTATE_OFF;
     
    196216                                                                        left : '0px',
    197217                                                                        top : '0px'
    198218                                                                } );
    199                                                         editor.resize( viewPaneSize.width, viewPaneSize.height, null, true );
    200219
     220                                                        shim =  createIframeShim( container );          // IE6 select element penetration when maximized. (#4459)
     221                                                        resizeHandler();
     222
    201223                                                        // Still not top left? Fix it. (Bug #174)
    202224                                                        var offset = container.getDocumentPosition();
    203225                                                        container.setStyles(
     
    240262                                                        // Remove cke_maximized class.
    241263                                                        container.removeClass( 'cke_maximized' );
    242264
     265                                                        if ( shim )
     266                                                        {
     267                                                                shim.remove();
     268                                                                shim = null;
     269                                                        }
     270
    243271                                                        // Emit a resize event, because this time the size is modified in
    244272                                                        // restoreStyles.
    245273                                                        editor.fire( 'resize' );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy