Changeset 36743
- Timestamp:
- 02/27/2016 12:51:41 AM (8 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
r36716 r36743 69 69 }, 70 70 getLinkText: function() { 71 return tinymce.trim( this.getEl().firstChild.nextSibling.value ); 71 var text = this.getEl().firstChild.nextSibling.value; 72 73 if ( ! tinymce.trim( text ) ) { 74 return ''; 75 } 76 77 return text.replace( /[\r\n\t ]+/g, ' ' ); 72 78 }, 73 79 reset: function() { … … 145 151 146 152 editToolbar.on( 'show', function() { 147 var inputNode = editToolbar.find( 'toolbar' )[0]; 148 149 if ( inputNode && ! tinymce.$( document.body ).hasClass( 'modal-open' ) ) { 153 if ( ! tinymce.$( document.body ).hasClass( 'modal-open' ) ) { 150 154 window.setTimeout( function() { 151 inputNode.focus( true ); 152 }); 155 var element = editToolbar.$el.find( 'input.ui-autocomplete-input' )[0]; 156 157 if ( element ) { 158 element.focus(); 159 element.select(); 160 } 161 } ); 153 162 } 154 163 } ); … … 172 181 return; 173 182 } 183 184 editToolbar.tempHide = false; 174 185 175 186 if ( link ) { … … 182 193 editor.windowManager.wplinkBookmark = editor.selection.getBookmark(); 183 194 } 195 196 editor.nodeChanged(); 184 197 } 185 198 } ); … … 228 241 removePlaceholders(); 229 242 editor.focus(); 230 243 231 244 if ( tinymce.isIE ) { 232 245 editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark ); 233 246 editor.windowManager.wplinkBookmark = null; 234 247 } 235 248 236 249 editToolbar.tempHide = false; 237 250 } … … 385 398 if ( event.keyCode === 13 ) { 386 399 editor.execCommand( 'wp_link_apply' ); 400 event.preventDefault(); 387 401 } 388 402 } ); -
trunk/src/wp-includes/js/wplink.js
r36716 r36743 30 30 } 31 31 32 inputs.submit.click( function( event ) { 32 inputs.dialog.on( 'keydown', wpLink.keydown ); 33 inputs.submit.on( 'click', function( event ) { 33 34 event.preventDefault(); 34 35 wpLink.update(); … … 211 212 window.setTimeout( function() { 212 213 inputs.url.focus()[0].select(); 213 } , 100);214 } ); 214 215 } 215 216 … … 432 433 }, 433 434 435 keydown: function( event ) { 436 var id; 437 438 // Escape key. 439 if ( 27 === event.keyCode ) { 440 wpLink.close(); 441 event.stopImmediatePropagation(); 442 // Tab key. 443 } else if ( 9 === event.keyCode ) { 444 id = event.target.id; 445 446 // wp-link-submit must always be the last focusable element in the dialog. 447 // following focusable elements will be skipped on keyboard navigation. 448 if ( id === 'wp-link-submit' && ! event.shiftKey ) { 449 inputs.close.focus(); 450 event.preventDefault(); 451 } else if ( id === 'wp-link-close' && event.shiftKey ) { 452 inputs.submit.focus(); 453 event.preventDefault(); 454 } 455 } 456 }, 457 434 458 setDefaultValues: function() { 435 459 var selection,
Note: See TracChangeset
for help on using the changeset viewer.