Could you explain in more technical terms how the notes work? I assumed it was just field on the data but then I accidentally added two. How are they stored? Are they exportable? When exported how are they linked to locations? How simple would implementing basic markdown in them be? Thanks!
Sure thing!
They’re stored as a separate Notes table in the database, which have … actually let me check the schema…
try db.create(table: "Note") { table in
table.primaryKey("id", .text)
table.column("lastSaved", .datetime).notNull().defaults(sql: "CURRENT_TIMESTAMP")
table.column("source", .text).notNull().indexed()
table.column("creationDate", .datetime).notNull()
table.column("startDate", .datetime).notNull().indexed()
table.column("endDate", .datetime).notNull().indexed()
table.column("deleted", .boolean).notNull()
table.column("body", .text).notNull()
table.column("timelineItemId", .text).indexed()
.references("TimelineItemBase", onDelete: .setNull, deferred: true)
}
Ok so “body” is the content of the note, and its relationship to TimelineItems is by an option reference to the item’s id, to associate it with the item that it was added from.
It also has date values, which the UI can also use to show any notes that fall within an item’s date range, even if the notes aren’t directly associated with the item by id. (That’s actually a bug I’m fixing today - they were losing that item id reference when items got merged during processing).
So notes can either appear under an item by direct reference to the item’s id, or by virtue of falling within the item’s date range.
I hope they’re exportable! though I’m uncertain on whether they’re included in the current JSON exports. I’ll check that now… Oh dear, they’re not! I’ll put that on the todos as high priority.
My instinct is to say “not too difficult”, but the devil will be in the details I think. Like, parsing Markdown for presentation is trivial and essentially built in to SwiftUI these days. But the actual editor would require considerable complexity. But I’m guessing that’s something that’s already been built many times, and is available out there on Github, ready for reuse.
Yeah that was my initial thought but I imagine getting tool bars and nice functionality would be a bit more difficult. And y’know if you built it you might as well built it right, with smart brackets and auto hide for text formatting, etc.
Anyways, I’ll put this all over on changemap when I get a good break from life’s other battles.
Yeah Changemap feels like a good place for it. If it gets enough votes over there it essentially becomes a lock - it’s gonna get built. I’ve got a feeling there’s also some other entries there of the “improve notes / journaling” type. Worth voting on those too!