mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
Merge pull request #20 from danny-avila/override-links
feat: links open in new tab
This commit is contained in:
commit
57d3025717
2 changed files with 28 additions and 1 deletions
15
client/src/components/Messages/TabLink.jsx
Normal file
15
client/src/components/Messages/TabLink.jsx
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
import React from 'react';
|
||||||
|
|
||||||
|
export default function TabLink(a) {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={a.href}
|
||||||
|
title={a.title}
|
||||||
|
className={a.className}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{a.children}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
}
|
|
@ -2,10 +2,22 @@ import React from 'react';
|
||||||
import Markdown from 'markdown-to-jsx';
|
import Markdown from 'markdown-to-jsx';
|
||||||
import Embed from './Embed';
|
import Embed from './Embed';
|
||||||
import Highlight from './Highlight';
|
import Highlight from './Highlight';
|
||||||
|
import TabLink from './TabLink';
|
||||||
import regexSplit from '~/utils/regexSplit';
|
import regexSplit from '~/utils/regexSplit';
|
||||||
import { wrapperRegex } from '~/utils';
|
import { wrapperRegex } from '~/utils';
|
||||||
const { codeRegex, inLineRegex, markupRegex, languageMatch, newLineMatch } = wrapperRegex;
|
const { codeRegex, inLineRegex, markupRegex, languageMatch, newLineMatch } = wrapperRegex;
|
||||||
const mdOptions = { wrapper: React.Fragment, forceWrapper: true };
|
const mdOptions = {
|
||||||
|
wrapper: React.Fragment,
|
||||||
|
forceWrapper: true,
|
||||||
|
overrides: {
|
||||||
|
a: {
|
||||||
|
component: TabLink,
|
||||||
|
// props: {
|
||||||
|
// className: 'foo'
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const inLineWrap = (parts) => {
|
const inLineWrap = (parts) => {
|
||||||
let previousElement = null;
|
let previousElement = null;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue