Skip to content

Commit 55a7515

Browse files
committed
Fix dump panel hidden when closing a dump
1 parent e366a98 commit 55a7515

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@
5858
}
5959
};
6060
}
61+
62+
var dumpInfo = document.querySelector('.sf-toolbar-block-dump .sf-toolbar-info');
63+
if (null !== dumpInfo) {
64+
Sfjs.addEventListener(dumpInfo, 'sfbeforedumptoggle', function (event) {
65+
if (!event.detail.expanding) {
66+
dumpInfo.style.minHeight = dumpInfo.getBoundingClientRect().height+'px';
67+
}
68+
});
69+
Sfjs.addEventListener(dumpInfo, 'mouseleave', function () {
70+
dumpInfo.style.minHeight = '';
71+
});
72+
}
6173
},
6274
function(xhr) {
6375
if (xhr.status !== 0) {

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,24 @@ protected function getDumpHeader()
130130
}
131131
132132
function toggle(a, recursive) {
133-
var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass;
133+
var s = a.nextSibling || {}, oldClass = s.className, arrow, newClass, expanding;
134134
135135
if (/\bsf-dump-compact\b/.test(oldClass)) {
136136
arrow = '▼';
137137
newClass = 'sf-dump-expanded';
138+
expanding = true;
138139
} else if (/\bsf-dump-expanded\b/.test(oldClass)) {
139140
arrow = '▶';
140141
newClass = 'sf-dump-compact';
142+
expanding = false;
141143
} else {
142144
return false;
143145
}
146+
147+
s.dispatchEvent(new CustomEvent('sfbeforedumptoggle', {
148+
detail: { expanding: expanding },
149+
bubbles: true
150+
}));
144151
145152
a.lastChild.innerHTML = arrow;
146153
s.className = s.className.replace(/\bsf-dump-(compact|expanded)\b/, newClass);

0 commit comments

Comments
 (0)