mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-04 06:54:28 +00:00
fix(webui): allow item selection when clicking editable text area
This commit is contained in:
@@ -212,9 +212,9 @@ export function FileCard({
|
|||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
'group relative flex cursor-pointer select-none flex-col overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary/50 h-full',
|
'group relative flex cursor-pointer select-none flex-col overflow-hidden rounded-xl border border-border bg-card transition-all hover:border-primary h-full m-1',
|
||||||
isSelected && 'ring-2 ring-primary',
|
isSelected && 'outline-1 outline-primary border-primary',
|
||||||
showDropFeedback && 'border-primary ring-2 ring-primary',
|
showDropFeedback && 'border-primary outline-1 outline-primary',
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<div className="absolute left-2 top-2 z-10">
|
<div className="absolute left-2 top-2 z-10">
|
||||||
|
|||||||
@@ -240,7 +240,7 @@ export function FolderCard({
|
|||||||
d={folderPath}
|
d={folderPath}
|
||||||
vectorEffect="non-scaling-stroke"
|
vectorEffect="non-scaling-stroke"
|
||||||
strokeLinejoin="round"
|
strokeLinejoin="round"
|
||||||
strokeWidth={showDropFeedback ? 3 : 1}
|
strokeWidth={showDropFeedback || isSelected ? 2 : 1}
|
||||||
className={cn(
|
className={cn(
|
||||||
'transition-colors duration-200 fill-none group-hover:stroke-primary stroke-foreground/10',
|
'transition-colors duration-200 fill-none group-hover:stroke-primary stroke-foreground/10',
|
||||||
(isSelected || isChecked || showDropFeedback) && 'stroke-primary',
|
(isSelected || isChecked || showDropFeedback) && 'stroke-primary',
|
||||||
|
|||||||
@@ -5,23 +5,29 @@ import React from 'react'
|
|||||||
export type EditableTextProps = React.ComponentPropsWithoutRef<'input'>
|
export type EditableTextProps = React.ComponentPropsWithoutRef<'input'>
|
||||||
|
|
||||||
const EditableText = React.forwardRef<HTMLInputElement, EditableTextProps>(
|
const EditableText = React.forwardRef<HTMLInputElement, EditableTextProps>(
|
||||||
({ className, onClick, onMouseDown, ...props }, ref) => {
|
({ className, onClick, onMouseDown, disabled, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
|
ref={ref}
|
||||||
|
readOnly={disabled}
|
||||||
|
tabIndex={disabled ? -1 : undefined}
|
||||||
className={cn(
|
className={cn(
|
||||||
'h-auto min-h-0 w-full rounded-sm border px-1 py-0.5 text-base shadow-none transition-all outline-none focus-visible:ring-0',
|
'h-auto min-h-0 w-full rounded-sm border px-1 py-0.5 text-base shadow-none transition-all outline-none focus-visible:ring-0',
|
||||||
!props.disabled
|
!disabled
|
||||||
? 'border-blue-500 bg-muted/10 ring-1 ring-blue-500'
|
? 'border-blue-500 bg-muted/10 ring-1 ring-blue-500'
|
||||||
: 'border-transparent bg-transparent cursor-default opacity-100 disabled:opacity-100 disabled:cursor-default disabled:pointer-events-auto',
|
: 'border-transparent bg-transparent cursor-default opacity-100 focus-visible:border-transparent focus-visible:ring-0 caret-transparent select-none',
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
ref={ref}
|
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation()
|
if (!disabled) {
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
onClick?.(e)
|
onClick?.(e)
|
||||||
}}
|
}}
|
||||||
onMouseDown={(e) => {
|
onMouseDown={(e) => {
|
||||||
e.stopPropagation()
|
if (!disabled) {
|
||||||
|
e.stopPropagation()
|
||||||
|
}
|
||||||
onMouseDown?.(e)
|
onMouseDown?.(e)
|
||||||
}}
|
}}
|
||||||
{...props}
|
{...props}
|
||||||
|
|||||||
Reference in New Issue
Block a user