From 12d008ae88aa1843455c5480bcaca5c5d6435c82 Mon Sep 17 00:00:00 2001 From: Rory Doak <138574807+RODO94@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:22:48 +0100 Subject: [PATCH] feat: Make external portals open in new tab when clicked (#3497) --- .../components/Flow/components/Portal.tsx | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Portal.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Portal.tsx index 5e00ef5a2d..c0de58e814 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Portal.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/Portal.tsx @@ -14,12 +14,10 @@ import Hanger from "./Hanger"; import Question from "./Question"; const ExternalPortal: React.FC = (props) => { - const [copyNode, addExternalPortal] = useStore((state) => [ - state.copyNode, - state.addExternalPortal, - ]); const [href, setHref] = useState("Loading..."); + const addExternalPortal = useStore.getState().addExternalPortal; + const { data, loading } = useQuery( gql` query GetExternalPortal($id: uuid!) { @@ -77,12 +75,6 @@ const ExternalPortal: React.FC = (props) => { ); } - const handleContext = (e: React.MouseEvent) => { - e.preventDefault(); - e.stopPropagation(); - copyNode(props.id); - }; - let editHref = `${window.location.pathname}/nodes/${props.id}/edit`; if (parent) { editHref = `${window.location.pathname}/nodes/${parent}/nodes/${props.id}/edit`; @@ -91,10 +83,7 @@ const ExternalPortal: React.FC = (props) => { return ( <>