1
0

Fix "Rename page" command (#190)

This commit is contained in:
Chris Zarate 2022-12-13 03:49:31 -05:00 committed by GitHub
parent ff8d658a2a
commit 996b518d93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View File

@ -68,6 +68,7 @@ functions:
name: "Page: Rename"
mac: Cmd-Alt-r
key: Ctrl-Alt-r
page: ""
pageComplete:
path: "./page.ts:pageComplete"

View File

@ -90,12 +90,12 @@ export async function deletePage() {
await space.deletePage(pageName);
}
export async function renamePage(targetName?: string) {
console.log("Got a target name", targetName);
export async function renamePage(cmdDef: any) {
console.log("Got a target name", cmdDef.page);
const oldName = await editor.getCurrentPage();
const cursor = await editor.getCursor();
console.log("Old name is", oldName);
const newName = targetName ||
const newName = cmdDef.page ||
await editor.prompt(`Rename ${oldName} to:`, oldName);
if (!newName) {
return;

View File

@ -844,7 +844,7 @@ export class Editor {
console.log("Now renaming page to...", newName);
editor.system.loadedPlugs.get("core")!.invoke(
"renamePage",
[newName],
[{ page: newName }],
).then(() => {
editor.focus();
}).catch(console.error);