SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.

Started by Antechinus, August 30, 2021, 08:43:14 PM

Previous topic - Next topic

Antechinus

This one is a pain in the posterior when checking formatting for longish posts. Can it be removed, to allow unlimited height? Or, at the very least, doubled from what it is now?

Would be a big usability improvement, for stuff all code changes. Should not even require anything much in the way of testing. Kthnx. :)

ETA: .sceditor-container seems to be restricted to 370px max-height, being applied by javascript as an inline style, but at the moment I haven't found where that is coming from.

Diego Andrés

That is "hardcoded" in the sceditor file, the main main one  :laugh:

maxHeight = options.resizeMaxHeight || origHeight * 2.5;https://github.com/samclarke/SCEditor/blob/042ddbded861e7ddad895ab78c1557aaf242278a/src/lib/SCEditor.js#L843

@live627 would need to take a look at it maybe, or comment on this

SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

Aha. Ok cool. I tried overriding it with CSS in Stylus (even used !important) but it refuses to be overridden. :P

Although I just ran a search on the whole 2.1 directory on my test site, and that code doesn't turn up anywhere. So presumably something else in 2.1 is doing the same job somewhere.

Diego Andrés

It's because once the sceditor files are compiled and minified, this ends up somewhere in jquery.sceditor.bbcode.min.js, could probably remove it deleting this from your file
g=he.resizeMaxHeight||2.5*f,
This is just a hack, obviously live627 would need to check for that on the main files, if he wants  :P

SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

Ok thanks. I'll try that on a test site and see what it destroys. Although I'd be inclined to just double it from 2.5 to 5, just in case completely removing it throws it for a loop. Changing an integer or two shouldn't upset it.

Arantor

Fairly sure each instance of the editor being configured (via control_create_richedit or whatever it's called) sets the height. It certainly used to set the default height and I have instances of much bigger ones.

Though it does have an annoying "you can't resize it more than a certain size from what it started as" by default which is I think what is being outlined above.

Antechinus

Just noting: Elkarte uses SCE as well, and their implementation of it has no height restriction. So, it should be fairly easy to do.

And yes, I am bumping this because the restriction is still pissing me off on a pretty regular basis. :D

Diego Andrés


SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

I'll try it later, but TBH it's not what I want. I just want to kill the height restriction, completely, where is is hard-coded. No max-height at all.

Which I can obviously do myself. I was just pointing out that others have done in as core, for years, without any issues. So, there's no reason why SMF can't do it.

Diego Andrés

well you can now with the mod, you can put 50000 if you want

SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

My point is that removing the height restriction should not require a a mod. It should be core code. Default. Not extra layers of crud. I like things clean and simple wherever possible.

Diego Andrés

I've mentioned it a couple of times to the dev team.

The most recent I was told from them that it could cause issues or that they don't remember why there's no max height defined, so anyways there you have a mod that uses the sceditor built in options for it, have fun :P
I also tried to add some more options but didn't work, so I reckon there might be some funky stuff with the sceditor.

SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

It's as simple as removing the decimal point here:

Code (jquery.sceditor.bbcode.min.js - Find) Select
g=he.resizeMaxHeight||2.5*f
Code (jquery.sceditor.bbcode.min.js - Replace) Select
g=he.resizeMaxHeight||25*f
Scary stuff. Terrified me, anyway. I may need counselling to deal with the trauma.

ETA: Just changed it from 25 to 99. Still works perfectly. I got bored once I stretched the textarea height to 10145px and it was still fine.

Diego Andrés

Yea that's just the quick fix, using the options is better as proposed by the sceditor docs

SMF Tricks - Free & Premium Responsive Themes for SMF.

Antechinus

Why is using the options "better" than dealing effectively with the source of the problem?

Antechinus

Ok, never mind. Did some searching.
https://www.sceditor.com/documentation/options/
QuoteresizeMaxHeight

resizeMaxHeight int Defaults to null

Maximum height the editor can be resized to. Set to null for double textarea height or -1 for unlimited

So...
Code (jquery.sceditor.bbcode.min.js - Find) Select
resizeMaxHeight:null,
Code (jquery.sceditor.bbcode.min.js - Replace) Select
resizeMaxHeight:-1,
There you go. Sorted, using officially approved SCE options. Post this to Tips and Tricks if the devs don't want to touch it. ;)

Arantor

That's a bizarre design choice. Why wouldn't you make unlimited the default if not explicitly specified?

Antechinus

Beats me, mate. It's damnably annoying when you're trying to format complex posts on a support forum. Seems more suited to blog comments or the like. Although even then it's likely to be annoying on a phone, due to the very short line length imposing a tight limit on the number of visible characters (which should be a consideration for SMF in this glorious mobile-friendly era).

Anyway it is easy to fix, using officially approved options, so...

Antechinus

And I have just marked this as NOT solved because, although the solution is simple and obvious, it has not been implemented in SMF 2.1 yet.

Shades.

Quote from: Antechinus on May 08, 2022, 06:20:58 PMAnd I have just marked this as NOT solved because, although the solution is simple and obvious, it has not been implemented in SMF 2.1 yet.
Weird! I don't see a "Solved" or "Not Solved" button on this thread! Must be above my clearance level!? ;D  ;D  8)  8)
ShadesWeb.com - Custom Logos - My Themes on SMF | My Themes on ShadesWeb
https://shadesweb.com

BikerHound.com - Sniffing out the road ahead
https://bikerhound.com

Dream as if you'll live forever; Live as if you'll die today. - James Dean

Advertisement: