Fix Markdown preview (#368)

This commit is contained in:
Thomas Miceli
2024-11-02 01:05:43 +01:00
committed by GitHub
parent 97b9fa1100
commit d537153785
4 changed files with 11 additions and 6 deletions

View File

@ -73,10 +73,14 @@ document.addEventListener("DOMContentLoaded", () => {
} else {
const formData = new FormData();
formData.append('content', editor.state.doc.toString());
let csrf = document.querySelector<HTMLInputElement>('form#create input[name="_csrf"]').value
fetch(`${baseUrl}/preview`, {
method: 'POST',
credentials: 'same-origin',
body: formData
body: formData,
headers: {
'X-CSRF-Token': csrf
}
}).then(r => r.text()).then(r => {
let divpreview = dom.querySelector("div.preview") as HTMLElement;
divpreview!.innerHTML = r;