Change your Import button so it allows multiple files to be imported -Android and Windows

I got this idea from TW_Tones.

We can modify the Import Button so that we can select more than one file: very handy on Android Phones, I tell you!

1 find this system Tiddler: $:/core/ui/Buttons/import
If you search for “core” and select contents, go down, it’s in alphabetical order.

2 Edit the contents of that Tiddler: You’ll get a little warning about editing system tiddlers. Heed that if necessary in your particular case.

modify these lines:

</$button>
<$browse tooltip={{$:/language/Buttons/Import/Hint}}/>
</div>

to:

</$button>
<$browse multiple tooltip={{$:/language/Buttons/Import/Hint}}/>
</div>

I hope my instructions were clear enough and you found this worked for you and all your devices. If now, don’t hesitate to say so.

That said, I wondered how I could make ANOTHER unique button with this feature and have it listed under the Tools section. And could this be a plugin or a feature standard in future releases? What are your thoughts on that?

Many Thanks!

7 Likes

You could easily clone $:/core/ui/Buttons/import and patch its code, probably change its icon too, et voilà !
Import button tiddler is tagged $:/tags/PageControls and so would be the clone, effectively making it a page button in the Tools section.
Then, a little configuration in Control Panel → Appearance → Toolbars → Page Toolbar can make the original button invisible, the clone visible, and you’re done.

As for making it a plugin, there are a few plugin building plugins around, like @Mohammad’s Gatha here: Gatha Studio Workspace 2.0.1 — develop plugin using Gatha and Gatha-Thirdflow on Node.JS
Or simple instructions to convert any tiddler group to a plugin by @EricShulman here: Plugin Development Workflow - #6 by EricShulman

Fred

1 Like

If multiple selection is compatible with single selection, I am curious why tiddlywiki core does not have this setting.

2 Likes

This works nicely! Tested with Chrome/Edge/Firefox on Windows 11.
It worth to have it in the core!

Just out of curiosity, could this be done with the export button as well?

I’m guessing that that is one tiny bit of code that came over from TW Classic, which was developed before the “multiple” attribute was introduced.

What would it mean to export to multiple targets?

But I think you mean wouldn’t it be great to export multiple tiddlers at once. But since the browser only allows exports as downloads, you can only do one at a time. What would be handy is if multiple tiddlers could be downloaded as a zip file.

1 Like

apologies, yes. the ability to export multiple tiddlers individually is something I’ve been hoping for the ability to do, and was curious if this would make it possible.

The browser limitations was something I encountered when asking in an earlier post, and started to think about if a sort of export cue could be set up, but never figured out how something like that could be done :sweat_smile:

TiddlyTools/Search/Filters has the ability to select and export multiple tiddlers as separate .tid files.

To import this tiddler, just visit TiddlyTools/Search/Filters and then drag-and-drop the tiddler’s title to your own TiddlyWiki. Since this add-on is written purely in wikitext, you can use it immediately, without needing to save-and-reload.

Start by entering/selecting a filter that identifies the tiddlers you want to export. Just type your desired filter syntax in the same way you would use the $:/AdvancedSearch>Filter tab input, or click on “Filters” to view a drop list and select a previously saved custom filter or pre-defined shadow filter. Alternatively, to assist in creating a custom filter you can press the “hammer and screwdriver” icon to display the “FilterMaker” interface.

Once a valid filter has been entered/selected, a list of matching tiddlers will be displayed. You can futher filter this list by entering some matching text (or regular expression pattern) and selecting which tiddler field(s) to search (default is title… use ctrl-click to select multiple field names). The list can also be sorted by title, size, date created, or date modified.

When you have a suitable list of tiddlers that you want to export, press the “export” button (“box and arrow” icon, upper-right above the filter input field). This will display an “Export tiddlers” modal dialog listing all matching tiddlers with individual checkboxes (defaulting to checked). You can manually uncheck any specific tiddler titles that you don’t want to be exported (or use the all/none buttons, lower-left).

Then, select “tid” from the droplist (bottom-center). Note that the exported filenames will use the tiddler title of each exported tiddler as the target filename. Finally, press the “export” button (lower-right) to begin downloading the selected tiddlers as separate .tid files. If you’ve configured your browser to “always ask where to download files”, a system-provided dialog will appear for each downloaded .tid file.

enjoy,
-e

2 Likes

thats awesome :smiley:
I didnt see it when I just read it over but, is it possible to change the export format to .json, or is .tid the only choice?
it isn’t a make or break sort of thing but, I do have tiddlers with multiline fields

Exporting to .json format is the default, but it puts all the selected tiddlers in the same file. Do you specifically want .json format, but with only one tiddler per file?

if possible then that would be ideal, yes :smile_cat:

A post was split to a new topic: Exporting tiddlers individually