[TW5] Way to open certain tiddlers as draft by default?

143 views
Skip to first unread message

Zyb

unread,
Apr 8, 2017, 7:42:08 PM4/8/17
to TiddlyWiki
Dear all,

I’ve noticed that there is a group of tiddlers in my main TW that I only ever open to edit them, like custom stylesheets or tiddlers that collect data: I don’t look at their content, I just add to it and manipulate it, so that other tiddlers do stuff with their content. It would add to my productivity if any links to these tiddlers (especially those in the ToC) would open them as drafts immediately, without the need to open them first and then click on the edit button.

Is there a way to change all links of, say, tiddlers with a specific tag, into edit links (button widgets, if I’m not mistaken)? Or that a clickable edit icon is appended to the (normal) link?

I’ve been using TWC and TW5 for a long time and can understand some code, but I don’t have experience programming plugins, so any hint is appreciated! :)

All best,
Tyll

Mat

unread,
Apr 9, 2017, 4:34:55 PM4/9/17
to TiddlyWiki
Good idea. I posted it as a github request issue. In deed, the absolute majority of system plugins are just irrelevant ti view!

One route may be to use the EditTextWidget for things you only want to edit. I.e put it in another tiddler and have it display the contents from the tiddlers you want to edit. If this sounds relevant for you then I'll see if I can dig up an old template I made for this.

<:-)

Zyb

unread,
Apr 9, 2017, 5:15:35 PM4/9/17
to tiddl...@googlegroups.com
Thanks Mat!

What I came up with in the meantime was that I created a tiddler QuickEdit and added this list filter to it

<ul class="quickedit">
<$list filter="[tag[QuickEdit]]">
<li><$button message="tm-edit-tiddler" param=<<currentTiddler>> class="tc-btn-invisible tc-tiddlylink">{{$:/core/ui/Buttons/edit}} <<currentTiddler>></$button></li></$list>
</ul>

I tagged all the respective tiddlers with QuickEdit and transcluded the tiddler in a designated sidebar section, fancied up with a little CSS. For now, this serves the purpose well enough (sort by title is okay because I have strict naming rules), but of course I will run into trouble once the list becomes very long. Plus, such a separate list is not strictly necessary, I’d prefer a universal solution where links to tagged tiddlers are treated thus all through TW, no matter where they occur.

Re EditTextWidget: Do I understand you correctly that your suggestion would be to actually work with two tiddlers, one content/data tiddler and one edit tiddler? The latter would contain only the edit widget displaying the content of the data tiddler, but I would use it for all intents and purposes as if it were the data tiddler. Yes, okay, that could work. I haven’t worked with the EditTextWidget before, I give it a try!

(Edit: This works in principle, but because the changes are applied in real time things become awkward for stylesheets, when everytime I haven’t yet closed a bracket, parts of the wiki layout disintegrate ... ;) Is there a way to postpone the changes in the widget and send them on click of an additional button or something? Yet, the more complex this becomes the more it simply mimics the normal draft behaviour of TW, doesn’t it ...)

And what kind of template did you use for this; or more generally: I don’t understand how templates come into play with the widget at all, could you explain?

Thanks again and all best!
Tyll

Mat

unread,
Apr 9, 2017, 8:06:56 PM4/9/17
to TiddlyWiki
 
Re EditTextWidget: Do I understand you correctly that your suggestion would be to actually work with two tiddlers, one content/data tiddler and one edit tiddler? The latter would contain only the edit widget displaying the content of the data tiddler, but I would use it for all intents and purposes as if it were the data tiddler. Yes, okay, that could work. I haven’t worked with the EditTextWidget before, I give it a try!

Yeah, that basically it. But you can also use a EditTextWidget or perhaps a SelectWidget for the title, meaning that when you enter the title, you get the text in another bigger EditTextWidget field.


(Edit: This works in principle, but because the changes are applied in real time things become awkward for stylesheets, when everytime I haven’t yet closed a bracket, parts of the wiki layout disintegrate ... ;) Is there a way to postpone the changes in the widget and send them on click of an additional button or something? Yet, the more complex this becomes the more it simply mimics the normal draft behaviour of TW, doesn’t it ...)

Yes, the trick is to use a temporary tiddler. So basically via a button (e.g the SelectWidget... at least I think that should work) you'd copy the current into the temporary and then when done you click another button that overwrites the temp content into the original.
 

And what kind of template did you use for this; or more generally: I don’t understand how templates come into play with the widget at all, could you explain?

I might use the term sloppily. I merely referred to an old thing based on what I described above with a EditTextWidget for the title and another for the text. (Side note: A cool discovery in that process was that you could create tiddlers silently by entering a new title and filling in text. That evolved into QuickTid.)

<:-)

Zyb

unread,
Apr 10, 2017, 5:16:08 PM4/10/17
to TiddlyWiki
Thank you, Mat, for your help! This makes me want to fiddle around with code. :)

Thomas Elmiger

unread,
Apr 11, 2017, 1:40:07 AM4/11/17
to TiddlyWiki
Hi Zyb and Mat

A simple way for a simple edit-text field (no full fledged editor) would be to establish a conditional view template like I did for my tiddler-notes recently: https://tid.li/tw5/hacks.html#Field%20for%20Notes%20on%20Tiddlers%20with%20a%20Defined%20Tag

You would have to change the start like this:

<$list filter="[all[current]tag[FooBar]]">
<$set name="tid" value=<<currentTiddler>>>
<$edit-text tiddler=<<tid>> placeholder="Your text goes here" default="" rows="3" minHeight="3em" class="te-vt-note-field"/>

Happy hacking!
Thomas

Mat

unread,
Apr 11, 2017, 4:40:23 AM4/11/17
to TiddlyWiki
Thomas, that's a good idea. And since it  could be used/based on tagging, one could also use the tag to repress the ordinary body field in view mode, i.e something like

.tc-tagged-FooBar .tc-tiddler-body {display:none;}

One weakness is that unless it's part of core, you'd have to overwrite the concerned tiddlers to begin with. I wish there was some way to tag tiddlers without overwriting them. I've done a lot of experimenting before, attempting to remotely change, or inject into, a tiddler without overwriting it. One result is the @ttention plugin which, it strikes me now, is somewhat similar to the idea here with a conditional viewtemplate. In order to not overwrite the tiddler to begin with, maybe there could be a predefined list of which tiddlers should be affected, i.e where the EditTextWidget should show and where the tiddler-body should hide.

<:-)

Thomas Elmiger

unread,
Apr 11, 2017, 5:13:42 AM4/11/17
to TiddlyWiki
Hi Mat

That would make up a nice little plugin:

Am Dienstag, 11. April 2017 10:40:23 UTC+2 schrieb Mat:
maybe there could be a predefined list of which tiddlers should be affected,

The view template plus a settings tiddler to choose where to show/hide. As the template is applied via filters, we are flexible: some kinds of tiddlers are tagged by nature: stylesheets, global macros, ... others could be filtered by title. Maybe experienced users could fill in a filter field, or the readme could offer popular filters to copy-paste …

As always. The possibilities are endless :)

Cheers, Thomas
Reply all
Reply to author
Forward
0 new messages