Allow ids for content tabs with special characters

This commit is contained in:
squidfunk
2022-07-02 09:25:09 +02:00
parent 940cfb27f1
commit 209856e724
4 changed files with 8 additions and 8 deletions

View File

@@ -216,7 +216,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.0238f547.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.382fbf4b.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %} {% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script> <script src="{{ path | url }}"></script>
{% endfor %} {% endfor %}

View File

@@ -84,11 +84,11 @@ export function watchContentTabs(
const initial = inputs.find(input => input.checked) || inputs[0] const initial = inputs.find(input => input.checked) || inputs[0]
return merge(...inputs.map(input => fromEvent(input, "change") return merge(...inputs.map(input => fromEvent(input, "change")
.pipe( .pipe(
map(() => getElement<HTMLLabelElement>(`label[for=${input.id}]`)) map(() => getElement<HTMLLabelElement>(`label[for="${input.id}"]`))
) )
)) ))
.pipe( .pipe(
startWith(getElement<HTMLLabelElement>(`label[for=${initial.id}]`)), startWith(getElement<HTMLLabelElement>(`label[for="${initial.id}"]`)),
map(active => ({ active })) map(active => ({ active }))
) )
} }
@@ -196,7 +196,7 @@ export function mountContentTabs(
for (const input of getElements<HTMLInputElement>( for (const input of getElements<HTMLInputElement>(
":scope > input", set ":scope > input", set
)) { )) {
const label = getElement(`label[for=${input.id}]`) const label = getElement(`label[for="${input.id}"]`)
if (label.innerText.trim() === tab) { if (label.innerText.trim() === tab) {
input.click() input.click()
break break