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

Fix duplicate numbers are entered when input number with microsoft pinyin #663

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/cleave-angular.min.js

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion dist/cleave-react-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,18 @@ return /******/ (function(modules) { // webpackBootstrap
owner.registeredEvents.onBlur(event);
},

isComposition: false,

onChange: function onChange(event) {
var owner = this,
pps = owner.properties;

if (this.isComposition) {
pps.result = event.target.value;
owner.updateValueState();
return;
}

owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward';
// hit backspace when last character is delimiter
var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters);
Expand All @@ -357,6 +365,15 @@ return /******/ (function(modules) { // webpackBootstrap
owner.registeredEvents.onChange(event);
},

onCompositionStart: function onCompositionStart(event) {
this.isComposition = true;
},

onCompositionEnd: function onCompositionEnd(event) {
this.isComposition = false;
this.onChange(event);
},

onInput: function onInput(value, fromProps) {
var owner = this,
pps = owner.properties;
Expand Down Expand Up @@ -532,7 +549,9 @@ return /******/ (function(modules) { // webpackBootstrap
onKeyDown: owner.onKeyDown,
onChange: owner.onChange,
onFocus: owner.onFocus,
onBlur: owner.onBlur
onBlur: owner.onBlur,
onCompositionStart: owner.onCompositionStart,
onCompositionEnd: owner.onCompositionEnd
}, propsToTransfer));
}
});
Expand Down
4 changes: 2 additions & 2 deletions dist/cleave-react-node.min.js

Large diffs are not rendered by default.

21 changes: 20 additions & 1 deletion dist/cleave-react.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,18 @@ return /******/ (function(modules) { // webpackBootstrap
owner.registeredEvents.onBlur(event);
},

isComposition: false,

onChange: function onChange(event) {
var owner = this,
pps = owner.properties;

if (this.isComposition) {
pps.result = event.target.value;
owner.updateValueState();
return;
}

owner.isBackward = owner.isBackward || event.inputType === 'deleteContentBackward';
// hit backspace when last character is delimiter
var postDelimiter = Util.getPostDelimiter(owner.lastInputValue, pps.delimiter, pps.delimiters);
Expand All @@ -357,6 +365,15 @@ return /******/ (function(modules) { // webpackBootstrap
owner.registeredEvents.onChange(event);
},

onCompositionStart: function onCompositionStart(event) {
this.isComposition = true;
},

onCompositionEnd: function onCompositionEnd(event) {
this.isComposition = false;
this.onChange(event);
},

onInput: function onInput(value, fromProps) {
var owner = this,
pps = owner.properties;
Expand Down Expand Up @@ -532,7 +549,9 @@ return /******/ (function(modules) { // webpackBootstrap
onKeyDown: owner.onKeyDown,
onChange: owner.onChange,
onFocus: owner.onFocus,
onBlur: owner.onBlur
onBlur: owner.onBlur,
onCompositionStart: owner.onCompositionStart,
onCompositionEnd: owner.onCompositionEnd
}, propsToTransfer));
}
});
Expand Down
5 changes: 2 additions & 3 deletions dist/cleave-react.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/cleave.min.js

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions gulp-tasks/addon.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var path = require('path');
var rename = require('gulp-rename');
var rimraf = require('gulp-rimraf');
var uglify = require('gulp-uglify');
var gulpsync = require('gulp-sync')(gulp);

var paths = {
src: './src',
Expand All @@ -29,4 +28,4 @@ gulp.task('addon:build', function () {
.pipe(gulp.dest(path.join(paths.dist, paths.addons)));
});

gulp.task('addon', gulpsync.sync(['addon:clean', 'addon:build']));
gulp.task('addon', gulp.parallel('addon:clean', 'addon:build'));
32 changes: 14 additions & 18 deletions gulp-tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var path = require('path');
var header = require('gulp-header');
var gulpsync = require('gulp-sync')(gulp);
var fs = require('fs');
var del = require('del');

Expand Down Expand Up @@ -54,25 +53,22 @@ gulp.task('min-no-mangle', function () {
.pipe(gulp.dest(path.join(paths.dist)));
});

gulp.task('clean', function () {
gulp.task('clean', function (done) {
del([paths.tmp])
done()
});

gulp.task('build', gulpsync.sync([
gulp.task('build', gulp.parallel(
// sync
'js:vanilla',
'js:react',
'js:react-node',
'js:angular-merge',
'js:angular',
[
'js:esm',
'js:esm-min'
],
[
// async
'min-mangle',
'min-no-mangle'
],
// 'js:vanilla',
// 'js:react',
// 'js:react-node',
// 'js:angular-merge',
// 'js:angular',
// 'js:esm',
// 'js:esm-min',
// async
'min-mangle',
'min-no-mangle',
'clean'
]));
));
5 changes: 2 additions & 3 deletions gulp-tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ var mocha = require('gulp-mocha');
var path = require('path');
var should = require('should');
var eslint = require('gulp-eslint');
var gulpsync = require('gulp-sync')(gulp);
var mochaPhantomJS = require('gulp-mocha-phantomjs');

var paths = {
Expand Down Expand Up @@ -54,6 +53,6 @@ gulp.task('eslint', function () {
.pipe(eslint.failAfterError());
});

gulp.task('test', gulpsync.sync(['unit', 'browser']));
gulp.task('test', gulp.parallel('unit', 'browser'));

gulp.task('publish', gulpsync.sync(['build', 'test', 'eslint']));
gulp.task('publish', gulp.parallel('build', 'test', 'eslint'));
11 changes: 11 additions & 0 deletions gulp-tasks/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,14 @@ gulp.task('js:react', function () {
}))
.pipe(gulp.dest(paths.dist));
});

gulp.task('build', gulp.series(
// sync
'js:vanilla',
'js:react',
'js:react-node',
'js:angular-merge',
'js:angular',
'js:esm',
'js:esm-min',
));
Loading