Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84c4871

Browse files
committed
Append line number to path and replace button with icon
1 parent 15bf3a8 commit 84c4871

File tree

5 files changed

+22
-19
lines changed

5 files changed

+22
-19
lines changed

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
3939
}
4040
4141
if (navigator.clipboard) {
42-
document.querySelectorAll('[data-clipboard-text]').forEach(function(button) {
43-
removeClass(button, 'hidden');
44-
button.addEventListener('click', function() {
45-
navigator.clipboard.writeText(button.getAttribute('data-clipboard-text'));
42+
document.querySelectorAll('[data-clipboard-text]').forEach(function(element) {
43+
removeClass(element, 'hidden');
44+
element.addEventListener('click', function() {
45+
navigator.clipboard.writeText(element.getAttribute('data-clipboard-text'));
4646
})
4747
});
4848
}
@@ -714,10 +714,10 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
714714
});
715715
}
716716
717-
/* Prevents from disallowing clicks on buttons inside toggles */
718-
var copyToClipboardButtons = toggles[i].querySelectorAll('button');
719-
for (var k = 0; k < copyToClipboardButtons.length; k++) {
720-
addEventListener(copyToClipboardButtons[k], 'click', function(e) {
717+
/* Prevents from disallowing clicks on "copy to clipboard" elements inside toggles */
718+
var copyToClipboardElements = toggles[i].querySelectorAll('span[data-clipboard-text]')
719+
for (var k = 0; k < copyToClipboardElements.length; k++) {
720+
addEventListener(copyToClipboardElements[k], 'click', function(e) {
721721
e.stopPropagation();
722722
});
723723
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,8 +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; }
230231
.trace-line-header { padding-left: 36px; padding-right: 10px; }
231-
.trace-line-header button { color: var(--color-error); padding-left: 0; padding-right: 0 }
232232

233233
.trace-file-path, .trace-file-path a { color: var(--base-6); font-size: 13px; }
234234
.trace-class { color: var(--color-error); }
Lines changed: 1 addition & 0 deletions
Loading

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ if (typeof Sfjs === 'undefined') {
3030
};
3131
}
3232

33-
if (navigator.clipboard) {
34-
document.querySelectorAll('[data-clipboard-text]').forEach(function(button) {
35-
removeClass(button, 'hidden');
36-
button.addEventListener('click', function() {
37-
navigator.clipboard.writeText(button.getAttribute('data-clipboard-text'));
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'));
3838
})
3939
});
4040
}
@@ -175,10 +175,10 @@ if (typeof Sfjs === 'undefined') {
175175
});
176176
}
177177

178-
/* Prevents from disallowing clicks on buttons inside toggles */
179-
var copyToClipboardButtons = toggles[i].querySelectorAll('button');
180-
for (var k = 0; k < copyToClipboardButtons.length; k++) {
181-
addEventListener(copyToClipboardButtons[k], 'click', function(e) {
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) {
182182
e.stopPropagation();
183183
});
184184
}

src/Symfony/Component/ErrorHandler/Resources/views/trace.html.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
<span class="trace-method"><?= $trace['function']; ?></span>
2626
<?php } ?>
2727
(line <?= $lineNumber; ?>)
28-
<button class="hidden" data-clipboard-text="<?php echo implode(\DIRECTORY_SEPARATOR, $filePathParts); ?>">Copy path</button>
28+
<span class="icon icon-copy hidden" data-clipboard-text="<?php echo implode(\DIRECTORY_SEPARATOR, $filePathParts).':'.$lineNumber; ?>">
29+
<?php echo $this->include('assets/images/icon-copy.svg'); ?>
30+
</span>
2931
</span>
3032
<?php } ?>
3133
</div>

0 commit comments

Comments
 (0)