Skip to content

Commit

Permalink
fix: fix user input's link not opening in default browser
Browse files Browse the repository at this point in the history
  • Loading branch information
lisiur committed Jul 10, 2023
1 parent c0f7782 commit dfdb43b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion web/src/components/chat/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,17 @@ export default defineComponent({
immediate: true,
}
);
} else if (message instanceof UserMessage) {
const dom = document.querySelector(
`#user-${message.id}`
) as HTMLElement;
if (dom && dom.dataset.intercepted) {
return false;
}
setTimeout(() => {
interceptLink(dom);
dom.dataset.intercepted = "true";
}, 200);
}
};
watch(
Expand Down Expand Up @@ -231,7 +242,11 @@ export default defineComponent({
function renderUserMessage(msg: UserMessage) {
const html = renderMarkdown(msg.content);
return (
<div key={msg.id} class="flex items-start px-4 pb-4 group relative">
<div
key={msg.id}
class="flex items-start px-4 pb-4 group relative"
id={`user-${msg.id}`}
>
<div
class="markdown-root user-msg inline-block px-3 ml-2 rounded-t-xl rounded-r-xl z-1"
v-html={html}
Expand Down

0 comments on commit dfdb43b

Please sign in to comment.