diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.js
index e6e60fa87..c84a1992c 100644
--- a/packages/core/__tests__/notes.test.js
+++ b/packages/core/__tests__/notes.test.js
@@ -75,6 +75,18 @@ test("note should get headline from content", () =>
expect(note.headline).toBe("This is a very colorful existence.");
}));
+test("note should get headline from content containing only lists", () =>
+ noteTest({
+ ...TEST_NOTE,
+ content: {
+ type: TEST_NOTE.content.type,
+ data: `
- Hello I won't be a headline :(
- Me too.
- Gold.
`,
+ },
+ }).then(async ({ db, id }) => {
+ let note = db.notes.note(id);
+ expect(note.headline).toBe("Hello I won't be a headline :(Me too.Gold.");
+ }));
+
test("note title should allow trailing space", () =>
noteTest({ title: "Hello ", content: TEST_NOTE.content }).then(
async ({ db, id }) => {
diff --git a/packages/core/content-types/tiny.js b/packages/core/content-types/tiny.js
index 6516aba21..ca3bf5847 100644
--- a/packages/core/content-types/tiny.js
+++ b/packages/core/content-types/tiny.js
@@ -15,9 +15,9 @@ class Tiny {
}
toTXT() {
- if (window.DOMParser) {
+ if ("DOMParser" in window || "DOMParser" in global) {
let doc = new DOMParser().parseFromString(this.data, "text/html");
- return (doc.body || doc.firstElementChild).textContent || "";
+ return doc.body.textContent.trim();
} else {
return decode(
this.data.replace(/
]*>/gi, "\n").replace(/<[^>]+>/g, "")