diamondburned / gotktrix

Matrix client in Go and GTK4
GNU Affero General Public License v3.0
312 stars 6 forks source link

Editing old messages using HTML #15

Open diamondburned opened 2 years ago

diamondburned commented 2 years ago

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:

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.

diamondburned commented 2 years ago

Edited original post.