diff options
author | sowgro <tpoke.ferrari@gmail.com> | 2025-01-18 19:46:39 -0500 |
---|---|---|
committer | sowgro <tpoke.ferrari@gmail.com> | 2025-01-18 19:46:39 -0500 |
commit | ca57d49aa7bdc17af272e4e92613eeba12f6f419 (patch) | |
tree | 167eca8df9c7a140f69f878b15286e55c8713937 /extension/src/components/BMEditor.tsx | |
parent | 481507ade449b9ed4f0fe1380be81ea1802f2f12 (diff) | |
download | bookmarks-home-main.tar.gz bookmarks-home-main.tar.bz2 bookmarks-home-main.zip |
Diffstat (limited to 'extension/src/components/BMEditor.tsx')
-rw-r--r-- | extension/src/components/BMEditor.tsx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/extension/src/components/BMEditor.tsx b/extension/src/components/BMEditor.tsx index eb84246..d66763e 100644 --- a/extension/src/components/BMEditor.tsx +++ b/extension/src/components/BMEditor.tsx @@ -16,7 +16,15 @@ function BMEditor() { if (!activeEdit) return; }, [activeEdit]); - let isFolder = activeEdit && activeEdit.children && activeEdit.children.length > 0; + function handleTitleChange(e: React.ChangeEvent<HTMLInputElement>) { + getBrowser().bookmarks.update(activeEdit!.id, {title: e.target.value}) + } + + function handleURLChange(e: React.ChangeEvent<HTMLInputElement>) { + getBrowser().bookmarks.update(activeEdit!.id, {url: e.target.value}) + } + + let isFolder = activeEdit && activeEdit.children /*&& activeEdit.children.length > 0;*/ return ( <div id="settings-menu" className={activeEdit ? "open" : "closed"}> <button id="settings-close" onClick={_ => setActiveEdit(null)}> @@ -27,15 +35,11 @@ function BMEditor() { <h1>Edit {isFolder ? "Folder" : "Bookmark"}</h1> <h3>Name</h3> - <input type={"text"} defaultValue={activeEdit?.title} onChange={e => { - getBrowser().bookmarks.update(activeEdit!.id, {title: e.target.value}) - }}/> + <input type={"text"} defaultValue={activeEdit?.title} onBlur={handleTitleChange}/> {!isFolder && (<> <h3>URL</h3> - <input type={"url"} defaultValue={activeEdit?.url} onChange={e => { - getBrowser().bookmarks.update(activeEdit!.id, {url: e.target.value}) - }}/> + <input type={"url"} defaultValue={activeEdit?.url} onBlur={handleURLChange}/> </>)} <h3>Icon</h3> |