146 Commits

Author SHA1 Message Date
015659d58f Allow a note to be renamed to whatever
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
2021-11-15 12:39:12 +01:00
a149371a44 Map EditorTypes with NoteFileFormat
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
2021-11-09 15:43:57 +01:00
f8926d9eda NotesCache: Add pinned files
This way the view doesn't change later.
2021-11-04 15:10:24 +01:00
e1ea7a4953 Fetch the modified + created time from git
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.
2021-10-26 17:49:08 +02:00
f87793acbf NotesCache: Save it as a 'File'
This way it'll also be sorted correctly later.
2021-10-20 22:31:12 +02:00
729764c518 Remove NoteLoadState
It's no longer required as a Note can never be in an Error state, it
becomes an 'IgnoredFile'
2021-10-18 13:09:47 +02:00
7a56d0f423 Remove Note's default constructor
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.
2021-10-18 13:03:22 +02:00
5f07543db2 Remove Note's doc setter
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.
2021-10-17 22:22:33 +02:00
7f9beb0d5c NoteFileTypes: Hook up selector to the settings 2021-10-15 17:33:19 +02:00
ff46c38599 NotesFolderFS: Operate on 'File' instead of 'Note'
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.
2021-10-15 15:38:12 +02:00
88697c1965 Make Note implement the 'File' interface.
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.
2021-10-15 12:41:54 +02:00
6a915864f2 Move NotesFolder's code to their own folder
The 'core' folder is becoming way too huge.
2021-10-15 12:31:35 +02:00
efffec0a1a Allow changing the default note file format 2021-10-12 14:02:22 +02:00
c4ef1f569b Use flutter_lint
Instead of picking lint values. This way I don't need to routinely
looking at extra lints to enable.
2021-09-21 15:42:13 +02:00
4daea0a14f Use optional instead of checking if empty
This is legacy code before we had null checks
2021-09-16 22:49:09 +02:00
510b277398 Add Note.apply
Avoid calling each setter as each results in the entire tree being
rebuilt.
2021-09-16 20:07:33 +02:00
33a731a3d7 Add reuse licensing to files in lib 2021-09-15 13:06:43 +02:00
cfaf1436f1 Move the MarkdownYamlCodec out of the Note class 2021-09-09 10:08:38 +02:00
fdc79828c7 Move note.load to NoteStorage
Now the note class is almost ready to become immutable
2021-09-09 10:01:36 +02:00
c53b7ebbd1 Note: fileLastModified should never be null
This simplifies so much of the code.
2021-09-07 00:00:42 +02:00
665d1dce2b Add a Materialized View for the Links
Calculating the links is very expensive, this way we finally don't need
to do it each time!
2021-09-06 16:57:30 +02:00
db80229209 Stop Note from being a ChangeNotifier
The only one listening was the parent folder. This simplifies the note
class a lot. Also it gets us one step closer from making the note more
dumb.
2021-09-05 11:23:51 +02:00
7abfc505e3 Note: move rename function to the parent
I want the note class to have a simple object with no internal state
mutation.
2021-09-05 11:15:24 +02:00
0231cbd3bc Note: Move 'move' function out of note
It doesn't need access to any of the note internals. For now I've placed
it in notes_folder_fs, though it really doesn't need to be there as
well.
2021-09-05 11:09:17 +02:00
abc9a31290 Add InlineTags Materialized View
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.
2021-08-31 22:59:41 +02:00
130eb852b2 Note: Move summary to a MaterializedView
This way it doesn't need to be computed each time the app loads.
2021-08-31 21:48:27 +02:00
0384bba656 Note: Remove unused member 'images' 2021-08-31 17:12:50 +02:00
5ea80fb617 Note: Move Image code to its own class
The Note class is way way too huge and has too many responsabilities. I
would like the Note class to be very small and immutable.
2021-08-31 12:30:47 +02:00
4d1dff32fa OrgMode: Add images with the correct markup
It was using the markdown syntax.

Related to #145
2021-08-04 08:40:15 +02:00
ef1536223d Remove Note.addImageSync
We can just always use the async version.
2021-08-04 08:28:10 +02:00
a0a97aa8cb Cleanup code 2021-08-04 08:17:49 +02:00
d53154aa8e Remove note.remove
Only being used in a test
2021-08-04 08:13:48 +02:00
39096c270c Note.save: Move to NoteStorage
I'm trying to move all FS related operations out of the Note class, and
ideally make it super small. This class will need to be serialized over
the wire for the web version, and that needs it to be small.
2021-08-04 08:03:48 +02:00
3a71cca202 Move logging code to its own folder 2021-07-30 14:39:13 +02:00
2505d00dfb Replace dart:io with universal_io
Platform from dart:io cannot be used on the web for reasons. And this
way we get a fake File/Directory class which we can use for atleast
running the web version, even if it won't work.
2021-07-30 11:39:26 +02:00
eca8bea239 Avoid modifying the note's state if not required 2021-07-26 18:55:51 +02:00
e3526b4911 Minor refactoring 2021-07-26 16:51:58 +02:00
0ea8da0d44 Remove a few more cases of dart:io usage
I want to abstract out all uses of File and Directory. The sooner I can
do that the sooner I can use it on the web.
2021-07-23 15:18:25 +02:00
fe1f28717b Note: Remove unused method 2021-07-07 17:12:42 +02:00
d4a345ea89 Avoid using 'dart:io' wherever possible
This gets us one step closer to supporting the web.
2021-07-01 01:46:01 +02:00
3e91e7d734 note: Try to use Result class
This is useless as the error handling isn't really taken into account
across the code base.
2021-06-25 09:01:07 +02:00
a3c539bf1f MdYamlDocLoader: Use Result
Instead of annoying exceptions.
2021-06-10 03:33:35 +02:00
d6e2f09a72 Move all settings code to its own folder
Jumping around between the widgets / screens and outside is bit
confusing. Also this way, I can add the stories right here.
2021-06-05 12:23:28 +02:00
9acf3d15f6 null safety++ 2021-06-02 09:40:53 +02:00
844111007b FolderViews: Null Safety++ 2021-05-25 11:25:24 +02:00
73f9db5fab Core: Null Safety++
This is a rather huge change. I hope I haven't broken anything.
2021-05-17 18:15:47 +02:00
d008f0d982 First version of dart migrate
Most of the files haven't been migrated. Lets work on this bit by bit
2021-04-10 22:18:35 +02:00
d2d9504dc9 Make sure all notes end with a \n
Fixes #383
2021-03-26 10:09:15 +01:00
ebd225c3b5 Fix linter + auto format 2021-03-25 16:32:24 +01:00
93cf6433d6 OrgEditor 2021-03-25 12:10:04 +01:00