qpixel icon indicating copy to clipboard operation
qpixel copied to clipboard

Remaining character count is not correct when editing, causing a confusing error message

Open cellio opened this issue 3 years ago • 0 comments

https://meta.codidact.com/posts/287292

A user edited a post and got the "max post length is 30,000 characters" error message, but according to the character count shown at the bottom of the post edit box, the count was below that limit. An answer there suspects that the length that triggers the error is the rendered HTML, while what the editor's stat is based on is the markdown source.

This is confusing. Are we able to unify these? I don't know the performance considerations, but if the editor is rendering the preview anyway, can we get its HTML's size and show that in the counter? Or, alternatively, can we base the limit on the size of the markdown source, and if we're storing the HTML in the database too, pad that field some to account for HTML bloat?

Related: if we do the check against the rendered HTML, it would also address https://meta.codidact.com/posts/290859 .

cellio avatar Oct 26 '22 00:10 cellio