mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
chore: rename to ref page
This commit is contained in:
@@ -2,7 +2,7 @@ import type { KanbanCard } from '@toeverything/components/editor-core';
|
|||||||
import {
|
import {
|
||||||
RenderBlock,
|
RenderBlock,
|
||||||
useKanban,
|
useKanban,
|
||||||
useSubPage,
|
useRefPage,
|
||||||
} from '@toeverything/components/editor-core';
|
} from '@toeverything/components/editor-core';
|
||||||
import { styled } from '@toeverything/components/ui';
|
import { styled } from '@toeverything/components/ui';
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ export const CardItem = ({
|
|||||||
block: KanbanCard['block'];
|
block: KanbanCard['block'];
|
||||||
}) => {
|
}) => {
|
||||||
const { addSubItem } = useKanban();
|
const { addSubItem } = useKanban();
|
||||||
const { openSubPage } = useSubPage();
|
const { openSubPage } = useRefPage();
|
||||||
const onAddItem = async () => {
|
const onAddItem = async () => {
|
||||||
await addSubItem(block);
|
await addSubItem(block);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,4 +17,4 @@ export * from './utils';
|
|||||||
|
|
||||||
export * from './editor';
|
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 { AsyncBlock } from '../editor';
|
||||||
import { ComponentType, createContext, ReactNode, useContext } from 'react';
|
import { ComponentType, createContext, ReactNode, useContext } from 'react';
|
||||||
import { RecastBlock } from './types';
|
import { RecastBlock } from './types';
|
||||||
import { SubPageProvider } from '../sub-page';
|
import { RefPageProvider } from '../ref-page';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine whether the block supports RecastBlock
|
* Determine whether the block supports RecastBlock
|
||||||
@@ -48,7 +48,7 @@ export const RecastBlockProvider = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<RecastBlockContext.Provider value={block}>
|
<RecastBlockContext.Provider value={block}>
|
||||||
<SubPageProvider>{children}</SubPageProvider>
|
<RefPageProvider>{children}</RefPageProvider>
|
||||||
</RecastBlockContext.Provider>
|
</RecastBlockContext.Provider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const Dialog = styled('div')({
|
|||||||
|
|
||||||
const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {
|
const Modal = ({ open, children }: { open: boolean; children?: ReactNode }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { closeSubPage } = useSubPage();
|
const { closeSubPage } = useRefPage();
|
||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<MuiBackdrop
|
<MuiBackdrop
|
||||||
@@ -55,7 +55,7 @@ const SubPageContext = createContext<
|
|||||||
ReturnType<typeof useState<string | null>> | undefined
|
ReturnType<typeof useState<string | null>> | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
|
|
||||||
export const SubPageProvider = ({ children }: { children: ReactNode }) => {
|
export const RefPageProvider = ({ children }: { children: ReactNode }) => {
|
||||||
const state = useState<string | null>();
|
const state = useState<string | null>();
|
||||||
const [blockId, setBlockId] = state;
|
const [blockId, setBlockId] = state;
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ export const SubPageProvider = ({ children }: { children: ReactNode }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useSubPage = () => {
|
export const useRefPage = () => {
|
||||||
const context = useContext(SubPageContext);
|
const context = useContext(SubPageContext);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
throw new Error(
|
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';
|
|
||||||
Reference in New Issue
Block a user