8000 [Profiler] Fix text selection & click on file links on exception pages by ogizanagi · Pull Request #22968 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Profiler] Fix text selection & click on file links on exception pages #22968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/Symfony/Bundle/TwigBundle/Resources/views/base_js.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@
addEventListener(toggles[i], 'click', function(e) {
e.preventDefault();

if ('' !== window.getSelection().toString()) {
/* Don't do anything on text selection */
return;
}

var toggle = e.target || e.srcElement;

/* needed because when the toggle contains HTML contents, user can click */
Expand Down Expand Up @@ -507,6 +512,14 @@
var altContent = toggle.getAttribute('data-toggle-alt-content');
toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
});

/* Prevents from disallowing clicks on links inside toggles */
var toggleLinks = document.querySelectorAll('.sf-toggle a');
for (var i = 0; i < toggleLinks.length; i++) {
addEventListener(toggleLinks[i], 'click', function(e) {
e.stopPropagation();
});
}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ header .container { display: flex; justify-content: space-between; }
.exception-illustration { flex-basis: 111px; flex-shrink: 0; height: 66px; margin-left: 15px; opacity: .7; }

.trace + .trace { margin-top: 30px; }
.trace-head { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.trace-head .trace-class { color: #222; font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; }
.trace-head .trace-namespace { color: #999; display: block; font-size: 13px; }
.trace-head .icon { position: absolute; right: 0; top: 0; }
Expand Down
8000
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,11 @@
addEventListener(toggles[i], 'click', function(e) {
e.preventDefault();

if ('' !== window.getSelection().toString()) {
/* Don't do anything on text selection */
return;
}

var toggle = e.target || e.srcElement;

/* needed because when the toggle contains HTML contents, user can click */
Expand Down Expand Up @@ -508,6 +513,14 @@
toggle.innerHTML = currentContent !== altContent ? altContent : originalContent;
});
}

/* Prevents from disallowing clicks on links inside toggles */
var toggleLinks = document.querySelectorAll('.sf-toggle a');
for (var i = 0; i < toggleLinks.length; i++) {
addEventListener(toggleLinks[i], 'click', function(e) {
e.stopPropagation();
});
}
}
};
})();
Expand Down
1 change: 0 additions & 1 deletion src/Symfony/Component/Debug/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ public function getStylesheet(FlattenException $exception)
.exception-illustration { flex-basis: 111px; flex-shrink: 0; height: 66px; margin-left: 15px; opacity: .7; }

.trace + .trace { margin-top: 30px; }
.trace-head { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; }
.trace-head .trace-class { color: #222; font-size: 18px; font-weight: bold; line-height: 1.3; margin: 0; position: relative; }

.trace-message { font-size: 14px; font-weight: normal; margin: .5em 0 0; }
Expand Down
0