From c8d9b97ab79aa0586eb04394798bbac83267294f Mon Sep 17 00:00:00 2001
From: raizasafeel <89463672+raizasafeel@users.noreply.github.com>
Date: Tue, 3 Feb 2026 14:01:48 +0530
Subject: [PATCH 1/5] refactor: reuse function 'escapehtml' from utils
---
frontend/src/utils/markdownParser.js | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/frontend/src/utils/markdownParser.js b/frontend/src/utils/markdownParser.js
index 493bcb47..e11f2a13 100644
--- a/frontend/src/utils/markdownParser.js
+++ b/frontend/src/utils/markdownParser.js
@@ -1,5 +1,6 @@
import { CodeXml } from 'lucide-vue-next'
import { createApp, h } from 'vue'
+import { escapeHTML } from '@/utils'
export class Markdown {
constructor({ data, api, readOnly, config }) {
@@ -301,7 +302,7 @@ export class Markdown {
_parseInlineMarkdown(text) {
if (!text) return ''
- let html = this._escapeHtml(text)
+ let html = escapeHTML(text)
html = html.replace(/`([^`]+)`/g, '$1')
@@ -316,15 +317,6 @@ export class Markdown {
return html
}
- _escapeHtml(text) {
- return text
- .replace(/&/g, '&')
- .replace(//g, '>')
- .replace(/"/g, '"')
- .replace(/'/g, ''')
- }
-
_togglePlaceholder() {
const blocks = document.querySelectorAll(
'.cdx-block.ce-paragraph[data-placeholder]'
From dc25b408e64592cc93160f3e324efeb35f5f9d67 Mon Sep 17 00:00:00 2001
From: raizasafeel <89463672+raizasafeel@users.noreply.github.com>
Date: Tue, 3 Feb 2026 14:51:17 +0530
Subject: [PATCH 2/5] fix(vimeo): video player is rendered for private videos
and unsanitized vimeo links
---
frontend/src/utils/index.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js
index e0a69d55..acf6c068 100644
--- a/frontend/src/utils/index.js
+++ b/frontend/src/utils/index.js
@@ -169,10 +169,10 @@ export function getEditorTools() {
id: ([id]) => id,
},
vimeo: {
- regex: /(?:http[s]?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)/,
+ regex: /(?:http[s]?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?(?:\?[^\s]*)?/,
embedUrl: '<%= remote_id %>',
html: `
`,
- id: ([id]) => id,
+ id: ([id, hash]) => (hash ? `${id}?h=${hash}` : id),
},
cloudflareStream: {
regex: /https:\/\/customer-[a-z0-9]+\.cloudflarestream\.com\/([a-f0-9]{32})\/watch/,
From 3b49aac1b393382c4d1cebd333104d49240be165 Mon Sep 17 00:00:00 2001
From: raizasafeel <89463672+raizasafeel@users.noreply.github.com>
Date: Tue, 3 Feb 2026 16:14:58 +0530
Subject: [PATCH 3/5] refactor: removed unused functions
---
frontend/src/utils/markdownParser.js | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/frontend/src/utils/markdownParser.js b/frontend/src/utils/markdownParser.js
index e11f2a13..1e3cf6dd 100644
--- a/frontend/src/utils/markdownParser.js
+++ b/frontend/src/utils/markdownParser.js
@@ -421,16 +421,6 @@ export class Markdown {
return { alt: '', url: '' }
}
- _isLink(text) {
- return /\[.+?\]\(.+?\)/.test(text)
- }
-
- _extractLink(text) {
- const match = text.match(/\[(.+?)\]\((.+?)\)/)
- if (match) return { text: match[1], url: match[2] }
- return { text: '', url: '' }
- }
-
_isEmbed(text) {
return /^https?:\/\/.+/.test(text.trim())
}
From 2f3fa7c2957d3a34c50408de4f4d9927354ca27b Mon Sep 17 00:00:00 2001
From: raizasafeel <89463672+raizasafeel@users.noreply.github.com>
Date: Tue, 3 Feb 2026 16:22:50 +0530
Subject: [PATCH 4/5] fix: added regex anchors to embed urls
---
frontend/src/utils/index.js | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js
index acf6c068..5da880ae 100644
--- a/frontend/src/utils/index.js
+++ b/frontend/src/utils/index.js
@@ -162,20 +162,20 @@ export function getEditorTools() {
config: {
services: {
youtube: {
- regex: /(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)/,
+ regex: /^(?:https?:\/\/)?(?:www\.)?(?:(?:youtu\.be\/)|(?:youtube\.com)\/(?:v\/|u\/\w\/|embed\/|watch))(?:(?:\?v=)?([^#&?=]*))?((?:[?&]\w*=\w*)*)$/,
embedUrl: '<%= remote_id %>',
/* 'https://www.youtube.com/embed/<%= remote_id %>?origin=https://plyr.io&iv_load_policy=3&modestbranding=1&playsinline=1&showinfo=0&rel=0&enablejsapi=1' */
html: ``,
id: ([id]) => id,
},
vimeo: {
- regex: /(?:http[s]?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?(?:\?[^\s]*)?/,
+ regex: /^(?:http[s]?:\/\/)?(?:www\.)?vimeo\.com\/(\d+)(?:\/([a-zA-Z0-9]+))?(?:\?[^\s]*)?$/,
embedUrl: '<%= remote_id %>',
html: ``,
id: ([id, hash]) => (hash ? `${id}?h=${hash}` : id),
},
cloudflareStream: {
- regex: /https:\/\/customer-[a-z0-9]+\.cloudflarestream\.com\/([a-f0-9]{32})\/watch/,
+ regex: /^https:\/\/customer-[a-z0-9]+\.cloudflarestream\.com\/([a-f0-9]{32})\/watch$/,
embedUrl:
'https://iframe.videodelivery.net/<%= remote_id %>',
html: ``,
},
bunnyStream: {
- regex: /https:\/\/(?:iframe\.mediadelivery\.net|video\.bunnycdn\.com)\/play\/([a-zA-Z0-9]+\/[a-zA-Z0-9-]+)/,
+ regex: /^https:\/\/(?:iframe\.mediadelivery\.net|video\.bunnycdn\.com)\/play\/([a-zA-Z0-9]+\/[a-zA-Z0-9-]+)$/,
embedUrl:
'https://iframe.mediadelivery.net/embed/<%= remote_id %>',
html: `