mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-22 02:12:30 +01:00
fix withBlur types
This commit is contained in:
parent
2378ca35b0
commit
3bba13ad42
@ -54,7 +54,7 @@ function ExportModeButton({ selectedSegments, style }: { selectedSegments: unkno
|
||||
<Select
|
||||
style={{ height: 20, ...style }}
|
||||
value={effectiveExportMode}
|
||||
onChange={withBlur((e) => onChange(e.target.value))}
|
||||
onChange={withBlur((e) => onChange(e.target.value as ExportMode))}
|
||||
>
|
||||
<option key="disabled" value="" disabled>{t('Export mode')}</option>
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
import { withBlur } from '../util';
|
||||
import useUserSettings from '../hooks/useUserSettings';
|
||||
import Switch from './Switch';
|
||||
|
||||
@ -9,7 +8,7 @@ function MovFastStartButton() {
|
||||
const { movFastStart, toggleMovFastStart } = useUserSettings();
|
||||
|
||||
return (
|
||||
<Switch checked={movFastStart} onCheckedChange={withBlur(toggleMovFastStart)} />
|
||||
<Switch checked={movFastStart} onCheckedChange={toggleMovFastStart} />
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { memo } from 'react';
|
||||
|
||||
import { withBlur } from '../util';
|
||||
import useUserSettings from '../hooks/useUserSettings';
|
||||
import Switch from './Switch';
|
||||
|
||||
@ -9,7 +8,7 @@ function PreserveMovDataButton() {
|
||||
const { preserveMovData, togglePreserveMovData } = useUserSettings();
|
||||
|
||||
return (
|
||||
<Switch checked={preserveMovData} onCheckedChange={withBlur(togglePreserveMovData)} />
|
||||
<Switch checked={preserveMovData} onCheckedChange={togglePreserveMovData} />
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -165,10 +165,11 @@ export function filenamify(name: string) {
|
||||
return name.replaceAll(/[^\w.-]/g, '_');
|
||||
}
|
||||
|
||||
export function withBlur(cb) {
|
||||
return (e) => {
|
||||
// eslint-disable-next-line space-before-function-paren
|
||||
export function withBlur<T extends { target?: { blur?: () => unknown } | object }>(cb: (a: T) => void) {
|
||||
return (e: T) => {
|
||||
cb(e);
|
||||
e.target?.blur();
|
||||
if (e.target && 'blur' in e.target) e.target?.blur?.();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user