Text wrapping (with prefix and suffix pre-configured) and shortcut

Hello,

I would like to have the possibility of inserting around a selection a prefix and a suffix text (both of them are paramterized) and call this action with a shortcut.

“Selected text” > [Prefixed text] Selected text [Suffixed text]

I search on this forum but without results.

Have you implemented this kind of feature?

Thanks

Vincent this can and is already done using buttons in the text editor. We call these “editor toolbar buttons”, as a rule they are tagged with $:/tags/EditorToolbar.

Within each editor toolbar button one or more actions can be specified and this includes your desired prefix/selection/suffix see WidgetMessage: tm-edit-text-operation.

Yes I have a number of times,

  • can you provide more details on why you want to do this?
    • eg “to wrap text in html tags”
  • I have already some solutions that may be a good fit.
  • Once you look into these buttons for “wrapping” the selection you find it gets more involved than you would expect.
    • I am gradually extending my current solutions to include ad hoc, named and asymmetric wrappers. Eg wrap in a tag open/parameters and close tag.
1 Like

Hi
Have a closer look at: https://tiddlywiki.com/#How%20to%20create%20dynamic%20editor%20toolbar%20buttons

have fun!
mario

Hi, thank you for your help. My need is to highlight text into my tiddlers. Btw, your indication gives me a solution. Thanks

Hi, great! Thank you!