gotktrix should allow editing old messages without losing any formatting. It can
do this by reading the old HTML and reparsing that into the TextView.
~~The best way to do this would be to borrow mcontent's renderer, but that
requires some work.~~
On second thoughts, more planning needs to be done. Not everything in
mcontent/text will really transfer well into the composer:
Bold (or other text styles) will appear without the Markdown syntax, and
editing them might be painful.
There might not be a way to delete mentions at all (see #8).
It might be better that we create a pseudo-Markdown format and write an HTML
renderer that renders into that format. The WYSIWYG renderer can then take care
of the rest. We can take inspiration from Discord's plain text editor:
Mentions can be of format <@diamondburned:matrix.org>, which the WYSIWYG
renderer can take and highlight as needed.
Images that only consist of <img src="X" /> can be directly translated to
Markdown's image syntax ![](mxc://); using the MXC URL should be acceptable.
Emojis can be of format ![:emoji_name:](mxc://), where the surrounding
colons (:) explicitly mark the image as an emoji. Emoji previewing might be
feasible using the WYSIWYG renderer.
Since we're implementing all the rich autocompletion features into the WYSIWYG
renderer, we should also consider making the autocompleter directly use the
WYSIWYG renderer's functions or have it insert texts that the renderer can
understand and parse.
It might also be worth it to optimize the WYSIWYG renderer to not re-format the
entire buffer after every change, but that's low priority.
[ ] Implement a HTML-to-Markdown renderer with custom formatting.
[ ] Implement a powerful WYSIWYG renderer that can render the custom Markdown
format into something meaningful for the user.
[ ] Wire up the autocompleter to insert WYSIWYG syntax.
As a side note, if mentions are done using the WYSIWYG syntax, then we'll be
able to solve #8 fairly trivially at the cost of some ugliness, but more
styling can be done by the renderer to make it less hideous, if needed be.
gotktrix should allow editing old messages without losing any formatting. It can do this by reading the old HTML and reparsing that into the TextView.
~~The best way to do this would be to borrow
mcontent
's renderer, but that requires some work.~~On second thoughts, more planning needs to be done. Not everything in
mcontent/text
will really transfer well into the composer:It might be better that we create a pseudo-Markdown format and write an HTML renderer that renders into that format. The WYSIWYG renderer can then take care of the rest. We can take inspiration from Discord's plain text editor:
<@diamondburned:matrix.org>
, which the WYSIWYG renderer can take and highlight as needed.<img src="X" />
can be directly translated to Markdown's image syntax![](mxc://)
; using the MXC URL should be acceptable.![:emoji_name:](mxc://)
, where the surrounding colons (:
) explicitly mark the image as an emoji. Emoji previewing might be feasible using the WYSIWYG renderer.Since we're implementing all the rich autocompletion features into the WYSIWYG renderer, we should also consider making the autocompleter directly use the WYSIWYG renderer's functions or have it insert texts that the renderer can understand and parse.
It might also be worth it to optimize the WYSIWYG renderer to not re-format the entire buffer after every change, but that's low priority.
As a side note, if mentions are done using the WYSIWYG syntax, then we'll be able to solve #8 fairly trivially at the cost of some ugliness, but more styling can be done by the renderer to make it less hideous, if needed be.