Trim whitespace from highlights and comments when creating a note
This commit is contained in:
parent
6eed0876de
commit
3de7b6c5ec
3 changed files with 6 additions and 5 deletions
|
@ -239,7 +239,8 @@ class EditorInstance {
|
||||||
|
|
||||||
let storedAnnotation = {
|
let storedAnnotation = {
|
||||||
uri: Zotero.URI.getItemURI(attachmentItem),
|
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,
|
color: annotation.color,
|
||||||
pageLabel: annotation.pageLabel,
|
pageLabel: annotation.pageLabel,
|
||||||
position: annotation.position
|
position: annotation.position
|
||||||
|
@ -294,12 +295,12 @@ class EditorInstance {
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
if (annotation.text) {
|
if (annotation.text) {
|
||||||
highlightHTML = `<span class="highlight" data-annotation="${encodeURIComponent(JSON.stringify(storedAnnotation))}">“${annotation.text}”</span>`;
|
highlightHTML = `<span class="highlight" data-annotation="${encodeURIComponent(JSON.stringify(storedAnnotation))}">“${annotation.text.trim()}”</span>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
if (annotation.comment) {
|
if (annotation.comment) {
|
||||||
commentHTML = ' ' + annotation.comment;
|
commentHTML = ' ' + annotation.comment.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
let otherHTML = [highlightHTML, citationHTML, commentHTML].filter(x => x).join(' ');
|
let otherHTML = [highlightHTML, citationHTML, commentHTML].filter(x => x).join(' ');
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit ce7dbf74fa0535b0b45eeeb942ceb001e693034a
|
Subproject commit a2ed2bde4914f08d0cbc92668ac959894897f9cf
|
|
@ -1 +1 @@
|
||||||
Subproject commit ca6dd5557fa30675a7556ca88cbda046335b6edb
|
Subproject commit 6ae6292949bfc5463245d61f6e785a187b2a2b3a
|
Loading…
Add table
Add a link
Reference in a new issue