Skip to content

Commit

Permalink
open a tags in right pane
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-work committed Nov 7, 2024
1 parent f39e80a commit cbdca85
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 15 deletions.
20 changes: 19 additions & 1 deletion src/components/shared/Link.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
import { useSystemContext } from "src/contexts/hooks";
import { FullSourcePreview } from "src/widgets/copilot/components/Messages/Sources";

const Link = (props: any) => {
const { layoutController } = useSystemContext();

const handleClick = () => {
layoutController?.toggleSecondaryDrawer?.(() => (
<FullSourcePreview
data={props?.data}
layoutController={layoutController}
/>
));
};

return (
<a href={props?.to} target="_blank" style={{ color: props.configColor }}>
<a
onClick={() => handleClick()}
style={{ color: props.configColor }}
className="gooey-link cr-pointer"
>
{props.children}
</a>
);
Expand Down
14 changes: 14 additions & 0 deletions src/css/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ ul {
text-decoration-thickness: 2px;
}

.gooey-embed-container .gooey-link {
color: inherit;
text-decoration: underline;
text-decoration-color: rgba(0, 0, 0, 0.45);
text-decoration-thickness: 0.6px;
text-underline-offset: 0.15em;
}

.gooey-embed-container .gooey-link:hover {
color: inherit;
text-decoration-color: black;
text-decoration-thickness: 2px;
}

div:focus-visible {
outline: none;
}
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/copilot/components/Messages/Sources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import IconButton from "src/components/shared/Buttons/IconButton";
import IconExternalLink from "src/assets/SvgIcons/IconExternalLink";
import IconClose from "src/assets/SvgIcons/IconClose";

const FullSourcePreview = (props: any) => {
export const FullSourcePreview = (props: any) => {
const { data, layoutController, metaData } = props;
const [isLoading, setIsLoading] = useState(true);

Expand Down
16 changes: 3 additions & 13 deletions src/widgets/copilot/components/Messages/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,10 @@ const customizedLinks = (reactNode: any, domNode: any, data: any) => {
url: href,
};
}

// hide source if mailto;
const hideSource = href.startsWith("mailto:");
return (
<React.Fragment>
<Link to={href} configColor={data?.linkColor || "default"}>
{domToReact(domNode.children, getReactParserOptions(data))}
</Link>{" "}
{!hideSource && (
<CollapsibleButton>
<Sources data={[source]} />
</CollapsibleButton>
)}
</React.Fragment>
<Link data={source} configColor={data?.linkColor || "default"}>
{domToReact(domNode.children, getReactParserOptions(data))}
</Link>
);
};

Expand Down

0 comments on commit cbdca85

Please sign in to comment.