Пофиксил проблему загрузки постов

This commit is contained in:
ifraimka1 committed 2025-05-06 17:21:25 +03:00
1 parent 1303ba3c89
commit 6684449986
2 files changed
+5 -8

No files matched your search

+4 -7
View File
@@ -27,14 +27,14 @@ export const parseContent = (html: string): ParsedContent[] => {
}
return; // Пропускаем добавление figure в результат
}
// Если есть накопленные медиа-элементы, добавляем их как mediablock
if (mediaBuffer.length > 0) {
result.push({ type: "mediablock", value: [...mediaBuffer] });
mediaBuffer = [];
}
if (node.props.className.includes('wp-block-gallery')) {
if (node.props.className?.includes('wp-block-gallery')) {
const slider = [];
for (const child of node.props.children) {
const imgSrc = child.props?.children.props?.src;
@@ -42,10 +42,10 @@ export const parseContent = (html: string): ParsedContent[] => {
slider.push(imgSrc);
}
}
result.push({ type: "slider", value: slider })
result.push({ type: "slider", value: slider });
return;
}
// Сохраняем текущий элемент как есть
result.push({ type: "html", element: node });
};
@@ -61,8 +61,5 @@ export const parseContent = (html: string): ParsedContent[] => {
result.push({ type: "mediablock", value: [...mediaBuffer] });
}
console.log('nonParsedElements', elements);
console.log('parsedElements', result);
return result;
};
+1 -1
View File
@@ -291,7 +291,7 @@ declare namespace App {
value: string[];
}
export type ParsedContent = HtmlElement | MediaBlock;
export type ParsedContent = HtmlElement | MediaBlock | Slider;
export interface WpPost {
id: number;