Make Inspector element available outside of dragscroll contexts

Credit to @Farrow. Update to the javascript cmsPage onInspectorShowing event handler to make it check whether the event target has a dragScroll attached to it (which it previously assumed it did). This allows the inspector to be used in other locations on the backend which are outside of a dragscroll without causing a javascript error.
This commit is contained in:
Farrow 2018-12-01 18:36:40 +00:00 committed by Luke Towers
parent a7bbfe2d9d
commit 52fe8586e3
1 changed files with 6 additions and 1 deletions

View File

@ -386,7 +386,12 @@
}
CmsPage.prototype.onInspectorShowing = function(ev, data) {
$(ev.currentTarget).closest('[data-control="toolbar"]').data('oc.dragScroll').goToElement(ev.currentTarget, data.callback)
var $dragScroll = $(ev.currentTarget).closest('[data-control="toolbar"]').data('oc.dragScroll')
if ($dragScroll) {
$dragScroll.goToElement(ev.currentTarget, data.callback)
} else {
data.callback();
}
ev.stopPropagation()
}