File tree Expand file tree Collapse file tree 1 file changed +11
-19
lines changed
src/BootstrapBlazor/wwwroot/modules Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Original file line number Diff line number Diff line change 11import EventHandler from "./event-handler.js"
22
33export default {
4- composition ( id , invoke , callback ) {
5- const el = document . getElementById ( id )
4+ composition ( el , callback ) {
65 if ( el ) {
7- var isInputZh = false
6+ let isComposing = false
87 EventHandler . on ( el , 'compositionstart' , e => {
9- isInputZh = true
10- } )
8+ isComposing = true ;
9+ } ) ;
1110 EventHandler . on ( el , 'compositionend' , e => {
12- isInputZh = false
13- } )
11+ isComposing = false ;
12+ callback ( el . value ) ;
13+ } ) ;
1414 EventHandler . on ( el , 'input' , e => {
15- if ( isInputZh ) {
16- e . stopPropagation ( )
17- e . preventDefault ( )
18- const handler = setTimeout ( ( ) => {
19- if ( ! isInputZh ) {
20- clearTimeout ( handler )
21- invoke . invokeMethodAsync ( callback , el . value )
22- }
23- } , 15 )
15+ if ( ! isComposing ) {
16+ callback ( el . value ) ;
2417 }
25- } )
18+ } ) ;
2619 }
2720 } ,
2821
29- dispose ( id ) {
30- const el = document . getElementById ( id )
22+ dispose ( el ) {
3123 if ( el ) {
3224 EventHandler . off ( el , 'compositionstart' )
3325 EventHandler . off ( el , 'compositionend' )
You can’t perform that action at this time.
0 commit comments