mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-10 05:29:08 +08:00
23 lines
523 B
TypeScript
23 lines
523 B
TypeScript
import { useCallback } from 'react';
|
|
import { useAppState, PageMeta } from '@/providers/app-state-provider';
|
|
|
|
export type ChangePageMeta = (
|
|
pageId: string,
|
|
pageMeta: Partial<PageMeta>
|
|
) => void;
|
|
|
|
export const useChangePageMeta = () => {
|
|
const { currentWorkspace } = useAppState();
|
|
|
|
return useCallback<ChangePageMeta>(
|
|
(pageId, pageMeta) => {
|
|
currentWorkspace?.blocksuiteWorkspace?.setPageMeta(pageId, {
|
|
...pageMeta,
|
|
});
|
|
},
|
|
[currentWorkspace]
|
|
);
|
|
};
|
|
|
|
export default ChangePageMeta;
|