Hi Bertrand

> I just tried a very quick implementation (I injected JavaScript code for
DeviceInfo, LocalFileSystem, window.requestFileSystem, etc.), and I was
able to save using TWEdit saver!

That's great, glad it's working. I've created a ticket for refactoring the
TWEdit saver into a generic saver:

https://github.com/Jermolene/TiddlyWiki5/issues/530

Best wishes

Jeremy



On Wed, Apr 2, 2014 at 12:37 PM, Bertrand Goetzmann <
[email protected]> wrote:

> Hi Jeremy,
>
> I just tried a very quick implementation (I injected JavaScript code for
> DeviceInfo, LocalFileSystem, window.requestFileSystem, etc.), and I was
> able to save using TWEdit saver!
> When the saver calls writer.write(text) I execute Groovy code to do the
> saving.
>
> Cheers,
>
> Bertrand.
>
> Le samedi 29 mars 2014 17:19:01 UTC+1, Jeremy Ruston a écrit :
>>
>> Hi Bertrand
>>
>> The saving process starts with syncer.saveWiki() here:
>>
>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/
>> modules/syncer.js#L126
>>
>> The individual savers are here:
>>
>> https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/savers
>>
>> The basic strategy is that saver modules have a numeric priority and
>> either or both of the capabilities "save" and "download". The saveWiki()
>> function looks for the highest priority saver that can handle a request.
>>
>> My suggestion is that you shouldn't need to write your own saver, but
>> begin by piggy-backing on the existing TWEdit saver (ie, injecting the JS
>> functions that it requires), and then we can work to recast TWEdit.js as a
>> generic saver for environments that support requestFileSystem.
>>
>> Best wishes
>>
>> Jeremy.
>>
>>
>>
>>
>>
>>
>>
>> On Fri, Mar 28, 2014 at 12:49 PM, Bertrand Goetzmann <
>> [email protected]> wrote:
>>
>>> Hello Jeremy,
>>>
>>> Can you tell me how the saver is selected and in what part of the source
>>> code?
>>>
>>>
>>> Thanks,
>>>
>>> Cheers,
>>>
>>> Bertrand.
>>>
>>> Le jeudi 27 mars 2014 12:16:54 UTC+1, Jeremy Ruston a écrit :
>>>
>>>> Hi Bertrand
>>>>
>>>> That's great, congratulations, and thank you for the detailed write-up
>>>> at https://bitbucket.org/bgoetzmann/tiddlywiki-fx/wiki/Home
>>>>
>>>> Have you seen TiddlyDesktop? It works in a similar way to TiddlyWikiFX,
>>>> embedding a web view containing a TiddlyWiki in a desktop application. To
>>>> the TiddlyWiki files that it displays it presents the same interface as
>>>> TiddlyFox.
>>>>
>>>> TiddlyDesktop: https://github.com/Jermolene/TiddlyDesktop
>>>> TiddlyFox: https://github.com/TiddlyWiki/TiddlyFox
>>>>
>>>> In the case of TiddlyWikiFX, though, I think a different approach may
>>>> be better. The goal would be to have TiddlyWikiFX re-use one of the savers
>>>> included in the core:
>>>>
>>>> https://github.com/Jermolene/TiddlyWiki5/tree/master/core/mo
>>>> dules/savers
>>>>
>>>> The best candidate might be the saver for the TWEdit iOS app:
>>>>
>>>> https://github.com/Jermolene/TiddlyWiki5/blob/master/core/mo
>>>> dules/savers/twedit.js
>>>>
>>>> It looks like you could inject skeleton JavaScript implementations of
>>>> DeviceInfo, window.requestFileSystem etc. that shell out to Java methods.
>>>>
>>>> The requestFileSystem interface is actually a semi-standard:
>>>>
>>>> https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem
>>>>
>>>> The test for DeviceInfo is a hangover from PhoneGap. If this approach
>>>> works we could refactor this saver into a general LocalFileSystem saver,
>>>> and add a new check that can detect TiddlyWikiFX.
>>>>
>>>> Best wishes
>>>>
>>>> Jeremy
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Mar 26, 2014 at 11:11 PM, Bertrand Goetzmann <
>>>> [email protected]> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I created a project named 
>>>>> TiddlyWikiFX<https://bitbucket.org/bgoetzmann/tiddlywiki-fx/wiki/Home>;
>>>>> all is in the name: it's a JavaFX application using a WebView component
>>>>> that contains a TiddlyWiki *classic *page. The benefit is to have a
>>>>> more integrated solution whereby you can have more control on content, 
>>>>> e.g.
>>>>> the way content is loaded or saved. I was able to do load and save
>>>>> operations using Java/Groovy code called from JavaScript added on the page
>>>>> and using existing JavaScript functions in the TiddlyWiki page.
>>>>> Now I would like to port my application to use the new TiddlyWiki
>>>>> version.
>>>>>
>>>>> Any suggestion or hint on the way I can use the JavaScript functions
>>>>> in the new version? Ideally, I don't want to modify anything in 
>>>>> TiddlyWiki,
>>>>> but just add or override some JavaScript functions.
>>>>>
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Bertrand
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "TiddlyWiki" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>>
>>>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Jeremy Ruston
>>>> mailto:[email protected]
>>>>
>>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:[email protected]
>>
>


-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to