Changeset 11654 for sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/handbook-toc/table-of-contents.php
- Timestamp:
- 03/09/2022 05:50:36 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-helphub/inc/handbook-toc/table-of-contents.php
r11390 r11654 8 8 protected $post_types = array(); 9 9 10 protected $styles = '<style> .toc-jump { text-align: right; font-size: 12px; } .page .toc-heading { margin-top: -50px; padding-top: 50px !important; }</style>'; 10 protected $styles = '<style> 11 .toc-jump { text-align: right; font-size: 12px; } 12 .toc-heading a { 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; } 16 </style>'; 11 17 12 18 /** … … 126 132 127 133 // Replace each level of the headings. 134 $content .= $this->styles . "\n"; 128 135 $content = $this->add_ids_and_jumpto_links( $items, $content ); 129 136 … … 133 140 134 141 $contents_header = 'h' . reset( $items )['level']; // Duplicate the first <h#> tag in the document for the TOC header 135 $toc .= $this->styles;136 142 $toc .= '<div class="table-of-contents">'; 137 143 $toc .= "<$contents_header>" . esc_html( $this->args->header_text ) . "</$contents_header><ul class=\"items\">"; … … 193 199 } 194 200 195 $a11y_text = sprintf( '<span class="screen-reader-text">%s</span>', $title ); 196 $anchor = sprintf( '<a href="#%1$s" class="anchor"><span aria-hidden="true">#</span>%2$s</a>', $id, $a11y_text ); 197 $replacement .= sprintf( '<%1$s id="%2$s" class="%3$s" tabindex="-1" %4$s>%5$s %6$s</%1$s>', $tag, $id, $class, $extra_attrs, $title, $anchor ); 201 $replacement .= sprintf( 202 '<%1$s id="%2$s" class="%3$s" tabindex="-1" %4$s><a href="#%2$s" class="dashicons-before dashicons-admin-links">%5$s</a></%1$s>', 203 $tag, 204 $id, 205 $class, 206 $extra_attrs, 207 $title 208 ); 198 209 $replacements[] = $replacement; 199 210 }
Note: See TracChangeset
for help on using the changeset viewer.