Changeset 44695
- Timestamp:
- 01/24/2019 11:10:34 AM (6 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/vendor/tinymce/plugins/wpeditimage/plugin.js
r43309 r44695 348 348 } 349 349 350 function updateImage( imageNode, imageData ) {351 var classes, className, node, html, parent, wrap, linkNode, 350 function updateImage( $imageNode, imageData ) { 351 var classes, className, node, html, parent, wrap, linkNode, imageNode, 352 352 captionNode, dd, dl, id, attrs, linkAttrs, width, height, align, 353 353 $imageNode, srcset, src, 354 354 dom = editor.dom; 355 355 356 if ( ! $imageNode || ! $imageNode.length ) { 357 return; 358 } 359 360 imageNode = $imageNode[0]; 356 361 classes = tinymce.explode( imageData.extraClasses, ' ' ); 357 362 … … 390 395 391 396 // Preserve empty alt attributes. 392 editor.$( imageNode ).attr( 'alt', imageData.alt || '' );397 $imageNode.attr( 'alt', imageData.alt || '' ); 393 398 394 399 linkAttrs = { … … 514 519 515 520 function editImage( img ) { 516 var frame, callback, metadata ;521 var frame, callback, metadata, imageNode; 517 522 518 523 if ( typeof wp === 'undefined' || ! wp.media ) { … … 522 527 523 528 metadata = extractImageData( img ); 529 530 // Mark the image node so we can select it later. 531 editor.$( img ).attr( 'data-wp-editing', 1 ); 524 532 525 533 // Manipulate the metadata by reference that is fed into the PostImage model used in the media modal … … 539 547 540 548 callback = function( imageData ) { 541 editor.focus();542 549 editor.undoManager.transact( function() { 543 updateImage( im g, imageData );550 updateImage( imageNode, imageData ); 544 551 } ); 545 552 frame.detach(); … … 551 558 editor.focus(); 552 559 frame.detach(); 560 561 // `close` fires first... 562 // To be able to update the image node, we need to find it here, 563 // and use it in the callback. 564 imageNode = editor.$( 'img[data-wp-editing]' ) 565 imageNode.removeAttr( 'data-wp-editing' ); 553 566 }); 554 567 … … 811 824 editor.on( 'beforeGetContent', function( event ) { 812 825 if ( event.format !== 'raw' ) { 813 editor.$( 'img[id="__wp-temp-img-id"]' ). attr( 'id', null);826 editor.$( 'img[id="__wp-temp-img-id"]' ).removeAttr( 'id' ); 814 827 } 815 828 }); -
trunk/src/wp-includes/css/editor.css
r44637 r44695 1212 1212 } 1213 1213 1214 .mce-content-body dl.wp-caption { 1215 max-width: 100%; 1216 } 1217 1214 1218 /* Quicktags */ 1215 1219 .quicktags-toolbar {
Note: See TracChangeset
for help on using the changeset viewer.