Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: Antechinus on August 30, 2021, 08:43:14 PM

Title: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on August 30, 2021, 08:43:14 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on August 30, 2021, 10:13:11 PM
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
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on August 30, 2021, 10:28:52 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on August 30, 2021, 10:34:05 PM
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
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on August 30, 2021, 10:39:57 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Arantor on August 31, 2021, 03:36:17 AM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 03:49:37 AM
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
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 02:49:22 PM
Try this  :laugh:

https://custom.simplemachines.org/index.php?mod=4332
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 04:23:51 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 04:30:08 PM
well you can now with the mod, you can put 50000 if you want
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 05:00:05 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 05:04:50 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 05:36:10 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 05:45:36 PM
Yea that's just the quick fix, using the options is better as proposed by the sceditor docs
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 05:57:37 PM
Why is using the options "better" than dealing effectively with the source of the problem?
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:06:01 PM
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. ;)
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Arantor on May 08, 2022, 06:09:01 PM
That's a bizarre design choice. Why wouldn't you make unlimited the default if not explicitly specified?
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:18:30 PM
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...
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:20:58 PM
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.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Shades. on May 08, 2022, 06:27:09 PM
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)
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:28:12 PM
It's my thread, so you don't get to use the button. Only the OP or mods get to use it. ;)
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 06:29:41 PM
Quote from: Antechinus on May 08, 2022, 06:06:01 PMSo...
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. ;)

Actually, you'd have to edit Subs-Editor.php since that's how SMF implemented it and that's how I also added it.  ;)
$sce_options['resizeMaxHeight'] = -1;

And I guess I should move it to Feature Requests since the dev team stated is not a bug?
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Shades. on May 08, 2022, 06:32:05 PM
Quote from: Antechinus on May 08, 2022, 06:28:12 PMIt's my thread, so you don't get to use the button. Only the OP or mods get to use it. ;)
Yea I know... was just kidding! ;)  ;D
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:34:00 PM
No, I would not have to edit Subs-Editor.php. I have tested the change live on local. It works perfectly, So, anyone can do it the way I indicated. It comes down to: do you want to hack Sources, or do you prefer to edit a js file?

The devs can say it is "not a bug" because it is "intended behaviour", but it is still dumb behaviour, and it is easy to fix, so it should be fixed. You can move it to Feature Requests if you like, or to Tips and Tricks. I'm not fussed.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Diego Andrés on May 08, 2022, 06:35:49 PM
Could also just use the mod and you know, no file edits :P
I might even add a per member option just to make you reasonably happy.
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Antechinus on May 08, 2022, 06:36:54 PM
Could even just fix it in core and, y'know, no mod required then. :P
Title: Re: SMF 2.1 RC4: Hard-coded height restriction on SCE Editor textarea.
Post by: Steve on May 09, 2022, 08:13:52 AM
I've installed Diego's mod and it works perfectly, however, I have to agree with Ant's main point, that there should be no height restriction hard-coded in.