IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
|
| 665 | 665 | } ); |
| 666 | 666 | } |
| 667 | 667 | |
| | 668 | // Re-layout the dialog on window resize. |
| | 669 | function resizeWithWindow( dialog ) |
| | 670 | { |
| | 671 | var win = CKEDITOR.document.getWindow(); |
| | 672 | function resizeHandler() { dialog.layout(); } |
| | 673 | win.on( 'resize', resizeHandler ); |
| | 674 | dialog.on( 'hide', function() { win.removeListener( 'resize', resizeHandler ); } ); |
| | 675 | } |
| | 676 | |
| 668 | 677 | CKEDITOR.dialog.prototype = |
| 669 | 678 | { |
| 670 | 679 | destroy : function() |
| … |
… |
|
| 733 | 742 | * @example |
| 734 | 743 | * dialogObj.move( 10, 40 ); |
| 735 | 744 | */ |
| 736 | | move : (function() |
| | 745 | move : function( x, y, save ) |
| 737 | 746 | { |
| 738 | | var isFixed; |
| 739 | | return function( x, y, save ) |
| 740 | | { |
| 741 | | // The dialog may be fixed positioned or absolute positioned. Ask the |
| 742 | | // browser what is the current situation first. |
| 743 | | var element = this._.element.getFirst(), |
| 744 | | rtl = this._.editor.lang.dir == 'rtl'; |
| | 747 | // The dialog may be fixed positioned or absolute positioned. Ask the |
| | 748 | // browser what is the current situation first. |
| | 749 | var element = this._.element.getFirst(), |
| | 750 | rtl = this._.editor.lang.dir == 'rtl'; |
| 745 | 751 | |
| 746 | | if ( isFixed === undefined ) |
| 747 | | isFixed = element.getComputedStyle( 'position' ) == 'fixed'; |
| | 752 | var isFixed = element.getComputedStyle( 'position' ) == 'fixed'; |
| 748 | 753 | |
| 749 | | if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y ) |
| 750 | | return; |
| | 754 | if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y ) |
| | 755 | return; |
| 751 | 756 | |
| 752 | | // Save the current position. |
| 753 | | this._.position = { x : x, y : y }; |
| | 757 | // Save the current position. |
| | 758 | this._.position = { x : x, y : y }; |
| 754 | 759 | |
| 755 | | // If not fixed positioned, add scroll position to the coordinates. |
| 756 | | if ( !isFixed ) |
| 757 | | { |
| 758 | | var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition(); |
| 759 | | x += scrollPosition.x; |
| 760 | | y += scrollPosition.y; |
| 761 | | } |
| | 760 | // If not fixed positioned, add scroll position to the coordinates. |
| | 761 | if ( !isFixed ) |
| | 762 | { |
| | 763 | var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition(); |
| | 764 | x += scrollPosition.x; |
| | 765 | y += scrollPosition.y; |
| | 766 | } |
| 762 | 767 | |
| 763 | | // Translate coordinate for RTL. |
| 764 | | if ( rtl ) |
| 765 | | { |
| 766 | | var dialogSize = this.getSize(), |
| 767 | | viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(); |
| 768 | | x = viewPaneSize.width - dialogSize.width - x; |
| 769 | | } |
| | 768 | // Translate coordinate for RTL. |
| | 769 | if ( rtl ) |
| | 770 | { |
| | 771 | var dialogSize = this.getSize(), |
| | 772 | viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(); |
| | 773 | x = viewPaneSize.width - dialogSize.width - x; |
| | 774 | } |
| 770 | 775 | |
| 771 | | var styles = { 'top' : ( y > 0 ? y : 0 ) + 'px' }; |
| 772 | | styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px'; |
| | 776 | var styles = { 'top' : ( y > 0 ? y : 0 ) + 'px' }; |
| | 777 | styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px'; |
| 773 | 778 | |
| 774 | | element.setStyles( styles ); |
| | 779 | element.setStyles( styles ); |
| 775 | 780 | |
| 776 | | save && ( this._.moved = 1 ); |
| 777 | | }; |
| 778 | | })(), |
| | 781 | save && ( this._.moved = 1 ); |
| | 782 | }, |
| 779 | 783 | |
| 780 | 784 | /** |
| 781 | 785 | * Gets the dialog's position in the window. |
| … |
… |
|
| 852 | 856 | CKEDITOR.tools.setTimeout( function() |
| 853 | 857 | { |
| 854 | 858 | this.layout(); |
| | 859 | resizeWithWindow( this ); |
| | 860 | |
| 855 | 861 | this.parts.dialog.setStyle( 'visibility', '' ); |
| 856 | 862 | |
| 857 | 863 | // Execute onLoad for the first show. |
| … |
… |
|
| 874 | 880 | */ |
| 875 | 881 | layout : function() |
| 876 | 882 | { |
| 877 | | var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(), |
| 878 | | dialogSize = this.getSize(); |
| | 883 | var el = this.parts.dialog; |
| | 884 | var dialogSize = this.getSize(); |
| | 885 | var win = CKEDITOR.document.getWindow(), |
| | 886 | viewSize = win.getViewPaneSize(); |
| 879 | 887 | |
| 880 | | this.move( this._.moved ? this._.position.x : ( viewSize.width - dialogSize.width ) / 2, |
| 881 | | this._.moved ? this._.position.y : ( viewSize.height - dialogSize.height ) / 2 ); |
| | 888 | var posX = ( viewSize.width - dialogSize.width ) / 2, |
| | 889 | posY = ( viewSize.height - dialogSize.height ) / 2; |
| | 890 | |
| | 891 | // Switch to absolute position when viewport is smaller than dialog size. |
| | 892 | if ( !CKEDITOR.env.ie6Compat ) |
| | 893 | { |
| | 894 | if ( dialogSize.height + ( posY > 0 ? posY : 0 ) > viewSize.height || |
| | 895 | dialogSize.width + ( posX > 0 ? posX : 0 ) > viewSize.width ) |
| | 896 | el.setStyle( 'position', 'absolute' ); |
| | 897 | else |
| | 898 | el.setStyle( 'position', 'fixed' ); |
| | 899 | } |
| | 900 | |
| | 901 | this.move( this._.moved ? this._.position.x : posX, |
| | 902 | this._.moved ? this._.position.y : posY ); |
| 882 | 903 | }, |
| 883 | 904 | |
| 884 | 905 | /** |