Import from Known URI useful trick and improvement desired

81 views
Skip to first unread message

TonyM

unread,
Nov 11, 2019, 2:01:23 AM11/11/19
to TiddlyWiki
Folks,

On windows and in FireFox If you capture a link to a tiddler wiki or json file, perhaps even a tiddler.
  • Copy and address from the browser address bar 
  • Copy a full path and filename from explorer
  • Use file:///C:/Data/ in the browser and locate a file and copy link location

You can press the import button and paste the link into the open dialogue eg: 
The above is a useful set of tips. However I would like to know if

There is a way to trigger the import button such that it opens with one of the above links prepopulated, thus all that is required is to hit open.

  • This would allow comprehensive resources to be made available within tiddlywikis that can be obtained with a click or two.
  • We could all publish useful content in out wikis with the full path to a resource to import on demand.
  • Perhaps this could be done in an iframe but the import takes place in the parent.
  • This still demands user intervention - Click Open so hopefully it does not come foul of browser security.
In this thread I am keen to get this feature also into a bookmarklet.

Thanks tony

PMario

unread,
Nov 11, 2019, 6:30:50 AM11/11/19
to TiddlyWiki
Hi Tony,

There is a way to trigger the import button such that it opens with one of the above links prepopulated, thus all that is required is to hit open.

Short answer: NO

---------- Long version ;)

TW uses the <input> element to read files from disk. The docs suggests, that there is a possibility to preload the "files" parameter. ... but it would need to be tested.


You'll need to read it all, but for the files info you'll need to scroll down to Additional attributes. ... TW only knows about:

BrowseWidget.prototype.execute = function() {
    this.browseMultiple = this.getAttribute("multiple");
    this.deserializer = this.getAttribute("deserializer");
    this.message = this.getAttribute("message");
    this.param = this.getAttribute("param");
    this.tooltip = this.getAttribute("tooltip");
    this.nwsaveas = this.getAttribute("nwsaveas");
    this.webkitdirectory = this.getAttribute("webkitdirectory");
    this.nwdirectory = this.getAttribute("nwdirectory");
};


So at the moment, there isn't any code to handle preloaded info, if possible. ... The biggest problem I see, is that the info that would be needed is way to low level to be useful for ordinary users.

have fun!
mario

TonyM

unread,
Nov 11, 2019, 11:23:10 PM11/11/19
to TiddlyWiki
Mario,

Thanks despite, your conclusion. 

way to low level to be useful

If it were possible do we not need only provide the path/filename in a format appropriate to the host?

For others passing, 

the browse widget works for import
<$browse multiple>

and even 
<$edit-text field="filename" tag=input type=file >

Gives you to the filename in a tiddler field (with the prefix C:\fakepath\clipboard-alt-green.svg}

Regards
Tony

A Gloom

unread,
Nov 12, 2019, 12:06:10 AM11/12/19
to TiddlyWiki

For others passing,

you mean me? : P  was goin to post my copy n pasting iframe content into a TW
 
the browse widget works for import
<$browse multiple>

yep, just got done looking at the import code for another post-- the import button invokes the browse widget

but you're examples are of interest -- I often use TW utility buttons in tiddlers

@TiddlyTweeter

unread,
Nov 12, 2019, 7:41:40 AM11/12/19
to TiddlyWiki
TonyM wrote:

... In this thread I am keen to get this feature also into a bookmarklet.

Noted. 

Jeremy's bookmarklet works well for transporting Tiddlers inter-wiki. 
It does not use the standard import system. 
It directly writes Tiddlers on click of Browser Bookmark.
One click. Done.

A solution to your OP might be worked up from his code? 
It is an invitingly minimal start!

Best
TT
Reply all
Reply to author
Forward
0 new messages