Apply more useKey: true

pull/1135/head
Lim Chee Aun 2025-05-03 09:36:00 +08:00
rodzic c619a7c6b3
commit 17c2390a5c
8 zmienionych plików z 231 dodań i 213 usunięć

Wyświetl plik

@ -519,6 +519,7 @@ function Compose({
{ {
enabled: !supportsCloseWatcher, enabled: !supportsCloseWatcher,
enableOnFormTags: true, enableOnFormTags: true,
useKey: true,
}, },
); );
useHotkeys( useHotkeys(
@ -541,6 +542,7 @@ function Compose({
modals.length === 1 && modals[0].querySelector('#compose-container'); modals.length === 1 && modals[0].querySelector('#compose-container');
return hasModal && !hasOnlyComposer; return hasModal && !hasOnlyComposer;
}, },
useKey: true,
}, },
); );
useCloseWatcher(() => { useCloseWatcher(() => {
@ -3141,6 +3143,7 @@ function MentionModal({
{ {
preventDefault: true, preventDefault: true,
enableOnFormTags: ['input'], enableOnFormTags: ['input'],
useKey: true,
}, },
); );
@ -3167,6 +3170,7 @@ function MentionModal({
{ {
preventDefault: true, preventDefault: true,
enableOnFormTags: ['input'], enableOnFormTags: ['input'],
useKey: true,
}, },
); );
@ -3192,6 +3196,7 @@ function MentionModal({
{ {
preventDefault: true, preventDefault: true,
enableOnFormTags: ['input'], enableOnFormTags: ['input'],
useKey: true,
}, },
); );

Wyświetl plik

@ -88,6 +88,7 @@ function MediaModal({
const hasModal = !!document.querySelector('#modal-container > *'); const hasModal = !!document.querySelector('#modal-container > *');
return hasModal; return hasModal;
}, },
useKey: true,
}, },
[onClose], [onClose],
); );

Wyświetl plik

@ -43,6 +43,7 @@ function Modal({ children, onClose, onClick, class: className, minimized }) {
// This will run "later" to prevent clash with esc handlers from other components // This will run "later" to prevent clash with esc handlers from other components
keydown: false, keydown: false,
keyup: true, keyup: true,
useKey: true,
}, },
[onClose], [onClose],
); );

Wyświetl plik

@ -45,6 +45,7 @@ export default memo(function SearchCommand({ onClose = () => {} }) {
enabled: showSearch, enabled: showSearch,
enableOnFormTags: true, enableOnFormTags: true,
preventDefault: true, preventDefault: true,
useKey: true,
}, },
); );

Wyświetl plik

@ -262,7 +262,9 @@ function Timeline({
behavior: 'smooth', behavior: 'smooth',
}); });
}, [loadItems, showNewPostsIndicator]); }, [loadItems, showNewPostsIndicator]);
const dotRef = useHotkeys('.', handleLoadNewPosts); const dotRef = useHotkeys('.', handleLoadNewPosts, {
useKey: true,
});
// const { // const {
// scrollDirection, // scrollDirection,

418
src/locales/en.po wygenerowano

Plik diff jest za duży Load Diff

Wyświetl plik

@ -808,6 +808,7 @@ function Catchup() {
preventDefault: true, preventDefault: true,
ignoreModifiers: true, ignoreModifiers: true,
enableOnFormTags: ['input'], enableOnFormTags: ['input'],
useKey: true,
}, },
); );

Wyświetl plik

@ -644,12 +644,19 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
const hasModal = !!document.querySelector('#modal-container > *'); const hasModal = !!document.querySelector('#modal-container > *');
return hasModal; return hasModal;
}, },
useKey: true,
}, },
); );
// For backspace, will always close both media and status page // For backspace, will always close both media and status page
useHotkeys('backspace', () => { useHotkeys(
'backspace',
() => {
location.hash = closeLink; location.hash = closeLink;
}); },
{
useKey: true,
},
);
useHotkeys( useHotkeys(
'j', 'j',