Inserting new line in filter result

Folks,

I am making a tool to append to a tiddler the payload of a drag and drop action.

The following works, with one problem

\define append-text-actions()
<$wikify name=new-text text="""{{{ [all[current]get[text]addsuffix<actionTiddler>] }}}""">
<$action-setfield $field="text" text=<<new-text>>/>
</$wikify>
\end

The text field is updated by appending <actionTiddler> to the text field., however I am not sure how I can force a new line between the original and the appended text.

  • I can not for example see how to get the charcode[13],[10] between the original test and the appended content.

Thanks in advance

\define append-text-actions()
<$action-setfield text={{{ [all[current]get[text]] [charcode[13],[10]] :all[charcode[13],[10]] [<actionTiddler>] :and[join[]] }}} />
\end

I assumed you wanted two newline characters to force a visible line break. If not, remove one of the charcode operators.

1 Like

Thanks @saqimtiaz

That solved it.
I did try using join but it did not work at the time, must have being a typo.

Its interesting to see you using the :all and :and, I have tended to only use the symbol prefixes.

This thread is complete, perhaps I should repost as a How to Inserting new line in a filter result?

For anyone visiting;
This currently nicely appends the title as text, do be sure they are Links one could add
+[format:titlelist[]] to ensure they are pasted in [[title format]]

I am just now building a separate solution to drag the “text” content, rather than the title. It needs a different “link/button” that uses the text as the draggable payload rather than the title, easy with copy to clipboard but not for draggable as far as I can see, yet.

The final idea is to have a list of content / components from which you can drag and drop on a tiddler to “populate” or “build” the tiddlers content be it code or prose.

Bravo @TW_Tones – looking forward to seeing that.

From my perspective, as of v5.1.23 the symbol prefixes should be considered deprecated in favour of the named filter run prefixes. The named filter run prefixes are far more expressive, especially once the logic behind them is understood. For example ~ vs :else.

Note that this only applies if the title contains spaces.

Both the $button and $draggable widget have an attribute that allows a filter to be used to specify the drag payload.

Maybe I am missing something, but I here assume payload tiddler means the tiddler from which it will use the content of text field?

With drag an drop of titles say from a tiddler link the content is the title(s).

I actually want to do both, set up buttons (looks like a link) to either drag the title, or the content of text depending on the application. I am using the button for other attributes like tooltips, actions or navigate etc… and when not dragging.

If I understand it correctly if I am dragging a text payload dragTiddler=<<payloadtiddler>> I drop the text, but use <<actionTiddler>> to access the title of that tiddler.

I am sure I will work it out, if can just get a little confusing. In future I would like to drag and from the content in other fields than text, or the result of a variable or filter.

You can assign any text as the drag payload.

If it is a tiddler title, you can handle in the drop actions - perhaps based on a modifier key - to use the title itself or get the text or another field of the tiddler.

1 Like

@saqimtiaz thanks for pointing this out, as I understand it in tiddlywiki all the default drags the payload in the tiddler title, and I see how the drop is where you can then use the title to access anything relating to that title.

So of course I can make my own drags and drop zones, in tiddlywiki. I suppose I could even provide content in a drag that is a non existent tiddler title, to repurpose that content.

Without wanting to hijack my own thread, do I see here a gap where we cant set arbitrary payloads in TiddlyWiki drag definitions?