WordPress.org

Make WordPress Core

Changeset 32937


Ignore:
Timestamp:
06/25/2015 04:41:34 AM (5 years ago)
Author:
azaozz
Message:

TinyMCE, inline link toolbar:

  • Add max-width for all floating toolbars.
  • Ensure the inline link toolbar doesn't exceed the width on small screen devices.
  • Do not cut/concatenate the URL when it is less than 40 characters long.
  • Show more of the URL if the beginning part plus the ending part are less than 40 characters long.

See #32604.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/css/editor.css

    r32931 r32937  
    175175    -ms-user-select: none;
    176176    user-select: none;
     177    max-width: 98%;
    177178    z-index: 100100; /* Same as the other TinyMCE "panels" */
    178179}
     
    16031604    float: left;
    16041605    margin: 5px;
     1606    max-width: 694px;
     1607    overflow: hidden;
     1608    text-overflow: ellipsis;
    16051609}
    16061610
     
    16171621}
    16181622
     1623@media screen and ( max-width: 782px ) {
     1624    .wp-link-preview {
     1625        max-width: 70%;
     1626        max-width: -webkit-calc(100% - 88px);
     1627        max-width: calc(100% - 88px);
     1628    }
     1629}
     1630
    16191631/* =Overlay Body
    16201632-------------------------------------------------------------- */
  • trunk/src/wp-includes/js/tinymce/plugins/wplink/plugin.js

    r32931 r32937  
    8181                url = url.replace( /(?:index)?\.html$/, '' );
    8282
    83                 if ( ( lastIndex = url.lastIndexOf( '/' ) ) === url.length - 1 ) {
    84                     url = url.slice( 0, lastIndex );
     83                if ( url.charAt( url.length - 1 ) === '/' ) {
     84                    url = url.slice( 0, -1 );
    8585                }
    8686
    87                 if ( ( index = url.indexOf( '/' ) ) !== -1 && ( lastIndex = url.lastIndexOf( '/' ) ) !== -1 && lastIndex !== index ) {
    88                     url = url.slice( 0, index + 1 ) + '\u2026' + url.slice( lastIndex, url.length );
     87                // If the URL is longer that 40 chars, concatenate the beginning (after the domain) and ending with ...
     88                if ( url.length > 40 && ( index = url.indexOf( '/' ) ) !== -1 && ( lastIndex = url.lastIndexOf( '/' ) ) !== -1 && lastIndex !== index ) {
     89                    // If the beginning + ending are shorter that 40 chars, show more of the ending
     90                    if ( index + url.length - lastIndex < 40 ) {
     91                        lastIndex =  -( 40 - ( index + 1 ) );
     92                    }
     93
     94                    url = url.slice( 0, index + 1 ) + '\u2026' + url.slice( lastIndex );
    8995                }
    9096
     
    97103            editor.on( 'wptoolbar', function( event ) {
    98104                var anchor = editor.dom.getParent( event.element, 'a' ),
     105                    $ = editor.$,
    99106                    href;
    100107
    101                 if ( anchor && ( href = editor.$( anchor ).attr( 'href' ) ) ) {
     108                if ( anchor && ! $( anchor ).find( 'img' ).length &&
     109                    ( href = $( anchor ).attr( 'href' ) ) ) {
     110
    102111                    self.setURL( href );
    103 
    104112                    event.element = anchor;
    105113                    event.toolbar = toolbar;
Note: See TracChangeset for help on using the changeset viewer.