@@ -120,8 +120,8 @@ function ( $row ) {
120
120
*/
121
121
public static function get_max_pre_height (): int {
122
122
/**
123
- * Filter the max height of a pre element before it is collapsed (in
124
- * pixels) with a default of 400 and a minimum of 100 .
123
+ * Filter the max height of a pre element before it is collapsed
124
+ * (in pixels) with a default of 400px and a minimum of 100px .
125
125
*
126
126
* @param int $max_pre_height The max height of a pre element before it is collapsed.
127
127
*/
@@ -224,11 +224,13 @@ public static function output_footer(): void {
224
224
var copyButtons = document.querySelectorAll('.meta-inspector button.copy-button')
225
225
copyButtons.forEach(function(button) {
226
226
button.addEventListener('click', function (event) {
227
- navigator.clipboard.writeText(this.parentNode.innerText);
227
+ var pre = this.parentNode.querySelector('pre');
228
+
229
+ navigator.clipboard.writeText(pre ? pre.innerText : this.parentNode.innerText);
228
230
this.classList.add('copied');
229
231
230
232
var previousLabel = this.getAttribute('aria-label');
231
- this.setAttribute('aria-label', <?php echo wp_json_encode ( esc_attr__ ( 'Copied ' , 'meta-inspector ' ) ); ?> );
233
+ this.setAttribute('aria-label', <?php echo wp_json_encode ( __ ( 'Copied ' , 'meta-inspector ' ) ); ?> );
232
234
233
235
setTimeout(function() {
234
236
button.classList.remove('copied');
@@ -242,7 +244,7 @@ public static function output_footer(): void {
242
244
// Collapse pre elements that are taller than the max height.
243
245
document.querySelectorAll('.meta-inspector pre').forEach(function(pre) {
244
246
var expandLink = pre.parentNode.querySelector('.expand-link');
245
- console.log('pre', jQuery(pre).height(), maxPreHeight);
247
+
246
248
if (pre.clientHeight < maxPreHeight) {
247
249
// Remove the expand link if the pre element is not tall enough.
248
250
if (expandLink) {
0 commit comments