From 74d084305c50219bcaa9ff474fc2a1727b4e4a69 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Thu, 25 Jul 2024 16:23:56 +0100 Subject: fix(gui): cursor positioning on new doc creation (#2310) --- ui/src/components/runbooks/List.tsx | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ui') 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(); }} > -- cgit v1.3.1