소스 검색

add GrammarPopShell

visuddhinanda 2 년 전
부모
커밋
f7af31a52e
2개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      dashboard/src/components/dict/GrammarPop.tsx
  2. 3 0
      dashboard/src/components/template/MdTpl.tsx

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