You've already forked bilibili-subtitle
保存下载类型选择
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
import Popover from '../components/Popover'
|
||||
import {Placement} from '@popperjs/core/lib/enums'
|
||||
import {useAppDispatch, useAppSelector} from '../hooks/redux'
|
||||
import {setDownloadType, setEnvData, setPage} from '../redux/envReducer'
|
||||
import {setEnvData, setPage, setTempData} from '../redux/envReducer'
|
||||
import {EventBusContext} from '../Router'
|
||||
import {EVENT_EXPAND, PAGE_SETTINGS} from '../const'
|
||||
import {formatSrtTime, formatTime, formatVttTime} from '../util/util'
|
||||
@@ -62,7 +62,7 @@ const MoreBtn = (props: Props) => {
|
||||
const data = useAppSelector(state => state.env.data)
|
||||
const envReady = useAppSelector(state => state.env.envReady)
|
||||
const envData = useAppSelector(state => state.env.envData)
|
||||
const downloadType = useAppSelector(state => state.env.downloadType)
|
||||
const downloadType = useAppSelector(state => state.env.tempData.downloadType)
|
||||
const [moreVisible, setMoreVisible] = useState(false)
|
||||
const eventBus = useContext(EventBusContext)
|
||||
const segments = useAppSelector(state => state.env.segments)
|
||||
@@ -162,7 +162,9 @@ const MoreBtn = (props: Props) => {
|
||||
}, [])
|
||||
|
||||
const selectCallback = useCallback((e: any) => {
|
||||
dispatch(setDownloadType(e.target.value))
|
||||
dispatch(setTempData({
|
||||
downloadType: e.target.value,
|
||||
}))
|
||||
}, [dispatch])
|
||||
|
||||
const preventCallback = useCallback((e: any) => {
|
||||
|
@@ -24,7 +24,6 @@ interface EnvState {
|
||||
curIdx?: number // 从0开始
|
||||
needScroll?: boolean
|
||||
currentTime?: number
|
||||
downloadType?: string
|
||||
infos?: any[]
|
||||
curInfo?: any
|
||||
curFetched?: boolean
|
||||
@@ -226,9 +225,6 @@ export const slice = createSlice({
|
||||
setNoVideo: (state, action: PayloadAction<boolean>) => {
|
||||
state.noVideo = action.payload
|
||||
},
|
||||
setDownloadType: (state, action: PayloadAction<string>) => {
|
||||
state.downloadType = action.payload
|
||||
},
|
||||
setNeedScroll: (state, action: PayloadAction<boolean>) => {
|
||||
state.needScroll = action.payload
|
||||
},
|
||||
@@ -285,7 +281,6 @@ export const {
|
||||
addTaskId,
|
||||
delTaskId,
|
||||
setTaskIds,
|
||||
setDownloadType,
|
||||
setAutoTranslate,
|
||||
setAutoScroll,
|
||||
setNoVideo,
|
||||
|
1
src/typings.d.ts
vendored
1
src/typings.d.ts
vendored
@@ -27,6 +27,7 @@ interface EnvData {
|
||||
|
||||
interface TempData {
|
||||
curSummaryType: SummaryType
|
||||
downloadType?: string
|
||||
compact?: boolean // 是否紧凑视图
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user