removes formatting from the uploaded html

This commit is contained in:
2026-02-24 17:46:26 +01:00
parent 59a4ea3d81
commit c92a73ff4e

View File

@@ -317,6 +317,18 @@ include 'header.php';
event.formData.append("host_profile", quill_profile.root.innerHTML);
});
// const quill = new Quill('#editor_notes', {
// modules: {
// toolbar: toolbarOptions
// },
// placeholder: 'Enter your show notes here...',
// theme: 'snow'
// });
// const form = document.querySelector("form");
// form.addEventListener("formdata", (event) => {
// event.formData.append("notes", quill.root.innerHTML);
// });
const quill = new Quill('#editor_notes', {
modules: {
toolbar: toolbarOptions
@@ -324,10 +336,21 @@ include 'header.php';
placeholder: 'Enter your show notes here...',
theme: 'snow'
});
const form = document.querySelector("form");
form.addEventListener("formdata", (event) => {
event.formData.append("notes", quill.root.innerHTML);
function prettyPrintHTML(html) {
const doc = new DOMParser().parseFromString(html, 'text/html');
return doc.body.innerHTML
.replace(/ /g, ' ')
.replace(/></g, '>\n<');
}
const form = document.querySelector('form');
form.addEventListener('formdata', event => {
const rawHTML = quill.getSemanticHTML();
const prettyHTML = prettyPrintHTML(rawHTML);
event.formData.append('notes', prettyHTML);
});
</script>
</form>
<?php