From ee9845483cbb69ee7bfabdcd92ea0f3f483bb24b Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Tue, 6 Aug 2024 17:05:37 +0100 Subject: [PATCH 1/5] add _blank to target attribute of eext portal anchor tag --- .../FlowEditor/components/Flow/components/Portal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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..f976f3c710 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 @@ -95,7 +95,13 @@ const ExternalPortal: React.FC = (props) => { className={classNames("card", "portal", { isDragging })} onContextMenu={handleContext} > - + {href} From 091f7faa11b848b57a4f18bec1eeb66273915247 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Thu, 8 Aug 2024 16:00:29 +0100 Subject: [PATCH 2/5] remove preventDefault from handleContext event --- .../FlowEditor/components/Flow/components/Portal.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 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 f976f3c710..bd91377b2c 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 @@ -78,7 +78,6 @@ const ExternalPortal: React.FC = (props) => { } const handleContext = (e: React.MouseEvent) => { - e.preventDefault(); e.stopPropagation(); copyNode(props.id); }; @@ -95,13 +94,7 @@ const ExternalPortal: React.FC = (props) => { className={classNames("card", "portal", { isDragging })} onContextMenu={handleContext} > - + {href} From f79ddce2bd578bf4bc2b5813745f876d5af03bce Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Thu, 8 Aug 2024 16:15:03 +0100 Subject: [PATCH 3/5] remove handleContext and Copy node state --- .../components/Flow/components/Portal.tsx | 19 +------------------ 1 file changed, 1 insertion(+), 18 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 bd91377b2c..6590dbac73 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,10 +14,6 @@ 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 { data, loading } = useQuery( @@ -40,11 +36,6 @@ const ExternalPortal: React.FC = (props) => { "/", ); setHref(href); - addExternalPortal({ - id: props.data.flowId, - name: data.flows_by_pk.name, - href, - }); }, }, ); @@ -77,11 +68,6 @@ const ExternalPortal: React.FC = (props) => { ); } - const handleContext = (e: React.MouseEvent) => { - 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`; @@ -90,10 +76,7 @@ const ExternalPortal: React.FC = (props) => { return ( <>