|
@@ -62,6 +62,7 @@ export interface IWidgetSentEditInner {
|
|
|
wbwScore?: number;
|
|
wbwScore?: number;
|
|
|
|
|
|
|
|
onTranslationChange?: (data: ISentence) => void;
|
|
onTranslationChange?: (data: ISentence) => void;
|
|
|
|
|
+ onModeChange?: (mode: ArticleMode) => void;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export const SentEditInner = ({
|
|
export const SentEditInner = ({
|
|
@@ -86,6 +87,7 @@ export const SentEditInner = ({
|
|
|
readonly = false,
|
|
readonly = false,
|
|
|
commentaries,
|
|
commentaries,
|
|
|
onTranslationChange,
|
|
onTranslationChange,
|
|
|
|
|
+ onModeChange,
|
|
|
}: IWidgetSentEditInner) => {
|
|
}: IWidgetSentEditInner) => {
|
|
|
const [wbwData, setWbwData] = useState<IWbw[]>();
|
|
const [wbwData, setWbwData] = useState<IWbw[]>();
|
|
|
const [magicDict, setMagicDict] = useState<string>();
|
|
const [magicDict, setMagicDict] = useState<string>();
|
|
@@ -99,6 +101,8 @@ export const SentEditInner = ({
|
|
|
const divRef = useRef<HTMLDivElement>(null);
|
|
const divRef = useRef<HTMLDivElement>(null);
|
|
|
const rootFixed = useSetting("setting.layout.root.fixed");
|
|
const rootFixed = useSetting("setting.layout.root.fixed");
|
|
|
|
|
|
|
|
|
|
+ const currMode = mode ?? articleMode;
|
|
|
|
|
+
|
|
|
// ✅ 从 settings 派生 commentaryLayout,无需 state + effect
|
|
// ✅ 从 settings 派生 commentaryLayout,无需 state + effect
|
|
|
const commentaryLayout = useMemo<string>(() => {
|
|
const commentaryLayout = useMemo<string>(() => {
|
|
|
const layoutCommentary = GetUserSetting(
|
|
const layoutCommentary = GetUserSetting(
|
|
@@ -167,7 +171,7 @@ export const SentEditInner = ({
|
|
|
layout={layout}
|
|
layout={layout}
|
|
|
magicDict={magicDict}
|
|
magicDict={magicDict}
|
|
|
compact={isCompact}
|
|
compact={isCompact}
|
|
|
- mode={articleMode}
|
|
|
|
|
|
|
+ mode={currMode}
|
|
|
wbwProgress={showWbwProgress}
|
|
wbwProgress={showWbwProgress}
|
|
|
readonly={readonly}
|
|
readonly={readonly}
|
|
|
onWbwChange={(data: IWbw[]) => {
|
|
onWbwChange={(data: IWbw[]) => {
|
|
@@ -221,15 +225,18 @@ export const SentEditInner = ({
|
|
|
origin={origin}
|
|
origin={origin}
|
|
|
magicDictLoading={magicDictLoading}
|
|
magicDictLoading={magicDictLoading}
|
|
|
compact={isCompact}
|
|
compact={isCompact}
|
|
|
- mode={articleMode}
|
|
|
|
|
|
|
+ mode={currMode}
|
|
|
onMagicDict={(type: string) => {
|
|
onMagicDict={(type: string) => {
|
|
|
setMagicDict(type);
|
|
setMagicDict(type);
|
|
|
setMagicDictLoading(true);
|
|
setMagicDictLoading(true);
|
|
|
}}
|
|
}}
|
|
|
onCompact={(value: boolean) => setIsCompact(value)}
|
|
onCompact={(value: boolean) => setIsCompact(value)}
|
|
|
- onModeChange={(value: ArticleMode | undefined) =>
|
|
|
|
|
- setArticleMode(value)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ onModeChange={(value: ArticleMode | undefined) => {
|
|
|
|
|
+ if (value) {
|
|
|
|
|
+ setArticleMode(value);
|
|
|
|
|
+ onModeChange?.(value);
|
|
|
|
|
+ }
|
|
|
|
|
+ }}
|
|
|
onAffix={() => setAffix(!affix)}
|
|
onAffix={() => setAffix(!affix)}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|