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);
|
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', {
|
const quill = new Quill('#editor_notes', {
|
||||||
modules: {
|
modules: {
|
||||||
toolbar: toolbarOptions
|
toolbar: toolbarOptions
|
||||||
@@ -324,10 +336,21 @@ include 'header.php';
|
|||||||
placeholder: 'Enter your show notes here...',
|
placeholder: 'Enter your show notes here...',
|
||||||
theme: 'snow'
|
theme: 'snow'
|
||||||
});
|
});
|
||||||
const form = document.querySelector("form");
|
|
||||||
form.addEventListener("formdata", (event) => {
|
function prettyPrintHTML(html) {
|
||||||
event.formData.append("notes", quill.root.innerHTML);
|
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>
|
</script>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
Reference in New Issue
Block a user