dthigpen / todotxt-extension

A keyboard driven to-do list extension with the todo.txt methodology in mind.
GNU General Public License v3.0
2 stars 1 forks source link

Import / Export #2

Open Ryuno-Ki opened 5 years ago

Ryuno-Ki commented 5 years ago

Today, I had the idea to embed the todo.txt generated with Simpletask with my Firefox web browser on my laptop.

Sure, it wouldn't be synced, but this way I could have access to it in contexts, where I don't want to always switch context.

Describe the solution you'd like It would be helpful to have an Import / Export feature of the todo.txt. I can take care for the sync (and conflict resolution) myself.

Describe alternatives you've considered Developing an own extension for Firefox :-)

Additional context I'd like to contribute to this repository if you are fine with it. But you don't have a LICENSE.txt, so I cannot from a legal point of view.

dthigpen commented 5 years ago

Importing and exporting is a great idea. I think a simple File import/export would be a good first implementation. As for cloud services, I use Simpletask on my Android as well and considered the sync with Dropbox option but ran into a few API issues when attempting to implement it directly into the extension.

Thank you for bringing up the license I will add that immediately.

Ryuno-Ki commented 5 years ago

I mean, even a <textarea> could work if you don't have permissions for the FileReader API...

Ryuno-Ki commented 5 years ago

For me it would be a sync with NextCloud. Maybe we can come up with a common interface and implement it for different providers?

dthigpen commented 5 years ago

For me it would be a sync with NextCloud. Maybe we can come up with a common interface and implement it for different providers?

That would be the way to go, something to make it easier to add providers down the road if needed. Also, never knew something like NextCloud existed, thanks for introducing me

gabriel-tandil commented 5 years ago

Hello ! It would be great if you could define where on the pc save the file everything.txt and done.txt although I do not know if the firefox permissions will allow it.

Greetings Gabriel

Ryuno-Ki commented 5 years ago

Hi Gabriel,

I would assume, that the extension can only trigger a download dialog (but can check earliest on the weekend).

Then it's up to you, how you configured download behaviour.

What browsers are supported by this extension? Firefox + Chrome? Opera? Edge? (No idea, just wondering)

dthigpen commented 5 years ago

I created a test branch with file importing and exporting behavior.

The exporting, downloading, actually doesn't require a dialog but that would be helpful for specifying location. I doubt you have your todo.txt file synced to your Downloads folder..

One potential problem I ran into was the extension's window being dismissed after the "File Upload" Window opens up, preventing it from loading in the file's contents since the script is closed. I'll look into ways to keep the extension window from auto-hiding, but if that is not possible then the extension would either have to move to a sidebar, or have file uploading on the options page.

As of now compatibility with Firefox and Chrome are the goals. Haven't done much testing in Chrome/Vivaldi but it should only be minor changes if it does not work already.

Ryuno-Ki commented 5 years ago

Hi, @dthigpen, sorry for the delay. I was sidetracked by #SaveYourInternet and demos we had here in Europe. I just cloned this repository and loaded the extension via about:debugging (by picking the manifest.json).

So far I can get the download dialog to work, but clicking on the upload button does nothing. Running Sabayon Linux here with Firefox 66.0.1.

Trying it in Chromium Version 72.0.3626.121 nothing works at all (not even saving a todo item). Browse to chrome://extensions/ and enable developer mode to load an unpacked extension (picking the directory itself). Opening the console, it tells me, that browser is undefined. We could use webextension-polyfill to deal with that.

Also the right side is cut of (part of the cogwheel).

In Opera 58.0.3135.117 I browsed to opera:extensions (see https://dev.opera.com/extensions/basics/) and loaded it the same way like for Chromium. It behaves the same. But their I can see black text on dark-grey background (I'm using a darktheme).

Sorry for just reporting some issues. I'll try to reserve some time on the weekend to contribute code.

Ryuno-Ki commented 5 years ago

@dthigpen I played around with the code today. I could not get the file upload to work. However, if I move the fileinput + reader stuff to the todolist.js I can at least get the dialogue to open and can pick a file. But somehow the onchange callback isn't invoked. Will investigate further, but opened a PR to allow the usage on Chromium-based browsers.

Ryuno-Ki commented 5 years ago

Ignore the triple references from commits above (had a force push due to inadvertently including #4).

@dthigpen Please decide between PR #5 and #6. Close the one you don't want to go for.

dthigpen commented 5 years ago

@Ryuno-Ki Sorry for the inactivity I got busy with other things. I'll review them now!

dthigpen commented 5 years ago

@Ryuno-Ki Great stuff, I like the sidebar one #5 a little more for the user experience, but the extension page #6 preserves compatibility so I think I'd go with that one.

dthigpen commented 5 years ago

@Ryuno-Ki I am concerned why you were not able to get my implementation of the file upload (with the background process) to work in Firefox. To me this would be the ideal solution since it doesn't make the user take any more actions than necessary. I will try to reproduce your problem, but it works fine for me in Firefox Quantum 66.0.2

Ryuno-Ki commented 5 years ago

Hm, using an UI would have some upsides:

But it's your call :-)

Regarding background version: Could you outline the exact steps? Maybe I did something different...

Ryuno-Ki commented 5 years ago

@dthigpen Ping. Any update on this? If you would pick either PR I could continue with writing others :-)

Ryuno-Ki commented 5 years ago

@dthigpen What is blocking this from moving forward?

Ryuno-Ki commented 4 years ago

@dthigpen Ping :-)