Skip to content

Fix security issue editing folder with password, and refactor and the bookmarks file #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions src/components/text-input.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useCallback, useEffect, useRef, useState } from 'react'
import { useCallback, useEffect, useRef, useState, forwardRef } from 'react'

enum TextInputSize {
XS = 'xs',
Expand All @@ -19,31 +19,32 @@ interface TextInputProps {
type?: string
direction?: 'rtl' | 'ltr' | ''
className?: string
ref?: React.RefObject<HTMLInputElement | null>
debounce?: boolean
debounceTime?: number
maxLength?: number
size?: TextInputSize
}

export function TextInput({
onChange,
value,
placeholder,
onFocus,
onKeyDown,
disabled = false,
name,
id,
type = 'text',
direction = '',
className = '',
ref,
debounce = false,
debounceTime = 150,
maxLength = 1000,
size = TextInputSize.MD,
}: TextInputProps) {
export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(function TextInput(
{
onChange,
value,
placeholder,
onFocus,
onKeyDown,
disabled = false,
name,
id,
type = 'text',
direction = '',
className = '',
debounce = false,
debounceTime = 150,
maxLength = 1000,
size = TextInputSize.MD,
},
ref
) {
const sizes: Record<TextInputSize, string> = {
[TextInputSize.XS]: 'input-xs',
[TextInputSize.SM]: 'input-sm',
Expand Down Expand Up @@ -101,4 +102,4 @@ export function TextInput({
autoComplete="off"
/>
)
}
})
Loading