There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix: fix pendant popover obscured by screen
QiShaoXuan4944887d4a22
diff --git a/libs/components/editor-core/src/block-pendant/AddPendantPopover.tsx b/libs/components/editor-core/src/block-pendant/AddPendantPopover.tsxindex 015f8a4120..ce5dc6cdc9 100644--- a/libs/components/editor-core/src/block-pendant/AddPendantPopover.tsx+++ b/libs/components/editor-core/src/block-pendant/AddPendantPopover.tsx@@ -5,6 +5,7 @@ import {type PopoverProps,PopperHandler,Tag,+ type PopperProps,} from '@toeverything/components/ui';import { TagsIcon } from '@toeverything/components/icons';@@ -26,9 +27,11 @@ export const AddPendantPopover = ({...popoverProps}: Props) => {const popoverHandlerRef = useRef<PopperHandler>();+ const popperRef = useRef<any>();return (<Popover- ref={popoverHandlerRef}+ popperHandlerRef={popoverHandlerRef}+ popperRef={popperRef}content={<CreatePendantPanelblock={block}@@ -36,6 +39,9 @@ export const AddPendantPopover = ({popoverHandlerRef.current?.setVisible(false);onSure?.();}}+ onTypeChange={() => {+ popperRef.current?.update?.();+ }}/>}placement="bottom-start"diff --git a/libs/components/editor-core/src/block-pendant/pendant-modify-panel/types.ts b/libs/components/editor-core/src/block-pendant/pendant-modify-panel/types.tsindex a7ed9e0198..5afbb29ad5 100644--- a/libs/components/editor-core/src/block-pendant/pendant-modify-panel/types.ts+++ b/libs/components/editor-core/src/block-pendant/pendant-modify-panel/types.ts@@ -11,6 +11,7 @@ export type ModifyPanelProps = {iconConfig?: PendantConfig;isStatusSelect?: boolean;property?: RecastMetaProperty;+ onTypeChange?: (type: PendantTypes) => void;};export type ModifyPanelContentProps = {diff --git a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsxindex 42e36e063f..88fd5b039f 100644--- a/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx+++ b/libs/components/editor-core/src/block-pendant/pendant-operation-panel/CreatePendantPanel.tsx@@ -24,9 +24,11 @@ import { useOnCreateSure } from './hooks';export const CreatePendantPanel = ({block,onSure,+ onTypeChange,}: {block: AsyncBlock;onSure?: () => void;+ onTypeChange?: (option: PendantOptions) => void;}) => {const [selectedOption, setSelectedOption] = useState<PendantOptions>();const [fieldName, setFieldName] = useState<string>('');@@ -37,6 +39,10 @@ export const CreatePendantPanel = ({setFieldName(generateRandomFieldName(selectedOption.type));}, [selectedOption]);+ useEffect(() => {+ onTypeChange?.(selectedOption);+ }, [selectedOption, onTypeChange]);+return (<StyledPopoverWrapper><StyledOperationTitle>Add Field</StyledOperationTitle>