From c92a73ff4eb4c4de71bd7fd6f0e776a5479d758d Mon Sep 17 00:00:00 2001 From: Ken Fallon Date: Tue, 24 Feb 2026 17:46:26 +0100 Subject: [PATCH] removes formatting from the uploaded html --- hub/upload.php | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/hub/upload.php b/hub/upload.php index 7337328..5e49334 100644 --- a/hub/upload.php +++ b/hub/upload.php @@ -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(/>\n<'); + } + + const form = document.querySelector('form'); + form.addEventListener('formdata', event => { + const rawHTML = quill.getSemanticHTML(); + const prettyHTML = prettyPrintHTML(rawHTML); + event.formData.append('notes', prettyHTML); }); +