Arlen22/tiddly-chrome-app

Can we avoid the dependency on TiddlyChromeSaver.js?

Closed this issue · 14 comments

I'm not familiar with the capabilities of Chrome extensions, so I wondered if it were possible to refactor communication between TW and the extension so that we can reuse the existing TiddlyFox saver module:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/savers/tiddlyfox.js

Instead of using messages, communication is handled through the DOM. Is that possible in Chrome?

Yes, I believe it is possible.

The only drawback is that Chrome Apps don't really have any way of asking "Are you sure" before closing if there are unsaved changes (like a tiddler being editted), and I was considering adding some kind of temporary save changes feature to the extension.

If we would use the tiddlyfox extension, we could inject another script, and it would require knowing how each different version operates and attach the right handler, but maybe that is alright. What do you think? It could be fairly easy, I suppose.

@Arlen22, perhaps skip any functionality beyond basic saving (for now)? Not exactly sure for what case any custom / additional "are you sure" type handling is needed, since TiddlyWiki aleady does save drafts as tiddlers. What (type of process / handling) did you have in mind?

Would be nice to not need any additional plugin module.

@tobibeer, Will TiddlyFox actually save that draft to the file system immediately? If so, then that should be all we need.

@Arlen22, I think TiddlyWiki does... and so TiddlyFox as an implementation of a saver module does ...as it is told to ...e.g. "save drafts as well".

There may be some confusion here. Using a saver module saves the entire standalone HTML file; drafts are included, but saves are not triggered until 'confirm' is clicked after editing a tiddler. Using the client-server configuration syncs all changes to individual tiddlers directly to the file system; drafts are saved continuously as they are saved.

Ok, that's what I was thinking. Thus the need to have something to actually save unsaved changes to the filesystem. But actually, using the tiddlyfox saver plugin that is already in TW5 isn't really held back by this anyway. The problem still exists, but its a separate problem.

@Jermolene: Not sure I understand what this means:

drafts are included, but saves are not triggered until 'confirm' is clicked after editing a tiddler

When does a user have to additionally confirm something / how to reproduce?

The 'confirm' button is the tick icon that you click to complete editing a tiddler. In the code it's called the 'save' button but we switched the docs some time ago to avoid confusion with the save changes button.

Ah, ok... I was wondering when there would be a js confirm popping up.

Sorry @tobibeer I think you are misunderstanding. This is not about JavaScript confirm dialogues. This is about how when editing a tiddler an autosave (for compatible savers) is only triggered when clicking the "tick" icon, which used to be called "save" and is now called "confirm".

Yes, I understood. :-)

What did you mean about the js confirm popping up?

That — before your explanation — I was wondering what confirm you might be referring to... and only then I realized you are not talking about js at all. :-)

The TiddlyChromeSaver is no longer used.