Allow shifts to open composer in new window

pull/286/head
Lim Chee Aun 2023-11-05 17:41:29 +08:00
rodzic 305710fa8c
commit 678fc100c8
4 zmienionych plików z 12 dodań i 4 usunięć

Wyświetl plik

@ -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 {

Wyświetl plik

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

Wyświetl plik

@ -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(

Wyświetl plik

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