🐛 (editor) Fix popover zIndex
This commit is contained in:
@ -20,6 +20,7 @@ import React, { useState, useRef, ChangeEvent, useEffect } from 'react'
|
|||||||
import { useDebouncedCallback } from 'use-debounce'
|
import { useDebouncedCallback } from 'use-debounce'
|
||||||
import { byId, env, isDefined, isNotDefined } from 'utils'
|
import { byId, env, isDefined, isNotDefined } from 'utils'
|
||||||
import { useOutsideClick } from '@/hooks/useOutsideClick'
|
import { useOutsideClick } from '@/hooks/useOutsideClick'
|
||||||
|
import { useParentModal } from '@/features/graph'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
initialVariableId?: string
|
initialVariableId?: string
|
||||||
@ -62,6 +63,7 @@ export const VariableSearchInput = ({
|
|||||||
const inputRef = useRef<HTMLInputElement>(null)
|
const inputRef = useRef<HTMLInputElement>(null)
|
||||||
const createVariableItemRef = useRef<HTMLButtonElement | null>(null)
|
const createVariableItemRef = useRef<HTMLButtonElement | null>(null)
|
||||||
const itemsRef = useRef<(HTMLButtonElement | null)[]>([])
|
const itemsRef = useRef<(HTMLButtonElement | null)[]>([])
|
||||||
|
const { ref: parentModalRef } = useParentModal()
|
||||||
|
|
||||||
useOutsideClick({
|
useOutsideClick({
|
||||||
ref: dropdownRef,
|
ref: dropdownRef,
|
||||||
@ -190,7 +192,7 @@ export const VariableSearchInput = ({
|
|||||||
{...inputProps}
|
{...inputProps}
|
||||||
/>
|
/>
|
||||||
</PopoverAnchor>
|
</PopoverAnchor>
|
||||||
<Portal>
|
<Portal containerRef={parentModalRef}>
|
||||||
<PopoverContent
|
<PopoverContent
|
||||||
maxH="35vh"
|
maxH="35vh"
|
||||||
overflowY="scroll"
|
overflowY="scroll"
|
||||||
|
@ -37,6 +37,7 @@ import {
|
|||||||
useGraph,
|
useGraph,
|
||||||
useBlockDnd,
|
useBlockDnd,
|
||||||
useDragDistance,
|
useDragDistance,
|
||||||
|
ParentModalProvider,
|
||||||
} from '../../../providers'
|
} from '../../../providers'
|
||||||
import { hasDefaultConnector } from '../../../utils'
|
import { hasDefaultConnector } from '../../../utils'
|
||||||
|
|
||||||
@ -239,12 +240,14 @@ export const BlockNode = ({
|
|||||||
onExpandClick={handleExpandClick}
|
onExpandClick={handleExpandClick}
|
||||||
onBlockChange={handleBlockUpdate}
|
onBlockChange={handleBlockUpdate}
|
||||||
/>
|
/>
|
||||||
<SettingsModal isOpen={isModalOpen} onClose={handleModalClose}>
|
<ParentModalProvider>
|
||||||
<BlockSettings
|
<SettingsModal isOpen={isModalOpen} onClose={handleModalClose}>
|
||||||
block={block}
|
<BlockSettings
|
||||||
onBlockChange={handleBlockUpdate}
|
block={block}
|
||||||
/>
|
onBlockChange={handleBlockUpdate}
|
||||||
</SettingsModal>
|
/>
|
||||||
|
</SettingsModal>
|
||||||
|
</ParentModalProvider>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{typebot && isMediaBubbleBlock(block) && (
|
{typebot && isMediaBubbleBlock(block) && (
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { useParentModal } from '@/features/graph'
|
||||||
import {
|
import {
|
||||||
Modal,
|
Modal,
|
||||||
ModalOverlay,
|
ModalOverlay,
|
||||||
@ -20,13 +21,14 @@ export const SettingsModal = ({
|
|||||||
onClose,
|
onClose,
|
||||||
...props
|
...props
|
||||||
}: Props & ModalBodyProps) => {
|
}: Props & ModalBodyProps) => {
|
||||||
|
const { ref } = useParentModal()
|
||||||
const handleMouseDown = (e: React.MouseEvent) => {
|
const handleMouseDown = (e: React.MouseEvent) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Modal isOpen={isOpen} onClose={onClose}>
|
<Modal isOpen={isOpen} onClose={onClose}>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent onMouseDown={handleMouseDown}>
|
<ModalContent onMouseDown={handleMouseDown} ref={ref}>
|
||||||
<ModalHeader mb="2">
|
<ModalHeader mb="2">
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
</ModalHeader>
|
</ModalHeader>
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
export { Graph } from './components/Graph'
|
export { Graph } from './components/Graph'
|
||||||
export {
|
export {
|
||||||
|
ParentModalProvider,
|
||||||
GraphProvider,
|
GraphProvider,
|
||||||
GroupsCoordinatesProvider,
|
GroupsCoordinatesProvider,
|
||||||
GraphDndProvider,
|
GraphDndProvider,
|
||||||
type Coordinates,
|
type Coordinates,
|
||||||
useGraph,
|
useGraph,
|
||||||
useBlockDnd,
|
useBlockDnd,
|
||||||
|
useParentModal,
|
||||||
} from './providers'
|
} from './providers'
|
||||||
export { parseNewBlock } from './utils'
|
export { parseNewBlock } from './utils'
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
import { createContext, ReactNode, useContext, useRef } from 'react'
|
||||||
|
|
||||||
|
const parentModalContext = createContext<{
|
||||||
|
ref?: React.MutableRefObject<HTMLDivElement | null>
|
||||||
|
}>({})
|
||||||
|
|
||||||
|
export const ParentModalProvider = ({ children }: { children: ReactNode }) => {
|
||||||
|
const ref = useRef<HTMLDivElement | null>(null)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<parentModalContext.Provider value={{ ref }}>
|
||||||
|
{children}
|
||||||
|
</parentModalContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useParentModal = () => useContext(parentModalContext)
|
@ -1,3 +1,4 @@
|
|||||||
export * from './GraphDndProvider'
|
export * from './GraphDndProvider'
|
||||||
export * from './GraphProvider'
|
export * from './GraphProvider'
|
||||||
export * from './GroupsCoordinateProvider'
|
export * from './GroupsCoordinateProvider'
|
||||||
|
export * from './ParentModalProvider'
|
||||||
|
@ -93,7 +93,6 @@ const Popover = createMultiStyleConfigHelpers(
|
|||||||
popper: {
|
popper: {
|
||||||
width: 'fit-content',
|
width: 'fit-content',
|
||||||
maxWidth: 'fit-content',
|
maxWidth: 'fit-content',
|
||||||
zIndex: 'popover',
|
|
||||||
},
|
},
|
||||||
content: {
|
content: {
|
||||||
bg: colorMode === 'dark' ? 'gray.800' : 'white',
|
bg: colorMode === 'dark' ? 'gray.800' : 'white',
|
||||||
|
Reference in New Issue
Block a user