mirror of
https://github.com/thomiceli/opengist.git
synced 2025-07-13 11:21:51 +02:00
Send Markdown preview data as form params (#347)
This commit is contained in:
@ -71,11 +71,12 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
cmeditor!.classList.remove("hidden-important");
|
||||
return;
|
||||
} else {
|
||||
fetch(`${baseUrl}/preview?` + new URLSearchParams({
|
||||
content: editor.state.doc.toString()
|
||||
}), {
|
||||
method: 'GET',
|
||||
const formData = new FormData();
|
||||
formData.append('content', editor.state.doc.toString());
|
||||
fetch(`${baseUrl}/preview`, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
body: formData
|
||||
}).then(r => r.text()).then(r => {
|
||||
let divpreview = dom.querySelector("div.preview") as HTMLElement;
|
||||
divpreview!.innerHTML = r;
|
||||
|
Reference in New Issue
Block a user