Add fallback for missing changelog
parent
3df82a36b8
commit
ed77fa31f5
|
@ -231,17 +231,19 @@ function fillWithPostData(hw: HandiWork, elements: IPostElement[]) {
|
||||||
//#region Get the changelog
|
//#region Get the changelog
|
||||||
hw.changelog = [];
|
hw.changelog = [];
|
||||||
const changelogElement = getPostElementByName(elements, "changelog") || getPostElementByName(elements, "change-log");
|
const changelogElement = getPostElementByName(elements, "changelog") || getPostElementByName(elements, "change-log");
|
||||||
const changelogSpoiler = changelogElement?.content.find(el => {
|
if (changelogElement) {
|
||||||
return el.type === "Spoiler" && el.content.length > 0;
|
const changelogSpoiler = changelogElement?.content.find(el => {
|
||||||
});
|
return el.type === "Spoiler" && el.content.length > 0;
|
||||||
|
});
|
||||||
|
|
||||||
// Add to the changelog the single spoilers
|
// Add to the changelog the single spoilers
|
||||||
changelogSpoiler.content.forEach(el => {
|
changelogSpoiler?.content.forEach(el => {
|
||||||
if (el.text.trim()) hw.changelog.push(el.text);
|
if (el.text.trim()) hw.changelog.push(el.text);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add at the ened also the text of the "changelog" element
|
// Add at the end also the text of the "changelog" element
|
||||||
hw.changelog.push(changelogSpoiler.text);
|
hw.changelog.push(changelogSpoiler.text);
|
||||||
|
}
|
||||||
//#endregion Get the changelog
|
//#endregion Get the changelog
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue