Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor position should be restored after change #150

Merged
merged 6 commits into from
Aug 26, 2017
Merged

Conversation

reborg
Copy link
Contributor

@reborg reborg commented Jan 23, 2017

I think this solves the jump of the cursor to the right for every change mentioned here #25, at least in some of the use cases I've tested on the number formatter. I didn't try this on the react part (although I think the change applies the same) or other type of inputs.

@reborg
Copy link
Contributor Author

reborg commented Jan 25, 2017

Last commit "Added new custom option to prevent stripLeadingZeroes" is not related, but added option default doesn't change current behaviour, only if you explicitly set it to false. The reason for not stripping zeroes is because if you have a number like "100,000" and you want to change it to "200,000" you don't necessary want to see it going to "0" before typing all the zeroes again. This option preserves the leading zeroes in this case.

@Viincenttt
Copy link

Very nice, you are my hero!

@jonatansberg
Copy link

@reborg Awesome! Seems like this breaks the react component tho :/

@mdziekon
Copy link
Contributor

@reborg as you can see, I've fixed the problem with React component being broken and created a separate PR (since I don't know what should be the proper way of me pushing changes to your branch here). If there is something wrong with that, please contact me so we can resolve it whatever way you like (as you are the original author of the fix).

@felixhorro
Copy link

Any update on this?
Very useful PR, I need this!

Thanks.

@jperelli
Copy link

since I don't know what should be the proper way of me pushing changes to your branch here

@mdziekon you can do a pull request here https://github.com/reborg/cleave.js if you want to do that

@grk
Copy link

grk commented Apr 27, 2017

There's an edge case here, with the following options: { numeral: true, prefix: "£" } the cursor jumps to the wrong place when adding characters that change the number of decimal separators.

@nosir nosir merged commit 9186214 into nosir:master Aug 26, 2017
@nosir
Copy link
Owner

nosir commented Aug 26, 2017

Thanks and sorry for the delay @reborg Awesome work!
So I finally got chance to test it and fix a couple of minor things.
React component is broken so I commented it out for now, will have a look at @mdziekon 's PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants