fixed that deletion calcel and exit edit mode doesn't reset selection error

This commit is contained in:
joey 2020-03-09 12:52:17 -04:00
parent e1af7c3a33
commit 69beb7ae40

View file

@ -263,8 +263,9 @@ const Logic = {
} }
return identity; return identity;
}); });
},
// reset selected container for deletion async resetSelectedIdentities() {
this._currentSelectedIdentities = []; this._currentSelectedIdentities = [];
}, },
@ -644,7 +645,6 @@ Logic.registerPanel(P_CONTAINERS_LIST, {
function next() { function next() {
const nextElement = selectables[index + 1]; const nextElement = selectables[index + 1];
if (nextElement) { if (nextElement) {
console.log(nextElement);
nextElement.focus(); nextElement.focus();
} }
} }
@ -1022,6 +1022,7 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
// This method is called when the panel is shown. // This method is called when the panel is shown.
prepare() { prepare() {
Logic.resetSelectedIdentities();
const fragment = document.createDocumentFragment(); const fragment = document.createDocumentFragment();
Logic.identities().forEach(identity => { Logic.identities().forEach(identity => {
const tr = document.createElement("tr"); const tr = document.createElement("tr");
@ -1077,7 +1078,6 @@ Logic.registerPanel(P_CONTAINERS_EDIT, {
} }
const panels = document.querySelectorAll(".unstriped .container-panel-row .userContext-wrapper"); const panels = document.querySelectorAll(".unstriped .container-panel-row .userContext-wrapper");
console.log(panels);
if (index === -1) { if (index === -1) {
@ -1279,6 +1279,7 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
// This method is called when the object is registered. // This method is called when the object is registered.
initialize() { initialize() {
Logic.addEnterHandler(document.querySelector("#delete-container-cancel-link"), () => { Logic.addEnterHandler(document.querySelector("#delete-container-cancel-link"), () => {
Logic.resetSelectedIdentities();
Logic.showPreviousPanel(); Logic.showPreviousPanel();
}); });
@ -1300,6 +1301,7 @@ Logic.registerPanel(P_CONTAINER_DELETE, {
await Logic.removeIdentity(Logic.userContextId(currentSelection[i].cookieStoreId)); await Logic.removeIdentity(Logic.userContextId(currentSelection[i].cookieStoreId));
} }
await Logic.refreshIdentities(); await Logic.refreshIdentities();
await Logic.resetSelectedIdentities();
Logic.showPreviousPanel(); Logic.showPreviousPanel();
} catch (e) { } catch (e) {
await Logic.showPanel(P_CONTAINERS_LIST); await Logic.showPanel(P_CONTAINERS_LIST);