visuddhinanda 3 anni fa
parent
commit
465ab83e46
1 ha cambiato i file con 24 aggiunte e 0 eliminazioni
  1. 24 0
      dashboard/src/components/library/article/TermShell.tsx

+ 24 - 0
dashboard/src/components/library/article/TermShell.tsx

@@ -0,0 +1,24 @@
+import { useEffect, useState } from "react";
+import { useAppSelector } from "../../../hooks";
+import { message } from "../../../reducers/command";
+
+import TermCreate, { IWidgetDictCreate } from "../../studio/term/TermCreate";
+
+const Widget = () => {
+  const [termProps, setTermProps] = useState<IWidgetDictCreate>();
+
+  const commandMsg = useAppSelector(message);
+  useEffect(() => {
+    console.log("get command", commandMsg);
+    if (commandMsg?.type === "term") {
+      setTermProps(commandMsg.prop);
+    }
+  }, [commandMsg]);
+  return (
+    <div>
+      <TermCreate type="inline" {...termProps} />
+    </div>
+  );
+};
+
+export default Widget;