MCPcopy Create free account
hub / github.com/zxlie/FeHelper / _bindOmniShortcuts

Function _bindOmniShortcuts

apps/json-format/content-script.js:409–443  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407 };
408
409 let _bindOmniShortcuts = () => {
410 if (omniShortcutsBound) {
411 return;
412 }
413 omniShortcutsBound = true;
414
415 document.addEventListener('keydown', event => {
416 if (!_isOmniMode() || event.altKey || event.ctrlKey || event.metaKey || _isEditableShortcutTarget(event.target)) {
417 return;
418 }
419
420 let key = String(event.key || '').toLowerCase();
421 if (key === '/') {
422 event.preventDefault();
423 $('#fhJsonSearchInput').trigger('focus');
424 return;
425 }
426 if (key === 'escape' && window.Formatter && Formatter.clearSelection) {
427 event.preventDefault();
428 Formatter.clearSelection();
429 return;
430 }
431 if (key === '[' && window.Formatter && Formatter.collapseAll) {
432 event.preventDefault();
433 Formatter.collapseAll();
434 _refreshOmniSelectionState();
435 return;
436 }
437 if (key === ']' && window.Formatter && Formatter.expandAll) {
438 event.preventDefault();
439 Formatter.expandAll();
440 _refreshOmniSelectionState();
441 }
442 }, true);
443 };
444
445 let _bindOmniSelectionEvents = () => {
446 if (omniSelectionEventsBound) {

Callers 1

_bindOmniToolbarFunction · 0.85

Calls 5

_isOmniModeFunction · 0.85
$Function · 0.50
addEventListenerMethod · 0.45

Tested by

no test coverage detected