Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
e9ee1a1f
Commit
e9ee1a1f
authored
Jul 21, 2023
by
金伟强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: handle link highlight
parent
54cf870d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
index.tsx
web/app/components/app/chat/thought/index.tsx
+7
-1
markdown.scss
web/app/styles/markdown.scss
+2
-2
No files found.
web/app/components/app/chat/thought/index.tsx
View file @
e9ee1a1f
...
...
@@ -8,6 +8,8 @@ import s from './style.module.css'
import
{
DataSet
,
Search
,
ThoughtList
,
WebReader
}
from
'@/app/components/base/icons/src/public/thought'
import
{
ChevronDown
}
from
'@/app/components/base/icons/src/vender/line/arrows'
// https://www.freecodecamp.org/news/how-to-write-a-regular-expression-for-a-url/
const
urlRegex
=
/
(
https:
\/\/
www
\.
|http:
\/\/
www
\.
|https:
\/\/
|http:
\/\/)?[
a-zA-Z
]{2,}(\.[
a-zA-Z
]{2,})(\.[
a-zA-Z
]{2,})?\/[
a-zA-Z0-9
]{2,}
|
((
https:
\/\/
www
\.
|http:
\/\/
www
\.
|https:
\/\/
|http:
\/\/)?[
a-zA-Z
]{2,}(\.[
a-zA-Z
]{2,})(\.[
a-zA-Z
]{2,})?)
|
(
https:
\/\/
www
\.
|http:
\/\/
www
\.
|https:
\/\/
|http:
\/\/)?[
a-zA-Z0-9
]{2,}\.[
a-zA-Z0-9
]{2,}\.[
a-zA-Z0-9
]{2,}(\.[
a-zA-Z0-9
]{2,})?
/gi
export
type
IThoughtProps
=
{
list
:
ThoughtItem
[]
}
...
...
@@ -32,7 +34,11 @@ const Thought: FC<IThoughtProps> = ({
const
renderItem
=
(
item
:
ThoughtItem
)
=>
(
<
div
className=
'flex space-x-1 py-[3px] leading-[18px]'
key=
{
item
.
id
}
>
<
div
className=
'flex items-center h-[18px] shrink-0'
>
{
getIcon
(
item
.
tool
)
}
</
div
>
<
div
>
{
item
.
thought
}
</
div
>
<
div
dangerouslySetInnerHTML=
{
{
__html
:
item
.
thought
.
replace
(
urlRegex
,
(
url
)
=>
{
return
`<a href="${url}" class="text-[#155EEF]">${url}</a>`
}),
}
}
></
div
>
</
div
>
)
return
(
...
...
web/app/styles/markdown.scss
View file @
e9ee1a1f
...
...
@@ -109,7 +109,7 @@
.markdown-body
a
{
background-color
:
transparent
;
color
:
var
(
--
color-accent-fg
)
;
color
:
#155EEF
;
text-decoration
:
none
;
}
...
...
@@ -1042,4 +1042,4 @@
.
markdown-body
:
:-
webkit-calendar-picker-indicator
{
filter
:
invert
(
50%
);
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment