Remember the last plugin tab and jump back to it.

This commit is contained in:
Ryan Blenis 2019-12-11 21:12:39 -05:00
parent 37d3bea8c6
commit c1c08f9400
2 changed files with 7 additions and 2 deletions

View File

@ -97,7 +97,7 @@ module.exports.pluginHandler = function (parent) {
if (!Q(d.tabId)) {
var defaultOn = 'class="on"';
if (Q('p19headers').querySelectorAll("span.on").length) defaultOn = '';
QA('p19headers', '<span ' + defaultOn + ' onclick="return pluginHandler.callPluginPage(\\''+d.tabId+'\\', this);">'+d.tabTitle+'</span>');
QA('p19headers', '<span ' + defaultOn + ' id="p19ph-' + d.tabId + '" onclick="return pluginHandler.callPluginPage(\\''+d.tabId+'\\', this);">'+d.tabTitle+'</span>');
QA('p19pages', '<div id="' + d.tabId + '"></div>');
}
QV('MainDevPlugins', true);
@ -109,6 +109,7 @@ module.exports.pluginHandler = function (parent) {
var tabs = Q('p19headers').querySelectorAll("span");
for (const i of tabs) { i.classList.remove('on'); }
el.classList.add('on');
putstore('_curPluginPage', id);
};
obj.addPluginEx = function() {
meshserver.send({ action: 'addplugin', url: Q('pluginurlinput').value});

View File

@ -4581,7 +4581,11 @@
p13clearConsoleMsg();
// Device refresh plugin handler
if (pluginHandler != null) { pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); }
if (pluginHandler != null) {
pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event);
var lastTab = getstore('_curPluginPage', null);
if (lastTab != null) pluginHandler.callPluginPage(lastTab, Q('p19ph-' + lastTab));
}
}
setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
if (!panel) panel = 10;