mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 18:42:11 +03:00
chore: rename to ref page
This commit is contained in:
parent
c609d40f5a
commit
974239bf9d
@ -2,7 +2,7 @@ import type { KanbanCard } from '@toeverything/components/editor-core';
|
||||
import {
|
||||
RenderBlock,
|
||||
useKanban,
|
||||
useSubPage,
|
||||
useRefPage,
|
||||
} from '@toeverything/components/editor-core';
|
||||
import { styled } from '@toeverything/components/ui';
|
||||
|
||||
@ -62,7 +62,7 @@ export const CardItem = ({
|
||||
block: KanbanCard['block'];
|
||||
}) => {
|
||||
const { addSubItem } = useKanban();
|
||||
const { openSubPage } = useSubPage();
|
||||
const { openSubPage } = useRefPage();
|
||||
const onAddItem = async () => {
|
||||
await addSubItem(block);
|
||||
};
|
||||
|
@ -17,4 +17,4 @@ export * from './utils';
|
||||
|
||||
export * from './editor';
|
||||
|
||||
export { SubPageProvider, useSubPage } from './sub-page';
|
||||
export { RefPageProvider, useRefPage } from './ref-page';
|
||||
|
@ -2,7 +2,7 @@ import { Protocol } from '@toeverything/datasource/db-service';
|
||||
import { AsyncBlock } from '../editor';
|
||||
import { ComponentType, createContext, ReactNode, useContext } from 'react';
|
||||
import { RecastBlock } from './types';
|
||||
import { SubPageProvider } from '../sub-page';
|
||||
import { RefPageProvider } from '../ref-page';
|
||||
|
||||
/**
|
||||
* Determine whether the block supports RecastBlock
|
||||
@ -48,7 +48,7 @@ export const RecastBlockProvider = ({
|
||||
|
||||
return (
|
||||
<RecastBlockContext.Provider value={block}>
|
||||
<SubPageProvider>{children}</SubPageProvider>
|
||||
<RefPageProvider>{children}</RefPageProvider>
|
||||
</RecastBlockContext.Provider>
|
||||
);
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ const Dialog = styled('div')({
|
||||
|
||||
const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {
|
||||
const theme = useTheme();
|
||||
const { closeSubPage } = useSubPage();
|
||||
const { closeSubPage } = useRefPage();
|
||||
|
||||
return createPortal(
|
||||
<MuiBackdrop
|
||||
@ -55,7 +55,7 @@ const SubPageContext = createContext<
|
||||
ReturnType<typeof useState<string | null>> | undefined
|
||||
>(undefined);
|
||||
|
||||
export const SubPageProvider = ({ children }: { children: ReactNode }) => {
|
||||
export const RefPageProvider = ({ children }: { children: ReactNode }) => {
|
||||
const state = useState<string | null>();
|
||||
const [blockId, setBlockId] = state;
|
||||
|
||||
@ -67,7 +67,7 @@ export const SubPageProvider = ({ children }: { children: ReactNode }) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const useSubPage = () => {
|
||||
export const useRefPage = () => {
|
||||
const context = useContext(SubPageContext);
|
||||
if (!context) {
|
||||
throw new Error(
|
1
libs/components/editor-core/src/ref-page/index.ts
Normal file
1
libs/components/editor-core/src/ref-page/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export { useRefPage, RefPageProvider } from './ModalPage';
|
@ -1 +0,0 @@
|
||||
export { useSubPage, SubPageProvider } from './ModalPage';
|
Loading…
Reference in New Issue
Block a user