mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 02:29:03 +00:00 
			
		
		
		
	Fixed # 599 Column level tag window needs to be manually closed before another column tag dialog to open (#700)
.
This commit is contained in:
		
							parent
							
								
									3dddc084c6
								
							
						
					
					
						commit
						562e7abff0
					
				| @ -42,6 +42,7 @@ const TagsContainer: FunctionComponent<TagsContainerProps> = ({ | |||||||
|   const [newTag, setNewTag] = useState<string>(''); |   const [newTag, setNewTag] = useState<string>(''); | ||||||
|   const [hasFocus, setFocus] = useState<boolean>(false); |   const [hasFocus, setFocus] = useState<boolean>(false); | ||||||
|   const inputRef = useRef<HTMLInputElement>(null); |   const inputRef = useRef<HTMLInputElement>(null); | ||||||
|  |   const node = useRef<HTMLDivElement>(null); | ||||||
|   // const [inputWidth, setInputWidth] = useState(INPUT_COLLAPED);
 |   // const [inputWidth, setInputWidth] = useState(INPUT_COLLAPED);
 | ||||||
|   // const [inputMinWidth, setInputMinWidth] = useState(INPUT_AUTO);
 |   // const [inputMinWidth, setInputMinWidth] = useState(INPUT_AUTO);
 | ||||||
| 
 | 
 | ||||||
| @ -153,11 +154,31 @@ const TagsContainer: FunctionComponent<TagsContainerProps> = ({ | |||||||
|       return getTagsContainer(tag, index); |       return getTagsContainer(tag, index); | ||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
|  |   const handleClick = (e: MouseEvent) => { | ||||||
|  |     if (node?.current?.contains(e.target as Node)) { | ||||||
|  |       return; | ||||||
|  |     } else { | ||||||
|  |       e.stopPropagation(); | ||||||
|  |       handleCancel(e as unknown as React.MouseEvent<HTMLElement, MouseEvent>); | ||||||
|  |     } | ||||||
|  |   }; | ||||||
| 
 | 
 | ||||||
|   useEffect(() => { |   useEffect(() => { | ||||||
|     setTags(selectedTags); |     setTags(selectedTags); | ||||||
|   }, [selectedTags]); |   }, [selectedTags]); | ||||||
| 
 | 
 | ||||||
|  |   useEffect(() => { | ||||||
|  |     if (editable) { | ||||||
|  |       document.addEventListener('mousedown', handleClick); | ||||||
|  |     } else { | ||||||
|  |       document.removeEventListener('mousedown', handleClick); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     return () => { | ||||||
|  |       document.removeEventListener('mousedown', handleClick); | ||||||
|  |     }; | ||||||
|  |   }, [editable]); | ||||||
|  | 
 | ||||||
|   return ( |   return ( | ||||||
|     <div |     <div | ||||||
|       className={classNames( |       className={classNames( | ||||||
| @ -168,6 +189,7 @@ const TagsContainer: FunctionComponent<TagsContainerProps> = ({ | |||||||
|         { 'hover:tw-border-main': !hasFocus } |         { 'hover:tw-border-main': !hasFocus } | ||||||
|       )} |       )} | ||||||
|       data-testid="tag-conatiner" |       data-testid="tag-conatiner" | ||||||
|  |       ref={node} | ||||||
|       onClick={(event) => { |       onClick={(event) => { | ||||||
|         if (editable) { |         if (editable) { | ||||||
|           event.preventDefault(); |           event.preventDefault(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Sachin Chaurasiya
						Sachin Chaurasiya