[TW5] TiddlyWiki to attach/store local file?

1,793 views
Skip to first unread message

dai...@hotmail.com

unread,
Jun 18, 2015, 2:34:03 PM6/18/15
to tiddly...@googlegroups.com
Firstly, I want to thank those who involved in TiddlyWiki and its plugin.
I hope someone out there will help in solving the missing feature below:-


Suggested feature (TiddlyWiki)
  • To attach/store local files (such as excel files, photoshop files, etc) under a folder at the same level as the TiddlyWiki file. Please see "suggestion.png" for the actual logic and details
  • Similar behavior found in Microsoft OneNote as shown in "MS OneNote.png"
  • Note that I am not asking to embed those local files inside the TiddlyWiki file which will have a huge performance impact)
Motivation
  • Research / Analysis often involves not only notes taking, but also capturing relevant files of any source (such as excel files, photoshop files, etc)
  • Such files may be downloaded from internet or created by application/software
  • These files will be forgotten after awhile, because:
    • there is no notes to describe what they are
    • they end up scattered around in different folders/directories
  • For any useful notebook, the ability to keep both notes and files next to each other is highly beneficial
suggestion.png
MS OneNote.png

PMario

unread,
Jun 18, 2015, 4:26:47 PM6/18/15
to tiddly...@googlegroups.com
Hi,
TiddlyWiki allows you to embed files. eg: small images and even small PDFs. ... If you just want to embed _some_ files it may be OK.
See reasoning below.


On Thursday, June 18, 2015 at 8:34:03 PM UTC+2, dai...@hotmail.com wrote:

Motivation

  • Research / Analysis often involves not only notes taking, but also capturing relevant files of any source (such as excel files, photoshop files, etc)
Excel and Photoshop, especially Photoshop files tend to be huge, if you embed them into TW. TiddlyWiki is an HTML file. HTML is text. So you can't attach a binary file into an HTML file. It needs to be converted into a text based format.
This format is called base64. TW does exactly that. The down side is, that it increases the file size. eg: a 500kByte jpg image will need ~800kByte embedded. Which is about 60% more. ...

So storing many big binary files in TW is not recommended. You will _not_ be happy. HTML files are not designed for that. What you can do, is store links to the files in your TW. So you have the meta data in TW, but let the files rest on the file system.

  • These files will be forgotten after awhile, because:
    • there is no notes to describe what they are
    • they end up scattered around in different folders/directories
  • For any useful notebook, the ability to keep both notes and files next to each other is highly beneficial
Yes. but keep them separate. If you need to store them, within one file. Create a zip file, which can be handled on the OS level.
Compression formats have been designed for this task.
 
  • In contrast, TiddlyWiki as a notebook software does not seems to allow attaching files
It is possible and makes sense for some small files. As I wrote. HTML is not ZIP ... in the contrary.
At the moment TW recognises and hand full of file types. see: https://github.com/pmario/TiddlyWiki5/blob/master/boot/boot.js#L1771

To save them back we use the browser right click: "Save as" button.
FireFox has an built in viewer, that also lets you save PDFs for example.

So depending on the file type, handling may or may not be convenient. ...

So, good idea, but wrong tool if you have many huge files.

-mario
 

dai...@hotmail.com

unread,
Jun 18, 2015, 6:00:13 PM6/18/15
to tiddly...@googlegroups.com
Sorry I did not make my point right at the begin.

I was wondering if possible to implement a feature/plugin to attach/store local files (such as excel files, photoshop files, etc) under a folder at the same level as the TiddlyWiki file. Please see "suggestion.png" for the actual logic and details.

I don't mean to embed the local files inside TiddlyWiki file which would create a huge performance impact.

PMario

unread,
Jun 18, 2015, 8:04:41 PM6/18/15
to tiddly...@googlegroups.com
On Friday, June 19, 2015 at 12:00:13 AM UTC+2, dai...@hotmail.com wrote:
I was wondering if possible to implement a feature/plugin to attach/store local files (such as excel files, photoshop files, etc) under a folder at the same level as the TiddlyWiki file. Please see "suggestion.png" for the actual logic and details.

Ahh, I see :)
If you copy those files, using the OS file explorer.... Yes. .. Browsers are not allowed to directly write files to the users file system. This would be a huge security risk. So all browser vendors prevent direct file access. TW uses the default browser download mechanism or the TiddlyFox extension for FireFox to store itself. ... TiddlyDesktop doesn't have these restrictions, but I'm not sure, how difficult it would be to implement your suggested behaviour. ... and imo it doesn't make sense to create a new file browser, if every OS already has one.

hope that helps
mario

Jeremy Ruston

unread,
Jun 19, 2015, 4:14:47 AM6/19/15
to TiddlyWikiDev
Hi daimip

Your proposal is admirably clear and well explained. I would love to be able to implement it, but some of those capabilities remain out of reach with current browser capabilities:

* When dragging a file into the browser, JS code only sees the content of the file, and not it's path. Thus there is no opportunity to link to files in their original locations
* When saving changes, the default HTML5 fallback saver only permits a single file to be saved at a time. There is no convenient way for the user to control saving the subsidiary, attached files

Tantalisingly, a lot of your proposal does already work out of the box. Using the `_canonical_uri` feature makes it possible to reference images, PDFs etc as "external tiddlers" which reside in separate files and are only loaded when required for display. We can easily support operations such as downloading attachments. The obstacle is around the input of attachments.

We can do a lot better when using something like TiddlyFox or TiddlyDesktop; both of them support unrestricted file access.

Best wishes

Jeremy.











--
You received this message because you are subscribed to the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/5e075caf-38e0-46d8-ae89-bb39cb23818c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

BJ

unread,
Jun 19, 2015, 10:59:42 AM6/19/15
to tiddly...@googlegroups.com
It is possible to use tiddlyclip to 'clip' references to external files.

http://tiddlyclip.tiddlyspot.com/

-BJ

dai...@hotmail.com

unread,
Jun 19, 2015, 12:57:55 PM6/19/15
to tiddly...@googlegroups.com, jeremy...@gmail.com
Hi Jeremy,

Thanks for your reply and I am looking forward to replace my notes taking software "MS Onenote" with the "TiddlyFox or TiddlyDesktop" in the near futrure.

Daimip

BJ

unread,
Jun 19, 2015, 2:57:02 PM6/19/15
to tiddly...@googlegroups.com
I'll give a bit more of an explanation.

browsers (at least firefox and chrome) allow the user to navigate the file system within the browser. On a windows system typing "file:///c/" or on a mac or linux "file:///" in the address bar will display the file system. As this is in the browser what is displayed in actually a web page, and the files and dirs are links. Although it is not possible to drag the links into tiddlywiki, it is possible to use the context menu (right click on a  file) that is provided by tiddlyclip to create `_canonical_uri` tiddlers of the files location, and thus display external files (such as pdfs, mp3, images) within a tiddlywiki. How to configure tiddlyclip to do this is explained in

Creating Local Media Links

I use it this way quite a bit - I create a sub directory within the same directory as my tiddlywiki and place the media files within it. Then 'clip' the links to them into my tiddlywiki.

dai...@hotmail.com

unread,
Jun 19, 2015, 9:22:12 PM6/19/15
to tiddly...@googlegroups.com, jeremy...@gmail.com
Hi Jeremy,

I did some research and thought regarding to your concern on:


* When dragging a file into the browser, JS code only sees the content of the file, and not it's path. Thus there is no opportunity to link to files in their original locations

It might work if drag the "original file" and drop into current cursor location of the TW5's text area, can trigger the following sequence of actions:
  1. obtain a binary/raw copy of the "original file" (eg. "my.psd") into the browser (so no need to know the path of the "original file")
  2. rename the "copied file" to (eg. "my(some random id).psd")
  3. save the the "copied file" to a "known location" relative to the TW5's file
  4. create an icon or syntax (eg. [file[...]]) reference to that "known location\copied file" (where "known location" would be the relative to TW5's file location)
  5. set the icon or syntax next to the current cursor location
I came across the url for your refernce:
http://stackoverflow.com/questions/25595708/is-it-possible-to-drag-and-drop-a-local-file-from-a-file-manager-to-a-browser-an
 
* When saving changes, the default HTML5 fallback saver only permits a single file to be saved at a time. There is no convenient way for the user to control saving the subsidiary, attached files

I think saving single file at a time is good enough. The use case would probably be:
  1. typing some text
  2. drag and drop a file in the current cursor/typing location
  3. repeat step 1 and 2
To illustrate, imagine the following typed in TW5 text-area:
This is my first drap and drop of file "my.psd" at this cursor location [file[known location\my(1a1).psd]], I drag and drop the same file "my.psd" again at another cursor location [file[known location\my(2w2).psd]]

My main concern rather how to drag the icon or syntax from TW5 text area, and drop back to any folder inside file explorer/manager. Consider the following sequence of action:
  1. get the file from location based on user dragged icon or syntax (eg. [file[known location\my(1a1).psd]])
  2. rename the file back to original name (eg. my.psd)
  3. save the file to location based on user dropped to folder inside file explorer/manager (eg. C:\my.psd)
NOTE that this drag and drop action does not delete the file (ie. known location\my(1a1).psd)

This raises another concern if it is possible to click on icon or syntax (eg. [file[known location\my(1a1).psd]]) and press delete, to trigger an actual delete of the file (ie. known location\my(1a1).psd)

manoflinux

unread,
Aug 14, 2015, 5:54:20 PM8/14/15
to TiddlyWikiDev
Check this out, its a way to import files into your tiddly wiki for download.

http://filetotid.tiddlyspot.com/
Reply all
Reply to author
Forward
Message has been deleted
0 new messages