(chore) remove outdated code (#1765)
* optimize room typing members hook * remove unused code - WIP * remove old code from initMatrix * remove twemojify function * remove old sanitize util * delete old markdown util * delete Math atom component * uninstall unused dependencies * remove old notification system * decrypt message in inbox notification center and fix refresh in background * improve notification --------- Co-authored-by: Krishan <33421343+kfiven@users.noreply.github.com>
This commit is contained in:
@@ -1,31 +1,5 @@
|
||||
import { openSearch } from '../action/navigation';
|
||||
import navigation from '../state/navigation';
|
||||
import { markAsRead } from '../action/notifications';
|
||||
|
||||
function shouldFocusMessageField(code) {
|
||||
// do not focus on F keys
|
||||
if (/^F\d+$/.test(code)) return false;
|
||||
|
||||
// do not focus on numlock/scroll lock
|
||||
if (
|
||||
code.metaKey
|
||||
|| code.startsWith('OS')
|
||||
|| code.startsWith('Meta')
|
||||
|| code.startsWith('Shift')
|
||||
|| code.startsWith('Alt')
|
||||
|| code.startsWith('Control')
|
||||
|| code.startsWith('Arrow')
|
||||
|| code === 'Tab'
|
||||
|| code === 'Space'
|
||||
|| code === 'Enter'
|
||||
|| code === 'NumLock'
|
||||
|| code === 'ScrollLock'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function listenKeyboard(event) {
|
||||
// Ctrl/Cmd +
|
||||
@@ -36,39 +10,6 @@ function listenKeyboard(event) {
|
||||
if (navigation.isRawModalVisible) return;
|
||||
openSearch();
|
||||
}
|
||||
|
||||
// focus message field on paste
|
||||
if (event.key === 'v') {
|
||||
if (navigation.isRawModalVisible) return;
|
||||
const msgTextarea = document.getElementById('message-textarea');
|
||||
const { activeElement } = document;
|
||||
if (activeElement !== msgTextarea
|
||||
&& ['input', 'textarea'].includes(activeElement.tagName.toLowerCase())
|
||||
) return;
|
||||
msgTextarea?.focus();
|
||||
}
|
||||
}
|
||||
|
||||
if (!event.ctrlKey && !event.altKey && !event.metaKey) {
|
||||
if (navigation.isRawModalVisible) return;
|
||||
|
||||
if (event.key === 'Escape') {
|
||||
if (navigation.selectedRoomId) {
|
||||
markAsRead(navigation.selectedRoomId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (['input', 'textarea'].includes(document.activeElement.tagName.toLowerCase())) {
|
||||
return;
|
||||
}
|
||||
|
||||
// focus the text field on most keypresses
|
||||
if (shouldFocusMessageField(event.code)) {
|
||||
// press any key to focus and type in message field
|
||||
const msgTextarea = document.getElementById('message-textarea');
|
||||
msgTextarea?.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user