Explorar el Código

add onSearch in TermShow

visuddhinanda hace 2 años
padre
commit
c8aff943ed
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      dashboard/src/components/dict/Dictionary.tsx

+ 5 - 1
dashboard/src/components/dict/Dictionary.tsx

@@ -117,7 +117,11 @@ const DictionaryWidget = ({ word, compact = false, onSearch }: IWidget) => {
                 onIdChange={(value: string) => {
                   const newInput = `type:term id:${value}`;
                   console.debug("term onIdChange setWordInput", newInput);
-                  setWordInput(newInput);
+                  if (typeof onSearch !== "undefined") {
+                    onSearch(newInput);
+                  } else {
+                    setWordInput(newInput);
+                  }
                 }}
               />
             )}