Ticket #7912: 7912_2.patch

File 7912_2.patch, 3.6 KB (added by Garry Yao, 13 years ago)
  • _source/core/dom/element.js

     
    721721
    722722                isEditable : function()
    723723                {
    724                         if ( this.isReadOnly() )
     724                        if ( this.isReadOnly() || !this.isVisible() )
    725725                                return false;
    726726
    727727                        // Get the element name.
     
    781781                 */
    782782                isVisible : function()
    783783                {
    784                         var isVisible = !!this.$.offsetHeight && this.getComputedStyle( 'visibility' ) != 'hidden',
     784                        var isVisible = ( this.$.offsetHeight || this.$.offsetWidth ) && this.getComputedStyle( 'visibility' ) != 'hidden',
    785785                                elementWindow,
    786786                                elementWindowFrame;
    787787
     
    798798                                }
    799799                        }
    800800
    801                         return isVisible;
     801                        return !!isVisible;
    802802                },
    803803
    804804                /**
  • _source/core/dom/range.js

     
    19201920                 */
    19211921                moveToElementEditablePosition : function( el, isMoveToEnd )
    19221922                {
    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 )
    19301924                        {
    1931                                 isEditable = el.isEditable();
     1925                                var next;
    19321926
    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() ] )
    19401931                                {
    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 );
    19451933                                }
    19461934
    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 );
    19521937
     1938                                return next;
     1939                        }
     1940                       
     1941                        var found = 0;
     1942
     1943                        while ( el )
     1944                        {
    19531945                                // Stop immediately if we've found a text node.
    1954                                 if ( el && el.type == CKEDITOR.NODE_TEXT )
     1946                                if ( el.type == CKEDITOR.NODE_TEXT )
    19551947                                {
    19561948                                        this.moveToPosition( el, isMoveToEnd ?
    19571949                                                                 CKEDITOR.POSITION_AFTER_END :
    19581950                                                                 CKEDITOR.POSITION_BEFORE_START );
    1959                                         return true;
     1951                                        found = 1;
     1952                                        break;
    19601953                                }
    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                                }
    19621966
    1963                         return isEditable;
     1967                                el = nextDFS( el, found );
     1968                        }
     1969
     1970                        return !!found;
    19641971                },
    19651972
    19661973                /**
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy