From 36cc18e8cf349eb2e35ae5e5eefb57fb94b51d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Tue, 27 Oct 2020 15:00:23 +0200 Subject: [PATCH] Add root html tags if not present for note insertion --- chrome/content/zotero/xpcom/integration.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js index 1f977fe323..20e5684f47 100644 --- a/chrome/content/zotero/xpcom/integration.js +++ b/chrome/content/zotero/xpcom/integration.js @@ -1444,9 +1444,13 @@ Zotero.Integration.Session.prototype._processNote = function (item) { Zotero.logError(e); } } - text = text.replace(/[\u00A0-\u9999\&]/gim, function(i) { + // Encode unicode chars + text = text.replace(/[\u00A0-\u9999\&]/gim, function (i) { return '&#'+i.charCodeAt(0)+';'; }); + if (!text.startsWith('')) { + text = `${text}`; + } return [text, citations, placeholderIDs]; };