El miércoles, 30 de septiembre de 2015, 22:41:07 (UTC+2), PMario escribió:
IMO if you need a sandbox, you should use a sandbox.
The $tw.wiki structure is the TW tiddler store, which contains the functions to manipulate tiddlers. It is implemented starting here:
https://github.com/Jermolene/TiddlyWiki5/blob/master/boot/boot.js#L850It may be possible to create sandbox structure, that has less functions. eg: initializing / executing plugins and modules is not be needed in the sandbox. As you write, you don't want to interfere with the existing TW UI. The problem here is, that you'll need some helper functions, that map your sandbox tiddler content into the existing UI, so you can view and edit the content.
That is a very interesting idea Mario! If I am understanding you well,you mean that, instead of adding the tiddlers directly to the wiki, I should store them in an alternative store and provide some interface (API) to interact with them. Since this sounds very very interesting and very appropriate it also looks like a lot of work:
For example, I don't know how to do this without re-writing, or at least extending, every widget that I have to use, and of course re-creating the entire view and edit templates. How would I for example list tiddlers using the list widget? or the search operator? I'm not asking you for a complete answer :P just your toughs.
Also I don't know how to do some things that requires the tiddler to be on the tiddler store. For example, for rendering a tiddler I add it to the wiki, I call $tw.wiki.renderTiddler with the tiddler tittle and then I delete the tiddler. I would love to be able to do it in other way, But the mechanisms behind render tiddler are too complex.
Would it be, (maybe) enough to just instantiate another wiki object and provide an interface to it?
IMO prefixing fields to prevent nasty side effects won't help. Since your plugins may be used / imported into TWs, that are heavily customized. So you may run into naming conflicts in the future.
That is right, but my plugin is not intended to be used in any other wiki, is more like an edition. But, as I said, I still want some interaction, like macros, transclusions and that stuff. Maybe renaming is not the best solution because transclussions and links would stop working. It's hard to determine which levels of "interactivity" to allow !
Many thanks.