brantje / nextnote

A full Evernote / OneNote style WYSIWYG note editor for Nextcloud / ownCloud. Join our telegram at: https://t.me/NextNote
GNU Affero General Public License v3.0
163 stars 19 forks source link

Add ownnote-like folder support #33

Open ThomasDaheim opened 7 years ago

ThomasDaheim commented 7 years ago

Before adding/changing code to support notes stored in folders I will use this issue for discussion & design.

Aim: provide support for storing notes in folders as is done in current ownnote

Once this is achieved we can think about extending that into various directions (multiple groups, tags, ...).

ThomasDaheim commented 7 years ago

Places that need changing:

main.php: extend & store valid values for $folder

OCA\NextNote\Db\NextNoteMapper: I can see two options how to do that

  1. Rename this to NextNoteDbMapper, add a OCA\NextNote\Folder\NextNoteFolderMapper, introduce a OCA\NextNote\NextNoteMapper that calls the Db and/or Folder Mapper based on configuration
  2. Move NextNoteMapper "one-up" and add logic for folder access into it as well

@brantje : Your preferences?

OCA\NextNote\ShareBackend\NextNoteShareBackend: Not quite sure what to do with formatItems

brantje commented 7 years ago

My idea was to use a service, eg copy the NextNoteService to NextNoteFileService (and rename the NextNoteService to eg NextNoteDBService). In the api controller we inject both NextNoteService and NextNoteFileService, then we get the config parameter for which service which we need to use, and assign it to the controller using $this->service.

The NextNoteFileService can use file ids, since it will go through the api first the NextNoteFileService can load files by id.

ThomasDaheim commented 7 years ago

That would mean, that we can't support current database-and-folder mode anymore. And it would be difficult to extend to e.g. any third method of storage we can come up with. Not that I have any clue about the benefits of database-and-folder mode - but before throwing it away we might ask @fmstrat about why its there.

Thats why I thought about having some kind of OCA\NextNote\NextNoteMapper that gets injected and knows which is the right mapper (or even sequence of mappers as for database-and-folder mode...) for the config.

As for file ids: we would need to create these on the fly such that they are a) unique and b) map to note name + group name (those are the primary keys for files...). The only good solution I could think of would be id = note name + group name but that probably has some issues.

ThomasDaheim commented 7 years ago

@brantje Started to add "storagemode" to admin.php. But I must confess I'm out of my depth trying to fill settings-admin.js properly. Had a look at the old admin.js but thats quit different...

Fmstrat commented 7 years ago

@ThomasDaheim The only reason it's there is because DB mode was added after the fact. I would doubt too many users would care if they had to pick one or the other.

ThomasDaheim commented 7 years ago

@Fmstrat Thanks for the info. So I would go ahead and don't make provisions for a database-and-folder mode. Besides the add. overhead to keep both in sync there doesn't seem to be a good reason to have it.

Only one caveat: Without database-and-folder mode its impossible to switch from database to folder storage without some admin migration tool. So if we don't have it in general we need to add functionality to the admin section.

ThomasDaheim commented 6 years ago

Finally found some time to have a look at this again. See my branch folder-only.

Things I have run into:

As for now the list of notes is returned by findNotesFromUser and shown. Need to work on the other functions but I'm stuck in debugging. Trying to edit a note never ends up in NextNoteApiController::get. Not sure where the problem is (most likely in front of the machine...).

ThomasDaheim commented 6 years ago

OK, enough for today:

Working:

TODO:

larmoe commented 6 years ago

Saving notes as html in a folder is my number one request for this app. What is the status on this feature? Otherwise nice work.

Kind regards Lars

ThomasDaheim commented 6 years ago

I fear that parrot is dead :-)

I have played around with it and have added folder support but I fear that this project isn't active anymore. Happy to be proven wrong!

ThomasDaheim commented 6 years ago

For me this would be a more important feature than e.g. etag support. I'd rather spent some time here than e.g. on etag support (#70)

atbanpc commented 6 years ago

If you are still working on this, I'd be happy to help out.

ThomasDaheim commented 6 years ago

Still on vacation :-) Will get to this once I'm back... Since I'm only using folders for notes I would definitely want to add this.

ThomasDaheim commented 6 years ago

So, at least a sign of life :-)

After finishing converting my ownNoteEditor to use TinyMCE as well I would start looking back into folder mode for nextnote. Will let you know how far I manage to come with this.