File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -21,9 +21,9 @@ function onChange () {
21
21
var lastToken
22
22
tokens . forEach ( ( function ( v , i ) {
23
23
if ( v . type === 2 ) {
24
- pinyin += ( pinyin && lastToken . target !== ' ' ) ? ( ' ' + format ( v . target ) ) : format ( v . target )
24
+ pinyin += ( pinyin && ! / \n | \s / . test ( lastToken . target ) ) ? ( ' ' + format ( v . target ) ) : format ( v . target )
25
25
} else {
26
- pinyin += v . target
26
+ pinyin += ( ( lastToken && lastToken . type === 2 ) ? ' ' : '' ) + v . target
27
27
}
28
28
lastToken = v
29
29
} ) )
Original file line number Diff line number Diff line change @@ -106,9 +106,9 @@ function onChange() {
106
106
var lastToken ;
107
107
tokens . forEach ( function ( v , i ) {
108
108
if ( v . type === 2 ) {
109
- pinyin += pinyin && lastToken . target !== ' ' ? ' ' + format ( v . target ) : format ( v . target ) ;
109
+ pinyin += pinyin && ! / \n | \s / . test ( lastToken . target ) ? ' ' + format ( v . target ) : format ( v . target ) ;
110
110
} else {
111
- pinyin += v . target ;
111
+ pinyin += ( lastToken && lastToken . type === 2 ? ' ' : '' ) + v . target ;
112
112
}
113
113
lastToken = v ;
114
114
} ) ;
You can’t perform that action at this time.
0 commit comments