Commit 8d55215
authored
Re-introduce custom HTML formatting for long messages (#641)
<!-- Please read
https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md before
submitting your pull request -->
### Description
For long formatted messages (specifically, messages with over 8000
characters in their internal source), styles are disabled. I personally
noticed this when trying to use `/rainbow` messages.
I noticed that this regression was caused by [this
commit](7w1/sable@d97a6c6);
while sanitizing the formatted body of a long message was safe for the
specific message in the channel that was linked in the issue, it ended
up disabling _all_ HTML formatting for longer messages.
Here, you can see the result of my fix:
<img width="50%" alt="image"
src="https://github.com/user-attachments/assets/a5ed26b4-bf55-492a-83d1-93c747226d74"
/><img width="50%" height="877" alt="image"
src="https://github.com/user-attachments/assets/84312b48-c426-4508-8341-6445fb9460ec"
/>
Specifically, I've determined that the cause of the original crash was
specifically only related to jumbo emojis; as I've kept the safeguard
regarding jumbo emojis, this still prevents the crash, as well as
keeping any spacing or line breaks in a message with many emojis. Here's
the difference:
<img width="50%" alt="image"
src="https://github.com/user-attachments/assets/35dbd824-f14a-4a61-9dfa-93593e01a1e1"
/><img width="50%" alt="image"
src="https://github.com/user-attachments/assets/873429bb-1166-418d-b7fd-b0c9f102e285"
/>
_(I'm considering this a breaking change because, as far as I can tell,
this does _technically_ make emojis no longer jumbo in longer messages.
I could be wrong, though.)_
#### Type of change
- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] This change requires a documentation update
### Checklist:
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
### AI disclosure:
- [ ] Partially AI assisted (clarify which code was AI assisted and
briefly explain what it does).
- [ ] Fully AI generated (explain what all the generated code does in
moderate detail).
<!-- Write any explanation required here, but do not generate the
explanation using AI!! You must prove you understand what the code in
this PR does. -->2 files changed
Lines changed: 10 additions & 14 deletions
File tree
- .changeset
- src/app/components/message
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | 100 | | |
110 | 101 | | |
111 | 102 | | |
| |||
122 | 113 | | |
123 | 114 | | |
124 | 115 | | |
125 | | - | |
| 116 | + | |
126 | 117 | | |
127 | 118 | | |
128 | 119 | | |
129 | 120 | | |
130 | 121 | | |
131 | 122 | | |
132 | 123 | | |
133 | | - | |
| 124 | + | |
134 | 125 | | |
135 | 126 | | |
136 | 127 | | |
137 | 128 | | |
138 | | - | |
| 129 | + | |
139 | 130 | | |
140 | 131 | | |
141 | 132 | | |
| |||
175 | 166 | | |
176 | 167 | | |
177 | 168 | | |
178 | | - | |
| 169 | + | |
179 | 170 | | |
180 | 171 | | |
181 | 172 | | |
182 | 173 | | |
183 | 174 | | |
184 | | - | |
| 175 | + | |
185 | 176 | | |
186 | 177 | | |
187 | 178 | | |
| |||
0 commit comments