feat(blog): جدول — ستون‌ها قابل تغییر اندازه/افزودن و حذف؛ لینک کپشن تصویر؛ هدینگ‌های نسخه انگلیسی بزرگ‌تر

This commit is contained in:
aramesh-site deploy
2026-10-06 10:57:01 +00:00
parent 61a2e95278
commit 1b491357ab
45 changed files with 2341 additions and 81 deletions
+16 -1
View File
@@ -18,6 +18,12 @@ export const ArticleImage = Image.extend({
parseHTML: (element) =>
element.closest('figure')?.querySelector('figcaption')?.textContent?.trim() ?? '',
},
// پیوند کپشن — کل متن figcaption به این نشانی لینک می‌شود
caption_href: {
default: '',
parseHTML: (element) =>
element.closest('figure')?.querySelector('figcaption a')?.getAttribute('href') ?? '',
},
}
},
@@ -35,6 +41,7 @@ export const ArticleImage = Image.extend({
alt: img.getAttribute('alt'),
title: img.getAttribute('title'),
caption: element.querySelector('figcaption')?.textContent?.trim() ?? '',
caption_href: element.querySelector('figcaption a')?.getAttribute('href') ?? '',
}
},
},
@@ -51,12 +58,20 @@ export const ArticleImage = Image.extend({
]
// کپشن خالی → عنصر figcaption اصلاً رندر نمی‌شود (فقط تصویر می‌ماند)
const captionHref = (HTMLAttributes.caption_href as string | undefined)?.trim() ?? ''
const figcaption: Array<string | Record<string, unknown>> = captionHref
? [
'a',
{ href: captionHref, target: '_blank', rel: 'noopener noreferrer nofollow' },
caption,
]
: [caption]
return caption
? [
'figure',
{ class: 'article-figure' },
image,
['figcaption', { class: 'article-figure__caption' }, caption],
['figcaption', { class: 'article-figure__caption' }, ...figcaption],
]
: ['figure', { class: 'article-figure' }, image]
},