mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-11 20:08:37 +00:00
fix: fix pendant popover obscured by screen
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
|||||||
type PopoverProps,
|
type PopoverProps,
|
||||||
PopperHandler,
|
PopperHandler,
|
||||||
Tag,
|
Tag,
|
||||||
|
type PopperProps,
|
||||||
} from '@toeverything/components/ui';
|
} from '@toeverything/components/ui';
|
||||||
import { TagsIcon } from '@toeverything/components/icons';
|
import { TagsIcon } from '@toeverything/components/icons';
|
||||||
|
|
||||||
@@ -26,9 +27,11 @@ export const AddPendantPopover = ({
|
|||||||
...popoverProps
|
...popoverProps
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const popoverHandlerRef = useRef<PopperHandler>();
|
const popoverHandlerRef = useRef<PopperHandler>();
|
||||||
|
const popperRef = useRef<any>();
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
ref={popoverHandlerRef}
|
popperHandlerRef={popoverHandlerRef}
|
||||||
|
popperRef={popperRef}
|
||||||
content={
|
content={
|
||||||
<CreatePendantPanel
|
<CreatePendantPanel
|
||||||
block={block}
|
block={block}
|
||||||
@@ -36,6 +39,9 @@ export const AddPendantPopover = ({
|
|||||||
popoverHandlerRef.current?.setVisible(false);
|
popoverHandlerRef.current?.setVisible(false);
|
||||||
onSure?.();
|
onSure?.();
|
||||||
}}
|
}}
|
||||||
|
onTypeChange={() => {
|
||||||
|
popperRef.current?.update?.();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
placement="bottom-start"
|
placement="bottom-start"
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type ModifyPanelProps = {
|
|||||||
iconConfig?: PendantConfig;
|
iconConfig?: PendantConfig;
|
||||||
isStatusSelect?: boolean;
|
isStatusSelect?: boolean;
|
||||||
property?: RecastMetaProperty;
|
property?: RecastMetaProperty;
|
||||||
|
onTypeChange?: (type: PendantTypes) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ModifyPanelContentProps = {
|
export type ModifyPanelContentProps = {
|
||||||
|
|||||||
@@ -24,9 +24,11 @@ import { useOnCreateSure } from './hooks';
|
|||||||
export const CreatePendantPanel = ({
|
export const CreatePendantPanel = ({
|
||||||
block,
|
block,
|
||||||
onSure,
|
onSure,
|
||||||
|
onTypeChange,
|
||||||
}: {
|
}: {
|
||||||
block: AsyncBlock;
|
block: AsyncBlock;
|
||||||
onSure?: () => void;
|
onSure?: () => void;
|
||||||
|
onTypeChange?: (option: PendantOptions) => void;
|
||||||
}) => {
|
}) => {
|
||||||
const [selectedOption, setSelectedOption] = useState<PendantOptions>();
|
const [selectedOption, setSelectedOption] = useState<PendantOptions>();
|
||||||
const [fieldName, setFieldName] = useState<string>('');
|
const [fieldName, setFieldName] = useState<string>('');
|
||||||
@@ -37,6 +39,10 @@ export const CreatePendantPanel = ({
|
|||||||
setFieldName(generateRandomFieldName(selectedOption.type));
|
setFieldName(generateRandomFieldName(selectedOption.type));
|
||||||
}, [selectedOption]);
|
}, [selectedOption]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
onTypeChange?.(selectedOption);
|
||||||
|
}, [selectedOption, onTypeChange]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledPopoverWrapper>
|
<StyledPopoverWrapper>
|
||||||
<StyledOperationTitle>Add Field</StyledOperationTitle>
|
<StyledOperationTitle>Add Field</StyledOperationTitle>
|
||||||
|
|||||||
Reference in New Issue
Block a user