Making WordPress.org


Ignore:
Timestamp:
09/05/2022 05:05:40 AM (4 years ago)
Author:
dufresnesteven
Message:

Handbook: Update Table of Contents control.

See: ​https://github.com/WordPress/wporg-developer/pull/126
Related: r19228

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/table-of-contents.php

    r11911 r12049  
    99
    1010        protected $styles = '<style>
    11                 .toc-jump { text-align: right; font-size: 12px; }
    12                 .toc-heading a:first-of-type { color: inherit; font-weight: inherit; margin-left: -25px; text-decoration: none !important; }
    13                 .toc-heading a:before { visibility: hidden; vertical-align: middle; margin-top: -5px; margin-right: 5px; }
    14                 .toc-heading:target a:before { margin-left: -8px; margin-right: 13px; }
    15                 .toc-heading a:hover:before, .toc-heading a:focus:before { visibility: visible; }
     11                .toc-header {
     12                        display: flex;
     13                        justify-content: space-between;
     14                        margin-top: 48px !important;
     15                }
     16                .toc-jump {
     17                        text-align: right;
     18                        font-size: 0.75em;
     19                        order: 2;
     20                }
     21                .toc-heading a {
     22                        color: inherit;
     23                        font-weight: inherit;
     24                        margin-left: -32px;
     25                        text-decoration: none !important;
     26                }
     27                .toc-heading a:before {
     28                        vertical-align: middle;
     29                        /* icon is 20px wide in a 32px space, so add 12px horizontal margin. */
     30                        margin: -4px 8px 0 4px;
     31                }
     32                @media (max-width: 876px) {
     33                        .toc-heading a {
     34                                margin-left: -20px;
     35                        }
     36                        .toc-heading a:before {
     37                                /* icon is 14px wide in a 20px space, so add 6px horizontal margin. */
     38                                margin: -2px 4px 0 2px;
     39                                width: 14px;
     40                                height: 14px;
     41                                font-size: 14px;
     42                        }
     43                }
    1644        </style>';
    1745
    … …  
    133161                // Replace each level of the headings.
    134162                $content .= $this->styles . "\n";
     163                //var_dump( $this->styles ); // they look fine on sandbox, not missing like they are on local
     164                // so why don't they work?
     165                //wp_die();
     166                //die( 'main handbook .org' );
    135167                $content = $this->add_ids_and_jumpto_links( $items, $content );
    136168
    … …  
    207239                                $title
    208240                        );
    209                         $replacements[] = $replacement;
     241                        $replacements[] = '<header class="toc-header">' . $replacement . '</header>';
    210242                }
    211243
Note: See TracChangeset for help on using the changeset viewer.