I'm trying to get ride of this huge 'Note' class, and have it be quite
dumb. The idea is that we'll have separate Note subclasses - TxtNote,
MdNote, etc
This greatly simplifies the entire data flow. Though, it comes at the
risk of introducing bugs, but I think it's worth it.
Plus, it makes everything far far more testable.
This way the disk barely needs to be accessed when loading GitJournal,
and we can hide how long it takes GitJournal to parse all the notes in
the background.
Earlier one could never change a note type, and therefore its extension.
Now you can rename a note's filename to whatever and accordingly the
editor will change.
A warning message is shown when changing the file type.
Fixes#474
Certain Editors only support certain file formats. We can create an
editor either by -
* Giving it a Note, and letting it choose an editor based on the default
/ note metadata
* New Note with a file type
* New Note with a editor type + possible file type
Fixes#78
This is probably the largest commit that I have ever made. From now on -
every File always has an mtime and ctime which is fetched from git.
Notes can optionally override that time by providing yaml metadata.
Additionally the 'filePath' and 'folderPath' is now relative to the
repoPath instead of being the full path.
This will slow down GitJournal like crazy as all the mtimes and ctime
still need to be cached. For my test repo it takes about 23 seconds for
GitJournal to become responsive.
Instead there is a new type called 'UnopenedFile'. This was part of my
effort to not have everything inside the 'Note' class and to make it a
bit more immutable.
But, wow, this took a very long time. The 'Note' class seems to be very
deeply integrated everywhere.
This makes us one step closer to making the Note class immutable which
will help GitJournal's overall architecture a lot. Plus it makes me one
step closer to having proper web support.
Also simplify the loading logic. This makes it much easier to
understand.
With this, I can now slowly migrate the interface of a NotesFolder to be
based on Files instead of Notes.
I'm trying to expand GitJournal and let it understand the concept of
different Files. Right now everything is mashed into the "Note" class,
which is messy.
This way we avoid parsing the tags from the body again and again, also
I can make the tags processing more complex without worrying too much
about the computational overhead.