Correction for edit tools

This commit is contained in:
2026-07-23 04:33:21 +02:00
committed by kitoy
parent fb9388a0de
commit 2da8aad1a9
2 changed files with 39 additions and 7 deletions

View File

@@ -10,7 +10,7 @@
onclick="enableModBtn()"
hx-get="{% if page %}/{{ page }}{% endif %}/view/{{ bloc.name }}"
hx-swap="outerHTML"
hx-target="#{{ bloc.name }}" > Annuler </button>
hx-target="#{{ bloc.name }}" > Fermer </button>
</div>
<script>
function enableModBtn(){
@@ -20,9 +20,13 @@
function saveText(){
editor_content = document.getElementById("editor");
result = document.getElementById("text");
if (editor_content != null)
{
document.getElementById("text").innerHTML = quill.getSemanticHTML(0);
console.log(quill.root.innerHTML);
result.innerHTML = quill.root.innerHTML;
delete quill;
}
enableModBtn();

View File

@@ -7,7 +7,6 @@
<!-- Initialize Quill editor -->
<script>
var toolbarOptions = [
@@ -31,11 +30,40 @@
['clean'] // remove formatting button
];
var quill = new Quill('#editor', {
theme: 'snow',
modules: {
syntax: true, // Include syntax module
toolbar: toolbarOptions // Include button in toolbar
toolbar: toolbarOptions, // Include button in toolbar
resize: {
// embed tags to capture resize
embedTags: ["VIDEO", "IFRAME"],
// custom toolbar
tools: [
"left",
"center",
"right",
"full",
"edit",
{
text: "Alt",
attrs: {
title: "Set image alt",
class: "btn-alt",
},
verify(activeEle) {
return activeEle && activeEle.tagName === "IMG";
},
handler(evt, button, activeEle) {
let alt = activeEle.alt || "";
alt = window.prompt("Description de l'image", alt);
if (alt == null) return;
activeEle.setAttribute("alt", alt);
},
},
],
}
},
theme: 'snow'
});
</script>