mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-18 10:36:22 +08:00
29 lines
647 B
TypeScript
29 lines
647 B
TypeScript
import type { TldrawCommand } from '@toeverything/components/board-types';
|
|
import type { TldrawApp } from '@toeverything/components/board-state';
|
|
|
|
export function renamePage(
|
|
app: TldrawApp,
|
|
pageId: string,
|
|
name: string
|
|
): TldrawCommand {
|
|
const { page } = app;
|
|
|
|
return {
|
|
id: 'rename_page',
|
|
before: {
|
|
document: {
|
|
pages: {
|
|
[pageId]: { name: page.name },
|
|
},
|
|
},
|
|
},
|
|
after: {
|
|
document: {
|
|
pages: {
|
|
[pageId]: { name: name },
|
|
},
|
|
},
|
|
},
|
|
};
|
|
}
|