From 47f897fe8cf0d136a5f71a00ef0e43c218f1860a Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Fri, 18 Jun 2021 13:00:22 +0300 Subject: [PATCH] Use two lines for extracted annotation header and fix title extraction Fixes #2095 --- chrome/content/zotero/xpcom/data/notes.js | 1 + chrome/content/zotero/xpcom/editorInstance.js | 2 +- chrome/locale/en-US/zotero/zotero.properties | 2 +- note-editor | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/notes.js b/chrome/content/zotero/xpcom/data/notes.js index 0f16521886..3a2911b854 100644 --- a/chrome/content/zotero/xpcom/data/notes.js +++ b/chrome/content/zotero/xpcom/data/notes.js @@ -39,6 +39,7 @@ Zotero.Notes = new function() { this.noteToTitle = function(text) { var origText = text; text = text.trim(); + text = text.replace(//g, ' '); text = Zotero.Utilities.unescapeHTML(text); // If first line is just an opening HTML tag, remove it diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index c3fd3c70e3..9e14fb75fd 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -1268,7 +1268,7 @@ class EditorInstance { jsonAnnotation.attachmentItemID = attachmentItem.id; jsonAnnotations.push(jsonAnnotation); } - let html = `

${Zotero.getString('noteEditor.annotationsWithDate', new Date().toLocaleString())}

\n`; + let html = `

${Zotero.getString('noteEditor.annotationsWithDate', new Date().toLocaleString()).replace(/\n/g, '
')}

\n`; let { html: serializedHTML, citationItems } = await editorInstance._serializeAnnotations(jsonAnnotations, true); html += serializedHTML; citationItems = encodeURIComponent(JSON.stringify(citationItems)); diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index b0431d84c6..e83601e9ac 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -1267,7 +1267,7 @@ retraction.citeWarning.text2 = You can view the item in your library for further retraction.citationWarning = A citation in your document has been retracted: retraction.citationWarning.dontWarn = Don’t warn me about this item again -noteEditor.annotationsWithDate = Annotations (%S) +noteEditor.annotationsWithDate = Annotations\n(%S) noteEditor.cut = Cut noteEditor.copy = Copy noteEditor.paste = Paste diff --git a/note-editor b/note-editor index 0651ded628..f0b0689790 160000 --- a/note-editor +++ b/note-editor @@ -1 +1 @@ -Subproject commit 0651ded628bb5a00b0b471ea5d43cf9fac015361 +Subproject commit f0b0689790ea09498e9fc2063649163c992f9bf0