Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Make external portals open in new tab when clicked #3497

Merged
merged 5 commits into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading