Ticket #3375: 3375.patch

File 3375.patch, 1.9 KB (added by Garry Yao, 15 years ago)
  • _source/plugins/link/dialogs/link.js

     
    11311131                                // Create element if current selection is collapsed.
    11321132                                var selection = editor.getSelection(),
    11331133                                        ranges = selection.getRanges();
     1134                               
     1135                                // Create an padding node for inline position.
     1136                                var paddingInine = editor.document.createElement( 'span' );
     1137                                paddingInine.setHtml( '' );     // Zero Width No-Break Space (U+FEFF).
     1138                                paddingInine = paddingInine.getFirst();         
     1139
    11341140                                if ( ranges.length == 1 && ranges[0].collapsed )
    11351141                                {
    1136                                         var text = new CKEDITOR.dom.text( attributes._cke_saved_href, editor.document );
    1137                                         ranges[0].insertNode( text );
    1138                                         ranges[0].selectNodeContents( text );
     1142                                        var textNode = new CKEDITOR.dom.text(
     1143                                                attributes._cke_saved_href, editor.document );
     1144                                        // Avoid text unappendable at the end of link.
     1145                                        ranges[0].insertNode( textNode );
     1146                                        ranges[0].selectNodeContents( textNode );
     1147                                        ranges[0].collapse();
     1148                                        ranges[0].insertNode( paddingInine.clone( true ) );
     1149                                        ranges[0].selectNodeContents( textNode );
    11391150                                        selection.selectRanges( ranges );
    11401151                                }
    11411152
     
    11431154                                var style = new CKEDITOR.style( { element : 'a', attributes : attributes } );
    11441155                                style.type = CKEDITOR.STYLE_INLINE;             // need to override... dunno why.
    11451156                                style.apply( editor.document );
     1157                               
     1158                                // Avoid unable to exist link problem with Firefox.
     1159                                if( CKEDITOR.env.gecko && ranges[0].checkEndOfBlock() )
     1160                                {
     1161                                        var link = ranges[0].getCommonAncestor().getAscendant( 'a' );
     1162                                        paddingInine.clone( true ).insertAfter( link );
     1163                                }
    11461164
    11471165                                // Id. Apply only to the first link.
    11481166                                if ( data.adv && data.adv.advId )
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy