Dropzone issue

113 views
Skip to first unread message

mervin mecklenburg

unread,
Jul 15, 2017, 10:21:07 AM7/15/17
to TiddlyWiki

Can someone help me?


I want to make a dropzone that tags the action tiddler, or the tiddler dragged into the dropzone, with the title of the tiddler hosting the drop zone. The solution I have created works unless the proposed tag has more than one word; then each word presents as a separate tag; ie, if the hosting tiddler is entitled "DropZone" my solution works fine, but if the title is "Drop Zone," then two tags are produced, "Drop" and "Zone." I need the entire title to be one tag.


Here is an example of my code:


\define droppable-projectnotes() <$action-listops $tiddler=<<actionTiddler>> $tags="+[append<currentTiddler>]"/> \end


<$droppable actions=<<droppable-projectnotes>>>{{$:/core/images/copy-clipboard}}AddProjectNotes</$droppable>


I have tried several solutions, but the answer has escaped me. Does anyone have an answer? I'm sure that here is a simple fix.


Merv

Eric Shulman

unread,
Jul 15, 2017, 11:25:58 AM7/15/17
to TiddlyWiki
On Saturday, July 15, 2017 at 7:21:07 AM UTC-7, mervin mecklenburg wrote:

I want to make a dropzone that tags the action tiddler, or the tiddler dragged into the dropzone, with the title of the tiddler hosting the drop zone. The solution I have created works unless the proposed tag has more than one word; then each word presents as a separate tag; ie, if the hosting tiddler is entitled "DropZone" my solution works fine, but if the title is "Drop Zone," then two tags are produced, "Drop" and "Zone." I need the entire title to be one tag.


Here is an example of my code:


\define droppable-projectnotes() <$action-listops $tiddler=<<actionTiddler>> $tags="+[append<currentTiddler>]"/> \end 


The parameter for the append[...] list-ops filter expects a *list* of values to add.  As a result, spaces are treated as separators between individual tags "Drop" and "Zone".

Try using the insertbefore[...] filter instead: http://tiddlywiki.com/#insertbefore%20Operator.  As noted in the documentation, if you do not specify the "B" (before) tiddler as a suffix, the new value is added to the *end* of the list.  Something like this:

<$action-listops $tiddler=<<actionTiddler>> $tags="+[insertbefore<currentTiddler>]"/>

Let me know how it goes.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals

mervin mecklenburg

unread,
Jul 16, 2017, 11:17:25 AM7/16/17
to TiddlyWiki

I'm still struggling with this. I tried your suggestion, but the "Insertbefore" is not giving me a return.

Here is a copy of the relevant code using the listbefore operand:

\define droppable-projectnotes() <$action-listtops $tiddler=<<actionTiddler>> $tags="+[insertbefore<currentTiddler>] \end <$droppable actions=<<droppable-projectnotes>>>{{$:/core/images/copy-clipboard}}AddProjectNotes</$droppable>

I as not able to find any examples in the documentation of the listbefore operand being used. Perhaps I am missing something.

Do you have any suggestions. I appreciate all of the suggestions I get from this forum, and I find much in this forum helpful.

Merv

Thomas Elmiger

unread,
Jul 16, 2017, 11:58:42 AM7/16/17
to TiddlyWiki
Hi Merv

Here’s an example how I use action listops for something similar:

I use the same button to add and remove tags by either specifying the tag in the attribute "add" or in "remove".

In a $set widget I define a variable called "subfilter" that puts double brackets around the tag to add/remove.


\define teBtnTagAddRemove(btntext,add:"_false_",remove:"_false_",class:"",tiddler:"_false_")
<$vars tiddler="""$tiddler$""" btnclass="te-popup-action $class$" add="""$add$""" remove="""$remove$""">
<$set name="actiontid" filter="[<tiddler>!prefix[_false_]]" value=<<tiddler>> emptyValue=<<currentTiddler>>>
<$set name="subfilter" filter="[<add>!prefix[_false_]]" value="[[$add$]]" emptyValue="-[[$remove$]]">
<$wikify name="at" text=<<actiontid>>>
<$button class=<<btnclass>>>
<$action-listops $tiddler=<<at>> $field="tags" $subfilter=<<subfilter>>/>
<$text text="""$btntext$""">
</$button>
</$wikify>
</$set>
</$set>
</$vars>
\end

I have removed some additional complexity not relevant for your case, I hope you get the main part.

Maybe this helps.

Cheers,
Thomas

Eric Shulman

unread,
Jul 16, 2017, 12:12:41 PM7/16/17
to TiddlyWiki
On Sunday, July 16, 2017 at 8:17:25 AM UTC-7, mervin mecklenburg wrote:

I'm still struggling with this. I tried your suggestion, but the "Insertbefore" is not giving me a return.

Here is a copy of the relevant code using the listbefore operand:

\define droppable-projectnotes() <$action-listtops $tiddler=<<actionTiddler>> $tags="+[insertbefore<currentTiddler>] \end <$droppable actions=<<droppable-projectnotes>>>{{$:/core/images/copy-clipboard}}AddProjectNotes</$droppable>


some possible reasons it's not working:

1) TYPO
   "$action-listtops" should be "$action-listops" (one "t")
2) SYNTAX
   "\end" is only needed for multi-line macro definitions (where the \end occurs on a line by itself)

let me know if that makes any difference

-e
Reply all
Reply to author
Forward
0 new messages