feat: Introduce a generic inline rename input component for document editing

This commit is contained in:
2025-12-03 12:00:57 +01:00
parent e1dd1990d7
commit e66451afbd
5 changed files with 59 additions and 64 deletions
@@ -1,7 +1,7 @@
import React from 'react';
import { CheckIcon, CloseIcon } from '../../ui/icons';
interface InlineRenameInputProps {
interface InlineRenameInputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'onSubmit' | 'value'> {
value: string;
onChange: (value: string) => void;
onSubmit: () => void;
@@ -21,11 +21,13 @@ const InlineRenameInput: React.FC<InlineRenameInputProps> = ({
canSubmit = true,
inputRef,
className = 'doc-title-edit',
type = 'text',
...props
}) => {
return (
<span className={className}>
<input
type="text"
type={type}
ref={inputRef}
value={value}
onChange={(event) => onChange(event.target.value)}
@@ -45,6 +47,7 @@ const InlineRenameInput: React.FC<InlineRenameInputProps> = ({
onCancel();
}
}}
{...props}
/>
<button
type="button"