FancyTextRendering
FancyTextRendering copied to clipboard
Unified Editor and Viewer
Hi,
Love this tool - has great utility, thanks for making it.
I'm trying to make a text editor for journaling, where users view/edit a single block of fancy text and never see the markdown syntax. I haven't had any success, and I'm not sure if it's supported just yet. I've created a basic setup with the DemoRenderUpdater (similar to the demo scene), and then tried a few things without success:
- Adding the MarkdownRenderer to the InputField's "Text" GameObject (no fancy rendering occurs)
- Creating a sister GameObject to the InputField's "Text" GameObject called "Markdown-Text" with the TMP_Text and MarkdownRenderer components, and setting Text's alpha to 0 (fancy rendering does occur, but the caret disappears, and trying to highlight the fancy text instead highlights the ghost text)
I wonder if you have a solution to this, have considered it, or have suggestions for how to go about it.
Thanks again for making this
I've thought about this a bit more, and one idea seems promising: mapping string indices between rich text and markdown text.
(relevant sidenote- i tried a 3rd idea where I apply the rich text output back to the TMP_InputField.text field, but caret position quickly gets de-synced and chaos ensues)
I noticed that text selection (highlighting, caret position) works exactly as you'd expect when you're editing an InputField with rich text. If I write a callback for modifications (eg: using the onValueChanged or onValidateInput) that applies the changes to the TMP_InputField.text field AND manages the caret position/selection, this could work.
I'll play around with this idea next chance I get
Uhhh, I would love that!