Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from <a> tags to custom html tags for mentions #714

Open
alunturner opened this issue Jun 9, 2023 · 0 comments
Open

Move from <a> tags to custom html tags for mentions #714

alunturner opened this issue Jun 9, 2023 · 0 comments
Labels
Rust T-Enhancement Improvement or feature request

Comments

@alunturner
Copy link
Contributor

It is possible in html to use custom tags. To prevent us having to constantly parse attributes to check if something is a mention, we could move to using a custom tag. This has many benefits:

  • It will tidy up how we identify what is a mention. In some places we check for the contenteditable attribute, others we check for data-mention-type often these are combined with checking the tag type too. All this repetition/confusion could be tidied up if we could simply always check the tag type in the html
  • It would really help to tidy up Rust tests, which suffer from the same confusion, and make them easier to read. For example when reading a test in Rust, if I see a test with an <a> tag in it, is the test for links or is it for mentions? It's not easy to tell at a glance
  • Discrimination between links and mentions becomes explicit in the html markup, not just in the inner workings of the Rust model

Proposed solution would be to move from <a data-mention-type="X" ... /> to:

  • <mention-user contenteditable="false" style="{}" href="">user name</mention-user>
  • <mention-room contenteditable="false" style="{}" href= "">room name</mention-room>
  • <mention-at-room contenteditable="false" style="{}" href= "">text</mention-at-room>

I think that this arrangement of information would satisfy all clients, as we have defined the type of mention (in the tag) then if it is editable (needed for web), custom styling (needed for web) and href (needed for all clients) in attributes. It's possible that another attribute may be required to make this legitimate html (I'm not completely familiar with custom components) but hopefully this serves as a reasonable start point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rust T-Enhancement Improvement or feature request
Projects
None yet
Development

No branches or pull requests

2 participants