Allow shifts to open composer in new window

This commit is contained in:
Lim Chee Aun 2023-11-05 17:41:29 +08:00
parent 305710fa8c
commit 678fc100c8
4 changed files with 12 additions and 4 deletions

View file

@ -11,7 +11,6 @@ export default function ComposeButton() {
const newWin = openCompose();
if (!newWin) {
alert('Looks like your browser is blocking popups.');
states.showCompose = true;
}
} else {

View file

@ -607,7 +607,6 @@ function Compose({
});
if (!newWin) {
alert('Looks like your browser is blocking popups.');
return;
}

View file

@ -44,6 +44,7 @@ import htmlContentLength from '../utils/html-content-length';
import isMastodonLinkMaybe from '../utils/isMastodonLinkMaybe';
import localeMatch from '../utils/locale-match';
import niceDateTime from '../utils/nice-date-time';
import openCompose from '../utils/open-compose';
import pmem from '../utils/pmem';
import safeBoundingBoxPadding from '../utils/safe-bounding-box-padding';
import shortenNumber from '../utils/shorten-number';
@ -373,10 +374,17 @@ function Status({
canBoost = true;
}
const replyStatus = () => {
const replyStatus = (e) => {
if (!sameInstance || !authenticated) {
return alert(unauthInteractionErrorMessage);
}
// syntheticEvent comes from MenuItem
if (e?.shiftKey || e?.syntheticEvent?.shiftKey) {
const newWin = openCompose({
replyToStatus: status,
});
if (newWin) return;
}
states.showCompose = {
replyToStatus: status,
};
@ -855,7 +863,7 @@ function Status({
);
const hotkeysEnabled = !readOnly && !previewMode;
const rRef = useHotkeys('r', replyStatus, {
const rRef = useHotkeys('r, shift+r', replyStatus, {
enabled: hotkeysEnabled,
});
const fRef = useHotkeys(

View file

@ -18,6 +18,8 @@ export default function openCompose(opts) {
// }
newWin.__COMPOSE__ = opts;
} else {
alert('Looks like your browser is blocking popups.');
}
return newWin;