Remember the last plugin tab and jump back to it.

Ryan Blenis committed Dec 11, 2019 at 21:12 UTC c1c08f940059915f9a556d8ab8c48674298fbbf0
2 files changed +7 -2
pluginHandler.js
+2 -1
@@ -97,7 +97,7 @@ module.exports.pluginHandler = function (parent) {
97 if (!Q(d.tabId)) {
98 var defaultOn = 'class="on"';
99 if (Q('p19headers').querySelectorAll("span.on").length) defaultOn = '';
100 - QA('p19headers', '<span ' + defaultOn + ' onclick="return pluginHandler.callPluginPage(\\''+d.tabId+'\\', this);">'+d.tabTitle+'</span>');
100 + QA('p19headers', '<span ' + defaultOn + ' id="p19ph-' + d.tabId + '" onclick="return pluginHandler.callPluginPage(\\''+d.tabId+'\\', this);">'+d.tabTitle+'</span>');
101 QA('p19pages', '<div id="' + d.tabId + '"></div>');
102 }
103 QV('MainDevPlugins', true);
@@ -109,6 +109,7 @@ module.exports.pluginHandler = function (parent) {
109 var tabs = Q('p19headers').querySelectorAll("span");
110 for (const i of tabs) { i.classList.remove('on'); }
111 el.classList.add('on');
112 + putstore('_curPluginPage', id);
113 };
114 obj.addPluginEx = function() {
115 meshserver.send({ action: 'addplugin', url: Q('pluginurlinput').value});
views/default.handlebars
+5 -1
@@ -4581,7 +4581,11 @@
4581 p13clearConsoleMsg();
4582
4583 // Device refresh plugin handler
4584 - if (pluginHandler != null) { pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event); }
4584 + if (pluginHandler != null) {
4585 + pluginHandler.callHook('onDeviceRefreshEnd', nodeid, panel, refresh, event);
4586 + var lastTab = getstore('_curPluginPage', null);
4587 + if (lastTab != null) pluginHandler.callPluginPage(lastTab, Q('p19ph-' + lastTab));
4588 + }
4589 }
4590 setupDesktop(); // Always refresh the desktop, even if we are on the same device, we need to do some canvas switching.
4591 if (!panel) panel = 10;