Changeset 29010
- Timestamp:
- 07/07/2014 01:20:53 AM (10 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js
r29004 r29010 9 9 TreeWalker = tinymce.dom.TreeWalker, 10 10 toRemove = false, 11 cursorInterval, lastKeyDownNode, setViewCursorTries; 11 firstFocus = true, 12 cursorInterval, lastKeyDownNode, setViewCursorTries, focus; 12 13 13 14 function getView( node ) { … … 350 351 node = selection.getNode(), 351 352 view = getView( node ), 352 cursorBefore, cursorAfter; 353 cursorBefore, cursorAfter, 354 range, clonedRange, tempRange; 353 355 354 356 lastKeyDownNode = node; 357 358 // Make sure we don't delete part of a view. 359 // If the range ends or starts with the view, we'll need to trim it. 360 if ( ! selection.isCollapsed() ) { 361 range = selection.getRng(); 362 363 if ( view = getView( range.endContainer ) ) { 364 clonedRange = range.cloneRange(); 365 selection.select( view.previousSibling, true ); 366 selection.collapse(); 367 tempRange = selection.getRng(); 368 clonedRange.setEnd( tempRange.endContainer, tempRange.endOffset ); 369 selection.setRng( clonedRange ); 370 } else if ( view = getView( range.startContainer ) ) { 371 clonedRange = range.cloneRange(); 372 clonedRange.setStart( view.nextSibling, 0 ); 373 selection.setRng( clonedRange ); 374 } 375 } 355 376 356 377 if ( ! view ) { … … 376 397 } 377 398 } else { 378 handleEnter( view, true);399 setViewCursor( true, view ); 379 400 } 380 401 event.preventDefault(); … … 382 403 if ( view.nextSibling ) { 383 404 if ( getView( view.nextSibling ) ) { 384 setViewCursor( false, view.nextSibling );405 setViewCursor( keyCode === VK.RIGHT, view.nextSibling ); 385 406 } else { 386 407 selection.setCursorLocation( view.nextSibling, 0 ); 387 408 } 388 } else {389 handleEnter( view );390 409 } 391 410 event.preventDefault(); … … 393 412 if ( view.previousSibling ) { 394 413 if ( getView( view.previousSibling ) ) { 395 setViewCursor( true, view.previousSibling );414 setViewCursor( keyCode === VK.UP, view.previousSibling ); 396 415 } else { 397 416 selection.select( view.previousSibling, true ); 398 417 selection.collapse(); 399 418 } 400 } else {401 handleEnter( view, true );402 419 } 403 420 event.preventDefault(); … … 410 427 } 411 428 } else { 412 handleEnter(view );429 setViewCursor( false, view ); 413 430 } 414 431 event.preventDefault(); … … 466 483 } 467 484 468 if ( keyCode === VK.LEFT || keyCode === VK.UP) {485 if ( keyCode === VK.LEFT ) { 469 486 setViewCursor( true, view ); 470 487 deselect(); 471 } else if ( keyCode === VK.RIGHT || keyCode === VK.DOWN ) { 488 } else if ( keyCode === VK.UP ) { 489 if ( view.previousSibling ) { 490 if ( getView( view.previousSibling ) ) { 491 setViewCursor( true, view.previousSibling ); 492 } else { 493 selection.select( view.previousSibling, true ); 494 selection.collapse(); 495 } 496 } else { 497 setViewCursor( true, view ); 498 } 499 deselect(); 500 } else if ( keyCode === VK.RIGHT ) { 472 501 setViewCursor( false, view ); 502 deselect(); 503 } else if ( keyCode === VK.DOWN ) { 504 if ( view.nextSibling ) { 505 if ( getView( view.nextSibling ) ) { 506 setViewCursor( false, view.nextSibling ); 507 } else { 508 selection.setCursorLocation( view.nextSibling, 0 ); 509 } 510 } else { 511 setViewCursor( false, view ); 512 } 473 513 deselect(); 474 514 } else if ( keyCode === VK.ENTER ) { … … 512 552 }); 513 553 554 editor.on( 'focus', function() { 555 var view; 556 557 focus = true; 558 editor.dom.addClass( editor.getBody(), 'has-focus' ); 559 560 // Edge case: show the fake caret when the editor is focused for the first time 561 // and the first element is a view. 562 if ( firstFocus && ( view = getView( editor.getBody().firstChild ) ) ) { 563 setViewCursor( true, view ); 564 } 565 566 firstFocus = false; 567 } ); 568 569 editor.on( 'blur', function() { 570 focus = false; 571 editor.dom.removeClass( editor.getBody(), 'has-focus' ); 572 } ); 573 514 574 editor.on( 'nodechange', function( event ) { 515 575 var dom = editor.dom, … … 527 587 dom.removeClass( views, 'wpview-cursor-hide' ); 528 588 529 if ( view ) {589 if ( view && editor.selection.isCollapsed() && focus ) { 530 590 if ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) { 531 591 setViewCursorTries = 0; -
trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
r28994 r29010 242 242 } 243 243 244 . wpview-wrap.wpview-selection-before:before,245 . wpview-wrap.wpview-selection-after:before {244 .has-focus .wpview-wrap.wpview-selection-before:before, 245 .has-focus .wpview-wrap.wpview-selection-after:before { 246 246 content: ''; 247 247 margin: 0; … … 259 259 } 260 260 261 . wpview-wrap.wpview-selection-after:before {261 .has-focus .wpview-wrap.wpview-selection-after:before { 262 262 left: auto; 263 263 right: -3px; 264 264 } 265 265 266 . wpview-wrap.wpview-cursor-hide:before {266 .has-focus .wpview-wrap.wpview-cursor-hide:before { 267 267 opacity: 0; 268 268 } -
trunk/src/wp-includes/version.php
r28932 r29010 19 19 * @global string $tinymce_version 20 20 */ 21 $tinymce_version = '4028-20140 630';21 $tinymce_version = '4028-20140706'; 22 22 23 23 /**
Note: See TracChangeset
for help on using the changeset viewer.