From 87aab7ac5b5a64b7ec466048261676f4ef332814 Mon Sep 17 00:00:00 2001 From: azivner Date: Mon, 10 Dec 2018 20:29:49 +0100 Subject: [PATCH] fix attributes leaking into imported notes, #241 --- src/services/import/enex.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/import/enex.js b/src/services/import/enex.js index aeb4f67d0..09339ffed 100644 --- a/src/services/import/enex.js +++ b/src/services/import/enex.js @@ -54,7 +54,11 @@ async function importEnex(file, parentNote) { function extractContent(enNote) { // [] thing is workaround for https://github.com/Leonidas-from-XIV/node-xml2js/issues/484 let content = xmlBuilder.buildObject([enNote]); - content = content.substr(3, content.length - 7).trim(); + + const endOfFirstTagIndex = content.indexOf('>'); + + // strip the <0> and tags + content = content.substr(endOfFirstTagIndex + 1, content.length - endOfFirstTagIndex - 5).trim(); // workaround for https://github.com/ckeditor/ckeditor5-list/issues/116 content = content.replace(/
  • \s+
    /g, "
  • ");