mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-16 10:30:44 +01:00
fix(gui): cursor positioning on new doc creation (#2310)
This commit is contained in:
parent
c408465549
commit
74d084305c
@ -58,6 +58,9 @@ const NoteSidebar = () => {
|
|||||||
variant="light"
|
variant="light"
|
||||||
size="sm"
|
size="sm"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
|
// otherwise the cursor is weirdly positioned in the new document
|
||||||
|
window.getSelection()?.removeAllRanges();
|
||||||
|
|
||||||
let runbook = await Runbook.create();
|
let runbook = await Runbook.create();
|
||||||
setCurrentRunbook(runbook.id);
|
setCurrentRunbook(runbook.id);
|
||||||
refreshRunbooks();
|
refreshRunbooks();
|
||||||
@ -105,6 +108,10 @@ const NoteSidebar = () => {
|
|||||||
className="text-danger"
|
className="text-danger"
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
await Runbook.delete(runbook.id);
|
await Runbook.delete(runbook.id);
|
||||||
|
|
||||||
|
if (runbook.id == currentRunbook)
|
||||||
|
setCurrentRunbook(null);
|
||||||
|
|
||||||
refreshRunbooks();
|
refreshRunbooks();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
Loading…
Reference in New Issue
Block a user