Browse Source

add setting.layout.root.fixed

visuddhinanda 4 months ago
parent
commit
fc235329e2

+ 1 - 0
dashboard-v4/dashboard/src/components/auth/setting/SettingArticle.tsx

@@ -19,6 +19,7 @@ const SettingArticleWidget = () => {
       <SettingItem data={SettingFind("setting.display.original", settings)} />
       <SettingItem data={SettingFind("setting.layout.direction", settings)} />
       <SettingItem data={SettingFind("setting.layout.commentary", settings)} />
+      <SettingItem data={SettingFind("setting.layout.root.fixed", settings)} />
       <SettingItem data={SettingFind("setting.layout.paragraph", settings)} />
       <SettingItem
         data={SettingFind("setting.pali.script.primary", settings)}

+ 8 - 0
dashboard-v4/dashboard/src/components/auth/setting/default.ts

@@ -278,4 +278,12 @@ export const defaultSetting: ISetting[] = [
     label: "setting.wbw.order.label",
     defaultValue: false,
   },
+  {
+    /**
+     * 是否显示逐词解析输入顺序提示
+     */
+    key: "setting.layout.root.fixed",
+    label: "setting.layout.root.fixed.label",
+    defaultValue: false,
+  },
 ];

+ 4 - 1
dashboard-v4/dashboard/src/components/template/SentEdit.tsx

@@ -19,6 +19,7 @@ import SentCell from "./SentEdit/SentCell";
 import { settingInfo } from "../../reducers/setting";
 import { GetUserSetting } from "../auth/setting/default";
 import { SENTENCE_FIX_WIDTH } from "../../types/article";
+import { useSetting } from "../../hooks/useSetting";
 
 export interface IResNumber {
   translation?: number;
@@ -142,6 +143,8 @@ export const SentEditInner = ({
   const [affix, setAffix] = useState<boolean>(false);
   const settings = useAppSelector(settingInfo);
   const [commentaryLayout, setCommentaryLayout] = useState("column");
+  const rootFixed = useSetting("setting.layout.root.fixed");
+
   useEffect(() => {
     const layoutCommentary = GetUserSetting(
       "setting.layout.commentary",
@@ -239,7 +242,7 @@ export const SentEditInner = ({
       }}
     >
       <div>
-        {affix ? (
+        {affix || rootFixed === true ? (
           <Affix offsetTop={44}>
             <div className="affix">{content}</div>
           </Affix>

+ 1 - 0
dashboard-v4/dashboard/src/locales/en-US/setting/index.ts

@@ -40,6 +40,7 @@ const items = {
   "term.first.show.meaning_others": "Meaning & Others Meaning",
   "term.first.show.meaning": "Meaning Only",
   "setting.layout.commentary.label": "Commentary Layout",
+  "setting.layout.root.fixed.label": "Root Text Fixed",
 };
 
 export default items;

+ 1 - 0
dashboard-v4/dashboard/src/locales/zh-Hans/setting/index.ts

@@ -40,6 +40,7 @@ const items = {
   "term.first.show.meaning_others": "意思其他解释",
   "term.first.show.meaning": "仅意思",
   "setting.layout.commentary.label": "注释排版方向",
+  "setting.layout.root.fixed.label": "根节点固定显示",
 };
 
 export default items;