Ticket #5214: FCK_img_link_fix-2.patch
File FCK_img_link_fix-2.patch, 8.4 KB (added by , 14 years ago) |
---|
-
FCKeditorSkin.body.php
diff -Naur FCKeditor.orig/FCKeditorSkin.body.php FCKeditor/FCKeditorSkin.body.php
old new 158 158 if( $fp['align'] ) { 159 159 $ret .= "_fck_mw_location=\"" . strtolower( $fp['align'] ) . "\" "; 160 160 } 161 if( isset( $fp['link-url'] ) ) { 162 $ret .= "_fck_link_url=\"" . $fp['link-url'] . "\" "; 163 } 164 if( isset( $fp['link-title'] ) && is_object( $fp['link-title'] ) ) { 165 $ret .= "_fck_link_url=\"" . $fp['link-title']->getFullText() . "\" "; 166 } 161 167 if( !empty( $hp ) ) { 162 168 if( isset( $hp['width'] ) ) { 163 169 $ret .= "_fck_mw_width=\"" . $hp['width'] . "\" "; … … 192 198 $class .= ( $class ? ' ' : '' ) . 'fck_mw_notfound'; 193 199 } 194 200 195 if( isset( $fp['alt'] ) && !empty( $fp['alt'] ) && $fp['alt'] != 'Image:' .$orginal ) {201 if( isset( $fp['alt'] ) && !empty( $fp['alt'] ) && $fp['alt'] != $orginal ) { 196 202 $ret .= "alt=\"" . htmlspecialchars( $fp['alt'] ) . "\" "; 197 203 } else { 198 204 $ret .= "alt=\"\" "; -
plugins/mediawiki/dialogs/image.html
diff -Naur FCKeditor.orig/plugins/mediawiki/dialogs/image.html FCKeditor/plugins/mediawiki/dialogs/image.html
old new 71 71 72 72 GetE('txtUrl').value = GetAttribute( oImage, '_fck_mw_filename', '' ) ; 73 73 GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; 74 GetE('xType').value 74 GetE('xType').value = GetAttribute( oImage, '_fck_mw_type', '' ) ; 75 75 GetE('cmbAlign').value = GetAttribute( oImage, '_fck_mw_location', '' ) ; 76 76 GetE('txtLink').value = GetAttribute( oImage, '_fck_link_url', '' ) ; 77 77 GetE('txtWidth').value = GetAttribute( oImage, '_fck_mw_width', '' ) ; 78 78 GetE('txtHeight').value = GetAttribute( oImage, '_fck_mw_height', '' ) ; 79 79 … … 94 94 window.parent.document.getElementById( 'btnCancel' ).disabled = true ; 95 95 } 96 96 97 var imgName 97 var imgName = GetE('txtUrl').value ; 98 98 var imgCaption = GetE('txtAlt').value ; 99 var imgType 99 var imgType = GetE('xType').value ; 100 100 var imgLocation = GetE('cmbAlign').value ; 101 101 var imgWidth = GetE('txtWidth').value ; 102 102 var imgHeight = GetE('txtHeight').value ; 103 var imgLink = GetE('txtLink').value ; 103 104 104 105 var ajaxArg = imgName ; 105 106 … … 118 119 119 120 ajaxArg += 'px' ; 120 121 } 122 123 if ( imgLink.length > 0 ) 124 ajaxArg += '|link=' + imgLink ; 121 125 122 126 if ( imgCaption.length > 0 ) 123 127 ajaxArg += '|' + imgCaption ; … … 154 158 SetAttribute( e, "_fck_mw_location", imgLocation ) ; 155 159 SetAttribute( e, "_fck_mw_width", GetE('txtWidth').value ) ; 156 160 SetAttribute( e, "_fck_mw_height", GetE('txtHeight').value ) ; 157 161 SetAttribute( e, "_fck_link_url", GetE('txtLink').value ) ; 158 162 SetAttribute( e, "width" , GetE('txtWidth').value ) ; 159 163 SetAttribute( e, "height", GetE('txtHeight').value ) ; 160 164 … … 179 183 SetAttribute( e, "_fcksavedurl", realUrl ) ; 180 184 } 181 185 182 var searchTimer ; 186 var searchLnkTimer ; 187 188 //#### Called while the user types the URL. 189 function OnLnkUrlChange() 190 { 191 var link = GetE('txtLink').value.Trim() ; 192 193 if ( searchLnkTimer ) 194 window.clearTimeout( searchLnkTimer ) ; 195 196 if ( link.StartsWith( '#' ) ) 197 { 198 SetLnkSearchMessage( FCKLang.wikiLnkNoSearchAnchor || 'anchor link... no search for it' ) ; 199 return ; 200 } 201 202 if ( link.StartsWith( 'mailto:' ) ) 203 { 204 SetLnkSearchMessage( FCKLang.wikiLnkNoSearchMail || 'e-mail link... no search for it' ) ; 205 return ; 206 } 207 208 if( /^\w+:\/\//.test( link ) ) 209 { 210 SetLnkSearchMessage( FCKLang.wikiLnkNoSearchExt || 'external link... no search for it' ) ; 211 return ; 212 } 213 214 if ( link.length < 3 ) 215 { 216 ClearLnkSearch() ; 217 218 if ( link.length == 0 ) 219 SetLnkSearchMessage( FCKLang.wikiLnkStartTyping || 'start typing in the above field' ) ; 220 else 221 SetLnkSearchMessage( FCKLang.wikiLnkTooShort || 'too short... type more' ) ; 222 return ; 223 } 224 225 SetLnkSearchMessage( FCKLang.wikiLnkStopTyping || 'stop typing to search' ) ; 226 searchLnkTimer = window.setTimeout( StartLnkSearch, 500 ) ; 227 } 228 229 function StartLnkSearch() 230 { 231 var link = GetE('txtLink').value.Trim() ; 232 233 if ( link.length < 3 ) 234 return ; 235 236 SetLnkSearchMessage( FCKLang.wikiLnkSearching || 'searching...' ) ; 237 238 // Make an Ajax search for the pages. 239 oEditor.window.parent.sajax_request_type = 'GET' ; 240 oEditor.window.parent.sajax_do_call( 'wfSajaxSearchArticleFCKeditor', [link], LoadLnkSearchResults ) ; 241 } 242 243 function LoadLnkSearchResults( result ) 244 { 245 var results = result.responseText.Trim().split( '\n' ) ; 246 var select = GetE( 'xWikiLnkResults' ) ; 247 248 ClearLnkSearch() ; 249 250 if ( results.length == 0 || ( results.length == 1 && results[0].length == 0 ) ) 251 { 252 SetLnkSearchMessage( FCKLang.wikiLnkSearchNothing || 'no articles found' ) ; 253 } 254 else 255 { 256 if ( results.length == 1 ) 257 SetLnkSearchMessage( FCKLang.wikiLnkSearch1Found || 'one article found' ) ; 258 else 259 SetLnkSearchMessage( (FCKLang.wikiLnkSearchSeveral || '%1 articles found').replace( /%1/g, results.length ) ) ; 183 260 261 for ( var i = 0 ; i < results.length ; i++ ) 262 FCKTools.AddSelectOption( select, results[i], results[i] ) ; 263 } 264 } 265 266 function ClearLnkSearch() 267 { 268 var select = GetE( 'xWikiLnkResults' ) ; 269 270 while ( select.options.length > 0 ) 271 select.remove( 0 ) 272 } 273 274 function SetLnkSearchMessage( message ) 275 { 276 GetE('xWikiLnkSearchStatus').innerHTML = message ; 277 } 278 279 function SetLnkUrl( url ) 280 { 281 GetE('txtLink').value = url ; 282 } 283 284 285 var searchTimer ; 184 286 //#### Called while the user types the URL. 287 185 288 function OnUrlChange() 186 289 { 187 290 var link = GetE('txtUrl').value.Trim() ; … … 301 404 <input id="txtAlt" style="width: 100%" type="text"><br /> 302 405 </td> 303 406 </tr> 407 <tr> 408 <td colspan="2"> 409 <span fcklang="wikiImgLink">Link</span><br /> 410 <input id="txtLink" style="width: 100%" type="text" onkeyup="OnLnkUrlChange();" /> 411 <br /> 412 <span fcklang="wikiLnkAutomatic">Automatic search results</span> (<span fcklang="wikiLnkStartTyping" id="xWikiLnkSearchStatus">start typing in the above field</span>)<br /> 413 <select id="xWikiLnkResults" size="10" style="width: 100%; height:150px" onclick="SetLnkUrl( this.value );"> 414 </td> 415 </tr> 416 <tr> 417 <td colspan="2"> 418 304 419 <tr> 305 420 <td valign="top" colspan="2"> 306 421 <table cellspacing="0" cellpadding="0" border="0"> -
plugins/mediawiki/fckplugin.js
diff -Naur FCKeditor.orig/plugins/mediawiki/fckplugin.js FCKeditor/plugins/mediawiki/fckplugin.js
old new 553 553 var imgStyleHeight = ( parseInt(htmlNode.style.height) || '' ) + ''; 554 554 var imgRealWidth = ( htmlNode.getAttribute( 'width' ) || '' ) + ''; 555 555 var imgRealHeight = ( htmlNode.getAttribute( 'height' ) || '' ) + ''; 556 var imgLinkUrl = htmlNode.getAttribute( '_fck_link_url' ) || ''; 556 557 557 558 stringBuilder.push( '[[Image:' ); 558 559 stringBuilder.push( imgName ); … … 575 576 576 577 if ( imgWidth.length > 0 ){ 577 578 stringBuilder.push( '|' + imgWidth ); 578 579 579 if ( imgHeight.length > 0 ) 580 580 stringBuilder.push( 'x' + imgHeight ); 581 stringBuilder.push( 'px' ); 581 582 583 } else if ( imgHeight.length > 0 ) { 584 stringBuilder.push( '|x' + imgHeight ); 582 585 stringBuilder.push( 'px' ); 583 586 } 584 587 588 if ( imgLinkUrl.length > 0 ){ 589 stringBuilder.push( '|link=' + imgLinkUrl ); 590 imgCaption = ''; 591 } 585 592 if ( imgCaption.length > 0 ) 586 593 stringBuilder.push( '|' + imgCaption ); 587 594