select with images

main
alexanderroese 2024-07-17 23:30:38 +02:00
parent 75d3ee008d
commit a61b4e2716
1 changed files with 8 additions and 4 deletions

View File

@ -663,17 +663,21 @@
html += `<option value="${optionValue}" ${inputVal === optionValue ? 'selected' : ''}>${optionDisplayName}</option>`;
if (isInputShxFont) {
const fontAssetName = `shx-texte-font-${optionValue.toLowerCase().split(" ").join("-")}.svg`
// const fontAssetName = `shx-texte-font-${optionValue.toLowerCase().split(" ").join("-")}.svg`
const imgSrc = "{{ `${fontAssetName}` | asset_url }}"
// const imgSrc = `{{ '' | asset_url }}${fontAssetName}`;
console.log("fontAssetName", fontAssetName, imgSrc)
console.log("here fontAssetName")
{% assign option_value = optionValue %}
{% assign font_asset_name = "shx-texte-font-" | append: option_value | downcase | replace: " ", "-" | append: ".svg" %}
{% assign img_src = font_asset_name | asset_url %}
customDropdownHtml += `
<div data-value="${optionValue}" class="${inputVal === optionValue ? 'shx-custom-enhanced-dropdown-variant-selected' : ''}" onclick="onFontDropdownItemClick(event)">
<span>${optionDisplayName}</span>
<img src="${imgSrc}" alt="${optionDisplayName}"/>
<img src="{{ img_src }}" alt="${optionDisplayName}"/>
</div>
`
}