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"> class="btn btn-sm btn-outline-info" title="Version française">
<i class="bi bi-translate"></i> FR <i class="bi bi-translate"></i> FR
</a> </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 %} {% endif %}
<a href="{{ path('app_admin_wiki_compare', {'key': page.key}) }}" <a href="{{ path('app_admin_wiki_compare', {'key': page.key}) }}"
class="btn btn-sm btn-outline-secondary" title="Comparer les versions"> class="btn btn-sm btn-outline-secondary" title="Comparer les versions">

View file

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