mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01: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>,
|
keys: <kbd>x</kbd>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1021,6 +1021,20 @@ function Status({
|
||||||
enabled: hotkeysEnabled && canBoost,
|
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(
|
const displayedMediaAttachments = mediaAttachments.slice(
|
||||||
0,
|
0,
|
||||||
|
@ -1169,6 +1183,7 @@ function Status({
|
||||||
fRef.current = nodeRef;
|
fRef.current = nodeRef;
|
||||||
dRef.current = nodeRef;
|
dRef.current = nodeRef;
|
||||||
bRef.current = nodeRef;
|
bRef.current = nodeRef;
|
||||||
|
xRef.current = nodeRef;
|
||||||
}}
|
}}
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
class={`status ${
|
class={`status ${
|
||||||
|
|
Loading…
Reference in a new issue