Browse Source

句子参数改变时发布句子信息

visuddhinanda 2 years ago
parent
commit
401ee87e07
1 changed files with 13 additions and 0 deletions
  1. 13 0
      dashboard/src/components/template/SentEdit/SentContent.tsx

+ 13 - 0
dashboard/src/components/template/SentEdit/SentContent.tsx

@@ -9,6 +9,8 @@ import { mode as _mode } from "../../../reducers/article-mode";
 import { IWbw } from "../Wbw/WbwWord";
 import { ArticleMode } from "../../article/Article";
 import SuggestionFocus from "./SuggestionFocus";
+import store from "../../../store";
+import { push } from "../../../reducers/sentence";
 
 interface ILayoutFlex {
   left: number;
@@ -56,6 +58,16 @@ const SentContentWidget = ({
   const settings = useAppSelector(settingInfo);
   const [divShellWidth, setDivShellWidth] = useState<number>();
 
+  useEffect(() => {
+    store.dispatch(
+      push({
+        id: `${book}-${para}-${wordStart}-${wordEnd}`,
+        origin: origin?.map((item) => item.html),
+        translation: translation?.map((item) => item.html),
+      })
+    );
+  }, [book, origin, para, translation, wordEnd, wordStart]);
+
   useEffect(() => {
     const width = divShell.current?.offsetWidth;
     if (width && width < 550) {
@@ -141,6 +153,7 @@ const SentContentWidget = ({
                 para={para}
                 wordStart={wordStart}
                 wordEnd={wordEnd}
+                studio={item.studio}
                 channelId={item.channel.id}
                 channelType={item.channel.type}
                 channelLang={item.channel.lang}