A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: period is stripped from headline extraction
thecodrr83e896ce1e95
diff --git a/packages/core/__tests__/notes.test.js b/packages/core/__tests__/notes.test.jsindex b3b1c1183..68edb7f8e 100644--- a/packages/core/__tests__/notes.test.js+++ b/packages/core/__tests__/notes.test.js@@ -63,6 +63,18 @@ test("note without a title should get title from content", () =>expect(note.title).toBe("HelloThis is colorful");}));+test("note should get headline from content", () =>+ noteTest({+ ...TEST_NOTE,+ content: {+ type: TEST_NOTE.content.type,+ data: "<p>This is a very colorful existence.</p>",+ },+ }).then(async ({ db, id }) => {+ let note = db.notes.note(id);+ expect(note.headline).toBe("This is a very colorful existence.");+ }));+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.jsindex cb77dfbb4..6e2ca52c8 100644--- a/packages/core/content-types/tiny.js+++ b/packages/core/content-types/tiny.js@@ -61,13 +61,15 @@ export default Tiny;function getHeadlineFromText(text) {for (var i = 0; i < text.length; ++i) {const char = text[i];+ const nextChar = text[i + 1];if (char === "\n" ||char === "\t" ||char === "\r" ||- char === "." ||+ (char === "." && nextChar === " ") ||i >= 120) {+ if (char === ".") ++i;return text.substring(0, i);}}