mirror of
https://github.com/mifi/lossless-cut.git
synced 2024-11-21 18:02:35 +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
|
<Select
|
||||||
style={{ height: 20, ...style }}
|
style={{ height: 20, ...style }}
|
||||||
value={effectiveExportMode}
|
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>
|
<option key="disabled" value="" disabled>{t('Export mode')}</option>
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
import { withBlur } from '../util';
|
|
||||||
import useUserSettings from '../hooks/useUserSettings';
|
import useUserSettings from '../hooks/useUserSettings';
|
||||||
import Switch from './Switch';
|
import Switch from './Switch';
|
||||||
|
|
||||||
@ -9,7 +8,7 @@ function MovFastStartButton() {
|
|||||||
const { movFastStart, toggleMovFastStart } = useUserSettings();
|
const { movFastStart, toggleMovFastStart } = useUserSettings();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Switch checked={movFastStart} onCheckedChange={withBlur(toggleMovFastStart)} />
|
<Switch checked={movFastStart} onCheckedChange={toggleMovFastStart} />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
import { withBlur } from '../util';
|
|
||||||
import useUserSettings from '../hooks/useUserSettings';
|
import useUserSettings from '../hooks/useUserSettings';
|
||||||
import Switch from './Switch';
|
import Switch from './Switch';
|
||||||
|
|
||||||
@ -9,7 +8,7 @@ function PreserveMovDataButton() {
|
|||||||
const { preserveMovData, togglePreserveMovData } = useUserSettings();
|
const { preserveMovData, togglePreserveMovData } = useUserSettings();
|
||||||
|
|
||||||
return (
|
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, '_');
|
return name.replaceAll(/[^\w.-]/g, '_');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function withBlur(cb) {
|
// eslint-disable-next-line space-before-function-paren
|
||||||
return (e) => {
|
export function withBlur<T extends { target?: { blur?: () => unknown } | object }>(cb: (a: T) => void) {
|
||||||
|
return (e: T) => {
|
||||||
cb(e);
|
cb(e);
|
||||||
e.target?.blur();
|
if (e.target && 'blur' in e.target) e.target?.blur?.();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user