Browse Source

add onSearch in TermShow

visuddhinanda 2 năm trước cách đây
mục cha
commit
c8aff943ed

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

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