Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix: handle p tags with attributes and isolate IG caption direction

Gilad Resisi53ea9c8f894c
diff --git a/apps/frontend/src/components/new-launch/add.edit.modal.tsx b/apps/frontend/src/components/new-launch/add.edit.modal.tsx
index a7d016f47..644f7ea64 100644
--- a/apps/frontend/src/components/new-launch/add.edit.modal.tsx
+++ b/apps/frontend/src/components/new-launch/add.edit.modal.tsx
@@ -176,7 +176,7 @@ export const AddEditModalInnerInner: FC<AddEditModalProps> = (props) => {
existingData.posts.map((post) => ({
delay: post.delay,
content:
- post.content.indexOf('<p>') > -1
+ post.content.indexOf('<p') > -1
? post.content
: post.content
.split('\n')
@@ -201,7 +201,7 @@ export const AddEditModalInnerInner: FC<AddEditModalProps> = (props) => {
props.onlyValues?.length
? props.onlyValues.map((p) => ({
content:
- p.content.indexOf('<p>') > -1
+ p.content.indexOf('<p') > -1
? p.content
: p.content
.split('\n')
@@ -214,7 +214,7 @@ export const AddEditModalInnerInner: FC<AddEditModalProps> = (props) => {
? props.set.posts[0].value.map((p: any) => ({
id: makeId(10),
content:
- p.content.indexOf('<p>') > -1
+ p.content.indexOf('<p') > -1
? p.content
: p.content
.split('\n')
diff --git a/apps/frontend/src/components/new-launch/providers/instagram/instagram.preview.tsx b/apps/frontend/src/components/new-launch/providers/instagram/instagram.preview.tsx
index 7ee9dcf6b..68e0d48ec 100644
--- a/apps/frontend/src/components/new-launch/providers/instagram/instagram.preview.tsx
+++ b/apps/frontend/src/components/new-launch/providers/instagram/instagram.preview.tsx
@@ -34,6 +34,7 @@ export const InstagramPreview: FC<{
const finalValue =
`<strong class="text-[15px] font-[600]">${integration?.name} </strong>` +
+ `<span dir="auto">` +
newContent
.slice(start, end)
.replace(/\[\[\[([.\s\S]*?)]]]/, (match, match1) => {
@@ -43,7 +44,7 @@ export const InstagramPreview: FC<{
newContent.slice(end).replace(/\[\[\[([.\s\S]*?)]]]/, (match, match1) => {
return `<span class="font-bold font-[arial]" style="color: #ae8afc">${match1}</span>`;
}) +
- `</mark>`;
+ `</mark></span>`;
return { text: finalValue, images: p.image };
});
diff --git a/libraries/helpers/src/utils/strip.html.validation.ts b/libraries/helpers/src/utils/strip.html.validation.ts
index 0b1c9eada..813e64570 100644
--- a/libraries/helpers/src/utils/strip.html.validation.ts
+++ b/libraries/helpers/src/utils/strip.html.validation.ts
@@ -225,7 +225,7 @@ export const stripHtmlValidation = (
.replace(/&lt;/gi, '<');
}
- if (value.indexOf('<p>') === -1 && !none) {
+ if (value.indexOf('<p') === -1 && !none) {
return value;
}