Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1a60bb

Browse filesBrowse files
committed
Display copy button only on hover
1 parent 84c4871 commit d1a60bb
Copy full SHA for d1a60bb

File tree

2 files changed

+20
-19
lines changed
Filter options

2 files changed

+20
-19
lines changed

‎src/Symfony/Component/ErrorHandler/Resources/assets/css/exception.css

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/Resources/assets/css/exception.css
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,8 @@ header .container { display: flex; justify-content: space-between; }
227227
.trace-line a { color: var(--base-6); }
228228
.trace-line .icon { opacity: .4; position: absolute; left: 10px; top: 11px; }
229229
.trace-line .icon svg { fill: var(--base-5); height: 16px; width: 16px; }
230-
.trace-line .icon.icon-copy { left: auto; top: auto; padding-left: 5px; }
230+
.trace-line .icon.icon-copy { left: auto; top: auto; padding-left: 5px; display: none }
231+
.trace-line:hover .icon.icon-copy:not(.hidden) { display: inline-block }
231232
.trace-line-header { padding-left: 36px; padding-right: 10px; }
232233

233234
.trace-file-path, .trace-file-path a { color: var(--base-6); font-size: 13px; }

‎src/Symfony/Component/ErrorHandler/Resources/assets/js/exception.js

Copy file name to clipboardExpand all lines: src/Symfony/Component/ErrorHandler/Resources/assets/js/exception.js
+18-18Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,17 @@ if (typeof Sfjs === 'undefined') {
3030
};
3131
}
3232

33-
if (navigator.clipboard) {
34-
document.querySelectorAll('[data-clipboard-text]').forEach(function(element) {
35-
removeClass(element, 'hidden');
36-
element.addEventListener('click', function() {
37-
navigator.clipboard.writeText(element.getAttribute('data-clipboard-text'));
38-
})
39-
});
40-
}
41-
42-
return {
43-
addEventListener: addEventListener,
33+
if (navigator.clipboard) {
34+
document.querySelectorAll('[data-clipboard-text]').forEach(function(element) {
35+
removeClass(element, 'hidden');
36+
element.addEventListener('click', function() {
37+
navigator.clipboard.writeText(element.getAttribute('data-clipboard-text'));
38+
})
39+
});
40+
}
41+
42+
return {
43+
addEventListener: addEventListener,
4444

4545
createTabs: function() {
4646
var tabGroups = document.querySelectorAll('.sf-tabs:not([data-processed=true])');
@@ -175,13 +175,13 @@ if (typeof Sfjs === 'undefined') {
175175
});
176176
}
177177

178-
/* Prevents from disallowing clicks on "copy to clipboard" elements inside toggles */
179-
var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]')
180-
for (var k = 0; k < copyToClipboardElements.length; k++) {
181-
addEventListener(copyToClipboardElements[k], 'click', function(e) {
182-
e.stopPropagation();
183-
});
184-
}
178+
/* Prevents from disallowing clicks on "copy to clipboard" elements inside toggles */
179+
var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]')
180+
for (var k = 0; k < copyToClipboardElements.length; k++) {
181+
addEventListener(copyToClipboardElements[k], 'click', function(e) {
182+
e.stopPropagation();
183+
});
184+
}
185185

186186
toggles[i].setAttribute('data-processed', 'true');
187187
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.