Selaa lähdekoodia

:test_tube: 为了测试增加的onShellClick

visuddhinanda 3 vuotta sitten
vanhempi
sitoutus
9b4470b95c
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 11 1
      dashboard/src/components/template/Wbw/WbwWord.tsx

+ 11 - 1
dashboard/src/components/template/Wbw/WbwWord.tsx

@@ -76,6 +76,7 @@ interface IWidget {
   fields?: IWbwFields;
   onChange?: Function;
   onSplit?: Function;
+  onShellClick?: Function;
 }
 const Widget = ({
   data,
@@ -83,6 +84,7 @@ const Widget = ({
   fields = { meaning: true, factors: true, factorMeaning: true, case: true },
   onChange,
   onSplit,
+  onShellClick,
 }: IWidget) => {
   const [wordData, setWordData] = useState(data);
 
@@ -93,7 +95,15 @@ const Widget = ({
     ? bookMarkColor[wordData.bookMarkColor.value]
     : "unset";
   return (
-    <div className={`wbw_word ${display}`} style={styleWbw}>
+    <div
+      className={`wbw_word ${display}`}
+      style={styleWbw}
+      onClick={() => {
+        if (typeof onShellClick !== "undefined") {
+          onShellClick();
+        }
+      }}
+    >
       <WbwPali
         data={wordData}
         onSave={(e: IWbw) => {