Properly format newlines of plain text ICS entries

This commit is contained in:
FliegendeWurst 2021-08-24 14:46:28 +02:00
parent a1371b2948
commit 974d544db8
2 changed files with 4 additions and 4 deletions

View File

@ -32,9 +32,9 @@ const targetTemplate = await api.currentNote.getRelationValue('targetTemplate');
const options = {
"parentNoteId": dayNote.noteId,
"title": name,
"content": summaryHtml != "" ? summaryHtml : summary,
"content": summaryHtml != "" ? summaryHtml : summary.replace(/\n/g, "<br>").replace(/\r/g, ""),
"type": "text",
"mime": summaryHtml != "" ? "text/html" : "text/plain"
"mime": "text/html"
};
const resp = await api.createNewNote(options);
const note = resp.note;

View File

@ -142,8 +142,8 @@ async fn process_one(update: Update, context: &mut Context) -> Result<(), Error>
if CLIENT.get(&trilium_url("/custom/new_event")).form(&json!({
"uid": calendar.events[0].uid,
"name": calendar.events[0].summary,
"summary": calendar.events[0].description,
"summaryHtml": calendar.events[0].description_html.as_deref().unwrap_or_default(),
"summary": calendar.events[0].description.replace("\\n", "\n"),
"summaryHtml": calendar.events[0].description_html.as_deref().map(|x| x.replace("\\n", "\n")).unwrap_or_default(),
"fileName": document.file_name,
"fileData": text,
"location": calendar.events[0].location,