Ticket #3375: 3375.patch
File 3375.patch, 1.9 KB (added by , 15 years ago) |
---|
-
_source/plugins/link/dialogs/link.js
1131 1131 // Create element if current selection is collapsed. 1132 1132 var selection = editor.getSelection(), 1133 1133 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 1134 1140 if ( ranges.length == 1 && ranges[0].collapsed ) 1135 1141 { 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 ); 1139 1150 selection.selectRanges( ranges ); 1140 1151 } 1141 1152 … … 1143 1154 var style = new CKEDITOR.style( { element : 'a', attributes : attributes } ); 1144 1155 style.type = CKEDITOR.STYLE_INLINE; // need to override... dunno why. 1145 1156 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 } 1146 1164 1147 1165 // Id. Apply only to the first link. 1148 1166 if ( data.adv && data.adv.advId )