- // Set the IFrame focus, so the blur event gets fired.\r
- CKEDITOR.tools.setTimeout( function()\r
+ var panelElement = panel.element,\r
+ panelWindow = panelElement.getWindow(),\r
+ windowScroll = panelWindow.getScrollPosition(),\r
+ viewportSize = panelWindow.getViewPaneSize(),\r
+ panelSize =\r
+ {\r
+ 'height' : panelElement.$.offsetHeight,\r
+ 'width' : panelElement.$.offsetWidth\r
+ };\r
+\r
+ // If the menu is horizontal off, shift it toward\r
+ // the opposite language direction.\r
+ if ( rtl ? left < 0 : left + panelSize.width > viewportSize.width + windowScroll.x )\r
+ left += ( panelSize.width * ( rtl ? 1 : -1 ) );\r
+\r
+ // Vertical off screen is simpler.\r
+ if ( top + panelSize.height > viewportSize.height + windowScroll.y )\r
+ top -= panelSize.height;\r
+\r
+ // If IE is in RTL, we have troubles with absolute\r
+ // position and horizontal scrolls. Here we have a\r
+ // series of hacks to workaround it. (#6146)\r
+ if ( CKEDITOR.env.ie )\r