NicolasCARPi / jquery_jeditable

jQuery edit in place plugin. Extendable via plugin architecture. Plugins for plugin. Really.
https://jeditable.elabftw.net
MIT License
1.74k stars 459 forks source link

2.0.2 -- input width is not set correctly #172

Closed thezoggy closed 4 years ago

thezoggy commented 6 years ago

by default the input height and width are auto.. in 2.0.2 this yields width: auto being set on the input. in older version the input would have width: 432px or whatever the size of the text was.. looking at older version of the code I see it had a autowidth/autoheight and stored the data.. that is all gone now.

http://jsfiddle.net/L8a12den/1/

thezoggy commented 6 years ago

1.7.3: img

2.0.2: img2

NicolasCARPi commented 6 years ago

Yes I remember merging some stuff related to width. A bunch of code for old versions of IE or for an old bug of jquery were removed, too. It's possible that during the cleaning and merging period the behaviour changed (hence the major version bump!). I think it's good that the width is 'auto' by default. Not sure how you can restore the old behavior. One way would be to use one of the hooks functions to adjust the width (size) of the input before it appears. Or you can have width: '80%', that's probably the easiest solution.

thezoggy commented 6 years ago

just tried using % but doesnt do much good because things are inline which then causes stuff to go outside of the div / wrap / etc. i can hard code a width but then that only works if the content requires it... otherwise it looks a bit funny. now if min-width + max-width was being set then I might have better luck setting hardcoded limits

adding this here for reference later: https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript