removes formatting from the uploaded html
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user