MCPcopy
hub / github.com/CopyTranslator/CopyTranslator / getKeys

Method getKeys

src/common/action.ts:608–724  ·  view source on GitHub ↗
(optionType: MenuActionType | Category)

Source from the content-addressed store, hash-verified

606 }
607
608 getKeys(optionType: MenuActionType | Category): Array<Identifier> {
609 let contain: Array<Identifier> = [];
610 const keys = Array.from(this.actions.keys());
611 const filterByCate = (cate: Category) => {
612 return (x: Identifier) => this.getAction(x).cate === cate;
613 };
614 switch (optionType) {
615 case "translatorGroups":
616 contain = Array.from(translatorGroups);
617 break;
618 case "allActions":
619 const invalidTypes: ActionInitOpt["actionType"][] = [
620 "prompt",
621 "submenu",
622 "multi_select",
623 "config",
624 "constant",
625 ];
626 const invalidKeys: Identifier[] = [
627 "simpleDebug",
628 "notify",
629 "toast",
630 "selectionQuery",
631 "simulateCopy",
632 "welcome",
633 "doubleCopyTranslate",
634 "restoreMultiDefault",
635 "testTranslate",
636 "reloadCustomTranslators",
637 ];
638 contain = keys.filter((x) => {
639 const action = this.getAction(x);
640 return (
641 (!invalidKeys.includes(x) &&
642 !invalidTypes.includes(action.actionType) &&
643 !action.role) ||
644 x == "minimize"
645 );
646 });
647 break;
648 case "contrastPanel":
649 contain = this.config.get("contrastPanel");
650 break;
651 case "tray":
652 contain = this.config.get("tray");
653 break;
654 case "options":
655 contain = keys.filter((x) => {
656 return (
657 ["submenu", "constant"].includes(this.getAction(x).actionType) &&
658 ![
659 "dragCopyMode",
660 "listenClipboardMode",
661 "sourceLanguage",
662 "targetLanguage",
663 "layoutType",
664 ].includes(x)
665 );

Callers 2

getMenuMethod · 0.80
restoreMultiDefaultMethod · 0.80

Calls 3

getActionMethod · 0.95
keysMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected