Skip to content
Snippets Groups Projects
Commit 8be66e5c authored by Arkerthan's avatar Arkerthan
Browse files

add dynamic hotkey display for return link

parent 05c1b503
No related branches found
No related tags found
1 merge request!6912Custom hotkeys
......@@ -17,7 +17,7 @@ App.UI.quickMenu = (function() {
const noHistory = Story.lookup("tags", "no-history").map(passage => passage.title);
// if property name is a passage name, then it's a link, otherwise only text.
// category titles are never links to passages
// category titles are never links to passages
// Only two values are allowed: true or an object following the same rules
const layout = addOtherCategory({
Main: true,
......@@ -284,7 +284,7 @@ App.UI.quickMenu = (function() {
history.shift();
}
});
App.UI.Hotkeys.add("Back in history", {callback: goBack, combinations: ["backspace"]});
App.UI.Hotkeys.add("historyBack", {callback: goBack, combinations: ["backspace"], uiName: "Back in history"});
/**
* Goes back in history if possible.
......@@ -307,7 +307,10 @@ App.UI.quickMenu = (function() {
const a = document.createElement("a");
a.append("Return");
a.onclick = goBack;
div.append(a, " ", App.UI.DOM.makeElement("span", "[backspace]", "hotkey"));
const hotkey = App.UI.Hotkeys.hotkeys("historyBack");
if (hotkey !== "") {
div.append(a, " ", App.UI.DOM.makeElement("span", hotkey, "hotkey"));
}
// insert at second position
linkList.splice(1, 0, div);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment