copier les titres de section au clic

This commit is contained in:
Tykayn 2025-09-01 16:02:14 +02:00 committed by tykayn
parent b7caf96929
commit bcd1691b50
2 changed files with 23 additions and 9 deletions

View file

@ -241,6 +241,12 @@
class="btn btn-sm btn-outline-info" title="Version française">
<i class="bi bi-translate"></i> FR
</a>
{% else %}
<a href="{{ path('app_admin_wiki_create_french', {'key': page.key}) }}"
class="btn btn-sm btn-success"
title="Créer une traduction française">
<i class="bi bi-plus-circle"></i> Traduire
</a>
{% endif %}
<a href="{{ path('app_admin_wiki_compare', {'key': page.key}) }}"
class="btn btn-sm btn-outline-secondary" title="Comparer les versions">

View file

@ -21,10 +21,14 @@
padding: 3px;
}
.section-title,
.suggestion-before, .suggestion-after {
cursor: pointer;
min-width: 80%;
display: inline-block;
}
.section-title:hover,
.suggestion-before:hover, .suggestion-after:hover {
color: #d1e7dd;
background: #0f5132;
@ -33,7 +37,6 @@
.suggestion-correction {
color: #0f5132;
background: #d1e7dd;
background: #ccc;
border-radius: 3px;
padding: 3px;
display: block;
@ -59,24 +62,29 @@
}
.title-level-2 {
padding-right: 1.5rem;
padding-left: 1.5rem;
opacity: 0.8;
}
.title-level-3 {
padding-right: 2.8rem;
padding-left: 2.8rem;
opacity: 0.5;
}
.title-level-4 {
padding-right: 4rem;
padding-left: 4rem;
opacity: 0.4;
}
.title-level-5 {
padding-right: 5.2rem;
padding-left: 5.2rem;
opacity: 0.3;
}
.title-level-6 {
padding-right: 6.4rem;
padding-left: 6.4rem;
font-size: 0.9rem;
opacity: 0.2;
}
/* Style for placeholder sections */
@ -179,7 +187,7 @@
<li class="list-group-item title-level-{{ section.level|default(1) }}">
<span class="badge bg-secondary pull-right">h{{ section.level|default(1) }}</span>
{% if section.title is defined and section.title is not empty %}
{{ section.title }}
<span class="section-title">{{ section.title }}</span>
{% endif %}
</li>
{% endfor %}
@ -207,7 +215,7 @@
<li class="list-group-item title-level-{{ section.level|default(1) }}">
<span class="badge bg-secondary pull-right">h{{ section.level|default(1) }}</span>
{% if section.title is defined and section.title is not empty %}
{{ section.title }}
<span class="section-title">{{ section.title }}</span>
{% endif %}
</li>
{% endfor %}
@ -949,7 +957,7 @@
});
// Add click event listeners to all suggestion-correction elements
document.querySelectorAll('.suggestion-correction, .suggestion-before, .suggestion-after').forEach(function (element) {
document.querySelectorAll('.suggestion-correction, .suggestion-before, .suggestion-after, .section-title').forEach(function (element) {
element.addEventListener('click', function () {
// Get the text content to copy
const content = this.textContent.trim();