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(); const newWin = openCompose();
if (!newWin) { if (!newWin) {
alert('Looks like your browser is blocking popups.');
states.showCompose = true; states.showCompose = true;
} }
} else { } else {

View file

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

View file

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

View file

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