fix(gui): cursor positioning on new doc creation (#2310)

This commit is contained in:
Ellie Huxtable 2024-07-25 16:23:56 +01:00 committed by GitHub
parent c408465549
commit 74d084305c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}}
>