Adding new RichText features without having to modify the plugin code
Posted: 09 Jan 2024, 15:46
Hi, in our project we make use of the RichText structure to embed buttons used by input actions into text. In order to do so, we have added custom code to the TryCreateInlineTag function, checking for a tag named "action". Then, an interface implemented by the data context of the TextBlock is used to "access" core project systems in order to determine the button currently used by that action.
The solution works quite well, but we still don't like it for several reasons:
- We had to modify the original plugin code -> It would be nice to keep the plugin clean in its original state, since it would also save a lot of trouble with merging when upgrading Noesis
- The header and source files of the interface mentioned before are also part of the plugin
Ideally, the functions declared in RichText.cpp should be exposed as overridable members to the RichText class, so it's possible to write a custom one based on that outside of the plugin.
But I'd be happy to hear other suggestions as well.
Best Regards
The solution works quite well, but we still don't like it for several reasons:
- We had to modify the original plugin code -> It would be nice to keep the plugin clean in its original state, since it would also save a lot of trouble with merging when upgrading Noesis
- The header and source files of the interface mentioned before are also part of the plugin
Ideally, the functions declared in RichText.cpp should be exposed as overridable members to the RichText class, so it's possible to write a custom one based on that outside of the plugin.
But I'd be happy to hear other suggestions as well.
Best Regards