updated regex for img and video tag removal one more time...
This commit is contained in:
parent
5c78a8a491
commit
ad10100c02
2 changed files with 3 additions and 3 deletions
4
index.js
4
index.js
|
|
@ -135,7 +135,7 @@ export default async function now() {
|
||||||
} else {
|
} else {
|
||||||
// remove img tags if no image available (handle multi-line tags and any attribute order)
|
// remove img tags if no image available (handle multi-line tags and any attribute order)
|
||||||
newNow = newNow.replace(
|
newNow = newNow.replace(
|
||||||
new RegExp(`<img\\b[^>]*\\bsrc=["']${imageId}["'][^>]*>`, 'gis'),
|
new RegExp(`\\s*<img\\b[^>]*\\bsrc=["']${imageId}["'][^>]*>\\s*`, 'gis'),
|
||||||
'',
|
'',
|
||||||
)
|
)
|
||||||
// remove markdown image
|
// remove markdown image
|
||||||
|
|
@ -154,7 +154,7 @@ export default async function now() {
|
||||||
} else {
|
} else {
|
||||||
// remove video tags if no video available
|
// remove video tags if no video available
|
||||||
newNow = newNow.replace(
|
newNow = newNow.replace(
|
||||||
new RegExp(`<video\\b[^>]*\\bsrc=["']${videoId}["'][^>]*>[\\s\\S]*?</video>`, 'gis'),
|
new RegExp(`\\s*<video\\b[^>]*\\bsrc=["']${videoId}["'][^>]*>[\\s\\S]*?</video>\\s*`, 'gis'),
|
||||||
'',
|
'',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
<div
|
<div
|
||||||
style="background: rgba(148, 226, 213, 0.15); padding: 1rem; border: 4px solid #94e2d5; color:white; display: flex; justify-content: space-between; align-items: center;">
|
style="background: rgba(148, 226, 213, 0.15); padding: 1rem; border: 4px solid #94e2d5; color:white; display: flex; justify-content: space-between; align-items: center;">
|
||||||
<div style="text-align: left;">
|
<div style="text-align: left;">
|
||||||
I shared this photo<br>
|
<i class="fa-regular fa-images"></i>I shared this photo<br>
|
||||||
<a href="https://dylan.some.pics" style="color: #94e2d5 !important;">some.pics</a>
|
<a href="https://dylan.some.pics" style="color: #94e2d5 !important;">some.pics</a>
|
||||||
</div>
|
</div>
|
||||||
<img src="some.pics-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
<img src="some.pics-image" style="max-width: 120px; max-height: 120px; object-fit: cover; border-radius: 4px;">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue