Make WordPress Core

Changeset 31143


Ignore:
Timestamp:
01/11/2015 08:41:36 PM (12 years ago)
Author:
azaozz
Message:

TinyMCE wpView: when clicking in the editor optimize the caret placement before or after a view. Props avryl, fixes #30938.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpview/plugin.js

    r30986 r31143  
    163163                        editorToolbar = tinymce.$( editor.editorContainer ).find( '.mce-toolbar-grp' )[0],
    164164                        editorToolbarBottom = ( editorToolbar && editorToolbar.getBoundingClientRect().bottom ) || 0;
    165                
     165
    166166                if ( toolbar.length && editor.iframeElement ) {
    167167                        // 48 = 43 for the toolbar + 5 buffer
    … …  
    265265                        setViewCursor( false, view );
    266266                        event.preventDefault();
    267                 } else {
     267                } else if ( x < bodyRect.left || x > bodyRect.right ) {
    268268                        tinymce.each( editor.dom.select( '.wpview-wrap' ), function( view ) {
    269269                                var rect = view.getBoundingClientRect();
     270
     271                                if ( y < rect.top ) {
     272                                        return false;
     273                                }
    270274
    271275                                if ( y >= rect.top && y <= rect.bottom ) {
    … …  
    277281                                                event.preventDefault();
    278282                                        }
    279                                         return;
     283
     284                                        return false;
    280285                                }
    281286                        });
Note: See TracChangeset for help on using the changeset viewer.