Add onLock and onUnlock functions to panel extensions

This commit is contained in:
Ryo Hilmawan 2020-11-23 16:50:03 +07:00 committed by GitHub
parent 4cb0bf6b56
commit b453c41132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -159,7 +159,7 @@ module.exports = {
if (mod.panelJs) { if (mod.panelJs) {
curPanelJs = require(mod.panelJs)(store(mod.id)); curPanelJs = require(mod.panelJs)(store(mod.id));
if (curPanelJs && curPanelJs.onLoad) curPanelJs.onLoad(); if (curPanelJs && curPanelJs.onLoad) curPanelJs.onLoad();
} } else curPanelJs = null;
if (mod.panelFullHeight) { if (mod.panelFullHeight) {
panel.dataset.fullHeight = mod.panelFullHeight; panel.dataset.fullHeight = mod.panelFullHeight;
@ -188,6 +188,10 @@ module.exports = {
} }
hidePanel(); hidePanel();
if (curPanelJs && curPanelJs.onUnlock) {
curPanelJs.onUnlock();
}
} }
function lockPanel() { function lockPanel() {
@ -201,6 +205,10 @@ module.exports = {
// Hover event listeners // Hover event listeners
panel.removeEventListener('mouseover', showPanel); panel.removeEventListener('mouseover', showPanel);
panel.removeEventListener('mouseleave', hidePanel); panel.removeEventListener('mouseleave', hidePanel);
if (curPanelJs && curPanelJs.onLock) {
curPanelJs.onLock();
}
} }
function togglePanel(e) { function togglePanel(e) {
@ -302,10 +310,6 @@ module.exports = {
frame.style.paddingRight = 0; frame.style.paddingRight = 0;
panel.style.right = width + 'px'; panel.style.right = width + 'px';
} }
if (curPanelJs && curPanelJs.onResize) {
curPanelJs.onResize();
}
} }
function enableResize() { function enableResize() {
@ -342,6 +346,10 @@ module.exports = {
if (width < 190) width = 190; if (width < 190) width = 190;
if (width > 480) width = 480; if (width > 480) width = 480;
setPanelWidth(width); setPanelWidth(width);
if (curPanelJs && curPanelJs.onResize) {
curPanelJs.onResize();
}
} }
function stopDrag() { function stopDrag() {