Ticket #7912: 7912_2.patch
File 7912_2.patch, 3.6 KB (added by , 12 years ago) |
---|
-
_source/core/dom/element.js
721 721 722 722 isEditable : function() 723 723 { 724 if ( this.isReadOnly() )724 if ( this.isReadOnly() || !this.isVisible() ) 725 725 return false; 726 726 727 727 // Get the element name. … … 781 781 */ 782 782 isVisible : function() 783 783 { 784 var isVisible = !!this.$.offsetHeight&& this.getComputedStyle( 'visibility' ) != 'hidden',784 var isVisible = ( this.$.offsetHeight || this.$.offsetWidth ) && this.getComputedStyle( 'visibility' ) != 'hidden', 785 785 elementWindow, 786 786 elementWindowFrame; 787 787 … … 798 798 } 799 799 } 800 800 801 return isVisible;801 return !!isVisible; 802 802 }, 803 803 804 804 /** -
_source/core/dom/range.js
1920 1920 */ 1921 1921 moveToElementEditablePosition : function( el, isMoveToEnd ) 1922 1922 { 1923 var isEditable; 1924 1925 // Empty elements are rejected. 1926 if ( CKEDITOR.dtd.$empty[ el.getName() ] ) 1927 return false; 1928 1929 while ( el && el.type == CKEDITOR.NODE_ELEMENT ) 1923 function nextDFS( node, childOnly ) 1930 1924 { 1931 isEditable = el.isEditable();1925 var next; 1932 1926 1933 // If an editable element is found, move inside it. 1934 if ( isEditable ) 1935 this.moveToPosition( el, isMoveToEnd ? 1936 CKEDITOR.POSITION_BEFORE_END : 1937 CKEDITOR.POSITION_AFTER_START ); 1938 // Stop immediately if we've found a non editable inline element (e.g <img>). 1939 else if ( CKEDITOR.dtd.$inline[ el.getName() ] ) 1927 if ( node.type == CKEDITOR.NODE_ELEMENT 1928 && !node.isReadOnly() 1929 && node.isVisible() 1930 && !CKEDITOR.dtd.$nonEditable[ node.getName() ] ) 1940 1931 { 1941 this.moveToPosition( el, isMoveToEnd ? 1942 CKEDITOR.POSITION_AFTER_END : 1943 CKEDITOR.POSITION_BEFORE_START ); 1944 return true; 1932 next = node[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval ); 1945 1933 } 1946 1934 1947 // Non-editable non-inline elements are to be bypassed, getting the next one. 1948 if ( CKEDITOR.dtd.$empty[ el.getName() ] ) 1949 el = el[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval ); 1950 else 1951 el = el[ isMoveToEnd ? 'getLast' : 'getFirst' ]( nonWhitespaceOrBookmarkEval ); 1935 if ( !childOnly && !next ) 1936 next = node[ isMoveToEnd ? 'getPrevious' : 'getNext' ]( nonWhitespaceOrBookmarkEval ); 1952 1937 1938 return next; 1939 } 1940 1941 var found = 0; 1942 1943 while ( el ) 1944 { 1953 1945 // Stop immediately if we've found a text node. 1954 if ( el && el.type == CKEDITOR.NODE_TEXT )1946 if ( el.type == CKEDITOR.NODE_TEXT ) 1955 1947 { 1956 1948 this.moveToPosition( el, isMoveToEnd ? 1957 1949 CKEDITOR.POSITION_AFTER_END : 1958 1950 CKEDITOR.POSITION_BEFORE_START ); 1959 return true; 1951 found = 1; 1952 break; 1960 1953 } 1961 } 1954 1955 // If an editable element is found, move inside it, but not stop the searching. 1956 if ( el.type == CKEDITOR.NODE_ELEMENT ) 1957 { 1958 if ( el.isEditable() ) 1959 { 1960 this.moveToPosition( el, isMoveToEnd ? 1961 CKEDITOR.POSITION_BEFORE_END : 1962 CKEDITOR.POSITION_AFTER_START ); 1963 found = 1; 1964 } 1965 } 1962 1966 1963 return isEditable; 1967 el = nextDFS( el, found ); 1968 } 1969 1970 return !!found; 1964 1971 }, 1965 1972 1966 1973 /**