DEV: Define keyboard shortcuts help onShow, and un-define onClose (#9355)
This is so we don't have a big hash just sitting in the controller definition, it is only created when it is needed. From comment here #9318 (comment)
This commit is contained in:
parent
93c38cc175
commit
7e42963590
|
@ -50,176 +50,188 @@ function buildShortcut(
|
|||
export default Controller.extend(ModalFunctionality, {
|
||||
onShow() {
|
||||
this.set("modal.modalClass", "keyboard-shortcuts-modal");
|
||||
this._defineShortcuts();
|
||||
},
|
||||
|
||||
onClose() {
|
||||
this.set("shortcuts", null);
|
||||
},
|
||||
|
||||
showBookmarkShortcuts: setting("enable_bookmarks_with_reminders"),
|
||||
|
||||
shortcuts: {
|
||||
jump_to: {
|
||||
home: buildShortcut("jump_to.home", { keys1: ["g", "h"] }),
|
||||
latest: buildShortcut("jump_to.latest", { keys1: ["g", "l"] }),
|
||||
new: buildShortcut("jump_to.new", { keys1: ["g", "n"] }),
|
||||
unread: buildShortcut("jump_to.unread", { keys1: ["g", "u"] }),
|
||||
categories: buildShortcut("jump_to.categories", { keys1: ["g", "c"] }),
|
||||
top: buildShortcut("jump_to.top", { keys1: ["g", "t"] }),
|
||||
bookmarks: buildShortcut("jump_to.bookmarks", { keys1: ["g", "b"] }),
|
||||
profile: buildShortcut("jump_to.profile", { keys1: ["g", "p"] }),
|
||||
messages: buildShortcut("jump_to.messages", { keys1: ["g", "m"] }),
|
||||
drafts: buildShortcut("jump_to.drafts", { keys1: ["g", "d"] })
|
||||
},
|
||||
navigation: {
|
||||
back: buildShortcut("navigation.back", { keys1: ["u"] }),
|
||||
jump: buildShortcut("navigation.jump", { keys1: ["#"] }),
|
||||
up_down: buildShortcut("navigation.up_down", {
|
||||
keys1: ["k"],
|
||||
keys2: ["j"],
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
open: buildShortcut("navigation.open", { keys1: ["o"], keys2: [ENTER] }),
|
||||
next_prev: buildShortcut("navigation.next_prev", {
|
||||
keys1: [SHIFT, "j"],
|
||||
keys2: [SHIFT, "k"],
|
||||
keysDelimiter: PLUS,
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
go_to_unread_post: buildShortcut("navigation.go_to_unread_post", {
|
||||
keys1: [SHIFT, "l"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
application: {
|
||||
hamburger_menu: buildShortcut("application.hamburger_menu", {
|
||||
keys1: ["="]
|
||||
}),
|
||||
user_profile_menu: buildShortcut("application.user_profile_menu", {
|
||||
keys1: ["p"]
|
||||
}),
|
||||
create: buildShortcut("application.create", { keys1: ["c"] }),
|
||||
show_incoming_updated_topics: buildShortcut(
|
||||
"application.show_incoming_updated_topics",
|
||||
{ keys1: ["."] }
|
||||
),
|
||||
search: buildShortcut("application.search", {
|
||||
keys1: ["/"],
|
||||
keys2: [CTRL, ALT, "f"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
help: buildShortcut("application.help", { keys1: ["?"] }),
|
||||
dismiss_new_posts: buildShortcut("application.dismiss_new_posts", {
|
||||
keys1: ["x", "r"]
|
||||
}),
|
||||
dismiss_topics: buildShortcut("application.dismiss_topics", {
|
||||
keys1: ["x", "t"]
|
||||
}),
|
||||
log_out: buildShortcut("application.log_out", {
|
||||
keys1: [SHIFT, "z"],
|
||||
keys2: [SHIFT, "z"],
|
||||
keysDelimiter: PLUS,
|
||||
shortcutsDelimiter: "space"
|
||||
})
|
||||
},
|
||||
composing: {
|
||||
return: buildShortcut("composing.return", {
|
||||
keys1: [SHIFT, "c"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
fullscreen: buildShortcut("composing.fullscreen", {
|
||||
keys1: [SHIFT, "F11"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
bookmarks: {
|
||||
enter: buildShortcut("bookmarks.enter", { keys1: [ENTER] }),
|
||||
later_today: buildShortcut("bookmarks.later_today", {
|
||||
keys1: ["l", "t"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
later_this_week: buildShortcut("bookmarks.later_this_week", {
|
||||
keys1: ["l", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
tomorrow: buildShortcut("bookmarks.tomorrow", {
|
||||
keys1: ["n", "d"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_week: buildShortcut("bookmarks.next_week", {
|
||||
keys1: ["n", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_business_week: buildShortcut("bookmarks.next_business_week", {
|
||||
keys1: ["n", "b", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_business_day: buildShortcut("bookmarks.next_business_day", {
|
||||
keys1: ["n", "b", "d"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
custom: buildShortcut("bookmarks.custom", {
|
||||
keys1: ["c", "r"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
none: buildShortcut("bookmarks.none", {
|
||||
keys1: ["n", "r"],
|
||||
shortcutsDelimiter: "space"
|
||||
})
|
||||
},
|
||||
actions: {
|
||||
bookmark_topic: buildShortcut("actions.bookmark_topic", { keys1: ["f"] }),
|
||||
reply_as_new_topic: buildShortcut("actions.reply_as_new_topic", {
|
||||
keys1: ["t"]
|
||||
}),
|
||||
reply_topic: buildShortcut("actions.reply_topic", {
|
||||
keys1: [SHIFT, "r"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
reply_post: buildShortcut("actions.reply_post", { keys1: ["r"] }),
|
||||
quote_post: buildShortcut("actions.quote_post", { keys1: ["q"] }),
|
||||
pin_unpin_topic: buildShortcut("actions.pin_unpin_topic", {
|
||||
keys1: [SHIFT, "p"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
share_topic: buildShortcut("actions.share_topic", {
|
||||
keys1: [SHIFT, "s"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
share_post: buildShortcut("actions.share_post", { keys1: ["s"] }),
|
||||
like: buildShortcut("actions.like", { keys1: ["l"] }),
|
||||
flag: buildShortcut("actions.flag", { keys1: ["!"] }),
|
||||
bookmark: buildShortcut("actions.bookmark", { keys1: ["b"] }),
|
||||
edit: buildShortcut("actions.edit", { keys1: ["e"] }),
|
||||
delete: buildShortcut("actions.delete", { keys1: ["d"] }),
|
||||
mark_muted: buildShortcut("actions.mark_muted", { keys1: ["m", "m"] }),
|
||||
mark_regular: buildShortcut("actions.mark_regular", {
|
||||
keys1: ["m", "r"]
|
||||
}),
|
||||
mark_tracking: buildShortcut("actions.mark_tracking", {
|
||||
keys1: ["m", "t"]
|
||||
}),
|
||||
mark_watching: buildShortcut("actions.mark_watching", {
|
||||
keys1: ["m", "w"]
|
||||
}),
|
||||
print: buildShortcut("actions.print", {
|
||||
keys1: [CTRL, "p"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
defer: buildShortcut("actions.defer", {
|
||||
keys1: [SHIFT, "u"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
topic_admin_actions: buildShortcut("actions.topic_admin_actions", {
|
||||
keys1: [SHIFT, "a"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
search_menu: {
|
||||
prev_next: buildShortcut("search_menu.prev_next", {
|
||||
keys1: ["↑"],
|
||||
keys2: ["↓"],
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
insert_url: buildShortcut("search_menu.insert_url", {
|
||||
keys1: ["a"]
|
||||
})
|
||||
}
|
||||
_defineShortcuts() {
|
||||
this.set("shortcuts", {
|
||||
jump_to: {
|
||||
home: buildShortcut("jump_to.home", { keys1: ["g", "h"] }),
|
||||
latest: buildShortcut("jump_to.latest", { keys1: ["g", "l"] }),
|
||||
new: buildShortcut("jump_to.new", { keys1: ["g", "n"] }),
|
||||
unread: buildShortcut("jump_to.unread", { keys1: ["g", "u"] }),
|
||||
categories: buildShortcut("jump_to.categories", { keys1: ["g", "c"] }),
|
||||
top: buildShortcut("jump_to.top", { keys1: ["g", "t"] }),
|
||||
bookmarks: buildShortcut("jump_to.bookmarks", { keys1: ["g", "b"] }),
|
||||
profile: buildShortcut("jump_to.profile", { keys1: ["g", "p"] }),
|
||||
messages: buildShortcut("jump_to.messages", { keys1: ["g", "m"] }),
|
||||
drafts: buildShortcut("jump_to.drafts", { keys1: ["g", "d"] })
|
||||
},
|
||||
navigation: {
|
||||
back: buildShortcut("navigation.back", { keys1: ["u"] }),
|
||||
jump: buildShortcut("navigation.jump", { keys1: ["#"] }),
|
||||
up_down: buildShortcut("navigation.up_down", {
|
||||
keys1: ["k"],
|
||||
keys2: ["j"],
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
open: buildShortcut("navigation.open", {
|
||||
keys1: ["o"],
|
||||
keys2: [ENTER]
|
||||
}),
|
||||
next_prev: buildShortcut("navigation.next_prev", {
|
||||
keys1: [SHIFT, "j"],
|
||||
keys2: [SHIFT, "k"],
|
||||
keysDelimiter: PLUS,
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
go_to_unread_post: buildShortcut("navigation.go_to_unread_post", {
|
||||
keys1: [SHIFT, "l"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
application: {
|
||||
hamburger_menu: buildShortcut("application.hamburger_menu", {
|
||||
keys1: ["="]
|
||||
}),
|
||||
user_profile_menu: buildShortcut("application.user_profile_menu", {
|
||||
keys1: ["p"]
|
||||
}),
|
||||
create: buildShortcut("application.create", { keys1: ["c"] }),
|
||||
show_incoming_updated_topics: buildShortcut(
|
||||
"application.show_incoming_updated_topics",
|
||||
{ keys1: ["."] }
|
||||
),
|
||||
search: buildShortcut("application.search", {
|
||||
keys1: ["/"],
|
||||
keys2: [CTRL, ALT, "f"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
help: buildShortcut("application.help", { keys1: ["?"] }),
|
||||
dismiss_new_posts: buildShortcut("application.dismiss_new_posts", {
|
||||
keys1: ["x", "r"]
|
||||
}),
|
||||
dismiss_topics: buildShortcut("application.dismiss_topics", {
|
||||
keys1: ["x", "t"]
|
||||
}),
|
||||
log_out: buildShortcut("application.log_out", {
|
||||
keys1: [SHIFT, "z"],
|
||||
keys2: [SHIFT, "z"],
|
||||
keysDelimiter: PLUS,
|
||||
shortcutsDelimiter: "space"
|
||||
})
|
||||
},
|
||||
composing: {
|
||||
return: buildShortcut("composing.return", {
|
||||
keys1: [SHIFT, "c"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
fullscreen: buildShortcut("composing.fullscreen", {
|
||||
keys1: [SHIFT, "F11"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
bookmarks: {
|
||||
enter: buildShortcut("bookmarks.enter", { keys1: [ENTER] }),
|
||||
later_today: buildShortcut("bookmarks.later_today", {
|
||||
keys1: ["l", "t"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
later_this_week: buildShortcut("bookmarks.later_this_week", {
|
||||
keys1: ["l", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
tomorrow: buildShortcut("bookmarks.tomorrow", {
|
||||
keys1: ["n", "d"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_week: buildShortcut("bookmarks.next_week", {
|
||||
keys1: ["n", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_business_week: buildShortcut("bookmarks.next_business_week", {
|
||||
keys1: ["n", "b", "w"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
next_business_day: buildShortcut("bookmarks.next_business_day", {
|
||||
keys1: ["n", "b", "d"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
custom: buildShortcut("bookmarks.custom", {
|
||||
keys1: ["c", "r"],
|
||||
shortcutsDelimiter: "space"
|
||||
}),
|
||||
none: buildShortcut("bookmarks.none", {
|
||||
keys1: ["n", "r"],
|
||||
shortcutsDelimiter: "space"
|
||||
})
|
||||
},
|
||||
actions: {
|
||||
bookmark_topic: buildShortcut("actions.bookmark_topic", {
|
||||
keys1: ["f"]
|
||||
}),
|
||||
reply_as_new_topic: buildShortcut("actions.reply_as_new_topic", {
|
||||
keys1: ["t"]
|
||||
}),
|
||||
reply_topic: buildShortcut("actions.reply_topic", {
|
||||
keys1: [SHIFT, "r"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
reply_post: buildShortcut("actions.reply_post", { keys1: ["r"] }),
|
||||
quote_post: buildShortcut("actions.quote_post", { keys1: ["q"] }),
|
||||
pin_unpin_topic: buildShortcut("actions.pin_unpin_topic", {
|
||||
keys1: [SHIFT, "p"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
share_topic: buildShortcut("actions.share_topic", {
|
||||
keys1: [SHIFT, "s"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
share_post: buildShortcut("actions.share_post", { keys1: ["s"] }),
|
||||
like: buildShortcut("actions.like", { keys1: ["l"] }),
|
||||
flag: buildShortcut("actions.flag", { keys1: ["!"] }),
|
||||
bookmark: buildShortcut("actions.bookmark", { keys1: ["b"] }),
|
||||
edit: buildShortcut("actions.edit", { keys1: ["e"] }),
|
||||
delete: buildShortcut("actions.delete", { keys1: ["d"] }),
|
||||
mark_muted: buildShortcut("actions.mark_muted", { keys1: ["m", "m"] }),
|
||||
mark_regular: buildShortcut("actions.mark_regular", {
|
||||
keys1: ["m", "r"]
|
||||
}),
|
||||
mark_tracking: buildShortcut("actions.mark_tracking", {
|
||||
keys1: ["m", "t"]
|
||||
}),
|
||||
mark_watching: buildShortcut("actions.mark_watching", {
|
||||
keys1: ["m", "w"]
|
||||
}),
|
||||
print: buildShortcut("actions.print", {
|
||||
keys1: [CTRL, "p"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
defer: buildShortcut("actions.defer", {
|
||||
keys1: [SHIFT, "u"],
|
||||
keysDelimiter: PLUS
|
||||
}),
|
||||
topic_admin_actions: buildShortcut("actions.topic_admin_actions", {
|
||||
keys1: [SHIFT, "a"],
|
||||
keysDelimiter: PLUS
|
||||
})
|
||||
},
|
||||
search_menu: {
|
||||
prev_next: buildShortcut("search_menu.prev_next", {
|
||||
keys1: ["↑"],
|
||||
keys2: ["↓"],
|
||||
shortcutsDelimiter: "slash"
|
||||
}),
|
||||
insert_url: buildShortcut("search_menu.insert_url", {
|
||||
keys1: ["a"]
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue