set replace " to \" and newline to "\\n"

This commit is contained in:
Дмитрий Шиманский
2023-12-22 22:57:51 +03:00
parent a91de6921f
commit d410c11f6f

View File

@@ -12,9 +12,9 @@ function updateAnnotation(value) {
function sendArticleData () {
let melon = document.cookie.split(';')[0].replace("melon=", "");
let body = `{
title: "${$("#titleInput").val()}",
annotation: "${$("#annotationArea").val()}",
text: "${$("#textArea").val()}",
title: "${$("#titleInput").val().replace(/"/g, '\\"') }",
annotation: "${$("#annotationArea").val().replace(/\t/g, '\r\n').replace(/"/g, '\\"') }",
text: "${$("#textArea").val().replace(/\t/g, '\r\n').replace(/"/g, '\\"') }",
image: "${$("#imgInput").val()}",
author: "${melon}"
}`