Sfoglia il codice sorgente

add GrammarPopShell

visuddhinanda 2 anni fa
parent
commit
f7af31a52e

+ 12 - 0
dashboard/src/components/dict/GrammarPop.tsx

@@ -50,4 +50,16 @@ const GrammarPopWidget = ({ text, gid }: IWidget) => {
   );
 };
 
+interface IWidgetShell {
+  props: string;
+}
+export const GrammarPopShell = ({ props }: IWidgetShell) => {
+  const prop = JSON.parse(atob(props)) as IWidget;
+  return (
+    <>
+      <GrammarPopWidget {...prop} />
+    </>
+  );
+};
+
 export default GrammarPopWidget;

+ 3 - 0
dashboard/src/components/template/MdTpl.tsx

@@ -1,3 +1,4 @@
+import GrammarPop, { GrammarPopShell } from "../dict/GrammarPop";
 import Article from "./Article";
 import Exercise from "./Exercise";
 import Mermaid from "./Mermaid";
@@ -45,6 +46,8 @@ const Widget = ({ tpl, props, children }: IWidgetMdTpl) => {
       return <ParaHandle props={props ? props : ""} />;
     case "mermaid":
       return <Mermaid props={props ? props : ""} />;
+    case "grammar-pop":
+      return <GrammarPopShell props={props ? props : ""} />;
     default:
       return <>未定义模版({tpl})</>;
   }