40 Commits

Author SHA1 Message Date
b0cc615aae Move MdYamlDoc loading to its own class 2020-03-14 23:33:04 +01:00
8b48650ad8 Note: Reload the file when it changes
We were comparing the file modification date incorrectly

Fixes #65
2020-03-11 12:55:07 +01:00
f0eeefe125 SortedNotesFolder: Avoid calling sort again and again
For long lists of notes this could get very very expensive.
2020-03-08 04:00:27 +01:00
56d8f635eb Note class should not be sortable
There are various different methods of sorting an note.
2020-03-06 20:14:21 +01:00
de2553c31f Mark new notes as Loaded 2020-03-01 17:14:01 +01:00
c90189e55b Note: Do not try to generate the summary if not loaded 2020-03-01 14:28:10 +01:00
d50f772468 Only have one SortingMode class
It doesn't make sense to duplicate it.
2020-03-01 13:40:16 +01:00
020c65e132 Minor cleanup 2020-02-28 14:16:05 +01:00
d137fb83cf Add experimental support for not saving the yaml header
Fixes #19

This is experimental as it changes the whole concept of a Note - We have
till now always assumed that a Note can have attached metadata. With
this, there is no longer any metadata. So other parts of the application
need to start reacting accordingly. For example the Mardkown Editor
should not allow you to modify the title.

This also makes it easier to implement '.txt' file support.
2020-02-18 22:29:16 +01:00
b9c7fed6dc Add emjoi support
Only supported for the body and title of notes.

Fixes #62
2020-02-15 02:06:48 +01:00
46a38cdedf Rename NoteData -> MdYamlDoc
It more clearly defines what exactly it is.

This is important as its less confusing for when we add support for
other file types.
2020-02-14 08:12:41 +01:00
d5f5b4975a Note Summary: Avoid reparsing the markdown on each build
Save it after it is done once. This should result in a significant
performance boost - over 22% while showing the list view. Also, now with
the addition of a few more animations, this is even more important.
2020-02-11 19:08:33 +01:00
9c02f1d8ac Allow the sorting mode to be toggled 2020-02-09 19:37:10 +01:00
20f8d7f7fe NoteEditor: Improve modified check
If the only modification is the addition of a 'modified' tag, then we
shouldn't count it as modified.

I'm not too fond of this logic.
2020-02-09 17:34:12 +01:00
3d12c833d3 Revert "Deletes Note.compareTo"
This reverts commit 6cf5454f7940c9aee65279c4635f84b04f9ec700.

Having this compareTo makes testing easier.
2020-02-06 11:52:27 +01:00
6cf5454f79 Deletes Note.compareTo
Notes should no longer have a default comparison method. Since sorting
will soon be configurable (and is currently disabled), lets just remove
this method.
2020-02-06 01:53:16 +01:00
f9a2f4c875 Add some FIXMEs 2020-01-31 16:17:30 +01:00
43281bd2bb Add support for moving a Note to another folder
The Folder selection dialog needs a lot of work, but it's a start.
2020-01-29 16:51:57 +01:00
3f40a2992a Add the concept of Editors
* We no longer have a separate editing and browsing view - This does
mean we loose the ability to quick flip between notes by swiping.
However, this is more how a note editor would behave. I do later want to
add that capability back.

* We have 2 editors for now - Markdown and Raw. By default we use the
Markdown editor which can be toggled between Preview / Edit mode.

I later want to add a rich text editor and a todo editor as well.
2020-01-29 00:04:24 +01:00
f8e7773f16 NoteBrowser: Add a button to rename notes
Fixes #23
2020-01-27 23:09:11 +01:00
4be91f92f0 Note FileName: Save them by default with the title
If that title already exists add an _Num at the end.

This won't change the default for existing users, as our settings system
saves the default value and will just load it the next time. This really
needs to be improved.
2020-01-07 23:54:44 +01:00
442d9d2b4e Allows Notes to have a different modified yaml key
Possible Options - modified, mod, lastModified, lastMod, lastmodified or
lastmod. When read the the note we will figure out which one is being
used and accordingly write back that value.

This makes it easier to use GitJournal for editing Hugo websites as they
usually use the 'lastmod' field to indicate when the post was last modified.
2020-01-05 18:12:35 +01:00
3285712acc Sort based on file last modified if 'modified' and 'created' not present 2020-01-02 12:08:17 +01:00
2821eb1f8b Note sorting: 'created' can now be null
Earlier it was always something
2020-01-01 19:50:52 +01:00
36d1ae43c3 Split NoteData and its serializer into its own file 2020-01-01 19:50:31 +01:00
14e7f344d1 Add an explicit serializer from Note -> NoteData
This is so that we can start configuring what the yaml metadata keys
should be called, and not have them hardcoded.

This also allows the note.created to be null. Earlier we were always
setting it to some value. That's doesn't seem right.
2020-01-01 19:29:57 +01:00
b35d5f4337 Use YAML serializer package
This code might be useful to someone else
2019-12-29 12:03:42 +01:00
53839c9101 Surround the title by quotes before saving it to yaml
Otherwise people can put # or : or something else in the title and that
will result in invalid YAML.

Also escape any existing '. YAML is weird that the method of escaping a
' is by specifying it twice. It's sad that there is no dart YAML
serializer, and I'm surely missing some other edge cases. The YAML
specification is quite long.
2019-12-28 01:12:18 +01:00
2b09708793 JournalListing: Show the title
It's no longer a simple JournalListing and instead we also show the
title. The main problem is with what to do when the title is not there.
Just leaving it blank seems to feel weird, specially when the note is
too small.

Maybe it's time to change it such that each row size is not the same.
We're effectively wasting whitespace right now for very small notes.
2019-12-27 11:34:15 +01:00
895d2f4f1b Give each Note a title
We're moving away from being a Journal Editor to being a Note Editor. I
don't want to discard the Journaling parts, as Journaling is really a
subset of Note Taking - so in the future it would be nice if this could
be somehow toggled.

Maybe each Folder can have different display settings. Probably in the
"pro" version.
2019-12-27 11:05:32 +01:00
6790bfe9f5 Fix Note sorting function 2019-12-14 12:06:07 +01:00
bc6f7c1b8f Note: Load the modified tag properly 2019-12-14 12:05:52 +01:00
880f290d82 New note: fix 'created' not being serialized 2019-12-09 01:36:55 +01:00
b0b7da5291 Move storage classes into core
The Git functionality is fairly core!
2019-12-09 01:19:44 +01:00
cd24d2688f Never let the Note be in an invalid state
It's a bit confusing that the created date has to be set when creating a
new note, and the path had to be constructured properly, without which
the note shouldn't be saved. Ideally, an object shouldn't be able exist
in such an inconsistent state.
2019-12-09 01:14:45 +01:00
6c10fa8a0f Improve Note sorting
* First by modified
* Then by created
* Then by file Path

I feel like there must be a simpler way of writing this compareTo
function.
2019-12-09 00:14:00 +01:00
76f70f0d18 Note: Store when last modified
Also sort the notes based on when last modified. Now that we're moving
towards being a more note-taking app, it makes sense that a recently
modified note goes on top.

Of course, the sorting should be controllable by the user, but the
default probably should be by when modified.
2019-12-09 00:02:40 +01:00
a51f8f170f Make Note and NotesFolder ChangeNotifiers
This will allow us for finer grained notifications of when things change
so we don't have to rebuild everything, like we do currently.
2019-12-06 01:22:57 +01:00
5b8fc6342a Connect the AppState to the Folders
Now when adding/editing/removing a note, it gets modified from the
directory it was present in. There is no longer a just a plain list of
all notes, but always a tree of notes, which are inside Folders.
2019-12-04 15:33:30 +01:00
464b7512e9 Move Note and NoteFolder class into a core folder 2019-12-04 14:18:11 +01:00