diff --git a/www/common/fileObject.js b/www/common/fileObject.js index 57d029b9d..22840cb8c 100644 --- a/www/common/fileObject.js +++ b/www/common/fileObject.js @@ -948,7 +948,6 @@ define([ } } if (unsortedFiles.indexOf(href) === -1 && rootFiles.indexOf(href) === -1 && templateFiles.indexOf(href) === -1 && trashFiles.indexOf(href) === -1) { - console.log('push', href); files[UNSORTED].push(href); } }; diff --git a/www/poll/main.js b/www/poll/main.js index 70c117055..23f93acb7 100644 --- a/www/poll/main.js +++ b/www/poll/main.js @@ -238,22 +238,40 @@ define([ */ notify(); - if (throttle) { - if (APP.throttled) { window.clearTimeout(APP.throttled); } + var getFocus = function () { + var active = document.activeElement; + if (!active) { return; } + return { + el: active, + start: active.selectionStart, + end: active.selectionEnd + }; + }; + var setFocus = function (obj) { + if (obj.el) { obj.el.focus(); } + else { return; } + if (obj.start) { obj.el.selectionStart = obj.start; } + if (obj.end) { obj.el.selectionEnd = obj.end; } + }; + + var updateTable = function () { var displayedObj2 = mergeUncommitted(APP.proxy, APP.uncommitted); + var f = getFocus(); Render.updateTable(table, displayedObj2, conf); updateDisplayedTable(); + setFocus(f); + }; + + if (throttle) { + if (APP.throttled) { window.clearTimeout(APP.throttled); } + updateTable(); APP.throttled = window.setTimeout(function () { updateDisplayedTable(); }, throttle); return; } - window.setTimeout(function () { - var displayedObj2 = mergeUncommitted(APP.proxy, APP.uncommitted); - Render.updateTable(table, displayedObj2, conf); - updateDisplayedTable(); - }); + window.setTimeout(updateTable); }; var getRealtimeId = function (input) {