[bug] fix link add state not changing when using keybaord shortcuts

This commit is contained in:
Kuldeep M 2019-07-18 13:43:10 +01:00
parent 848f236d0d
commit 517f0d56ba
5 changed files with 58 additions and 46 deletions

View File

@ -58,7 +58,7 @@ var control = (function() {
element: helper.e(".control-link-add"),
type: "button",
func: function() {
link.add();
link.add.open();
}
}, {
element: helper.e(".control-link-edit"),

View File

@ -11,13 +11,14 @@ var keyboard = (function() {
} else if (state.get().menu) {
menu.close();
shade.close();
pagelock.unlock();
} else if (state.get().autoSuggest) {
autoSuggest.destroy();
} else if (state.get().link.add) {
link.add.close();
shade.close();
} else if (state.get().modal) {
modal.close();
shade.close();
pagelock.unlock();
} else if (state.get().link.edit) {
helper.setObject({
object: state.get(),
@ -43,7 +44,7 @@ var keyboard = (function() {
if (state.get().modal) {
modal.close();
};
link.add();
link.add.open();
};
};
}, false);
@ -65,7 +66,10 @@ var keyboard = (function() {
window.addEventListener("keydown", function(event) {
// ctrl+alt+m
if (event.ctrlKey && event.altKey && event.keyCode == 77) {
if (state.get().modal) {
if (state.get().link.add) {
link.add.close();
shade.close();
} else if (state.get().modal) {
modal.close();
shade.close();
};

View File

@ -727,45 +727,53 @@ var link = (function() {
helper.e(".link-form-text-icon").focus();
};
var add = function() {
mod.add.open();
stagedLink.init();
modal.open({
heading: "Add a new bookmark",
successAction: function() {
stagedLink.data.timeStamp = new Date().getTime();
bookmarks.add(JSON.parse(JSON.stringify(stagedLink.data)));
data.save();
mod.add.close();
render.clear();
render.item.all();
render.item.tabindex();
sortable(".link-area");
control.dependents();
control.render();
stagedLink.reset();
shade.close();
pagelock.unlock();
},
cancelAction: function() {
mod.add.close();
stagedLink.reset();
autoSuggest.destroy();
shade.close();
pagelock.unlock();
},
actionText: "Add",
size: "small",
content: render.form()
});
shade.open({
action: function() {
mod.add.close();
modal.close();
pagelock.unlock();
}
});
pagelock.lock();
var add = {
open: function() {
mod.add.open();
stagedLink.init();
modal.open({
heading: "Add a new bookmark",
successAction: function() {
stagedLink.data.timeStamp = new Date().getTime();
bookmarks.add(JSON.parse(JSON.stringify(stagedLink.data)));
data.save();
mod.add.close();
render.clear();
render.item.all();
render.item.tabindex();
sortable(".link-area");
control.dependents();
control.render();
stagedLink.reset();
shade.close();
pagelock.unlock();
},
cancelAction: function() {
console.log("hit");
mod.add.close();
stagedLink.reset();
autoSuggest.destroy();
shade.close();
pagelock.unlock();
},
actionText: "Add",
size: "small",
content: render.form()
});
shade.open({
action: function() {
mod.add.close();
modal.close();
pagelock.unlock();
}
});
pagelock.lock();
},
close: function() {
mod.add.close();
modal.close();
pagelock.unlock();
}
};
var edit = function() {

View File

@ -1,6 +1,6 @@
var version = (function() {
var current = "3.51.0";
var current = "3.52.0";
var compare = function(a, b) {
var pa = a.split(".");

View File

@ -2,7 +2,7 @@
"name": "nightTab",
"short_name": "nightTab",
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
"version": "3.51.0",
"version": "3.52.0",
"manifest_version": 2,
"chrome_url_overrides": {
"newtab": "index.html"