Fixed a bunch of bugs around page navigation and renaming

This commit is contained in:
Zef Hemel
2022-08-01 15:06:32 +02:00
parent 339a8a9402
commit ca796b9c95
7 changed files with 45 additions and 16 deletions
+3 -1
View File
@@ -12,6 +12,7 @@ import { set as storeSet } from "@plugos/plugos-syscall/store";
import {
flashNotification,
getCurrentPage,
getCursor,
getText,
matchBefore,
navigate,
@@ -107,6 +108,7 @@ export async function deletePage() {
export async function renamePage() {
const oldName = await getCurrentPage();
const cursor = await getCursor();
console.log("Old name is", oldName);
const newName = await prompt(`Rename ${oldName} to:`, oldName);
if (!newName) {
@@ -125,7 +127,7 @@ export async function renamePage() {
console.log("Writing new page to space");
await writePage(newName, text);
console.log("Navigating to new page");
await navigate(newName);
await navigate(newName, cursor, true);
console.log("Deleting page from space");
await deletePageSyscall(oldName);