From a1b1388ef84a10e39d8c1be657273448165230bd Mon Sep 17 00:00:00 2001 From: Jean-Emmanuel Date: Tue, 10 Nov 2015 15:40:49 +0100 Subject: [PATCH] editor fix: keep active tabs open when editing tabs (reset tab id iterator) --- app/browser/js/app/parser.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/browser/js/app/parser.js b/app/browser/js/app/parser.js index 6ee54d15..0f92611d 100644 --- a/app/browser/js/app/parser.js +++ b/app/browser/js/app/parser.js @@ -2,8 +2,10 @@ __widgets__ = {} __widgetsIds__ = {} -iterator = {} -getIterator = function(type){ +widgetIterator = {} +tabIterator = {} +getIterator = function(type,tab){ + var iterator = tab?tabIterator:widgetIterator if (iterator[type]==undefined) iterator[type] = 0 iterator[type] += 1 return iterator[type] @@ -23,6 +25,8 @@ parsetabs = function(tabs,parent){ if (main) { __widgets__ = {} __widgetsIds__ = {} + + tabIterator = {} session = tabs } @@ -41,7 +45,7 @@ parsetabs = function(tabs,parent){ var label = tabData.label||tabData.id||'Unnamed', hash = hashCode(label), - id = 'tab_'+hash+'_'+getIterator('tab'+hash), + id = 'tab_'+hash+'_'+getIterator('tab'+hash,true), on = i==0?'on':'' tabData.label = label @@ -128,7 +132,7 @@ parsewidgets = function(widgets,parent) { if (__widgets__[widgetData.id]==undefined) { __widgets__[widgetData.id] = [] } - + __widgets__[widgetData.id].push(widgetInner)