Skip to content

Commit 2e0b263

Browse files
committed
Fix dump panel hidden when closing a dump
1 parent 4a4f4d2 commit 2e0b263

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

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

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@
5858
}
5959
};
6060
}
61+
62+
var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
63+
if (null !== dumpInfo) {
64+
Sfjs.addEventListener(dumpInfo, 'sfbeforedumpcollapse', function () {
65+
dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
66+
});
67+
Sfjs.addEventListener(dumpInfo, 'mouseleave', function () {
68+
dumpInfo.style.minHeight = '';
69+
});
70+
}
6171
},
6272
function(xhr) {
6373
if (xhr.status !== 0) {

src/Symfony/Component/VarDumper/Dumper/HtmlDumper.php

+7
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ function toggle(a, recursive) {
142142
return false;
143143
}
144144
145+
if (doc.createEvent && s.dispatchEvent) {
146+
var event = doc.createEvent('Event');
147+
event.initEvent('sf-dump-expanded' === newClass ? 'sfbeforedumpexpand' : 'sfbeforedumpcollapse', true, false);
148+
149+
s.dispatchEvent(event);
150+
}
151+
145152
a.lastChild.innerHTML = arrow;
146153
s.className = s.className.replace(/\bsf-dump-(compact|expanded)\b/, newClass);
147154

0 commit comments

Comments
 (0)