diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js
index 6cfa96040..3176bda89 100644
--- a/app/javascript/mastodon/components/status.js
+++ b/app/javascript/mastodon/components/status.js
@@ -214,6 +214,22 @@ class Status extends ImmutablePureComponent {
this.props.onOpenVideo(media, startTime);
}
+ handleHotkeyOpenMedia = e => {
+ const { status, onOpenMedia, onOpenVideo } = this.props;
+
+ e.preventDefault();
+
+ if (status.get('media_attachments').size > 0) {
+ if (status.getIn(['media_attachments', 0, 'type']) === 'audio') {
+ // TODO: toggle play/paused?
+ } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
+ onOpenVideo(status.getIn(['media_attachments', 0]), 0);
+ } else {
+ onOpenMedia(status.get('media_attachments'), 0);
+ }
+ }
+ }
+
handleHotkeyReply = e => {
e.preventDefault();
this.props.onReply(this._properStatus(), this.context.router.history);
@@ -293,6 +309,7 @@ class Status extends ImmutablePureComponent {
moveDown: this.handleHotkeyMoveDown,
toggleHidden: this.handleHotkeyToggleHidden,
toggleSensitive: this.handleHotkeyToggleSensitive,
+ openMedia: this.handleHotkeyOpenMedia,
};
if (hidden) {
diff --git a/app/javascript/mastodon/features/keyboard_shortcuts/index.js b/app/javascript/mastodon/features/keyboard_shortcuts/index.js
index 90dc87cbb..666baf621 100644
--- a/app/javascript/mastodon/features/keyboard_shortcuts/index.js
+++ b/app/javascript/mastodon/features/keyboard_shortcuts/index.js
@@ -56,6 +56,10 @@ class KeyboardShortcuts extends ImmutablePureComponent {
enter, o |
|
+
+ e |
+ |
+
x |
|
diff --git a/app/javascript/mastodon/features/status/index.js b/app/javascript/mastodon/features/status/index.js
index 55bd99886..ab468b5e8 100644
--- a/app/javascript/mastodon/features/status/index.js
+++ b/app/javascript/mastodon/features/status/index.js
@@ -281,6 +281,22 @@ class Status extends ImmutablePureComponent {
this.props.dispatch(openModal('VIDEO', { media, time }));
}
+ handleHotkeyOpenMedia = e => {
+ const { status } = this.props;
+
+ e.preventDefault();
+
+ if (status.get('media_attachments').size > 0) {
+ if (status.getIn(['media_attachments', 0, 'type']) === 'audio') {
+ // TODO: toggle play/paused?
+ } else if (status.getIn(['media_attachments', 0, 'type']) === 'video') {
+ this.handleOpenVideo(status.getIn(['media_attachments', 0]), 0);
+ } else {
+ this.handleOpenMedia(status.get('media_attachments'), 0);
+ }
+ }
+ }
+
handleMuteClick = (account) => {
this.props.dispatch(initMuteModal(account));
}
@@ -506,6 +522,7 @@ class Status extends ImmutablePureComponent {
openProfile: this.handleHotkeyOpenProfile,
toggleHidden: this.handleHotkeyToggleHidden,
toggleSensitive: this.handleHotkeyToggleSensitive,
+ openMedia: this.handleHotkeyOpenMedia,
};
return (
diff --git a/app/javascript/mastodon/features/ui/index.js b/app/javascript/mastodon/features/ui/index.js
index b0e38c5cb..957e80737 100644
--- a/app/javascript/mastodon/features/ui/index.js
+++ b/app/javascript/mastodon/features/ui/index.js
@@ -100,6 +100,7 @@ const keyMap = {
goToRequests: 'g r',
toggleHidden: 'x',
toggleSensitive: 'h',
+ openMedia: 'e',
};
class SwitchingColumnsArea extends React.PureComponent {
diff --git a/app/javascript/mastodon/features/video/index.js b/app/javascript/mastodon/features/video/index.js
index 7ca477d35..f6aeb8c9a 100644
--- a/app/javascript/mastodon/features/video/index.js
+++ b/app/javascript/mastodon/features/video/index.js
@@ -467,7 +467,7 @@ class Video extends React.PureComponent {