Button to search and replace text from current tiddler

https://scribe.tiddlyhost.com/#List%20Dashboard

I want to create a button (which will be displayed via a viewtemplate) to replace the text internal from the toc-tabbed-internal-nav macro used inside the currentTiddler (see the example tiddler shown above) and replace it with text external to convert it into toc-tabbed-external-nav macro. How to do it?

There is a search and replace tool in code mirror you can use in edit mode, this would be a better approach for this kind of refactoring.

If you are trying to build a button to switch or toggle this value indefinitely it would be better to set a field or tiddler to hold the macro name and change that instead with the code using the above batch process or search and replace in a filter.

I believe what you are asking is possible but it will be somewhat complex and possibly fragile when it is hard to see a strong reason for this approach.

  • I am happy to be corrected if you think otherwise.
1 Like

Use the reveal-widget and a button that changes the view. You could also use a set-widget with a filter to create a different macro name and call it with <$macrocall. The macro name can depend on the value of a state tiddler. Or you could use the select-widget to change the macro name that should be called.

There are many possibilities, but imo rewriting the tiddler code is the worst one.

-m

1 Like

@pmario @TW_Tones Thanks both of you for the suggestions. Select widget seems like the easiest way to do it. So I am using it for the time being.