bgrins / ExpandingTextareas

jQuery plugin for elegant expanding textareas
http://bgrins.github.com/ExpandingTextareas/
MIT License
260 stars 73 forks source link

Max height to expand #39

Closed Serhioromano closed 10 years ago

Serhioromano commented 10 years ago

It is very often needed to set maximum height to expand textarea. very clean way is simply set max-height css property to textarea. no need for additional parameters.

This change will stop adding text to hidden pre/div if we have reached the height limit

bgrins commented 10 years ago

FYI, the functionality and code base has changed quite a bit since Issue #38 has landed so this would need to be rebased to be merged. The documentation here has been updated: http://bgrins.github.io/ExpandingTextareas/.

@domchristie any thoughts about this PR with regards to max height on the clone?

Serhioromano commented 10 years ago

So what should I do? If i update will you accept or not? I took latest master.

I think it is required. because there is no way to control height. And if I add max-height property, textarea stop growing but pre continue and white gap appear there.

domchristie commented 10 years ago

I like the idea of taking the max-height from the textarea itself, keeping any user-written CSS pretty dumb.

This would be pretty easy to port to the new code base: the resize function has been replaced with the update method (see: https://github.com/bgrins/ExpandingTextareas/blob/296f257a08e0db075c91c166b7792b6513327556/expanding.js#L81)

Would be good to have test coverage, too (I’d be happy to help with this)

Serhioromano commented 10 years ago

So should I create new PR or not? I have tested it on my local project.

bgrins commented 10 years ago

@Serhioromano yes, I like the idea of not needing the user to provide special CSS for this. There are some weird edge cases I can think of that involve changing the max-height of the textarea with JS after updates have occurred would not fire, but I think those are minor enough that it is worth doing anyway.

Serhioromano commented 10 years ago

Added PR #40.