mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-21 16:55:25 +03:00
Add 'x' for expanding content warning
This commit is contained in:
parent
9983c8086c
commit
bee32cc781
2 changed files with 22 additions and 1 deletions
|
@ -94,7 +94,13 @@ export default memo(function KeyboardShortcutsHelp() {
|
|||
),
|
||||
},
|
||||
{
|
||||
action: 'Toggle expanded/collapsed thread',
|
||||
action: (
|
||||
<>
|
||||
Expand content warning or
|
||||
<br />
|
||||
toggle expanded/collapsed thread
|
||||
</>
|
||||
),
|
||||
keys: <kbd>x</kbd>,
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1021,6 +1021,20 @@ function Status({
|
|||
enabled: hotkeysEnabled && canBoost,
|
||||
},
|
||||
);
|
||||
const xRef = useHotkeys('x', (e) => {
|
||||
const activeStatus = document.activeElement.closest(
|
||||
'.status-link, .status-focus',
|
||||
);
|
||||
if (activeStatus) {
|
||||
const spoilerButton = activeStatus.querySelector(
|
||||
'button.spoiler:not(.spoiling)',
|
||||
);
|
||||
if (spoilerButton) {
|
||||
e.stopPropagation();
|
||||
spoilerButton.click();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const displayedMediaAttachments = mediaAttachments.slice(
|
||||
0,
|
||||
|
@ -1169,6 +1183,7 @@ function Status({
|
|||
fRef.current = nodeRef;
|
||||
dRef.current = nodeRef;
|
||||
bRef.current = nodeRef;
|
||||
xRef.current = nodeRef;
|
||||
}}
|
||||
tabindex="-1"
|
||||
class={`status ${
|
||||
|
|
Loading…
Reference in a new issue