Can we access the 'selection' in the WidgetMessage: tm-edit-text-operation

@ahanniga @saqimtiaz : how would you recommend tweaking the $:/plugins/ahanniga/context-menu/ContextListener.js widget (and/or the current anchor of <$contextMenu> in $:/plugins/ahanniga/context-menu/view-template) for the context menu to work within Streams nodes?

I have tried a few different things (e.g. fetching data-node-title instead of data-tiddler-title and anchoring the widget in $:/plugins/sq/streams/templates/stream-row-template just below {{||$:/plugins/sq/streams/editor-template}}, but without success so far.

It seems the data-node-titleattribute returns null even if it appears to be well defined in $:/plugins/sq/streams/templates/stream-row-template everywhere.

Are there better approaches?

Cheers!

The context menu with the typographical applications is really good @fastfreddy and others who this is built on. Some thoughts;

  • This is almost a WYSIWYG editor
  • This is a great way to reformat content pasted from elsewhere

Future enhancements

  • Allow you to select one of the multiple instances to apply a change to rather than all.
  • Reversable edits, as works in editor Toolbar, select bold, click bold to remove?

@fastfreddy can search and replace function be added to the context menu - for that also we need an option to input the replacement text. Just a suggestion.

This thread seems to have diverged pretty far from its title and is thus hard to follow and provide assistance. I suggest starting a new thread for your plugin and posting a summary of the problem as relates to Streams.

Hi @TW_Tones ;

  • Allow you to select one of the multiple instances to apply a change to rather than all.

I am not sure that it is possible. There is no information on the right-click event that indicates which of instances has been selected. The two options are either A) replace the first match, or B) replace all of the matches.
Option A can lead to very weird behaviours where you apply it to some text and the formatting is applied to a different instance of that string.

  • Reversable edits, as works in editor Toolbar, select bold, click bold to remove?

I am also not sure that is possible. It may be possible to toggle simple markups (by simple, I mean immediately next to the string, e.g. ‘‘mystring’’), which I intend to play around with, but as outlined above, it is hard to get smarter than that.

For example, what if the raw text actually renders as I am liking mystring very much… To the search and replace function, this may look like mystring is surrounded by bold markups whereas it isn’t; what search and replace regular expressions would find is the end of the first string’s bolding, and the beginning of the next string’s bolding.

Similarly, if you have bold and italics, and toggling off italics would only work well if the markup for italics are closest to the string. I think efforts in that direction are bound to mangle markup and leave users upset.

I remain open-minded if others have good implementation ideas. There seems to be no shortage of wish list ideas, but I am not sure they are realistically implementable…