Changeset 26193
- Timestamp:
- 11/15/2013 04:27:31 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/js/wplink.js (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/wplink.js
r26033 r26193 1 /* global ajaxurl, tinymce, wpLinkL10n, tinyMCEPopup, setUserSetting, wpActiveEditor */ 1 2 var wpLink; 2 3 … … 114 115 inputs.title.val( ed.dom.getAttrib(e, 'title') ); 115 116 // Set open in new tab. 116 inputs.openInNewTab.prop('checked', ( "_blank"== ed.dom.getAttrib( e, 'target' ) ) );117 inputs.openInNewTab.prop('checked', ( '_blank' == ed.dom.getAttrib( e, 'target' ) ) ); 117 118 // Update save prompt. 118 119 inputs.submit.val( wpLinkL10n.update ); … … 157 158 158 159 htmlUpdate : function() { 159 var attrs, html, begin, end, cursor, 160 var attrs, html, begin, end, cursor, selection, 160 161 textarea = wpLink.textarea; 161 162 … … 202 203 cursor -= '</a>'.length; 203 204 204 textarea.value = textarea.value.substring( 0, begin ) 205 + html 206 + textarea.value.substring( end, textarea.value.length ); 205 textarea.value = textarea.value.substring( 0, begin ) + html + 206 textarea.value.substring( end, textarea.value.length ); 207 207 208 208 // Update cursor position … … 228 228 ed.dom.remove(e, 1); 229 229 ed.selection.moveToBookmark(b); 230 tinyMCEPopup.execCommand( "mceEndUndoLevel");230 tinyMCEPopup.execCommand('mceEndUndoLevel'); 231 231 wpLink.close(); 232 232 } … … 235 235 236 236 if (e == null) { 237 ed.getDoc().execCommand( "unlink", false, null);238 tinyMCEPopup.execCommand( "mceInsertLink", false, "#mce_temp_url#", {skip_undo : 1});239 240 tinymce.each(ed.dom.select( "a"), function(n) {237 ed.getDoc().execCommand('unlink', false, null); 238 tinyMCEPopup.execCommand('mceInsertLink', false, '#mce_temp_url#', {skip_undo : 1}); 239 240 tinymce.each(ed.dom.select('a'), function(n) { 241 241 if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { 242 242 e = n; … … 263 263 } 264 264 265 ed.execCommand( "mceEndUndoLevel");265 ed.execCommand('mceEndUndoLevel'); 266 266 wpLink.close(); 267 267 ed.focus(); … … 271 271 inputs.url.val( li.children('.item-permalink').val() ); 272 272 inputs.title.val( li.hasClass('no-title') ? '' : li.children('.item-title').text() ); 273 if ( originalEvent && originalEvent.type == "click")273 if ( originalEvent && originalEvent.type == 'click' ) 274 274 inputs.url.focus(); 275 275 }, … … 319 319 var fn, key = $.ui.keyCode; 320 320 321 switch( event.which ) { 322 case key.UP: 323 fn = 'prev'; 324 case key.DOWN: 325 fn = fn || 'next'; 326 clearInterval( wpLink.keyInterval ); 327 wpLink[ fn ](); 328 wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity ); 329 break; 330 default: 331 return; 332 } 321 if ( event.which !== key.UP && event.which !== key.DOWN ) { 322 return; 323 } 324 325 fn = event.which === key.UP ? 'prev' : 'next'; 326 clearInterval( wpLink.keyInterval ); 327 wpLink[ fn ](); 328 wpLink.keyInterval = setInterval( wpLink[ fn ], wpLink.keySensitivity ); 333 329 event.preventDefault(); 334 330 }, 331 335 332 keyup: function( event ) { 336 333 var key = $.ui.keyCode; 337 334 338 switch( event.which ) { 339 case key.ESCAPE: 340 event.stopImmediatePropagation(); 341 if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) ) 342 wpLink.close(); 343 344 return false; 345 break; 346 case key.UP: 347 case key.DOWN: 348 clearInterval( wpLink.keyInterval ); 349 break; 350 default: 351 return; 352 } 353 event.preventDefault(); 335 if ( event.which === key.ESCAPE ) { 336 event.stopImmediatePropagation(); 337 if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) ) 338 wpLink.close(); 339 return false; 340 } 341 342 if ( event.which === key.UP || event.which === key.DOWN ) { 343 clearInterval( wpLink.keyInterval ); 344 event.preventDefault(); 345 } 354 346 }, 355 347 … … 508 500 if ( !results ) { 509 501 if ( firstPage ) { 510 list += '<li class="unselectable"><span class="item-title"><em>' 511 + wpLinkL10n.noMatchesFound 512 + '</em></span></li>'; 502 list += '<li class="unselectable"><span class="item-title"><em>' + 503 wpLinkL10n.noMatchesFound + '</em></span></li>'; 513 504 } 514 505 } else { 515 506 $.each( results, function() { 516 507 classes = alt ? 'alternate' : ''; 517 classes += this ['title']? '' : ' no-title';508 classes += this.title ? '' : ' no-title'; 518 509 list += classes ? '<li class="' + classes + '">' : '<li>'; 519 list += '<input type="hidden" class="item-permalink" value="' + this ['permalink']+ '" />';510 list += '<input type="hidden" class="item-permalink" value="' + this.permalink + '" />'; 520 511 list += '<span class="item-title">'; 521 list += this ['title'] ? this['title']: wpLinkL10n.noTitle;522 list += '</span><span class="item-info">' + this ['info']+ '</span></li>';512 list += this.title ? this.title : wpLinkL10n.noTitle; 513 list += '</span><span class="item-info">' + this.info + '</span></li>'; 523 514 alt = ! alt; 524 515 }); … … 579 570 self.allLoaded = !r; 580 571 callback( r, query ); 581 }, "json");572 }, 'json' ); 582 573 } 583 574 });
Note: See TracChangeset
for help on using the changeset viewer.