Преглед на файлове

add onSearch in TermShow

visuddhinanda преди 2 години
родител
ревизия
c8aff943ed
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  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);
+                  }
                 }}
               />
             )}