Skip to content

Commit

Permalink
Fixed missing images for convention figure (#487)
Browse files Browse the repository at this point in the history
Removed link to topics for tagName 'wird_abgebildet_durchThemaRef'
  • Loading branch information
Bock4Soft authored Jun 25, 2024
1 parent 3f95e18 commit ee8fc57
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
getJsonDataFromXml,
getMenuItemByAttributeValue,
getSearchStringFromHash,
replaceImageUrlInText,
replaceUrlInText,
} from '../../../../shares/utils';
import { AnchorLinkItemProps } from 'antd/es/anchor/Anchor';
Expand All @@ -32,7 +33,7 @@ import { ProjectType } from '../../projekt/project';
function getConceptMappingData(conceptMapping: XMLElement, tagName: string, suffix: string): DataEntry[] {
return conceptMapping.getElementsByTagName(tagName).map((data: XMLElement) => {
const dataEntry: DataEntry = {
id: data.attributes.id,
id: tagName !== 'wird_abgebildet_durchThemaRef' ? data.attributes.id : undefined,
title: data.attributes?.name || data.attributes?.titel,
suffix: suffix,
};
Expand Down Expand Up @@ -1726,7 +1727,7 @@ export function Content() {
return {
id: jsonDataFromXml.attributes.id,
header: jsonDataFromXml.attributes.name,
descriptionText: summary,
descriptionText: replaceImageUrlInText(summary, tailoringParameter),
tableEntries: tableEntries,
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function TableEntriesList(props: { inputData: DataEntry[] }) {
} else {
entries.push(
<span style={{ marginRight: '20px' }} key={`table-item-entrySubItem-${innerEntryItemIndex}`}>
{parse(fixLinksInText(innerEntryItem.title))}
<span style={{ color: '#333' }}>{parse(fixLinksInText(innerEntryItem.title))}</span>
{innerEntryItem.suffix && <span style={{ marginLeft: '5px' }}>{innerEntryItem.suffix}</span>}
</span>
);
Expand All @@ -60,7 +60,7 @@ export function TableEntriesList(props: { inputData: DataEntry[] }) {
} else {
entries.push(
<span style={{ marginRight: '20px' }} key={`table-item-entryItem-${entryItemIndex}`}>
{parse(fixLinksInText(entryItem.title))}
<span style={{ color: '#333' }}>{parse(fixLinksInText(entryItem.title))}</span>
{entryItem.suffix && <span style={{ marginLeft: '5px' }}>{entryItem.suffix}</span>}
</span>
);
Expand Down
9 changes: 9 additions & 0 deletions client/src/shares/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ export function replaceUrlInText(text: string, tailoringParameter: any, projectF
);
}

export function replaceImageUrlInText(text: string, tailoringParameter: any): string {
return text.replace(
/src=['"](?:[^"'\/]*\/)*([^'"]+)['"]/g,
'src="https://vm-api.weit-verein.de/Tailoring/V-Modellmetamodell/mm_2021/V-Modellvariante/' +
tailoringParameter.modelVariantId +
'/Projekttyp/xxx/Projekttypvariante/xxx/Grafik/images/$1"'
);
}

export function removeLinksFromHtml(htmlString: string) {
const elem = document.createElement('div');
elem.innerHTML = htmlString;
Expand Down

0 comments on commit ee8fc57

Please sign in to comment.