Ticket #3345: 3345_2.patch

File 3345_2.patch, 1.7 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/link/dialogs/anchor.js

     
    66CKEDITOR.dialog.add( 'anchor', function( editor )
    77{
    88        // Function called in onShow to load selected element.
    9         var loadElements = function( editor, selection, ranges, element )
     9        var loadElements = function( element )
    1010        {
    1111                this.editMode = true;
    1212                this.editObj = element;
     
    6363
    6464                        var editor = this.getParentEditor(),
    6565                                selection = editor.getSelection(),
    66                                 ranges = selection.getRanges();
    67 
    68                         if ( ranges.length == 1 )
     66                                element = selection.getSelectedElement();
     67                       
     68                        // Update from selected anchor.
     69                        if ( element.is( 'img' )
     70                                && element.getAttribute( '_cke_real_element_type' )
     71                                && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
    6972                        {
    70                                 ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
    71                                 var rangeRoot = ranges[0].getCommonAncestor( true );
    72                                 var element = rangeRoot.getAscendant( 'img', true );
    73                                 if ( element && element.getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' )
    74                                 {
    75                                         this.fakeObj = element;
    76                                         element = editor.restoreRealElement( this.fakeObj );
    77                                         loadElements.apply( this, [ editor, selection, ranges, element ] );
    78                                         selection.selectElement( this.fakeObj );
    79                                 }
     73                                this.fakeObj = element;
     74                                element = editor.restoreRealElement( this.fakeObj );
     75                                loadElements.call( this, element );
     76                                selection.selectElement( this.fakeObj );
    8077                        }
    8178                        this.getContentElement( 'info', 'txtName' ).focus();
    8279                },
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy