Fix "Rename page" command (#190)
This commit is contained in:
parent
ff8d658a2a
commit
996b518d93
@ -68,6 +68,7 @@ functions:
|
||||
name: "Page: Rename"
|
||||
mac: Cmd-Alt-r
|
||||
key: Ctrl-Alt-r
|
||||
page: ""
|
||||
|
||||
pageComplete:
|
||||
path: "./page.ts:pageComplete"
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user