Ticket #3231: 3231_3.patch

File 3231_3.patch, 3.1 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/selection/plugin.js

     
    624624                                                {
    625625                                                        range.optimize();
    626626
     627                                                        // Decrease the range content to exclude particial
     628                                                        // selected node on the start which doesn't have
     629                                                        // visual impact. ( #3231 )
     630                                                        do
     631                                                        {
     632                                                                var startContainer = range.startContainer,
     633                                                                        startOffset = range.startOffset;
     634                                                                if ( startOffset == ( startContainer.getChildCount ?
     635                                                                        startContainer.getChildCount() : startContainer.getLength() ) )
     636                                                                        range.setStartAfter( startContainer );
     637                                                                else break;
     638                                                        }
     639                                                        while( true )
     640
    627641                                                        node = range.startContainer;
    628642
    629643                                                        if ( node.type != CKEDITOR.NODE_ELEMENT )
  • _source/core/dom/node.js

     
    221221                },
    222222
    223223                /**
    224                  * Gets a DOM tree descendant under the current node.
    225                  * @param {Array|Number} indices The child index or array of child indices under the node.
    226                  * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
    227                  * @example
    228                  * var strong = p.getChild(0);
    229                  */
    230                 getChild : function( indices )
    231                 {
    232                         var rawNode = this.$;
    233 
    234                         if ( !indices.slice )
    235                                 rawNode = rawNode.childNodes[ indices ];
    236                         else
    237                         {
    238                                 while ( indices.length > 0 && rawNode )
    239                                         rawNode = rawNode.childNodes[ indices.shift() ];
    240                         }
    241 
    242                         return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
    243                 },
    244 
    245                 getChildCount : function()
    246                 {
    247                         return this.$.childNodes.length;
    248                 },
    249 
    250                 /**
    251224                 * Gets the document containing this element.
    252225                 * @returns {CKEDITOR.dom.document} The document.
    253226                 * @example
  • _source/core/dom/element.js

     
    13111311                        this.$.parentNode.replaceChild( newNode.$, this.$ );
    13121312                        newNode.$._cke_expando = this.$._cke_expando;
    13131313                        this.$ = newNode.$;
    1314                 }
     1314                },
     1315
     1316                /**
     1317                 * Gets a DOM tree descendant under the current node.
     1318                 * @param {Array|Number} indices The child index or array of child indices under the node.
     1319                 * @returns {CKEDITOR.dom.node} The specified DOM child under the current node. Null if child does not exist.
     1320                 * @example
     1321                 * var strong = p.getChild(0);
     1322                 */
     1323                getChild : function( indices )
     1324                {
     1325                        var rawNode = this.$;
     1326
     1327                        if ( !indices.slice )
     1328                                rawNode = rawNode.childNodes[ indices ];
     1329                        else
     1330                        {
     1331                                while ( indices.length > 0 && rawNode )
     1332                                        rawNode = rawNode.childNodes[ indices.shift() ];
     1333                        }
     1334
     1335                        return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
     1336                },
     1337
     1338                getChildCount : function()
     1339                {
     1340                        return this.$.childNodes.length;
     1341                },
     1342
    13151343        });
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy