Commit Graph

68 Commits

Author SHA1 Message Date
Abhigyan Khaund a75f0aa594 hotkeys: Add "p" to narrow to next unread PM thread.
This works simimlar to the "n" key for next topics.

This commit does a few things:

    * It wires up the hotkey to an existing function
      that could change narrows.
    * It adds documentation.
    * It adds logic to make sure the compose box does
      not open.

@showell helped a bit with the wording of comments here.

Fixes #4874
2018-02-27 07:20:31 -05:00
Balaji2198 f49d9d016f hotkeys: Add '>' as a hotkey for quote and reply to message.
Tweaked by tabbott to fix a few minor issues.

Fixes #8146.
2018-02-02 17:37:53 -08:00
Brock Whittaker 2252d7e5f6 Revert "dark-mode: Add "T" hotkey for dark mode theme."
This reverts commit ce62abce73.

Fixes #7678.
2017-12-11 15:59:02 -06:00
Brock Whittaker ce62abce73 dark-mode: Add "T" hotkey for dark mode theme. 2017-11-15 16:45:34 -08:00
derAnfaenger 19bc55aa45 Fix various typos.
The typos and their corrections were found with the
aid of https://github.com/lucasdemarchi/codespell.
2017-11-09 16:26:38 +01:00
Steve Howell 6304aea4bc node tests: Use zrequire in hotkey.js. 2017-11-08 12:24:17 -08:00
Cynthia Lin f63585bd6d hotkeys: Ensure navigation hotkeys do not work while overlay is open.
Fixes #7123.
2017-11-03 15:38:10 -07:00
Harshit Bansal 48ac282667 hotkeys: Remap ':' to close the reactions popover in case of empty search.
Fixes: #6806.
2017-10-05 19:05:27 +05:30
Cynthia Lin c87ecf0f63 hotkeys: Prevent drafts overlay from showing while lightbox is open.
Fixes #6757.
2017-10-03 08:36:54 -07:00
Harshit Bansal ef4337edcb hotkey: Remap `+` key to use canonical name for thumbs up emoji. 2017-09-26 16:50:00 -07:00
Joshua Pan 178f5080cf hotkey.js: Switch 'q' and 'w' hotkeys.
On a standard keyboard, 'q' is to the left of 'w', so it makes sense
for the hotkeys for the left and right sidebars to be `q` and `w`,
respectively, not the other way around.
2017-09-25 12:14:07 -07:00
Joshua Pan b201e2c311 hotkey.js: Simplify ctrl+[ hotkey logic. 2017-09-19 19:07:30 -07:00
Joshua Pan d387291b6c reactions.js: Extract open_reactions_popover().
Added tests for open_reactions_popover() also.
2017-09-19 19:07:30 -07:00
Cynthia Lin bd7d9da668 hotkeys: Disable 'n' stream creation if user cannot create streams.
Tweaked by tabbott to handle a corner case and add test coverage.
2017-09-16 09:12:38 -07:00
Joshua Pan 42b05912f8 hotkeys: Make '?' hotkey toggle. 2017-09-14 05:56:55 -07:00
Steve Howell 29c05c82f0 Fix A/D hotkeys for cycling through stream narrows.
We now use similar code for A/D hotkeys as we do for the "n"
key.

The old code was using jQuery operations that got tripped up
by our splitters between active and inactive streams.

Fixes #4569
2017-08-16 15:45:47 -07:00
Jack Zhang c69b5d7d65 hotkey: Add support for hotspots on enter. 2017-08-05 18:32:37 -07:00
Joshua Pan ac64ee355d compose_actions.js: Allow compose to empty narrow.
This allows r/enter hotkeys to compose to
an empty narrow (no messages).

Fixes #4500.
2017-06-27 14:06:59 -04:00
Cynthia Lin e832ebdc98 hotkeys: Add collapse/show message hotkey.
Fixes #4540
2017-06-21 15:54:09 -04:00
Cynthia Lin a9afe43735 hotkeys: Add `u` hotkey for opening message sender profile.
Fixes #4873
2017-06-21 10:38:05 -04:00
Steve Howell d2b710b307 Add maybe_show_keyboard_shortcuts().
This prevents some strange UI experiences and some blueslip
errors by not opening keyboard help when other overlays or
popovers are open.
2017-06-15 10:15:29 -04:00
Steve Howell ecbbc8788a Move code from reactions -> emoji_picker.
This moves all the code dealing with emoji_picker
navigation and click/enter events to emoji_picker.js.

Some of the code still delegates back to reactions.js
in some way.

The navigate() code really does nothing reaction-specific,
nor does filter_emojis(), nor do some of their helpers.

This was mostly moving code, but I also did some
s/reaction// or s/reaction/emoji/ in names.
2017-05-29 17:10:05 -06:00
Steve Howell ed2ceb49cb Use toggle_emoji_reaction for "+" hotkey.
This is a more direct codepath when we know which emoji
we want to toggle.
2017-05-29 17:10:05 -06:00
Rohitt Vashishtha 2d73e03e37 ui-refactor: Rename modals.js to overlays.js.
Fixed #4702.
2017-05-29 11:24:46 -07:00
Cynthia Lin 2045426ab9 hotkeys: Change subscribe stream hotkey to `S`. 2017-05-24 12:19:15 -07:00
Tim Abbott df5a0e7c92 hotkeys: Simplify logic for checking for subscriptions page. 2017-05-15 20:28:56 -07:00
Steve Howell f60a829b4d Remove lightbox.is_open property.
Outside of lightbox.js, we now use modals.lightbox_open() to
detect that the lightbox modal is open.
2017-05-10 09:46:21 -07:00
Steve Howell 5c52495b64 Use modals.settings_open().
We now uses modals.settings_open() to check for the settings
modal being open, rather than doing a regex check on
windows.location.hash.
2017-05-09 18:44:08 -07:00
Mahim Goyal 49fec57768 Add hotkey for narrowing to next unread topic.
Fixes: #4199.
2017-05-09 10:02:54 -07:00
Steve Howell 70d4ac93ce Add modals.info_overlay_open().
This also removes ui_state.js, since its last function
is now replaced by modals.info_overlay_open().
2017-05-09 09:19:27 -07:00
Steve Howell 742c55f514 Speed up key handling by adding modals.is_active().
The function modals.is_active() can see if modals are open
without having to look at the DOM.  This should make it snappier
to type in the compose box.  Even if the speedup is pretty minor,
not having to worry about jQuery slowness should make it easier
to diagnose future compose box issues.

The new function gets used in other places, too, where performance
isn't so much an issue.
2017-05-08 22:04:56 -07:00
Brock Whittaker 2ae23054ee informational-overlays: Focus overlay body on shortcut "?".
This focuses the body content of the informational overlay after
going to it from "?" so that you can use up and down arrows to then
scroll the content easily.

Fixes: #4480.
2017-05-05 09:53:58 -07:00
Jack Zhang df817f12f4 emoji: Rename reaction-popover to emoji-popover.
The name emoji-popover should now be more appropiate, as there's no more
need to distinguish between reacting to messages and composing messages.
2017-04-30 15:15:33 -07:00
Jack Zhang f8b3ce7d15 emoji: Move all emoji picker logic/events into emoji_picker module.
Added emoji_picker.js to static asset pipeline.
2017-04-30 14:13:36 -07:00
Joshua Pan 4fb450d4a9 hotkey.js: Add reactions popover navigation.
Fixes #4197.
2017-04-18 23:25:45 -07:00
Steve Howell 5ba79f9c3a refactor: Move respond/reply methods to compose_actions.js.
This moves respond_to_mention() and reply_with_mention() to
compose_actions.js.  These methods are basically thin layers
on top of compose_actions.start().
2017-04-14 13:09:19 -07:00
Tim Abbott bfe512335b hotkey: Clean up state more consistently in node tests. 2017-04-05 11:59:48 -07:00
Steve Howell e2a21303eb hotkeys: Simplify up/down handling for stream settings.
We've had this kind of hacky setting called message_view_only for
a long time in the hotkeys code, and it originally helped optimize
the code a bit.  It wasn't well maintained, and people started
adding non-message-view behavior to the arrow keys without flipping
that flag to false.  This change finally flips the flag to false,
which simplifies some of our logic.
2017-04-05 11:53:52 -07:00
Steve Howell 4a3211d6af hotkeys: Clean up dispatching of drafts hotkeys.
We now explicitly return true from process_hotkey() when we
handle up/down/backspace for the drafts modal.  Also, we no longer
call preventDefault() from drafts.draft_handle_events(), since the
caller does that, and we no longer return `true`, since we were
never inspecting the return value anyway.
2017-04-05 11:53:52 -07:00
Steve Howell 2ef9957cbc hotkeys: Handle up/down arrows in settings page.
The up/down arrows now navigate the left pane of the settings menu.
The code here was originally implemented as part of our settings
redesign, but the code was added in a place that became unreachable
after we fixed a bug with home_tab_obscured().  This commit
resurrects the code and places the guts of it in settings.js.  It
is possible that we want to clean this code up eventually to deal
better with hidden blocks.
2017-04-05 11:53:52 -07:00
Steve Howell 4bbd73a9a2 Extract list_util.js for navigating lists.
The code here used to live in hotkey.js.  Its complicated calling
protocol made it difficult to unit test.  We are also trying to
slim down hotkey.js.

Our arrow navigation for things like `#stream_filters` has always
been kind of awkward, since it's difficult to get the focus to
their list items.  This commit does nothing to fix that yet.
2017-04-05 11:53:52 -07:00
Jonathan Pan 5556d2341c hotkey.js: Add hotkey for drafts.
* 'd' in message view opens drafts.

This also adds hotkeys within the drafts UI:
* Up/down arrow keys navigate the drafts.
* Pressing enter edits the selected draft.
* Pressing backspace deletes the selected draft.

Some variable names tweaked by tabbott.
2017-03-27 14:05:00 -07:00
Cynthia Lin 6e2d180a34 hotkeys: Add hotkey `n` for opening New streams modal in Streams menu. 2017-03-25 18:35:21 -07:00
Cynthia Lin ca460fad1f hotkeys: Add hotkey `V` for viewing selected stream in Streams menu. 2017-03-25 18:35:21 -07:00
Cynthia Lin b800cb05c0 hotkeys: Add left/right arrow keys to toggle views in Streams menu.
Fixes #4228
2017-03-25 18:35:21 -07:00
Cynthia Lin 69c32daffa hotkeys: Add `U` hotkey for unsubscribing/subscribing in Streams menu.
Fixes #4229
2017-03-25 18:35:21 -07:00
Cynthia Lin d17131dcb4 hotkeys: Rename subs.arrow_keys() to subs.switch_rows(). 2017-03-25 18:35:21 -07:00
Joshua Pan 7adf70e5ad Add node tests for M hotkey. 2017-03-25 09:42:49 -07:00
Tim Abbott 49f5be1dba hotkey: Extend tests for message_view_only_keys. 2017-03-23 11:38:37 -07:00
Joshua Pan f40b43a491 hotkeys: Add hotkey `G` an alias for End.
Fixes #4195.
2017-03-23 11:38:36 -07:00