aboutsummaryrefslogtreecommitdiffstats
path: root/ui/src/components/runbooks/List.tsx
diff options
context:
space:
mode:
authorEllie Huxtable <ellie@atuin.sh>2024-07-25 16:23:56 +0100
committerGitHub <noreply@github.com>2024-07-25 16:23:56 +0100
commit74d084305c50219bcaa9ff474fc2a1727b4e4a69 (patch)
treee0baea3a94c046bd2519707b03f2b609f60d6cf0 /ui/src/components/runbooks/List.tsx
parentfix(gui): double return on mac/linux (#2311) (diff)
downloadatuin-74d084305c50219bcaa9ff474fc2a1727b4e4a69.zip
fix(gui): cursor positioning on new doc creation (#2310)
Diffstat (limited to 'ui/src/components/runbooks/List.tsx')
-rw-r--r--ui/src/components/runbooks/List.tsx7
1 files changed, 7 insertions, 0 deletions
diff --git a/ui/src/components/runbooks/List.tsx b/ui/src/components/runbooks/List.tsx
index 024bcfd1..d4591e6f 100644
--- a/ui/src/components/runbooks/List.tsx
+++ b/ui/src/components/runbooks/List.tsx
@@ -58,6 +58,9 @@ const NoteSidebar = () => {
variant="light"
size="sm"
onPress={async () => {
+ // otherwise the cursor is weirdly positioned in the new document
+ window.getSelection()?.removeAllRanges();
+
let runbook = await Runbook.create();
setCurrentRunbook(runbook.id);
refreshRunbooks();
@@ -105,6 +108,10 @@ const NoteSidebar = () => {
className="text-danger"
onPress={async () => {
await Runbook.delete(runbook.id);
+
+ if (runbook.id == currentRunbook)
+ setCurrentRunbook(null);
+
refreshRunbooks();
}}
>