chore(react): bring back focus to add_link

This commit is contained in:
Elian Doran
2025-08-04 16:05:04 +03:00
parent c89737ae7b
commit a9c25b4edd
2 changed files with 26 additions and 6 deletions

View File

@@ -1,17 +1,19 @@
import { useRef } from "preact/hooks";
import { t } from "../../services/i18n";
import { use, useEffect } from "react";
import { useEffect } from "react";
import note_autocomplete, { type Suggestion } from "../../services/note_autocomplete";
import type { RefObject } from "preact";
interface NoteAutocompleteProps {
inputRef?: RefObject<HTMLInputElement>;
text?: string;
allowExternalLinks?: boolean;
allowCreatingNotes?: boolean;
onChange?: (suggestion: Suggestion) => void;
}
export default function NoteAutocomplete({ text, allowCreatingNotes, allowExternalLinks, onChange }: NoteAutocompleteProps) {
const ref = useRef<HTMLInputElement>(null);
export default function NoteAutocomplete({ inputRef: _ref, text, allowCreatingNotes, allowExternalLinks, onChange }: NoteAutocompleteProps) {
const ref = _ref ?? useRef<HTMLInputElement>(null);
useEffect(() => {
if (!ref.current) return;