Changeset 29463
- Timestamp:
- 08/10/2014 04:21:46 AM (11 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/css/media-views.css
r29456 r29463 1788 1788 .image-details .embed-media-settings, 1789 1789 .image-details .embed-media-settings div { 1790 -webkit-box-sizing: border-box; 1791 -moz-box-sizing: border-box; 1790 1792 box-sizing: border-box; 1791 1793 } … … 2320 2322 height: auto; 2321 2323 max-width: 65%; 2324 max-width: -webkit-calc(100% - 38px); 2322 2325 max-width: calc(100% - 38px); 2323 2326 } … … 2360 2363 max-width: 70%; 2361 2364 bottom: 120%; 2365 -webkit-box-sizing: border-box; 2366 -moz-box-sizing: border-box; 2362 2367 box-sizing: border-box; 2363 2368 padding-bottom: 0; -
trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js
r29380 r29463 436 436 437 437 editor.selection.collapse( true ); 438 editor.nodeChanged();439 438 editor.dom.remove( wrap ); 440 439 } else { 441 440 editor.dom.remove( node ); 442 441 } 442 443 443 removeToolbar(); 444 editor.nodeChanged(); 445 editor.undoManager.add(); 444 446 } 445 447 … … 458 460 rectangle = dom.getRect( node ); 459 461 460 toolbarHtml = '<i class="dashicons dashicons-edit edit" data-mce-bogus=" 1"></i>' +461 '<i class="dashicons dashicons-no-alt remove" data-mce-bogus=" 1"></i>';462 toolbarHtml = '<i class="dashicons dashicons-edit edit" data-mce-bogus="all"></i>' + 463 '<i class="dashicons dashicons-no-alt remove" data-mce-bogus="all"></i>'; 462 464 463 465 toolbar = dom.create( 'p', { 464 466 'id': 'wp-image-toolbar', 465 'data-mce-bogus': ' 1',467 'data-mce-bogus': 'all', 466 468 'contenteditable': false 467 469 }, toolbarHtml ); … … 928 930 }); 929 931 930 editor.on( 'mouseup ', function( event ) {932 editor.on( 'mouseup touchend', function( event ) { 931 933 var image, 932 934 node = event.target, … … 957 959 }); 958 960 959 // Remove toolbarfrom undo levels961 // Remove from undo levels 960 962 editor.on( 'BeforeAddUndo', function( event ) { 961 event.level.content = event.level.content.replace( / <p [^>]*data-mce-bogus[^>]+>[\s\S]*?<\/p>/g, '' );963 event.level.content = event.level.content.replace( / data-wp-imgselect="1"/g, '' ); 962 964 }); 963 965 964 editor.on( 'cut', function() { 966 // After undo/redo FF seems to set the image height very slowly when it is set to 'auto' in the CSS. 967 // This causes image.getBoundingClientRect() to return wrong values and the resize handles are shown in wrong places. 968 // Collapse the selection to remove the resize handles. 969 if ( tinymce.Env.gecko ) { 970 editor.on( 'undo redo', function() { 971 if ( editor.selection.getNode().nodeName === 'IMG' ) { 972 editor.selection.collapse(); 973 } 974 }); 975 } 976 977 editor.on( 'cut wpview-selected', function() { 965 978 removeToolbar(); 966 979 }); -
trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
r29302 r29463 12 12 firstFocus = true, 13 13 _noop = function() { return false; }, 14 isTouchDevice = ( 'ontouchend' in document ), 14 15 cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView; 15 16 … … 141 142 142 143 // select the hidden div 143 editor.selection.select( clipboard, true ); 144 if ( isTouchDevice ) { 145 editor.selection.select( clipboard ); 146 } else { 147 editor.selection.select( clipboard, true ); 148 } 149 144 150 editor.nodeChanged(); 151 editor.fire( 'wpview-selected', viewNode ); 145 152 } 146 153 … … 257 264 258 265 editor.on( 'init', function() { 259 var selection = editor.selection; 266 var scrolled = false, 267 selection = editor.selection; 260 268 261 269 // When a view is selected, ensure content that is being pasted … … 286 294 }); 287 295 288 editor.dom.bind( editor.getBody().parentNode, 'mousedown mouseup click', function( event ) { 289 var view = getView( event.target ); 296 editor.dom.bind( editor.getDoc(), 'touchmove', function() { 297 scrolled = true; 298 }); 299 300 editor.on( 'mousedown mouseup click touchend', function( event ) { 301 var view = getView( event.target ), 302 type = isTouchDevice ? 'touchend' : 'mousedown'; 290 303 291 304 firstFocus = false; … … 293 306 // Contain clicks inside the view wrapper 294 307 if ( view ) { 295 event.stopPropagation(); 296 297 if ( event.type === 'mousedown' && ! event.metaKey && ! event.ctrlKey ) { 308 event.stopImmediatePropagation(); 309 event.preventDefault(); 310 311 if ( event.type === type && ! event.metaKey && ! event.ctrlKey ) { 298 312 if ( editor.dom.hasClass( event.target, 'edit' ) ) { 299 313 wp.mce.views.edit( view ); … … 306 320 } 307 321 308 select( view ); 322 if ( event.type === 'touchend' && scrolled ) { 323 scrolled = false; 324 } else { 325 select( view ); 326 } 309 327 310 328 // Returning false stops the ugly bars from appearing in IE11 and stops the view being selected as a range in FF. … … 312 330 return false; 313 331 } else { 314 if ( event.type === 'mousedown') {332 if ( event.type === type ) { 315 333 deselect(); 316 334 } 317 335 } 318 }); 336 337 if ( event.type === 'touchend' && scrolled ) { 338 scrolled = false; 339 } 340 }, true ); 319 341 }); 320 342 … … 565 587 }); 566 588 567 if ( focus ) { 568 if ( view ) { 569 if ( ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) && editor.selection.isCollapsed() ) { 570 setViewCursorTries = 0; 571 572 deselect(); 573 574 // Make sure the cursor arrived in the right node. 575 // This is necessary for Firefox. 576 if ( lKDN === view.previousSibling ) { 577 setViewCursor( true, view ); 578 return; 579 } else if ( lKDN === view.nextSibling ) { 580 setViewCursor( false, view ); 581 return; 582 } 583 584 dom.addClass( view, className ); 585 586 cursorInterval = setInterval( function() { 587 if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { 588 dom.removeClass( view, 'wpview-cursor-hide' ); 589 } else { 590 dom.addClass( view, 'wpview-cursor-hide' ); 591 } 592 }, 500 ); 593 // If the cursor lands anywhere else in the view, set the cursor before it. 594 // Only try this once to prevent a loop. (You never know.) 595 } else if ( ! getParent( event.element, 'wpview-clipboard' ) && ! setViewCursorTries ) { 596 deselect(); 597 setViewCursorTries++; 589 if ( focus && view ) { 590 if ( ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) && 591 editor.selection.isCollapsed() ) { 592 593 setViewCursorTries = 0; 594 595 deselect(); 596 597 // Make sure the cursor arrived in the right node. 598 // This is necessary for Firefox. 599 if ( lKDN === view.previousSibling ) { 598 600 setViewCursor( true, view ); 599 } 600 } else { 601 return; 602 } else if ( lKDN === view.nextSibling ) { 603 setViewCursor( false, view ); 604 return; 605 } 606 607 dom.addClass( view, className ); 608 609 cursorInterval = setInterval( function() { 610 if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { 611 dom.removeClass( view, 'wpview-cursor-hide' ); 612 } else { 613 dom.addClass( view, 'wpview-cursor-hide' ); 614 } 615 }, 500 ); 616 // If the cursor lands anywhere else in the view, set the cursor before it. 617 // Only try this once to prevent a loop. (You never know.) 618 } else if ( ! getParent( event.element, 'wpview-clipboard' ) && ! setViewCursorTries ) { 601 619 deselect(); 620 setViewCursorTries++; 621 setViewCursor( true, view ); 602 622 } 603 623 }
Note: See TracChangeset
for help on using the changeset viewer.