Strange JavaScript red window error

34 views
Skip to first unread message

Mohammad

unread,
Mar 11, 2019, 12:08:37 AM3/11/19
to TiddlyWiki
Consider this small macro using stateTitle and stateIndex for reveal widget!

\define toggle-button(stateTiddler:"$:/state/toggle", stateIndex:"status", class:"")
<$reveal type="nomatch" stateTitle=<<__stateTiddler__>> stateIndex=<<__stateIndex__>> text="open">
<$button setTitle=<<__stateTiddler__>> setIndex=<<__stateIndex__>> setTo="open" class="$class$">
Open</$button>
</
$reveal>

<$reveal type="match" stateTitle=<<__stateTiddler__>> stateIndex=<<__stateIndex__>> text="open">
<$button setTitle=<<__stateTiddler__>> setIndex=<<__stateIndex__>> setTo="closed" class="$class$">
Closed</$button>
</
$reveal>
\end

No try the below example

<<toggle-button stateTiddler:"myTid" stateIndex:"xx">>

While you are in preview mode, try to change the stateIndex from "xx" to something else like "xx2"

The JS redwindow will be appeared!

If you donot use stateIndex and stateTitle and go through traditional state attribute, everything works fine!

--Mohammad

Reply all
Reply to author
Forward
0 new messages