[WIKI-638] fix: peek overview closing while dropdowns are open (#7841)
This commit is contained in:
parent
0ed49a6989
commit
dce8b75a1e
8 changed files with 78 additions and 23 deletions
|
|
@ -29,7 +29,8 @@ import { IssueTitleInput } from "../title-input";
|
|||
// services init
|
||||
const workItemVersionService = new WorkItemVersionService();
|
||||
|
||||
interface IPeekOverviewIssueDetails {
|
||||
type Props = {
|
||||
editorRef: React.RefObject<EditorRefApi>;
|
||||
workspaceSlug: string;
|
||||
projectId: string;
|
||||
issueId: string;
|
||||
|
|
@ -38,12 +39,11 @@ interface IPeekOverviewIssueDetails {
|
|||
isArchived: boolean;
|
||||
isSubmitting: TNameDescriptionLoader;
|
||||
setIsSubmitting: (value: TNameDescriptionLoader) => void;
|
||||
}
|
||||
};
|
||||
|
||||
export const PeekOverviewIssueDetails: FC<IPeekOverviewIssueDetails> = observer((props) => {
|
||||
const { workspaceSlug, issueId, issueOperations, disabled, isArchived, isSubmitting, setIsSubmitting } = props;
|
||||
// refs
|
||||
const editorRef = useRef<EditorRefApi>(null);
|
||||
export const PeekOverviewIssueDetails: FC<Props> = observer((props) => {
|
||||
const { editorRef, workspaceSlug, issueId, issueOperations, disabled, isArchived, isSubmitting, setIsSubmitting } =
|
||||
props;
|
||||
// store hooks
|
||||
const { data: currentUser } = useUser();
|
||||
const {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { FC, useRef, useState } from "react";
|
|||
import { observer } from "mobx-react";
|
||||
import { createPortal } from "react-dom";
|
||||
// plane imports
|
||||
import type { EditorRefApi } from "@plane/editor";
|
||||
import { EIssueServiceType, TNameDescriptionLoader } from "@plane/types";
|
||||
import { cn } from "@plane/utils";
|
||||
// hooks
|
||||
|
|
@ -53,6 +54,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||
const [isEditIssueModalOpen, setIsEditIssueModalOpen] = useState(false);
|
||||
// ref
|
||||
const issuePeekOverviewRef = useRef<HTMLDivElement>(null);
|
||||
const editorRef = useRef<EditorRefApi>(null);
|
||||
// store hooks
|
||||
const {
|
||||
setPeekIssue,
|
||||
|
|
@ -80,8 +82,9 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||
usePeekOverviewOutsideClickDetector(
|
||||
issuePeekOverviewRef,
|
||||
() => {
|
||||
const isAnyDropbarOpen = editorRef.current?.isAnyDropbarOpen();
|
||||
if (!embedIssue) {
|
||||
if (!isAnyModalOpen && !isAnyEpicModalOpen && !isAnyLocalModalOpen) {
|
||||
if (!isAnyModalOpen && !isAnyEpicModalOpen && !isAnyLocalModalOpen && !isAnyDropbarOpen) {
|
||||
removeRoutePeekId();
|
||||
}
|
||||
}
|
||||
|
|
@ -90,10 +93,10 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||
);
|
||||
|
||||
const handleKeyDown = () => {
|
||||
const slashCommandDropdownElement = document.querySelector("#slash-command");
|
||||
const editorImageFullScreenModalElement = document.querySelector(".editor-image-full-screen-modal");
|
||||
const dropdownElement = document.activeElement?.tagName === "INPUT";
|
||||
if (!isAnyModalOpen && !slashCommandDropdownElement && !dropdownElement && !editorImageFullScreenModalElement) {
|
||||
const isAnyDropbarOpen = editorRef.current?.isAnyDropbarOpen();
|
||||
if (!isAnyModalOpen && !dropdownElement && !isAnyDropbarOpen && !editorImageFullScreenModalElement) {
|
||||
removeRoutePeekId();
|
||||
const issueElement = document.getElementById(`issue-${issueId}`);
|
||||
if (issueElement) issueElement?.focus();
|
||||
|
|
@ -166,6 +169,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||
{["side-peek", "modal"].includes(peekMode) ? (
|
||||
<div className="relative flex flex-col gap-3 px-8 py-5 space-y-3">
|
||||
<PeekOverviewIssueDetails
|
||||
editorRef={editorRef}
|
||||
workspaceSlug={workspaceSlug}
|
||||
projectId={projectId}
|
||||
issueId={issueId}
|
||||
|
|
@ -206,6 +210,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
|
|||
<div className="relative h-full w-full space-y-6 overflow-auto p-4 py-5">
|
||||
<div className="space-y-3">
|
||||
<PeekOverviewIssueDetails
|
||||
editorRef={editorRef}
|
||||
workspaceSlug={workspaceSlug}
|
||||
projectId={projectId}
|
||||
issueId={issueId}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue