Changeset 36716
- Timestamp:
- 02/26/2016 12:20:54 AM (7 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r36597 r36716 886 886 function hide( event ) { 887 887 if ( activeToolbar ) { 888 if ( event.type === 'hide' ) {888 if ( activeToolbar.tempHide || event.type === 'hide' ) { 889 889 activeToolbar.hide(); 890 890 activeToolbar = false; -
trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js
r36703 r36716 224 224 225 225 editor.addCommand( 'wp_link_cancel', function() { 226 inputInstance.reset(); 227 removePlaceholders(); 228 editor.focus(); 229 230 if ( tinymce.isIE ) { 231 editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark ); 232 editor.windowManager.wplinkBookmark = null; 226 if ( ! editToolbar.tempHide ) { 227 inputInstance.reset(); 228 removePlaceholders(); 229 editor.focus(); 230 231 if ( tinymce.isIE ) { 232 editor.selection.moveToBookmark( editor.windowManager.wplinkBookmark ); 233 editor.windowManager.wplinkBookmark = null; 234 } 235 236 editToolbar.tempHide = false; 233 237 } 234 238 } ); … … 286 290 // Prevent adding undo levels on inserting link placeholder. 287 291 editor.on( 'BeforeAddUndo', function( event ) { 288 if ( event.level.content ) { 289 event.level.content = removePlaceholderStrings( event.level.content ); 292 if ( event.lastLevel && event.lastLevel.content && event.level.content && 293 event.lastLevel.content === removePlaceholderStrings( event.level.content ) ) { 294 295 event.preventDefault(); 290 296 } 291 297 }); … … 389 395 390 396 if ( tinymce.$( document.body ).hasClass( 'modal-open' ) ) { 397 editToolbar.tempHide = true; 391 398 return; 392 399 } 400 401 editToolbar.tempHide = false; 393 402 394 403 if ( linkNode ) { … … 433 442 text = inputInstance.getLinkText() || null; 434 443 435 editor.focus(); 444 editor.focus(); // Needed for IE 436 445 window.wpLink.open( editor.id, url, text ); 446 447 editToolbar.tempHide = true; 437 448 inputInstance.reset(); 438 449 } … … 448 459 449 460 return { 450 hideEditToolbar: function() { 451 editToolbar.hide(); 461 close: function() { 462 editToolbar.tempHide = false; 463 editor.execCommand( 'wp_link_cancel' ); 452 464 } 453 465 }; -
trunk/src/wp-includes/js/wplink.js
r36703 r36716 245 245 246 246 mceRefresh: function( url, text ) { 247 var linkNode = editor.dom.getParent( editor.selection.getNode(), 'a[href]' ), 247 var linkText, 248 linkNode = getLink(), 248 249 onlyText = this.hasSelectedText( linkNode ); 249 250 250 251 if ( linkNode ) { 251 text = tinymce.trim( linkNode.innerText || linkNode.textContent ) || text; 252 linkText = linkNode.innerText || linkNode.textContent; 253 254 if ( ! tinymce.trim( linkText ) ) { 255 linkText = text || ''; 256 } 257 252 258 url = url || editor.dom.getAttrib( linkNode, 'href' ); 253 259 … … 265 271 266 272 if ( onlyText ) { 267 inputs.text.val( text || '' );273 inputs.text.val( linkText || '' ); 268 274 inputs.wrap.addClass( 'has-text-field' ); 269 275 } else { … … 284 290 } 285 291 } else { 286 editor.plugins.wplink.hideEditToolbar(); 292 if ( editor.plugins.wplink ) { 293 editor.plugins.wplink.close(); 294 } 295 287 296 editor.focus(); 288 297 }
Note: See TracChangeset
for help on using the changeset viewer.