From 3de7b6c5ec4a7e8ca580b9c74e5fe27546344c7d Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Wed, 21 Apr 2021 15:55:27 +0300 Subject: [PATCH] Trim whitespace from highlights and comments when creating a note --- chrome/content/zotero/xpcom/editorInstance.js | 7 ++++--- pdf-reader | 2 +- pdf-worker | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 97cad0cde9..11e93e78bc 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -239,7 +239,8 @@ class EditorInstance { let storedAnnotation = { uri: Zotero.URI.getItemURI(attachmentItem), - text: annotation.text, + // trim() here is necessary because of already existing annotations + text: annotation.text ? annotation.text.trim() : annotation.text, color: annotation.color, pageLabel: annotation.pageLabel, position: annotation.position @@ -294,12 +295,12 @@ class EditorInstance { // Text if (annotation.text) { - highlightHTML = `“${annotation.text}”`; + highlightHTML = `“${annotation.text.trim()}”`; } // Note if (annotation.comment) { - commentHTML = ' ' + annotation.comment; + commentHTML = ' ' + annotation.comment.trim(); } let otherHTML = [highlightHTML, citationHTML, commentHTML].filter(x => x).join(' '); diff --git a/pdf-reader b/pdf-reader index ce7dbf74fa..a2ed2bde49 160000 --- a/pdf-reader +++ b/pdf-reader @@ -1 +1 @@ -Subproject commit ce7dbf74fa0535b0b45eeeb942ceb001e693034a +Subproject commit a2ed2bde4914f08d0cbc92668ac959894897f9cf diff --git a/pdf-worker b/pdf-worker index ca6dd5557f..6ae6292949 160000 --- a/pdf-worker +++ b/pdf-worker @@ -1 +1 @@ -Subproject commit ca6dd5557fa30675a7556ca88cbda046335b6edb +Subproject commit 6ae6292949bfc5463245d61f6e785a187b2a2b3a