mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 22:43:11 +02:00
NodeJS Plugin Runtime (#53)
This commit is contained in:
@@ -40,7 +40,7 @@ export type InputProps = Omit<
|
||||
size?: 'xs' | 'sm' | 'md' | 'auto';
|
||||
className?: string;
|
||||
placeholder: string;
|
||||
validate?: (v: string) => boolean;
|
||||
validate?: boolean | ((v: string) => boolean);
|
||||
require?: boolean;
|
||||
wrapLines?: boolean;
|
||||
};
|
||||
@@ -94,9 +94,10 @@ export const Input = forwardRef<EditorView | undefined, InputProps>(function Inp
|
||||
|
||||
const isValid = useMemo(() => {
|
||||
if (require && !validateRequire(currentValue)) return false;
|
||||
if (validate && !validate(currentValue)) return false;
|
||||
if (typeof validate === 'boolean') return validate;
|
||||
if (typeof validate === 'function' && !validate(currentValue)) return false;
|
||||
return true;
|
||||
}, [currentValue, validate, require]);
|
||||
}, [require, currentValue, validate]);
|
||||
|
||||
const handleChange = useCallback(
|
||||
(value: string) => {
|
||||
|
||||
Reference in New Issue
Block a user