Skip to content

Commit

Permalink
feat: Make external portals open in new tab when clicked (#3497)
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 authored Aug 12, 2024
1 parent 51031bf commit 12d008a
Showing 1 changed file with 3 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import Hanger from "./Hanger";
import Question from "./Question";

const ExternalPortal: React.FC<any> = (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!) {
Expand Down Expand Up @@ -77,12 +75,6 @@ const ExternalPortal: React.FC<any> = (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`;
Expand All @@ -91,10 +83,7 @@ const ExternalPortal: React.FC<any> = (props) => {
return (
<>
<Hanger hidden={isDragging} before={props.id} parent={parent} />
<li
className={classNames("card", "portal", { isDragging })}
onContextMenu={handleContext}
>
<li className={classNames("card", "portal", { isDragging })}>
<Link href={`/${href}`} prefetch={false} ref={drag}>
<span>{href}</span>
</Link>
Expand Down

0 comments on commit 12d008a

Please sign in to comment.