mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-03-28 08:15:55 +00:00
fix message parsing
This commit is contained in:
parent
0f6319670d
commit
7dadfa8346
@ -4,12 +4,11 @@ import './styles.css';
|
|||||||
import { executeEvent } from '../../utils/events';
|
import { executeEvent } from '../../utils/events';
|
||||||
|
|
||||||
const extractComponents = (url) => {
|
const extractComponents = (url) => {
|
||||||
console.log('url', url);
|
if (!url || !url.startsWith("qortal://")) { // Check if url exists and starts with "qortal://"
|
||||||
if (!url.startsWith("qortal://")) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = url.replace(/^(qortal\:\/\/)/, "");
|
url = url.replace(/^(qortal\:\/\/)/, ""); // Safe to use replace now
|
||||||
if (url.includes("/")) {
|
if (url.includes("/")) {
|
||||||
let parts = url.split("/");
|
let parts = url.split("/");
|
||||||
const service = parts[0].toUpperCase();
|
const service = parts[0].toUpperCase();
|
||||||
@ -59,6 +58,8 @@ function processText(input) {
|
|||||||
|
|
||||||
export const MessageDisplay = ({ htmlContent, isReply }) => {
|
export const MessageDisplay = ({ htmlContent, isReply }) => {
|
||||||
const linkify = (text) => {
|
const linkify = (text) => {
|
||||||
|
if (!text) return ""; // Return an empty string if text is null or undefined
|
||||||
|
|
||||||
let textFormatted = text;
|
let textFormatted = text;
|
||||||
const urlPattern = /(\bhttps?:\/\/[^\s<]+|\bwww\.[^\s<]+)/g;
|
const urlPattern = /(\bhttps?:\/\/[^\s<]+|\bwww\.[^\s<]+)/g;
|
||||||
textFormatted = text.replace(urlPattern, (url) => {
|
textFormatted = text.replace(urlPattern, (url) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user